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