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