#include #include #include #include // ROOT include files. #include #include // COMET Include Files #include #include #include #include #include #include #include #include class IRunOAUnpackLoop: public COMET::ICOMETEventLoopFunction { public: IRunOAUnpackLoop(); virtual ~IRunOAUnpackLoop() {} bool operator () (COMET::ICOMETEvent& event); void BeginFile(const COMET::IVInputFile* input); bool SetOption(std::string option, std::string value=""); }; //************************************************* IRunOAUnpackLoop::IRunOAUnpackLoop() { //************************************************* // Set the default output level COMET::ICOMETLog::SetLogLevel("oaUnpack",COMET::ICOMETLog::QuietLevel); // Make persisten the digits since they will be written out in the output file COMET::IOADatabase::Get().Digits().PersistentDigits(); } //************************************************* bool IRunOAUnpackLoop::SetOption(std::string option, std::string value) { //************************************************* if (option == "v"){ int value2 = atoi(value.c_str()); std::cout << value2 << std::endl; if (value2 == 1) { COMET::ICOMETLog::SetLogLevel("oaUnpack",COMET::ICOMETLog::LogLevel); } else if (value2 == 2) { COMET::ICOMETLog::SetLogLevel("oaUnpack",COMET::ICOMETLog::InfoLevel); } else if (value2 >= 3) { COMET::ICOMETLog::SetLogLevel("oaUnpack",COMET::ICOMETLog::VerboseLevel); } } else return false; return true; } //************************************************* void IRunOAUnpackLoop::BeginFile(const COMET::IVInputFile*){ //************************************************* } //***************************************************************************** bool IRunOAUnpackLoop::operator () (COMET::ICOMETEvent& event){ //***************************************************************************** if(COMET::ICOMETLog::GetLogLevel("oaUnpack") >= COMET::ICOMETLog::LogLevel) std::cout << "event # " << event.GetEventId() << std::endl; event.GetRaw()->Print(); // to be replaced by a loop over all available digit factories // this requires a modification in the IDigitManager const int NDETS = 6; std::string det[NDETS] = {"tpc","fgd","ecal","p0d","smrd","ingrid"}; for (int i=0;i digits = event.GetDigits(det[i].c_str()); if(COMET::ICOMETLog::GetLogLevel("oaUnpack") >= COMET::ICOMETLog::LogLevel) std::cout << "- " << digits->size() << " " << det[i] << " digits" << std::endl; } } return true; } //********************************************** int main(int argc, char *argv[]) { //********************************************** IRunOAUnpackLoop userCode; cometEventLoop(argc,argv,userCode); }