#include <GenAccessIO.h>
Public Types | |
typedef std::string | String |
Public Member Functions | |
GenAccessIO () | |
StatusCode | getMC (MCparticleCollection &) const |
StatusCode | getMC (MCparticleCollection &, const GenIMCselector *) const |
StatusCode | getDH (const McEventCollection *&) const |
StatusCode | getDH (const McEventCollection *&, String key) const |
StatusCode | store (McEventCollection *) const |
StatusCode | store (McEventCollection *, String key) const |
Private Attributes | |
StoreGateSvc * | m_sgSvc |
Definition at line 22 of file GenAccessIO.h.
typedef std::string GenAccessIO::String |
Definition at line 24 of file GenAccessIO.h.
GenAccessIO::GenAccessIO | ( | ) | [inline] |
Definition at line 42 of file GenAccessIO.h.
References m_sgSvc.
00042 :m_sgSvc(0){ 00043 ISvcLocator* svcLoc = Gaudi::svcLocator( ); 00044 if( (svcLoc->service( "StoreGateSvc", m_sgSvc )).isFailure() ){ 00045 throw StatusCode::FAILURE; 00046 } 00047 }
StatusCode GenAccessIO::getDH | ( | const McEventCollection *& | , | |
String | key | |||
) | const [inline] |
Definition at line 58 of file GenAccessIO.h.
References m_sgSvc.
00058 { 00059 if( (m_sgSvc->retrieve(dh, key)).isFailure() ){ 00060 return StatusCode::FAILURE; 00061 } 00062 return StatusCode::SUCCESS; 00063 }
StatusCode GenAccessIO::getDH | ( | const McEventCollection *& | ) | const [inline] |
Definition at line 50 of file GenAccessIO.h.
References m_sgSvc.
Referenced by getMC().
00050 { 00051 if((m_sgSvc->retrieve(dh)).isFailure() ){ 00052 return StatusCode::FAILURE; 00053 } 00054 return StatusCode::SUCCESS; 00055 }
StatusCode GenAccessIO::getMC | ( | MCparticleCollection & | , | |
const GenIMCselector * | ||||
) | const |
Definition at line 16 of file GenAccessIO.cxx.
References getDH().
00017 { 00018 00019 const McEventCollection* mcCollptr; 00020 StatusCode stat = this->getDH(mcCollptr); 00021 if(!stat){ 00022 return StatusCode::FAILURE; 00023 } 00024 00025 // Iterate over all McEvent records 00026 McEventCollection::const_iterator itr; 00027 for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) { 00028 // Access the HepMC record which is wrapped within McEvent 00029 const HepMC::GenEvent* genEvt = (*itr); 00030 if(genEvt == 0) return StatusCode::FAILURE; 00031 00032 HepMC::GenEvent::particle_const_iterator it= genEvt->particles_begin(); 00033 HepMC::GenEvent::particle_const_iterator en= genEvt->particles_end(); 00034 for(; it!=en; ++it){ 00035 if((*selector)(*it)){mcParticles.push_back(*it);} 00036 } 00037 } 00038 00039 return StatusCode::SUCCESS; 00040 00041 }
StatusCode GenAccessIO::getMC | ( | MCparticleCollection & | ) | const |
Definition at line 9 of file GenAccessIO.cxx.
Referenced by TruthDemo::execute().
00009 { 00010 const GenIMCselector* selector = new GenAll(); 00011 StatusCode stat = this->getMC(mcParticles, selector); 00012 return stat; 00013 }
StatusCode GenAccessIO::store | ( | McEventCollection * | , | |
String | key | |||
) | const [inline] |
StatusCode GenAccessIO::store | ( | McEventCollection * | ) | const [inline] |
Definition at line 65 of file GenAccessIO.h.
References m_sgSvc.
00065 { 00066 return (m_sgSvc->record(pObject) ) ; 00067 }
StoreGateSvc* GenAccessIO::m_sgSvc [private] |