CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecGeoSvc.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Kernel.h"
2#include "GaudiKernel/IInterface.h"
3#include "GaudiKernel/StatusCode.h"
4//#include "GaudiKernel/ISvcFactory.h"
5//#include "GaudiKernel/SvcFactory.h"
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/PropertyMgr.h"
8
11
12//static SvcFactory<EmcRecGeoSvc> s_factory;
13//const ISvcFactory& EmcRecGeoSvcFactory = s_factory;
14
15EmcRecGeoSvc::EmcRecGeoSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc)
16{
17 fGdml = true;
18
19 // Declare the properties
20 declareProperty("Gdml",fGdml);
21
22 if(fGdml) {
23 fROOTGeo = new EmcRecROOTGeo();
24 }
25}
26
28{
29 if(fGdml) {
30 if(fROOTGeo) delete fROOTGeo;
31 }
32}
33
34StatusCode EmcRecGeoSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
35
36 if ( IID_IEmcRecGeoSvc.versionMatch(riid) ) {
37 *ppvInterface = static_cast<IEmcRecGeoSvc*> (this);
38 } else {
39 return Service::queryInterface(riid, ppvInterface) ;
40 }
41 return StatusCode::SUCCESS;
42}
43
45 MsgStream log(messageService(), name());
46 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
47
48 StatusCode sc = Service::initialize();
49 if ( sc.isFailure() ) return sc;
50
51 // initialize geometry from gdml
52 if(fGdml) {
53 fROOTGeo->InitFromXML();
54 }
55 return StatusCode::SUCCESS;
56}
57
58
59StatusCode EmcRecGeoSvc::finalize ( ) {
60 MsgStream log(messageService(), name());
61 log << MSG::INFO << name() << ": End of Run" << endreq;
62 return StatusCode::SUCCESS;
63}
64
66 if(fGdml) {
67 return fROOTGeo->GetCrystal(id);
68 } else {
69 EmcRecCrystal cry;
70
71 if(EmcID::is_barrel(id)) {
72 cry=fBarrel.GetCrystal(id);
73 } else {
74 cry=fEndCap.GetCrystal(id);
75 }
76
77 return cry;
78 }
79
80}
81
83 EmcRecCrystal cry;
84 if(fGdml) {
85 cry=fROOTGeo->GetCrystal(id);
86 } else {
87 if(EmcID::is_barrel(id)) {
88 cry=fBarrel.GetCrystal(id);
89 } else {
90 cry=fEndCap.GetCrystal(id);
91 }
92 }
93 return cry.Get(i)/cm;
94}
95
97 if(fGdml) {
98 return fROOTGeo->GetCCenter(id)/cm;
99 } else {
100 HepPoint3D center;
101
102 if(EmcID::is_barrel(id)) {
103 center=fBarrel.GetCCenter(id);
104 } else {
105 center=fEndCap.GetCCenter(id);
106 }
107
108 return center/cm;
109 }
110}
111
113 if(fGdml) {
114 return fROOTGeo->GetCFrontCenter(id)/cm;
115 } else {
116 HepPoint3D frontCenter;
117
118 if(EmcID::is_barrel(id)) {
119 frontCenter=fBarrel.GetCFrontCenter(id);
120 } else {
121 frontCenter=fEndCap.GetCFrontCenter(id);
122 }
123
124 return frontCenter/cm;
125 }
126}
127
129{
130 return fBarrel.GetBarrelR()/cm;
131}
132
134{
135 return fBarrel.GetBarrelOffset1()/cm;
136}
137
139{
140 return fBarrel.GetBarrelOffset2()/cm;
141}
142
144{
145 return fBarrel.GetBarrelh1()/cm;
146}
147
149{
150 return fBarrel.GetBarrelh2()/cm;
151}
152
154{
155 return fBarrel.GetBarrelh3()/cm;
156}
157
159{
160 return fBarrel.GetBarrelL()/cm;
161}
162
164{
165 return fBarrel.GetBarrelNPhiMax();
166}
167
169{
170 return fBarrel.GetBarrelNThetaMax();
171}
static bool is_barrel(const Identifier &id)
Test for barrel.
Definition: EmcID.cxx:32
double GetBarrelOffset2() const
EmcRecCrystal GetCrystal(const Identifier &id) const
int GetBarrelNPhiMax() const
double GetBarrelh3() const
double GetBarrelh1() const
double GetBarrelR() const
int GetBarrelNThetaMax() const
double GetBarrelOffset1() const
double GetBarrelh2() const
double GetBarrelL() const
HepPoint3D GetCFrontCenter(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const
HepPoint3D Get(int index) const
Definition: EmcRecCrystal.h:83
EmcRecCrystal GetCrystal(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const
HepPoint3D GetCFrontCenter(const Identifier &id) const
virtual double GetBarrelL() const
virtual HepPoint3D GetCrystalPoint(const Identifier &id, const int i) const
virtual int GetBarrelNPhiMax() const
virtual double GetBarrelR() const
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const
EmcRecGeoSvc(const std::string &name, ISvcLocator *svcloc)
virtual EmcRecCrystal GetCrystal(const Identifier &id) const
virtual StatusCode initialize()
virtual StatusCode finalize()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
virtual double GetBarrelh2() const
virtual double GetBarrelOffset1() const
virtual HepPoint3D GetCCenter(const Identifier &id) const
virtual double GetBarrelOffset2() const
virtual int GetBarrelNThetaMax() const
virtual double GetBarrelh1() const
virtual double GetBarrelh3() const
EmcRecCrystal GetCrystal(const Identifier &id) const
HepPoint3D GetCFrontCenter(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const