BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
TofGeomSvc.cxx
Go to the documentation of this file.
2#include "GaudiKernel/Kernel.h"
3#include "GaudiKernel/IInterface.h"
4#include "GaudiKernel/StatusCode.h"
5#include "GaudiKernel/SvcFactory.h"
6#include "GaudiKernel/MsgStream.h"
7
8
9TofGeomSvc::TofGeomSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc) {}
10
11StatusCode TofGeomSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
12
13 if ( IID_ITofGeomSvc.versionMatch(riid) ) {
14 *ppvInterface = static_cast<ITofGeomSvc*> (this);
15 } else {
16 return Service::queryInterface(riid, ppvInterface) ;
17 }
18 return StatusCode::SUCCESS;
19}
20
21StatusCode TofGeomSvc::initialize ( ) {
22 MsgStream log(messageService(), name());
23 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
24
25 StatusCode sc = Service::initialize();
26 if ( sc.isFailure() ) return sc;
27
28 // get geometry data
29 // Fill();
30 return StatusCode::SUCCESS;
31}
32
33StatusCode TofGeomSvc::finalize ( ) {
34 MsgStream log(messageService(), name());
35 log << MSG::INFO << name() << ": End of Run" << endreq;
36 return StatusCode::SUCCESS;
37}
38
40 for(vector<BTofGeo*>::iterator it1 = fBTofGeo.begin(); it1 != fBTofGeo.end(); it1++) delete *it1;
41 for(vector<ETofGeo*>::iterator it2 = fETofGeo.begin(); it2 != fETofGeo.end(); it2++) delete *it2;
42 fBTofGeo.clear();
43 fETofGeo.clear();
44}
45/*
46void TofGeomSvc::Fill(){
47 DB2BesGeoBarTOF obj1;
48 DB2BesGeoEndTOF obj2;
49 vector<DBBesGeoBarTOF> VecA;
50 vector<DBBesGeoEndTOF> VecB;
51 obj1.get_DBBesGeoBarTOF(VecA);
52 obj2.get_DBBesGeoEndTOF(VecB);
53 double inradm = VecA[0].get_inrad();
54 double length = VecA[0].get_length();
55 double thick = VecA[0].get_thick();
56 for(int ib=0;ib<176;ib++){
57 BTofGeo* btof= new BTofGeo;
58 double phi=0,phiMin=0,phiMax=0,inrad=0;
59 double dphi = 0.0714;
60 if(ib<88){
61 inrad=inradm;
62 phi = dphi/2.+ib*dphi; //phi at center of the module
63 phiMin = phi-dphi/2.;
64 phiMax = phi+dphi/2.;
65 }
66 else if(ib>87) {
67 int ibb=ib-88;
68 inrad=inradm+5.1;
69 phi = ibb*dphi; //phi at center of the module
70 phiMin = phi-dphi/2.;
71 phiMax = phi+dphi/2.;
72 }
73 btof->setPhiMax(phiMax);
74 btof->setPhiMin(phiMin);
75 btof->setInrad(inrad);
76 btof->setLength(length);
77 btof->setThick(thick);
78 fBTofGeo.push_back(btof);
79
80 }
81 for(int ie=0;ie<96;ie++){
82 double inrad_e = VecB[0].get_inrad();
83 double outrad_e = VecB[0].get_outrad();
84 double thick_e = VecB[0].get_thick();
85 double phi_e=0,phiMin_e=0,phiMax_e=0,thetaMax_e=0,thetaMin_e=0;
86 ETofGeo* etof=new ETofGeo;
87 double dphi = 0.1309;
88 if(ie<48){
89 phi_e = dphi/2.+ie*dphi; //phi at center of the counter
90 phiMin_e = phi_e-dphi/2.;
91 phiMax_e = phi_e+dphi/2.;
92 thetaMax_e=0.93;
93 thetaMin_e=0.83;
94 }else{
95 int ie2=ie-48;
96 phi_e = dphi/2.+ie2*dphi; //phi at center of the counter
97 phiMin_e = phi_e-dphi/2.;
98 phiMax_e = phi_e+dphi/2.;
99 thetaMax_e=-0.83;
100 thetaMin_e=-0.93;
101 }
102 etof->setPhiMin(phiMin_e);
103 etof->setPhiMax(phiMax_e);
104 etof->setThetaMax(thetaMax_e);
105 etof->setThetaMin(thetaMin_e);
106 etof->setInrad(inrad_e);
107 etof->setOutrad(outrad_e);
108 etof->setThick(thick_e);
109 fETofGeo.push_back(etof);
110 }
111}
112*/
113
114
116 std::cout<<"Now can get the TOF Geometry Service!!"<<std::endl;
117/*
118 std::cout<<"Barrel TOF Counter Number = "<<fBTofGeo.size()<<std::endl;
119 std::cout<<"Endcap TOF Counter Number = "<<fETofGeo.size()<<std::endl;
120 for(int ib=0; ib<176; ib++){
121 cout<<"The"<<" "<<ib<<" "<<"Barrel TOF phiMax is"<<" "<<BTof(ib)->getPhiMax()<<endl;
122 cout<<"The"<<" "<<ib<<" "<<"Barrel TOF phiMin is"<<" "<<BTof(ib)->getPhiMin()<<endl;
123 }
124 for(int ie=0; ie<96; ie++){
125 cout<<"The"<<" "<<ie<<" "<<"Endcap TOF phiMax is"<<" "<<ETof(ie)->getPhiMax()<<endl;
126 cout<<"The"<<" "<<ie<<" "<<"Endcap TOF phiMin is"<<" "<<ETof(ie)->getPhiMin()<<endl;
127 }
128 cout<<"The 33rd Barrel TOF Counter inrad is"<<" "<<BTof(33)->getInrad()<<endl;
129 cout<<"The 133rd Barrel TOF Counter inrad is"<<" "<<BTof(133)->getInrad()<<endl;
130 cout<<"The 133rd Barrel TOF Counter length is"<<" "<<BTof(133)->getLength()<<endl;
131 cout<<"The 133rd Barrel TOF Counter thick is"<<" "<<BTof(133)->getThick()<<endl;
132 cout<<"The 22rd Endcap TOF Counter inrad is"<<" "<<ETof(22)->getInrad()<<endl;
133 cout<<"The 22rd Endcap TOF Counter outrad is"<<" "<<ETof(22)->getOutrad()<<endl;
134 cout<<"The 22rd Endcap TOF Counter thick is"<<" "<<ETof(22)->getThick()<<endl;
135 cout<<"The 22rd Endcap TOF Counter thetaMax is"<<" "<<ETof(22)->getThetaMax()<<endl;
136 cout<<"The 22rd Endcap TOF Counter thetaMin is"<<" "<<ETof(22)->getThetaMin()<<endl;
137 cout<<"The 90rd Endcap TOF Counter thetaMax is"<<" "<<ETof(90)->getThetaMax()<<endl;
138 cout<<"The 90rd Endcap TOF Counter thetaMin is"<<" "<<ETof(90)->getThetaMin()<<endl;
139*/
140}
141
142const double TofGeomSvc::getBPhiMax(unsigned id){
143 if (id < fBTofGeo.size())
144 return fBTofGeo[id]->getPhiMax();
145 return 0;
146}
147
148const double TofGeomSvc::getBPhiMin(unsigned id){
149 if (id < fBTofGeo.size())
150 return fBTofGeo[id]->getPhiMin();
151 return 0;
152}
153
154const double TofGeomSvc::getEPhiMax(unsigned id){
155 if (id < fETofGeo.size())
156 return fETofGeo[id]->getPhiMax();
157 return 0;
158}
159
160const double TofGeomSvc::getEPhiMin(unsigned id){
161 if (id < fETofGeo.size())
162 return fETofGeo[id]->getPhiMin();
163 return 0;
164}
165
166BTofGeo* TofGeomSvc::BTof(unsigned id) const{
167 if (id < fBTofGeo.size())
168 return fBTofGeo[id];
169 return 0;
170}
171
172ETofGeo* TofGeomSvc::ETof(unsigned id) const{
173 if (id < fETofGeo.size())
174 return fETofGeo[id];
175 return 0;
176}
Definition: BTofGeo.h:4
Definition: ETofGeo.h:4
ETofGeo * ETof(unsigned id) const
Definition: TofGeomSvc.cxx:172
const double getBPhiMin(unsigned id)
Definition: TofGeomSvc.cxx:148
void Dump()
Definition: TofGeomSvc.cxx:115
virtual StatusCode initialize()
Definition: TofGeomSvc.cxx:21
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
Definition: TofGeomSvc.cxx:11
const double getEPhiMax(unsigned id)
Definition: TofGeomSvc.cxx:154
TofGeomSvc(const std::string &name, ISvcLocator *svcloc)
Definition: TofGeomSvc.cxx:9
BTofGeo * BTof(unsigned id) const
Definition: TofGeomSvc.cxx:166
virtual StatusCode finalize()
Definition: TofGeomSvc.cxx:33
const double getEPhiMin(unsigned id)
Definition: TofGeomSvc.cxx:160
const double getBPhiMax(unsigned id)
Definition: TofGeomSvc.cxx:142