CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeomSvc.cxx
Go to the documentation of this file.
1/*
2 * 2004/09/10 Zhengyun You Peking University
3 *
4 */
5
7#include "GaudiKernel/Kernel.h"
8#include "GaudiKernel/IInterface.h"
9#include "GaudiKernel/StatusCode.h"
10//#include "GaudiKernel/ISvcFactory.h"
11#include "GaudiKernel/SvcFactory.h"
12#include "GaudiKernel/MsgStream.h"
13
14//static SvcFactory<MucGeomSvc> s_factory;
15//const ISvcFactory& MucGeomSvcFactory = s_factory;
16
17MucGeomSvc::MucGeomSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc)
18{
19 //Declare the properties
20 declareProperty("GeometryMode",m_Geometry=1);
21
22}
23
24StatusCode MucGeomSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
25
26 if ( IID_IMucGeomSvc.versionMatch(riid) ) {
27 *ppvInterface = static_cast<IMucGeomSvc*> (this);
28 } else {
29 return Service::queryInterface(riid, ppvInterface) ;
30 }
31 return StatusCode::SUCCESS;
32}
33
34StatusCode MucGeomSvc::initialize ( ) {
35 MsgStream log(messageService(), name());
36 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
37
38 StatusCode sc = Service::initialize();
39 if ( sc.isFailure() ) return sc;
40
41 // get geometry data
42 Fill();
43
44 return StatusCode::SUCCESS;
45}
46
47
48StatusCode MucGeomSvc::finalize ( ) {
49 MsgStream log(messageService(), name());
50 log << MSG::INFO << name() << ": End of Run" << endreq;
51 return StatusCode::SUCCESS;
52}
53
54
57
58void MucGeomSvc::Fill(){
59 if(m_Geometry==1){
60 m_pMucGeoGeneral = MucGeoGeneral::Instance();
61 m_pMucGeoGeneral->Init();
62 //m_pMucGeoGeneral->InitFromASCII();
63 m_pMucGeoGeneral->InitFromXML();
64 } else{ //geant4 geo
65 m_pMucG4Geo = MucG4Geo::Instance();
66 }
67}
68
69const MucGeoGeneral * const
71{
72 return m_pMucGeoGeneral;
73}
74
75const MucGeoGap * const
76MucGeomSvc::GetGap(int part, int seg, int gap)
77{
78 return m_pMucGeoGeneral->GetGap(part, seg, gap);
79}
80
81const MucGeoStrip * const
82MucGeomSvc::GetStrip(int part, int seg, int gap, int strip)
83{
84 return m_pMucGeoGeneral->GetStrip(part, seg, gap, strip);
85}
86
88 std::cout << "StripNumTotal = " << m_pMucGeoGeneral->GetStripNumTotal() << std::endl;
89}
90
91const MucG4Geo * const //for geant4 geo 2006.11.23
93{
94 return m_pMucG4Geo;
95}
static MucG4Geo * Instance()
Get a pointer to the single instance of MucG4Geo.
Definition MucG4Geo.cxx:57
int GetStripNumTotal()
Get total number of strips.
void Init()
Initialize the instance of MucGeoGeneral.
MucGeoStrip * GetStrip(const int part, const int seg, const int gap, const int strip) const
Get a pointer to the strip identified by (part,seg,gap,strip).
void InitFromXML()
Initialize from xml.
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
virtual void Dump()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
virtual StatusCode initialize()
MucGeomSvc(const std::string &name, ISvcLocator *svcloc)
virtual StatusCode finalize()
virtual const MucGeoGeneral *const GetGeoGeneral()
virtual const MucG4Geo *const GetMucG4Geo()
virtual const MucGeoStrip *const GetStrip(int part, int seg, int gap, int strip)
virtual const MucGeoGap *const GetGap(int part, int seg, int gap)