/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/lcio/Count.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1328 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-03 17:04:17 +0200 (Mon, 03 Oct 2011) $ */
00002 #include "lcio/Count.hh"
00003 #include "lcio.h"
00004 
00005 #include "IO/LCReader.h"
00006 #include "IO/LCEventListener.h"
00007 #include "IO/LCRunListener.h"
00008 
00009 #include "EVENT/LCIO.h"
00010 
00011 
00012 #include "tools/MicroException.hh"
00013 
00014 
00015 #include <iostream>
00016 #include <algorithm>
00017 
00018 using namespace std ;
00019 using namespace lcio ;
00020 
00021 
00022   
00023   Count::Count(const string _filename):counter(0), compute(false)
00024   {
00025     // Verify events number 
00026 
00027     LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
00028     lcReader->open(_filename);
00029     // registere processor to LCReader
00030     lcReader->registerLCEventListener( this ) ;
00031         lcReader->readStream() ;
00032   }
00033   
00034   Count::~Count(){
00035   }
00036   
00037   void Count::processEvent( LCEvent * evt ) { /* used for 'read only' access*/ 
00038 
00039     counter++ ;
00040         compute = true;
00041   }
00042 
00043   unsigned int Count::getNumberOfEvent()
00044   {
00045         if ( !compute )
00046         {
00047                  throw MicroException("Number of event not compute yet");
00048         }
00049 
00050         return counter;
00051   }
00052 
00053 /*
00054   void Count::modifyEvent( LCEvent * evt ) {
00055 
00056     // here we can modify existing objects that have been read from a stream:
00057         // get first list element
00058         int difEvtId = syncEvtId.front();
00059         // erase first list element
00060         syncEvtId.pop_front();
00061         evt->parameters().setValue("Dif_syncro",difEvtId ) ;
00062     cout << "Write Event[" << evt->getEventNumber() << "] \r" << flush;
00063 
00064   }
00065   
00066 
00067   void Count::processRunHeader( LCRunHeader* run){
00068 
00069     // just copy run headers to the outputfile
00070     lcWrt->writeRunHeader( run ) ;
00071         cout << "Write Run Header"<< endl;
00072   }
00073 
00074   void Count::modifyRunHeader(LCRunHeader* run){
00075 */
00076 
00077 

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