/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Tof/TofGeomSvc/TofGeomSvc-00-00-12/src/TofGeomSvc.cxx

Go to the documentation of this file.
00001 #include "TofGeomSvc/TofGeomSvc.h"
00002 #include "GaudiKernel/Kernel.h"
00003 #include "GaudiKernel/IInterface.h"
00004 #include "GaudiKernel/StatusCode.h"
00005 #include "GaudiKernel/SvcFactory.h"
00006 #include "GaudiKernel/MsgStream.h"
00007 
00008   
00009 TofGeomSvc::TofGeomSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc) {}
00010 
00011 StatusCode TofGeomSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
00012   
00013   if ( IID_ITofGeomSvc.versionMatch(riid) ) { 
00014     *ppvInterface = static_cast<ITofGeomSvc*> (this); 
00015   } else { 
00016     return Service::queryInterface(riid, ppvInterface) ; 
00017   }
00018   return StatusCode::SUCCESS;
00019 }
00020 
00021 StatusCode TofGeomSvc::initialize ( ) {
00022   MsgStream log(messageService(), name());
00023   log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
00024   
00025   StatusCode sc = Service::initialize();
00026   if ( sc.isFailure() ) return sc;
00027 
00028   //  get geometry data
00029  // Fill();    
00030   return StatusCode::SUCCESS;
00031 }  
00032   
00033 StatusCode TofGeomSvc::finalize ( ) {
00034   MsgStream log(messageService(), name());
00035   log << MSG::INFO << name() << ": End of Run" << endreq;
00036   return StatusCode::SUCCESS;
00037 }
00038 
00039 TofGeomSvc::~TofGeomSvc(){
00040   for(vector<BTofGeo*>::iterator it1 = fBTofGeo.begin(); it1 != fBTofGeo.end(); it1++) delete *it1;
00041   for(vector<ETofGeo*>::iterator it2 = fETofGeo.begin(); it2 != fETofGeo.end(); it2++) delete *it2;  
00042   fBTofGeo.clear();
00043   fETofGeo.clear();
00044 }
00045 /*
00046 void TofGeomSvc::Fill(){        
00047     DB2BesGeoBarTOF obj1;
00048     DB2BesGeoEndTOF obj2;
00049     vector<DBBesGeoBarTOF> VecA;
00050     vector<DBBesGeoEndTOF> VecB;
00051     obj1.get_DBBesGeoBarTOF(VecA);
00052     obj2.get_DBBesGeoEndTOF(VecB);
00053     double inradm = VecA[0].get_inrad();
00054     double length = VecA[0].get_length();
00055     double thick  = VecA[0].get_thick();
00056    for(int ib=0;ib<176;ib++){
00057         BTofGeo* btof= new BTofGeo;
00058         double phi=0,phiMin=0,phiMax=0,inrad=0;
00059         double dphi = 0.0714;
00060         if(ib<88){
00061            inrad=inradm;        
00062            phi  = dphi/2.+ib*dphi;      //phi at center of the module
00063            phiMin = phi-dphi/2.;
00064            phiMax = phi+dphi/2.;
00065         }
00066         else if(ib>87) {
00067            int ibb=ib-88;
00068            inrad=inradm+5.1;       
00069            phi    = ibb*dphi;      //phi at center of the module
00070            phiMin = phi-dphi/2.;
00071            phiMax = phi+dphi/2.;
00072         }               
00073         btof->setPhiMax(phiMax);
00074         btof->setPhiMin(phiMin);
00075         btof->setInrad(inrad);
00076         btof->setLength(length);
00077         btof->setThick(thick);                  
00078         fBTofGeo.push_back(btof);
00079         
00080     }   
00081     for(int ie=0;ie<96;ie++){
00082      double inrad_e  = VecB[0].get_inrad();
00083     double outrad_e = VecB[0].get_outrad();        
00084     double thick_e  = VecB[0].get_thick();            
00085         double phi_e=0,phiMin_e=0,phiMax_e=0,thetaMax_e=0,thetaMin_e=0;
00086         ETofGeo* etof=new ETofGeo;
00087         double dphi = 0.1309;
00088         if(ie<48){
00089            phi_e  = dphi/2.+ie*dphi;      //phi at center of the counter
00090            phiMin_e = phi_e-dphi/2.;
00091            phiMax_e = phi_e+dphi/2.;
00092            thetaMax_e=0.93;
00093            thetaMin_e=0.83;
00094         }else{
00095            int ie2=ie-48;
00096            phi_e  = dphi/2.+ie2*dphi;      //phi at center of the counter
00097            phiMin_e = phi_e-dphi/2.;
00098            phiMax_e = phi_e+dphi/2.;
00099            thetaMax_e=-0.83;
00100            thetaMin_e=-0.93;
00101         }       
00102         etof->setPhiMin(phiMin_e);
00103         etof->setPhiMax(phiMax_e);
00104         etof->setThetaMax(thetaMax_e);
00105         etof->setThetaMin(thetaMin_e);
00106         etof->setInrad(inrad_e);
00107         etof->setOutrad(outrad_e);
00108         etof->setThick(thick_e);
00109         fETofGeo.push_back(etof);       
00110     }    
00111 }
00112 */
00113 
00114 
00115 void TofGeomSvc::Dump(){
00116   std::cout<<"Now can get the TOF Geometry Service!!"<<std::endl;
00117 /*
00118   std::cout<<"Barrel TOF Counter Number = "<<fBTofGeo.size()<<std::endl;
00119   std::cout<<"Endcap TOF Counter Number = "<<fETofGeo.size()<<std::endl;
00120   for(int ib=0; ib<176; ib++){  
00121      cout<<"The"<<" "<<ib<<" "<<"Barrel TOF phiMax is"<<" "<<BTof(ib)->getPhiMax()<<endl;
00122      cout<<"The"<<" "<<ib<<" "<<"Barrel TOF phiMin is"<<" "<<BTof(ib)->getPhiMin()<<endl; 
00123   }
00124   for(int ie=0; ie<96; ie++){  
00125      cout<<"The"<<" "<<ie<<" "<<"Endcap TOF phiMax is"<<" "<<ETof(ie)->getPhiMax()<<endl;
00126      cout<<"The"<<" "<<ie<<" "<<"Endcap TOF phiMin is"<<" "<<ETof(ie)->getPhiMin()<<endl; 
00127   }  
00128   cout<<"The 33rd  Barrel TOF Counter  inrad is"<<" "<<BTof(33)->getInrad()<<endl; 
00129   cout<<"The 133rd Barrel TOF Counter  inrad is"<<" "<<BTof(133)->getInrad()<<endl; 
00130   cout<<"The 133rd Barrel TOF Counter  length is"<<" "<<BTof(133)->getLength()<<endl; 
00131   cout<<"The 133rd Barrel TOF Counter  thick  is"<<" "<<BTof(133)->getThick()<<endl; 
00132   cout<<"The 22rd  Endcap TOF Counter  inrad is"<<" "<<ETof(22)->getInrad()<<endl; 
00133   cout<<"The 22rd  Endcap TOF Counter  outrad is"<<" "<<ETof(22)->getOutrad()<<endl; 
00134   cout<<"The 22rd  Endcap TOF Counter  thick  is"<<" "<<ETof(22)->getThick()<<endl; 
00135   cout<<"The 22rd  Endcap TOF Counter  thetaMax is"<<" "<<ETof(22)->getThetaMax()<<endl; 
00136   cout<<"The 22rd  Endcap TOF Counter  thetaMin is"<<" "<<ETof(22)->getThetaMin()<<endl; 
00137   cout<<"The 90rd  Endcap TOF Counter  thetaMax is"<<" "<<ETof(90)->getThetaMax()<<endl; 
00138   cout<<"The 90rd  Endcap TOF Counter  thetaMin is"<<" "<<ETof(90)->getThetaMin()<<endl; 
00139 */
00140 }
00141 
00142 const double  TofGeomSvc::getBPhiMax(unsigned id){
00143   if (id < fBTofGeo.size())
00144         return  fBTofGeo[id]->getPhiMax();
00145     return 0;
00146 }
00147 
00148 const double  TofGeomSvc::getBPhiMin(unsigned id){
00149   if (id < fBTofGeo.size())
00150         return  fBTofGeo[id]->getPhiMin();
00151     return 0;
00152 }
00153 
00154 const double  TofGeomSvc::getEPhiMax(unsigned id){
00155   if (id < fETofGeo.size())
00156         return  fETofGeo[id]->getPhiMax();
00157     return 0;
00158 }
00159 
00160 const double  TofGeomSvc::getEPhiMin(unsigned id){
00161   if (id < fETofGeo.size())
00162         return  fETofGeo[id]->getPhiMin();
00163     return 0;
00164 }
00165         
00166 BTofGeo* TofGeomSvc::BTof(unsigned id) const{
00167     if (id < fBTofGeo.size())
00168         return  fBTofGeo[id];
00169     return 0;
00170 }
00171 
00172 ETofGeo* TofGeomSvc::ETof(unsigned id) const{
00173     if (id < fETofGeo.size())
00174         return  fETofGeo[id];
00175     return 0;
00176 }

Generated on Tue Nov 29 23:14:38 2016 for BOSS_7.0.2 by  doxygen 1.4.7