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

In This Package:

SoDetSvc.cpp

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

Generated on Mon Apr 11 20:02:29 2011 for SoDet by doxygen 1.4.7