Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fcs:eic:intro [2017/02/07 22:16]
hepsim17 [Reconstructed events]
fcs:eic:intro [2017/04/04 15:36] (current)
hepsim17 [Using C++]
Line 162: Line 162:
   * fake rate (cannot be done with this sample!)   * fake rate (cannot be done with this sample!)
   * calculate Q2 and x_bj, check efficiency and resolutions for these variable   * calculate Q2 and x_bj, check efficiency and resolutions for these variable
-====== Displaying reconstructed events ======+ 
 +====== Reconstructed events ======
  
  
Line 192: Line 193:
  
  
 +====== Using C++ ======
 +
 +You can read SLCIO files using a C++ program. As usual, your program can look as this:
 +
 +<code cpp>
 +string input="data.slcio";
 +LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
 +lcReader->open( infile1.c_str() ) ;
 +LCEvent*  evt;
 +int nEvents=0;
 +while( (evt = lcReader->readNextEvent()) != 0 ) {
 +      if (nEvents==0) UTIL::LCTOOLS::dumpEvent( evt ) ;
 +           cout << "  Run : " << evt->getRunNumber() << " Detector: "      << evt->getDetectorName() <<  endl ;
 +           
 +           const LCParameters& params=evt->getParameters();
 +           // print stored EVGEN parameters
 +           StringVec floatKeys ;
 +           int nFloatParameters = params.getFloatKeys( floatKeys ).size() ;
 +      
 +           for(int i=0; i< nFloatParameters ; i++ ){
 +              FloatVec floatVec ;
 +              params.getFloatVals(  floatKeys[i], floatVec ) ;
 +              int nFloat  = floatVec.size()  ;
 +              cout << " parameter " << floatKeys[i] << " [float]: " ;
 +              for(int j=0; j< nFloat ; j++ ){
 +                    cout << floatVec[j] << ", " ;
 +                }
 +               cout << endl ;
 +                   
 +   nEvents ++ ;
 +   }
 +  lcReader->close() ;
 +</code>
 +
 +This code example shows how to print float parameters from the EVGEN level (copied from the input ProMC).
 +Here is the example of all parameters (float, integers, strings):
 +<hidden>
 +<code cpp>
 + parameter EVGEN:Code [int]: 10, 
 + parameter EVGEN:DIS:ISR [int]: 0, 
 + parameter EVGEN:ID1 [int]: 11, 
 + parameter EVGEN:ID2 [int]: 2212, 
 + parameter EVGEN:ProcessID [int]: 10, 
 + parameter EVGEN:AlphaQCD [float]: 0.00255778, 
 + parameter EVGEN:AlphaQED [float]: 0.243193, 
 + parameter EVGEN:DIS:Q2 [float]: 12.4407, 
 + parameter EVGEN:DIS:W [float]: 69.6586, 
 + parameter EVGEN:DIS:XBJ [float]: 0.00255778, 
 + parameter EVGEN:DIS:YBJ [float]: 0.243193, 
 + parameter EVGEN:EventsRequested [float]: 50000, 
 + parameter EVGEN:PDF1 [float]: 0, 
 + parameter EVGEN:PDF2 [float]: 0, 
 + parameter EVGEN:Scale [float]: 69.6586, 
 + parameter EVGEN:ScalePDF [float]: 12.4407, 
 + parameter EVGEN:SigmaErrorPB [float]: 737.376, 
 + parameter EVGEN:SigmaPB [float]: 164882, 
 + parameter EVGEN:Weight [float]: 1, 
 + parameter EVGEN:X1 [float]: 0.00255778, 
 + parameter EVGEN:X2 [float]: 0.243193, 
 + parameter EVGEN:eCM [float]: 141, 
 + parameter _weight [float]: 1, 
 + parameter EVGEN:Process [string]: e-p, 
 + parameter GEANT4_VERSION [string]: 10.2.0, 
 + parameter HepSim [string]: 1.1, 
 + parameter ProcessID [string]: -1, 
 + parameter SLIC_VERSION [string]: 5.0.0, 
 +</code>
 +</hidden>
 +
 +For EIC ep events, the relevant parameters for a given DIS event are:
 +
 +<code cpp>
 + parameter EVGEN:eCM [float]: 141 
 + parameter EVGEN:Process [string]: e-p
 + parameter EVGEN:ID1 [int]: 11
 + parameter EVGEN:ID2 [int]: 2212 
 + parameter EVGEN:ProcessID [int]: 10 
 + parameter EVGEN:DIS:Q2 [float]: 12.4407      // Truth-level Q^2
 + parameter EVGEN:DIS:W [float]: 69.6586       // Truth-level W
 + parameter EVGEN:DIS:XBJ [float]: 0.00255778  // Truth_level x_bjorken
 + parameter EVGEN:DIS:YBJ [float]: 0.243193    // Truth_level y_bjorken
 +</code>
  
 +Note that SLCIO files have two records representing truth level MC: MCParticle and MCInfo. MCInfo includes information on generated events.
 +See the example how this record was created in [[https://github.com/Argonne-National-Laboratory/ProMC/blob/master/examples/promc2lcio/promc2lcio.java|promc2lcio.java]]
  
  --- //[[[email protected]|Sergei Chekanov]] 2016/09/19 07:06//  --- //[[[email protected]|Sergei Chekanov]] 2016/09/19 07:06//