/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/examples/cpp/rootDict/anajob.C

Go to the documentation of this file.
00001 #ifndef __CINT__ 
00002 #include "IO/LCReader.h"
00003 #include "IOIMPL/LCFactory.h"
00004 #include "EVENT/MCParticle.h"
00005 #include "EVENT/LCCollection.h"
00006 #include "EVENT/LCEvent.h"
00007 #include "UTIL/LCTOOLS.h"
00008 #endif
00009 
00010 
00011 /** Example script for testing the ROOT LCIO dictionary.
00012  * 
00013  *  anajob: reads *.slcio file and dumps events to the screen 
00014  *  in a ROOT macro.
00015  *
00016  */
00017 
00018 void anajob(const char* FILEN) {
00019   
00020   
00021   //just in case this script is executed multiple times
00022   delete gROOT->GetListOfFiles()->FindObject( FILEN );
00023   delete gROOT->GetListOfCanvases()->FindObject("c1");
00024   
00025 
00026   if (!TClassTable::GetDict("IMPL::ReconstructedParticleImpl")) {
00027     unsigned res ;
00028     
00029     res = gSystem->Load("${LCIO}/lib/liblcio.so"); 
00030     res = gSystem->Load("${LCIO}/lib/liblcioDict.so"); 
00031   }
00032 
00033   std::cout << " loaded LCIO library and dictionary ... " << std::endl ;
00034 
00035 
00036   int nEvents = 0  ;
00037   IO::LCReader* lcReader = IOIMPL::LCFactory::getInstance()->createLCReader() ;
00038   lcReader->open( FILEN ) ;
00039 
00040 
00041   //----------- the event loop -----------
00042   while( (evt = lcReader->readNextEvent()) != 0 ) {
00043 
00044     UTIL::LCTOOLS::dumpEvent( evt ) ;
00045     nEvents ++ ;
00046   }
00047   // -------- end of event loop -----------
00048 
00049   std::cout << std::endl 
00050             <<  "  " <<  nEvents 
00051             << " events read from file: " 
00052             << FILEN << std::endl  ;
00053   
00054 
00055   lcReader->close() ;
00056 
00057   delete lcReader ;
00058 }

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7