| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

SoHepMCSvc.cpp

Go to the documentation of this file.
00001 // this :
00002 #include "SoHepMCSvc.h"
00003 
00004 // Gaudi :
00005 #include <GaudiKernel/SvcFactory.h>
00006 #include <GaudiKernel/MsgStream.h>
00007 
00008 #include <GaudiKernel/IDataProviderSvc.h>
00009 #include <GaudiKernel/IParticlePropertySvc.h>
00010 
00011 // OnXSvc :
00012 #include <OnXSvc/IUserInterfaceSvc.h>
00013 
00014 #include "Types.h"
00015 
00016 DECLARE_SERVICE_FACTORY( SoHepMCSvc );
00017 
00019 SoHepMCSvc::SoHepMCSvc(
00020  const std::string& aName
00021 ,ISvcLocator* aSvcLoc
00022 ) 
00023 :Service(aName,aSvcLoc)
00024 ,m_uiSvc(0)
00025 ,m_eventDataSvc(0)
00026 ,m_particlePropertySvc(0)
00029 {
00030 }
00032 SoHepMCSvc::~SoHepMCSvc(
00033 ) 
00034 
00035 
00036 { 
00037 }
00039 StatusCode SoHepMCSvc::initialize(
00040 ) 
00041 
00042 
00043 {
00044   StatusCode status = Service::initialize();
00045   if( status.isFailure() ) return status;
00046 
00047   MsgStream log(messageService(), Service::name());
00048 
00049   log << MSG::INFO << " SoHepMCSvc::initialize " << endreq;
00050 
00051   setProperties();
00052 
00053   if(!serviceLocator()) {
00054     log << MSG::INFO << " service locator not found " << endreq;
00055     return StatusCode::FAILURE;
00056   }
00057 
00058   // Get the Detector data service :
00059   
00060   if(m_uiSvc) {
00061     m_uiSvc->release();
00062     m_uiSvc = 0;
00063   }
00064   status = service("OnXSvc",m_uiSvc,true);
00065   if(status.isFailure()  || !m_uiSvc) {
00066     log << MSG::INFO << " OnXSvc not found " << endreq;
00067     return StatusCode::FAILURE;
00068   }
00069   m_uiSvc->addRef();
00070 
00071   if(m_eventDataSvc) {
00072     m_eventDataSvc->release();
00073     m_eventDataSvc = 0;
00074   }
00075   status = service("EventDataSvc" , m_eventDataSvc , true );
00076   if(status.isFailure() || !m_eventDataSvc) {
00077     log << MSG::INFO << " EventDataSvc not found " << endreq;
00078   }
00079   m_eventDataSvc->addRef();
00080 
00081   if(m_particlePropertySvc) {
00082     m_particlePropertySvc->release();
00083     m_particlePropertySvc = 0;
00084   }
00085   status = service("ParticlePropertySvc" , m_particlePropertySvc , true );
00086   if(status.isFailure() || !m_particlePropertySvc) {
00087     log << MSG::INFO << " ParticlePropertySvc not found " << endreq;
00088   }
00089   m_particlePropertySvc->addRef();
00090   
00091   
00092   if(m_eventDataSvc) {
00093     if(m_particlePropertySvc) {
00094       m_uiSvc->addType(new GenParticleType(m_particlePropertySvc,
00095                                            m_eventDataSvc,
00096                                            m_uiSvc));
00097     }
00098   }
00099   
00100   return status;
00101 }
00103 StatusCode SoHepMCSvc::finalize(
00104 ) 
00105 
00106 
00107 {
00108   if(m_uiSvc) {
00109     m_uiSvc->release();
00110     m_uiSvc = 0;
00111   }
00112   if(m_eventDataSvc) {
00113     m_eventDataSvc->release();
00114     m_eventDataSvc = 0;
00115   }
00116   if(m_particlePropertySvc) {
00117     m_particlePropertySvc->release();
00118     m_particlePropertySvc = 0;
00119   }
00120 
00121   MsgStream log(messageService(), Service::name());
00122   log << MSG::INFO << "SoHepMCSvc finalized successfully" << endreq;
00123   return StatusCode::SUCCESS;
00124 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:04:31 2011 for SoHepMC by doxygen 1.4.7