Index: trunk/src/SmearUtil.cc
===================================================================
--- trunk/src/SmearUtil.cc	(revision 398)
+++ trunk/src/SmearUtil.cc	(revision 399)
@@ -37,4 +37,5 @@
 #include "SmearUtil.h"
 #include "TRandom.h"
+#include "TStopwatch.h"
 
 #include <iostream>
@@ -192,9 +193,11 @@
 
   //for very forward detectors
-  RP_offsetEl_s     = 120;
+  RP_offsetEl_s     = 120;    // distance of beam separation point, from IP
   RP_offsetEl_x     = 0.097;
-  RP_cross_x        = -500;
-  RP_cross_y        = 0.0;
-  RP_cross_ang      = 142.5;
+  RP_cross_x        = -500;   // IP offset in horizontal plane, in micrometers
+  RP_cross_y        = 0.0;    // IP offset in vertical plane, in micrometers
+  RP_cross_ang_x    = 142.5;  // half-crossing angle in horizontal plane, in microrad
+  RP_cross_ang_y    = 0.0;    // half-crossing angle in vertical plane, in microrad
+
 
   PdgTableFilename  = "data/particle.tbl";
@@ -311,5 +314,6 @@
   RP_cross_x        = DET.RP_cross_x;
   RP_cross_y        = DET.RP_cross_y;
-  RP_cross_ang      = DET.RP_cross_ang;
+  RP_cross_ang_x    = DET.RP_cross_ang_x;
+  RP_cross_ang_y    = DET.RP_cross_ang_y;
   RP_IP_name        = DET.RP_IP_name;
 
@@ -449,5 +453,6 @@
   RP_cross_x        = DET.RP_cross_x;
   RP_cross_y        = DET.RP_cross_y;
-  RP_cross_ang      = DET.RP_cross_ang;
+  RP_cross_ang_x    = DET.RP_cross_ang_x;
+  RP_cross_ang_y    = DET.RP_cross_ang_y;
   RP_IP_name        = DET.RP_IP_name;
 
@@ -521,4 +526,11 @@
     else if(strstr(temp_string.c_str(),"RP_beam2Card"))     {curstring >> varname >> svalue;RP_beam2Card      = svalue;}
     else if(strstr(temp_string.c_str(),"RP_IP_name"))       {curstring >> varname >> svalue;RP_IP_name        = svalue;}
+
+    else if(strstr(temp_string.c_str(),"RP_offsetEl_s"))    {curstring >> varname >> value; RP_offsetEl_s     = value;}
+    else if(strstr(temp_string.c_str(),"RP_offsetEl_x"))    {curstring >> varname >> value; RP_offsetEl_x     = value;}
+    else if(strstr(temp_string.c_str(),"RP_cross_x"))       {curstring >> varname >> value; RP_cross_x        = value;}
+    else if(strstr(temp_string.c_str(),"RP_cross_y"))       {curstring >> varname >> value; RP_cross_y        = value;}
+    else if(strstr(temp_string.c_str(),"RP_cross_ang_x"))   {curstring >> varname >> value; RP_cross_ang_x    = value;}
+    else if(strstr(temp_string.c_str(),"RP_cross_ang_y"))   {curstring >> varname >> value; RP_cross_ang_y    = value;}
     
     else if(strstr(temp_string.c_str(),"ELG_Scen"))         {curstring >> varname >> value; ELG_Scen          = value;}
@@ -713,13 +725,15 @@
           << left << setw(25) <<RP_beam2Card            <<""<< right << setw(10)<<"*"<<"\n";
     f_out << left << setw(44) <<"* Beam separation, in meters:     "<<""
-          << left << setw(6) << RP_offsetEl_x          <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+          << left << setw(6) << RP_offsetEl_x          <<""<< right << setw(10)<<"*"<<"\n";
     f_out << left << setw(44) <<"* Distance from IP for Beam separation (m):"<<""
-          << left << setw(6) <<RP_offsetEl_s           <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+          << left << setw(6) <<RP_offsetEl_s           <<""<< right << setw(10)<<"*"<<"\n";
     f_out << left << setw(44) <<"* X offset of beam crossing in micrometers:"<<""
-          << left << setw(6) <<RP_cross_x           <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+          << left << setw(6) <<RP_cross_x           <<""<< right << setw(10)<<"*"<<"\n";
     f_out << left << setw(44) <<"* Y offset of beam crossing in micrometers:"<<""
-          << left << setw(6) <<RP_cross_y           <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-    f_out << left << setw(44) <<"* Angle of  beam crossing:"<<""
-          << left << setw(6) <<RP_cross_ang           <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+          << left << setw(6) <<RP_cross_y           <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(44) <<"* X Angle of beam crossing:"<<""
+          << left << setw(6) <<RP_cross_ang_x          <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(44) <<"* Y Angle of beam crossing:"<<""
+          << left << setw(6) <<RP_cross_ang_y          <<""<< right << setw(10)<<"*"<<"\n";
     f_out<<"*                                                                    *"<<"\n";
   }
@@ -908,5 +922,5 @@
          << left << setw(20) <<ISOL_Calo_ET               <<""<< right << setw(10)<<"*"<<"\n";
    f_out << left << setw(40) <<"* Grid size (NxN) for calorimetric isolation: "<<""
-         << left << setw(20) <<ISOL_Calo_Grid             <<""<< right << setw(10)<<"*"<<"\n";
+         << left << setw(20) <<ISOL_Calo_Grid             <<""<< right << setw(4)<<"*"<<"\n";
   }
 
@@ -1029,5 +1043,6 @@
   f_out<<"#....................................................................*"<<"\n";
   f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
-  
+ 
+  f_out.close(); 
 }
 
@@ -1397,2 +1412,112 @@
   
 } // ReadParticleDataGroupTable
+
+
+// to be improved in order to avoid code repetition
+// sorry, no time to do it right now (XR, 19/05/2009)
+void time_report(const TStopwatch& global,const TStopwatch& loop,const TStopwatch& trigger,const TStopwatch& frog,const TStopwatch& lhco, const int flag_frog, const int flag_trigger, const int flag_lhco, const string& LogName, const Long64_t allEntries) {
+
+TStopwatch globalwatch(global), loopwatch(loop), triggerwatch(trigger), frogwatch(frog), lhcowatch(lhco);
+
+  cout <<"**                                                                 **"<< endl;
+  cout <<"**        ################## Time report #################         **"<< endl;
+  cout << left  << setw(32) <<"**              Time report for "<<""
+       << left  << setw(15) << allEntries <<""
+       << right << setw(22) <<"events         **"<<endl;
+  cout <<"**                                                                 **"<< endl;
+  cout << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<"Time (s):"<<""
+       << right << setw(15) <<"CPU"<<""
+       << right << setw(15) <<"Real"<<""
+       << right << setw(14)  <<"**"<<endl;
+  cout << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<" +  Global:"<<""
+       << right << setw(15) <<globalwatch.CpuTime()<<""
+       << right << setw(15) <<globalwatch.RealTime()<<""
+       << right << setw(14)  <<"**"<<endl;
+  cout << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<" +  Events:"<<""
+       << right << setw(15) <<loopwatch.CpuTime()<<""
+       << right << setw(15) <<loopwatch.RealTime()<<""
+       << right << setw(14)  <<"**"<<endl;
+  if(flag_trigger == 1)
+    {
+      cout << left  << setw(10) <<"**"<<""
+	   << left  << setw(15) <<" +  Trigger:"<<""
+	   << right << setw(15) <<triggerwatch.CpuTime()<<""
+	   << right << setw(15) <<triggerwatch.RealTime()<<""
+	   << right << setw(14)  <<"**"<<endl;
+    }
+  if(flag_frog == 1)
+    {
+      cout << left  << setw(10) <<"**"<<""
+	   << left  << setw(15) <<" +  Frog:"<<""
+	   << right << setw(15) <<frogwatch.CpuTime()<<""
+	   << right << setw(15) <<frogwatch.RealTime()<<""
+	   << right << setw(14)  <<"**"<<endl;
+    }
+  if(flag_lhco == 1)
+    {
+      cout << left  << setw(10) <<"**"<<""
+           << left  << setw(15) <<" +  LHCO:"<<""
+           << right << setw(15) <<lhcowatch.CpuTime()<<""
+           << right << setw(15) <<lhcowatch.RealTime()<<""
+           << right << setw(14)  <<"**"<<endl;
+    }
+
+
+  ofstream f_out(LogName.c_str(),ios_base::app);
+
+  f_out <<"**                                                                   *"<< endl;
+  f_out <<"**        ################## Time report #################           *"<< endl;
+  f_out << left  << setw(32) <<"**              Time report for "<<""
+       << left  << setw(15) << allEntries <<""
+       << right << setw(22) <<"events            *"<<endl;
+  f_out <<"**                                                                   *"<< endl;
+  f_out << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<"Time (s):"<<""
+       << right << setw(15) <<"CPU"<<""
+       << right << setw(15) <<"Real"<<""
+       << right << setw(15)  <<" *"<<endl;
+  f_out << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<" +  Global:"<<""
+       << right << setw(15) <<globalwatch.CpuTime()<<""
+       << right << setw(15) <<globalwatch.RealTime()<<""
+       << right << setw(15)  <<" *"<<endl;
+  f_out << left  << setw(10) <<"**"<<""
+       << left  << setw(15) <<" +  Events:"<<""
+       << right << setw(15) <<loopwatch.CpuTime()<<""
+       << right << setw(15) <<loopwatch.RealTime()<<""
+       << right << setw(15)  <<" *"<<endl;
+  if(flag_trigger == 1)
+    {
+      f_out << left  << setw(10) <<"**"<<""
+           << left  << setw(15) <<" +  Trigger:"<<""
+           << right << setw(15) <<triggerwatch.CpuTime()<<""
+           << right << setw(15) <<triggerwatch.RealTime()<<""
+           << right << setw(15)  <<" *"<<endl;
+    }
+  if(flag_frog == 1)
+    {
+      f_out << left  << setw(10) <<"**"<<""
+           << left  << setw(15) <<" +  Frog:"<<""
+           << right << setw(15) <<frogwatch.CpuTime()<<""
+           << right << setw(15) <<frogwatch.RealTime()<<""
+           << right << setw(15)  <<" *"<<endl;
+    }
+  if(flag_lhco == 1)
+    {
+      f_out << left  << setw(10) <<"**"<<""
+           << left  << setw(15) <<" +  LHCO:"<<""
+           << right << setw(15) <<lhcowatch.CpuTime()<<""
+           << right << setw(15) <<lhcowatch.RealTime()<<""
+           << right << setw(15)  <<" *"<<endl;
+    }
+  f_out<<"*                                                                    *"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  f_out<<"#....................................................................*"<<"\n";
+  f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
+
+  f_out.close(); 
+
+}
