#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "IVTimeShiftGenerator.hxx" #include "ISimHitMergerMain.hxx" using namespace COMET; class SimHitMerger: public COMET::ICOMETEventLoopFunction { public: SimHitMerger():fHitMerger(){} virtual ~SimHitMerger() {}; void Usage(void) { fHitMerger.Usage(); } virtual bool SetOption(std::string option,std::string value="") { return fHitMerger.SetOption(option, value); } virtual bool CheckOptions(){ return fHitMerger.CheckOptions(); } virtual void BeginFile(IVInputFile *const input){ fHitMerger.NewEventSource(input); // Ensure a geometry can be written at the end if (fHitMerger.UseAllEvents()) { // TODO clean this up, it overrides the other -g and -G options in // the event loop COMET::IOADatabase::Get().SetGeometryOverride(input->GetFilename()); COMET::IOADatabase::Get().SetEMFieldDescriptionOverride(input->GetFilename()); } } bool operator () (COMET::ICOMETEvent& event) { return fHitMerger.ProcessEvent(event); } virtual void Initialize(void){ fHitMerger.Initialize(); } virtual void Finalize(ICOMETOutput * const file){ fHitMerger.AfterLastInputEvent(*file); } private: COMET::ISimHitMergerMain fHitMerger; }; int main(int argc, char **argv) { SimHitMerger userCode; COMET::cometEventLoop(argc,argv,userCode,0); }