#include <TofSimSvc.h>
Inheritance diagram for TofSimSvc:
Public Member Functions | |
TofSimSvc (const std::string &name, ISvcLocator *svcloc) | |
~TofSimSvc () | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
void | handle (const Incident &) |
const double | BarLowThres () |
const double | BarHighThres () |
const double | EndLowThres () |
const double | EndHighThres () |
const double | BarPMTGain () |
const double | EndPMTGain () |
const double | BarConstant () |
const double | EndConstant () |
const double | EndNoiseSwitch () |
const double | BarGain1 (unsigned int id) |
const double | BarGain2 (unsigned int id) |
const double | EndGain (unsigned int id) |
const double | BarAttenLength (unsigned int id) |
const double | EndAttenLength (unsigned int id) |
const double | EndNoiseSmear (unsigned int id) |
void | Dump () |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Private Member Functions | |
StatusCode | FillfromDatabase () |
Private Attributes | |
bool | m_hasbeeninitialized |
IDataProviderSvc * | m_pSimDataSvc |
IntegerProperty | m_run |
std::vector< TofConst * > | fTofConst |
std::vector< BTofSim * > | fBTofSim |
std::vector< ETofSim * > | fETofSim |
Definition at line 14 of file TofSimSvc.h.
TofSimSvc::TofSimSvc | ( | const std::string & | name, | |
ISvcLocator * | svcloc | |||
) |
TofSimSvc::~TofSimSvc | ( | ) |
Definition at line 80 of file TofSimSvc.cxx.
References fBTofSim, fETofSim, fTofConst, Bes_Common::INFO, and msgSvc().
00080 { 00081 MsgStream log(msgSvc(), name()); 00082 log << MSG::INFO << name() << ": Destructor function of TofSimSvc" << endreq; 00083 00084 for(vector<TofConst*>::iterator it1 = fTofConst.begin(); it1 != fTofConst.end(); it1++) { delete (*it1); } 00085 fTofConst.clear(); 00086 for(vector<BTofSim*>::iterator it2 = fBTofSim.begin(); it2 != fBTofSim.end(); it2++) { delete (*it2); } 00087 fBTofSim.clear(); 00088 for(vector<ETofSim*>::iterator it3 = fETofSim.begin(); it3 != fETofSim.end(); it3++) { delete (*it3); } 00089 fETofSim.clear(); 00090 00091 return; 00092 }
const double TofSimSvc::BarAttenLength | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 229 of file TofSimSvc.cxx.
References fBTofSim.
00229 { 00230 if( id < 176 ) { 00231 return fBTofSim[id]->getAttenLength(); 00232 } 00233 else { 00234 std::cout<<"TofSimSvc::BarAttenLength: bad id="<<id<<std::endl; 00235 return 0.0; 00236 } 00237 }
const double TofSimSvc::BarConstant | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 187 of file TofSimSvc.cxx.
References fTofConst.
00187 { 00188 return fTofConst[0]->getBarConstant(); 00189 }
const double TofSimSvc::BarGain1 | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 199 of file TofSimSvc.cxx.
References fBTofSim.
00199 { 00200 if( id < 176 ) { 00201 return fBTofSim[id]->getGain1(); 00202 } 00203 else { 00204 std::cout<<"TofSimSvc::BarGain1: bad id="<<id<<std::endl; 00205 return 0.0; 00206 } 00207 }
const double TofSimSvc::BarGain2 | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 209 of file TofSimSvc.cxx.
References fBTofSim.
00209 { 00210 if( id < 176 ) { 00211 return fBTofSim[id]->getGain2(); 00212 } 00213 else { 00214 std::cout<<"TofSimSvc::BarGain2: bad id="<<id<<std::endl; 00215 return 0.0; 00216 } 00217 }
const double TofSimSvc::BarHighThres | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 167 of file TofSimSvc.cxx.
References fTofConst.
00167 { 00168 return fTofConst[0]->getBarHighThres(); 00169 }
const double TofSimSvc::BarLowThres | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 163 of file TofSimSvc.cxx.
References fTofConst.
00163 { 00164 return fTofConst[0]->getBarLowThres(); 00165 }
const double TofSimSvc::BarPMTGain | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 179 of file TofSimSvc.cxx.
References fTofConst.
00179 { 00180 return fTofConst[0]->getBarPMTGain(); 00181 }
void TofSimSvc::Dump | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 144 of file TofSimSvc.cxx.
00144 { 00145 std::cout<<"Now We can get the TOF Simulation Service"<<std::endl; 00146 return; 00147 }
const double TofSimSvc::EndAttenLength | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 239 of file TofSimSvc.cxx.
References fETofSim.
00239 { 00240 if( id < 96 ) { 00241 return fETofSim[id]->getAttenLength(); 00242 } 00243 else { 00244 std::cout<<"TofSimSvc::EndAttenLength: bad id="<<id<<std::endl; 00245 return 0.0; 00246 } 00247 }
const double TofSimSvc::EndConstant | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 191 of file TofSimSvc.cxx.
References fTofConst.
00191 { 00192 return fTofConst[0]->getEndConstant(); 00193 }
const double TofSimSvc::EndGain | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 219 of file TofSimSvc.cxx.
References fETofSim.
00219 { 00220 if( id < 96 ) { 00221 return fETofSim[id]->getGain(); 00222 } 00223 else { 00224 std::cout<<"TofSimSvc::EndGain: bad id="<<id<<std::endl; 00225 return 0.0; 00226 } 00227 }
const double TofSimSvc::EndHighThres | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 175 of file TofSimSvc.cxx.
References fTofConst.
00175 { 00176 return fTofConst[0]->getEndHighThres(); 00177 }
const double TofSimSvc::EndLowThres | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 171 of file TofSimSvc.cxx.
References fTofConst.
00171 { 00172 return fTofConst[0]->getEndLowThres(); 00173 }
const double TofSimSvc::EndNoiseSmear | ( | unsigned int | id | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 249 of file TofSimSvc.cxx.
References fETofSim.
00249 { 00250 if( id < 96 ) { 00251 return fETofSim[id]->getNoiseSmear(); 00252 } 00253 else { 00254 std::cout<<"TofSimSvc::EndNoiseSmear: bad id="<<id<<std::endl; 00255 return 0.0; 00256 } 00257 }
const double TofSimSvc::EndNoiseSwitch | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 195 of file TofSimSvc.cxx.
References fTofConst.
00195 { 00196 return fTofConst[0]->getEndNoiseSwitch(); 00197 }
const double TofSimSvc::EndPMTGain | ( | ) | [virtual] |
Implements ITofSimSvc.
Definition at line 183 of file TofSimSvc.cxx.
References fTofConst.
00183 { 00184 return fTofConst[0]->getEndPMTGain(); 00185 }
StatusCode TofSimSvc::FillfromDatabase | ( | ) | [private] |
Definition at line 94 of file TofSimSvc.cxx.
References Bes_Common::FATAL, fBTofSim, fETofSim, fTofConst, Bes_Common::INFO, m_pSimDataSvc, msgSvc(), TofConst::setBarConstant(), TofConst::setBarHighThres(), TofConst::setBarLowThres(), TofConst::setBarPMTGain(), TofConst::setEndConstant(), TofConst::setEndHighThres(), TofConst::setEndLowThres(), TofConst::setEndNoiseSwitch(), TofConst::setEndPMTGain(), deljobs::string, and test.
Referenced by handle().
00094 { 00095 00096 MsgStream log(msgSvc(), name()); 00097 std::string fullPath = "/Calib/TofSim"; 00098 log << MSG::INFO<<" Tof simulation fullPath = "<<fullPath<< endreq; 00099 SmartDataPtr<CalibData::TofSimData> test(m_pSimDataSvc, fullPath); 00100 if(!test){ 00101 log << MSG::FATAL << "TofSimSvc could not find TofSimData in TDS!!" << endreq; 00102 return StatusCode::FAILURE; 00103 } 00104 00105 for(vector<TofConst*>::iterator it1 = fTofConst.begin(); it1 != fTofConst.end(); it1++) { delete (*it1); } 00106 fTofConst.clear(); 00107 for(vector<BTofSim*>::iterator it2 = fBTofSim.begin(); it2 != fBTofSim.end(); it2++) { delete (*it2); } 00108 fBTofSim.clear(); 00109 for(vector<ETofSim*>::iterator it3 = fETofSim.begin(); it3 != fETofSim.end(); it3++) { delete (*it3); } 00110 fETofSim.clear(); 00111 00112 TofConst* tofConst = new TofConst; 00113 tofConst->setBarLowThres( test->getBarLowThres() ); 00114 tofConst->setBarHighThres( test->getBarHighThres() ); 00115 tofConst->setEndLowThres( test->getEndLowThres() ); 00116 tofConst->setEndHighThres( test->getEndHighThres() ); 00117 tofConst->setBarPMTGain( test->getBarPMTGain() ); 00118 tofConst->setEndPMTGain( test->getEndPMTGain() ); 00119 tofConst->setBarConstant( test->getBarConstant() ); 00120 tofConst->setEndConstant( test->getEndConstant() ); 00121 tofConst->setEndNoiseSwitch( test->getEndNoiseSwitch() ); 00122 fTofConst.push_back(tofConst); 00123 00124 for( unsigned int id=0; id<176; id++ ) { 00125 // std::cout<<test->getBarAttenLength(id)<<std::endl; 00126 BTofSim* btof = new BTofSim; 00127 btof->setGain( test->getBarGain(id) ); 00128 btof->setRatio( test->getBarRatio(id) ); 00129 btof->setAttenLength( test->getBarAttenLength(id) ); 00130 fBTofSim.push_back(btof); 00131 } 00132 00133 for( unsigned int id=0; id<96; id++ ) { 00134 ETofSim* etof = new ETofSim; 00135 etof->setGain( test->getEndGain(id) ); 00136 etof->setAttenLength( test->getEndAttenLength(id) ); 00137 etof->setNoiseSmear( test->getEndNoiseSmear(id) ); 00138 fETofSim.push_back(etof); 00139 } 00140 00141 return StatusCode::SUCCESS; 00142 }
StatusCode TofSimSvc::finalize | ( | ) | [virtual] |
Definition at line 74 of file TofSimSvc.cxx.
References Bes_Common::INFO, and msgSvc().
00074 { 00075 MsgStream log(msgSvc(), name()); 00076 log << MSG::INFO << name() << ": End of Run" << endreq; 00077 return StatusCode::SUCCESS; 00078 }
void TofSimSvc::handle | ( | const Incident & | ) |
Definition at line 149 of file TofSimSvc.cxx.
References Bes_Common::DEBUG, FillfromDatabase(), and m_hasbeeninitialized.
00149 { 00150 MsgStream log( messageService(), name() ); 00151 log << MSG::DEBUG << "handle: " << inc.type() << endreq; 00152 00153 if ( inc.type() == "NewRun" ){ 00154 log << MSG::DEBUG << "New Run" << endreq; 00155 StatusCode sc= FillfromDatabase(); 00156 if(sc.isSuccess()){ 00157 m_hasbeeninitialized=true; 00158 } 00159 } 00160 return; 00161 }
StatusCode TofSimSvc::initialize | ( | ) | [virtual] |
Definition at line 42 of file TofSimSvc.cxx.
References Bes_Common::DEBUG, calibUtil::ERROR, Bes_Common::INFO, m_hasbeeninitialized, m_pSimDataSvc, and msgSvc().
00042 { 00043 m_hasbeeninitialized=false; 00044 00045 MsgStream log(msgSvc(), name()); 00046 log << MSG::INFO << name() << ": Start of run initialisation" << endreq; 00047 00048 StatusCode sc = Service::initialize(); 00049 if ( sc.isFailure() ) return sc; 00050 00051 IIncidentSvc* incsvc; 00052 sc = service("IncidentSvc", incsvc); 00053 int priority = 100; 00054 if( sc.isSuccess() ){ 00055 incsvc -> addListener(this, "NewRun", priority); 00056 } 00057 00058 StatusCode scc; 00059 00060 log<<MSG::INFO << "setProperties()" << endreq; 00061 scc = service("CalibDataSvc", m_pSimDataSvc, true); 00062 if ( !scc.isSuccess() ) { 00063 log<<MSG::ERROR<<"Could not get IDataProviderSvc interface of SimXmlCnvSvc"<<endreq; 00064 return scc; 00065 } else { 00066 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of SimXmlCnvSvc"<<endreq; 00067 } 00068 // Get properties from the JobOptionsSvc 00069 scc = setProperties(); 00070 00071 return sc; 00072 }
static const InterfaceID& ITofSimSvc::interfaceID | ( | ) | [inline, static, inherited] |
Definition at line 13 of file ITofSimSvc.h.
References IID_ITofSimSvc().
00013 { return IID_ITofSimSvc; }
StatusCode TofSimSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvUnknown | |||
) | [virtual] |
Definition at line 32 of file TofSimSvc.cxx.
References IID_ITofSimSvc().
00032 { 00033 00034 if ( IID_ITofSimSvc.versionMatch(riid) ) { 00035 *ppvInterface = static_cast<ITofSimSvc*> (this); 00036 } else { 00037 return Service::queryInterface(riid, ppvInterface) ; 00038 } 00039 return StatusCode::SUCCESS; 00040 }
std::vector<BTofSim*> TofSimSvc::fBTofSim [private] |
Definition at line 54 of file TofSimSvc.h.
Referenced by BarAttenLength(), BarGain1(), BarGain2(), FillfromDatabase(), and ~TofSimSvc().
std::vector<ETofSim*> TofSimSvc::fETofSim [private] |
Definition at line 55 of file TofSimSvc.h.
Referenced by EndAttenLength(), EndGain(), EndNoiseSmear(), FillfromDatabase(), and ~TofSimSvc().
std::vector<TofConst*> TofSimSvc::fTofConst [private] |
Definition at line 53 of file TofSimSvc.h.
Referenced by BarConstant(), BarHighThres(), BarLowThres(), BarPMTGain(), EndConstant(), EndHighThres(), EndLowThres(), EndNoiseSwitch(), EndPMTGain(), FillfromDatabase(), and ~TofSimSvc().
bool TofSimSvc::m_hasbeeninitialized [private] |
IDataProviderSvc* TofSimSvc::m_pSimDataSvc [private] |
IntegerProperty TofSimSvc::m_run [private] |