00001 // $Header: /cvs/lcd/slic/src/PrimaryGeneratorAction.cc,v 1.30 2007/04/27 01:54:35 jeremy Exp $ 00002 00003 #include "PrimaryGeneratorAction.hh" 00004 00005 // lcdd 00006 #include "StringUtil.hh" 00007 00008 // slic 00009 #include "LcioManager.hh" 00010 #include "SlicApplication.hh" 00011 #include "LcioMcpFilter.hh" 00012 #include "EventSourceManager.hh" 00013 00014 // geant4 00015 #include "G4StateManager.hh" 00016 00017 namespace slic 00018 { 00019 PrimaryGeneratorAction::PrimaryGeneratorAction() 00020 : Module("PrimaryGeneratorAction", false) 00021 {} 00022 00023 PrimaryGeneratorAction::~PrimaryGeneratorAction() 00024 {} 00025 00026 void PrimaryGeneratorAction::GeneratePrimaries(G4Event *anEvent) 00027 { 00028 EventSourceManager* mgr = EventSourceManager::instance(); 00029 00030 // print begin message 00031 #ifdef SLIC_LOG 00032 printBeginEventMessage( anEvent ); 00033 #endif 00034 00035 // needs to be called here for setup purposes rather than in EventAction 00036 mgr->beginEvent(anEvent); 00037 00038 // delegate event generation to the manager 00039 mgr->GeneratePrimaryVertex(anEvent); 00040 00041 if ( mgr->isEOF() ) { 00042 SlicApplication::instance()->setAborting(true); 00043 } 00044 } 00045 00046 void PrimaryGeneratorAction::printBeginEventMessage(G4Event* anEvent) 00047 { 00048 log() << LOG::okay << ">>>> BeginEvent <" << StringUtil::toString( anEvent->GetEventID() ) << ">" << LOG::done; 00049 } 00050 }
1.5.4