BOSS 7.1.0
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
12DECLARE_COMPONENT(EmcRecGeoSvc)
13
14//static SvcFactory<EmcRecGeoSvc> s_factory;
15//const ISvcFactory& EmcRecGeoSvcFactory = s_factory;
16
17EmcRecGeoSvc::EmcRecGeoSvc( const std::string& name, ISvcLocator* svcloc ) : base_class(name, svcloc)
18{
19 fGdml = true;
20
21 // Declare the properties
22 declareProperty("Gdml",fGdml);
23
24 if(fGdml) {
25 fROOTGeo = new EmcRecROOTGeo();
26 }
27}
28
30{
31 if(fGdml) {
32 if(fROOTGeo) delete fROOTGeo;
33 }
34}
35
36/*StatusCode EmcRecGeoSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
37
38 if ( IID_IEmcRecGeoSvc.versionMatch(riid) ) {
39 *ppvInterface = static_cast<IEmcRecGeoSvc*> (this);
40 } else {
41 return Service::queryInterface(riid, ppvInterface) ;
42 }
43 return StatusCode::SUCCESS;
44}
45*/
47 MsgStream log(messageService(), name());
48 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
49
50 StatusCode sc = Service::initialize();
51 if ( sc.isFailure() ) return sc;
52
53 // initialize geometry from gdml
54 if(fGdml) {
55 fROOTGeo->InitFromXML();
56 }
57 return StatusCode::SUCCESS;
58}
59
60
61StatusCode EmcRecGeoSvc::finalize ( ) {
62 MsgStream log(messageService(), name());
63 log << MSG::INFO << name() << ": End of Run" << endreq;
64 return StatusCode::SUCCESS;
65}
66
68 if(fGdml) {
69 return fROOTGeo->GetCrystal(id);
70 } else {
71 EmcRecCrystal cry;
72
73 if(EmcID::is_barrel(id)) {
74 cry=fBarrel.GetCrystal(id);
75 } else {
76 cry=fEndCap.GetCrystal(id);
77 }
78
79 return cry;
80 }
81
82}
83
85 EmcRecCrystal cry;
86 if(fGdml) {
87 cry=fROOTGeo->GetCrystal(id);
88 } else {
89 if(EmcID::is_barrel(id)) {
90 cry=fBarrel.GetCrystal(id);
91 } else {
92 cry=fEndCap.GetCrystal(id);
93 }
94 }
95 return cry.Get(i)/cm;
96}
97
99 if(fGdml) {
100 return fROOTGeo->GetCCenter(id)/cm;
101 } else {
102 HepPoint3D center;
103
104 if(EmcID::is_barrel(id)) {
105 center=fBarrel.GetCCenter(id);
106 } else {
107 center=fEndCap.GetCCenter(id);
108 }
109
110 return center/cm;
111 }
112}
113
115 if(fGdml) {
116 return fROOTGeo->GetCFrontCenter(id)/cm;
117 } else {
118 HepPoint3D frontCenter;
119
120 if(EmcID::is_barrel(id)) {
121 frontCenter=fBarrel.GetCFrontCenter(id);
122 } else {
123 frontCenter=fEndCap.GetCFrontCenter(id);
124 }
125
126 return frontCenter/cm;
127 }
128}
129
131{
132 return fBarrel.GetBarrelR()/cm;
133}
134
136{
137 return fBarrel.GetBarrelOffset1()/cm;
138}
139
141{
142 return fBarrel.GetBarrelOffset2()/cm;
143}
144
146{
147 return fBarrel.GetBarrelh1()/cm;
148}
149
151{
152 return fBarrel.GetBarrelh2()/cm;
153}
154
156{
157 return fBarrel.GetBarrelh3()/cm;
158}
159
161{
162 return fBarrel.GetBarrelL()/cm;
163}
164
166{
167 return fBarrel.GetBarrelNPhiMax();
168}
169
171{
172 return fBarrel.GetBarrelNThetaMax();
173}
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
virtual EmcRecCrystal GetCrystal(const Identifier &id) const
virtual StatusCode initialize()
virtual StatusCode finalize()
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