BOSS 7.1.2
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
17DECLARE_COMPONENT(MucGeomSvc)
18
19MucGeomSvc::MucGeomSvc( const std::string& name, ISvcLocator* svcloc ) : base_class(name, svcloc)
20{
21 //Declare the properties
22 declareProperty("GeometryMode",m_Geometry=1);
23
24}
25
26/*StatusCode MucGeomSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
27
28 if ( IID_IMucGeomSvc.versionMatch(riid) ) {
29 *ppvInterface = static_cast<IMucGeomSvc*> (this);
30 } else {
31 return Service::queryInterface(riid, ppvInterface) ;
32 }
33 return StatusCode::SUCCESS;
34}
35*/
36StatusCode MucGeomSvc::initialize ( ) {
37 MsgStream log(messageService(), name());
38 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
39
40 StatusCode sc = Service::initialize();
41 if ( sc.isFailure() ) return sc;
42
43 // get geometry data
44 Fill();
45
46 return StatusCode::SUCCESS;
47}
48
49
50StatusCode MucGeomSvc::finalize ( ) {
51 MsgStream log(messageService(), name());
52 log << MSG::INFO << name() << ": End of Run" << endreq;
53 return StatusCode::SUCCESS;
54}
55
56
59
60void MucGeomSvc::Fill(){
61 if(m_Geometry==1){
62 m_pMucGeoGeneral = MucGeoGeneral::Instance();
63 m_pMucGeoGeneral->Init();
64 //m_pMucGeoGeneral->InitFromASCII();
65 m_pMucGeoGeneral->InitFromXML();
66 } else{ //geant4 geo
67 m_pMucG4Geo = MucG4Geo::Instance();
68 }
69}
70
71const MucGeoGeneral * const
73{
74 return m_pMucGeoGeneral;
75}
76
77const MucGeoGap * const
78MucGeomSvc::GetGap(int part, int seg, int gap)
79{
80 return m_pMucGeoGeneral->GetGap(part, seg, gap);
81}
82
83const MucGeoStrip * const
84MucGeomSvc::GetStrip(int part, int seg, int gap, int strip)
85{
86 return m_pMucGeoGeneral->GetStrip(part, seg, gap, strip);
87}
88
90 std::cout << "StripNumTotal = " << m_pMucGeoGeneral->GetStripNumTotal() << std::endl;
91}
92
93const MucG4Geo * const //for geant4 geo 2006.11.23
95{
96 return m_pMucG4Geo;
97}
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 initialize()
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)