#include #include #include #include #include #include #include #include #include #include #include #include "TElecSim.hxx" TROOT root("ROOT","Root of Everything"); int main(int argc, char **argv) { // Open input the file std::string fileName = ""; if (argc>1) fileName = argv[1]; COMET::ICOMETInput* input = new COMET::ICOMETInput(fileName.c_str()); COMET::IOADatabase::Get().SetCurrentFile(input); std::string outputName = ""; COMET::ICOMETOutput* output = NULL; if (argc>2) { outputName = argv[2]; output = new COMET::ICOMETOutput(outputName.c_str(),"NEW"); if (!output->IsOpen()) exit(1); output->WriteGeometry(COMET::IOADatabase::Get().Geometry()); } TDummyElectronics simulateElectronics; for (std::auto_ptrevent(input->begin()); !input->EndOfFile(); event.reset(input->NextEvent())) { simulateElectronics(*event); std::auto_ptr p0d(event->GetHitSelection("p0d")); std::auto_ptr fgd(event->GetHitSelection("fgd")); std::auto_ptr tpc(event->GetHitSelection("tpc")); event->ls(); for (COMET::IHitSelection::iterator h = p0d->begin(); h != p0d->end(); ++h) { std::cout << " P0D HIT: " << "(" << (*h)->GetPosition().X() << "," << (*h)->GetPosition().Y() << "," << (*h)->GetPosition().Z() << ") " << " q: " << (*h)->GetCharge() << " xyz: " << (*h)->IsXHit() << (*h)->IsYHit() << (*h)->IsZHit() << std::endl; } for (COMET::IHitSelection::iterator h = tpc->begin(); h != tpc->end(); ++h) { std::cout << " TPC HIT: " << "(" << (*h)->GetPosition().X() << "," << (*h)->GetPosition().Y() << "," << (*h)->GetPosition().Z() << ") " << " q: " << (*h)->GetCharge() << " xyz: " << (*h)->IsXHit() << (*h)->IsYHit() << (*h)->IsZHit() << std::endl; } for (COMET::IHitSelection::iterator h = fgd->begin(); h != fgd->end(); ++h) { std::cout << " FGD HIT: " << "(" << (*h)->GetPosition().X() << "," << (*h)->GetPosition().Y() << "," << (*h)->GetPosition().Z() << ") " << " q: " << (*h)->GetCharge() << " xyz: " << (*h)->IsXHit() << (*h)->IsYHit() << (*h)->IsZHit() << std::endl; } if (output) output->WriteEvent(*event); } input->Close(); delete input; if (output) { output->Close(); delete output; } return 0; }