00001 #include "GeneratorModule/PurgeUnstableParticles.h" 00002 #include "GeneratorObjects/McEventCollection.h" 00003 00004 #include "GaudiKernel/AlgFactory.h" 00005 #include "GaudiKernel/ISvcLocator.h" 00006 00007 #include "GaudiKernel/IDataManagerSvc.h" 00008 00009 #include "GaudiKernel/SmartDataPtr.h" 00010 #include "GaudiKernel/DataSvc.h" 00011 00012 static const AlgFactory<PurgeUnstableParticles> Factory; 00013 const IAlgFactory& PurgeUnstableParticlesFactory = Factory; 00014 00015 PurgeUnstableParticles::PurgeUnstableParticles 00016 (const std::string& name, ISvcLocator* pSvcLocator) : 00017 Algorithm(name, pSvcLocator) {} 00018 00019 00020 StatusCode PurgeUnstableParticles::initialize(){ 00021 00022 IDataManagerSvc* m_DMS; 00023 StatusCode sc = serviceLocator()->getService("EventDataSvc", 00024 IID_IDataManagerSvc, 00025 (IInterface*&)m_DMS); 00026 if (sc.isFailure()) { return sc; } 00027 00028 std::string rootEventName = m_DMS->rootEventName(); 00029 m_mcEventColl = rootEventName + "/McEventCollection"; 00030 00031 return StatusCode::SUCCESS; 00032 00033 } 00034 00035 StatusCode PurgeUnstableParticles::execute(){ 00036 00037 SmartDataPtr<McEventCollection> mcCollptr(eventDataService(), 00038 m_mcEventColl); 00039 if(mcCollptr) { 00040 McEventCollection::iterator it; 00041 for(it=mcCollptr->begin(); it!=mcCollptr->end(); it++) { 00042 (*it)->purgeUnstableParticles(); 00043 00044 } 00045 } 00046 00047 return StatusCode::SUCCESS; 00048 00049 } 00050 00051 StatusCode PurgeUnstableParticles::finalize(){ 00052 00053 return StatusCode::SUCCESS; 00054 00055 }