BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
EstTofCaliSvc Class Reference

#include <EstTofCaliSvc.h>

+ Inheritance diagram for EstTofCaliSvc:

Public Member Functions

 EstTofCaliSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~EstTofCaliSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
BTofCalBTof (unsigned id) const
 
BTofCommonCalBTofCommon () const
 
ETofCalETof (unsigned id) const
 
const double BTCorr1 (double ADC, double zHit, unsigned int id)
 
const double BTCorr2 (double ADC, double zHit, unsigned int id)
 
const double TOffset ()
 
const double BTime1 (double ADC, double TDC, double zHit, unsigned id)
 
const double BTime2 (double ADC, double TDC, double zHit, unsigned id)
 
const double ETime (double ADC, double TDC, double rHit, unsigned id)
 
const bool ValidInfo ()
 
void Dump ()
 
virtual BTofCalBTof (unsigned id) const =0
 
virtual BTofCommonCalBTofCommon () const =0
 
virtual ETofCalETof (unsigned id) const =0
 
virtual const double BTCorr1 (double ADC, double zHit, unsigned int id)=0
 
virtual const double BTCorr2 (double ADC, double zHit, unsigned int id)=0
 
virtual const double TOffset ()=0
 
virtual const double BTime1 (double ADC, double TDC, double zHit, unsigned id)=0
 
virtual const double BTime2 (double ADC, double TDC, double zHit, unsigned id)=0
 
virtual const double ETime (double ADC, double TDC, double rHit, unsigned id)=0
 
virtual const bool ValidInfo ()=0
 
virtual void Dump ()=0
 

Additional Inherited Members

- Static Public Member Functions inherited from IEstTofCaliSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 21 of file EstTofCaliSvc.h.

Constructor & Destructor Documentation

◆ EstTofCaliSvc()

EstTofCaliSvc::EstTofCaliSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

Definition at line 43 of file EstTofCaliSvc.cxx.

43 : Service(name, svcloc) {
44 declareProperty("Run",m_run=1);
45}

◆ ~EstTofCaliSvc()

EstTofCaliSvc::~EstTofCaliSvc ( )

Definition at line 96 of file EstTofCaliSvc.cxx.

96 {
97 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) { delete (*it1); }
98 fBTofCal.clear();
99 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) { delete (*it2); }
100 fETofCal.clear();
101 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) { delete (*it3); }
102 fBTofCommonCal.clear();
103 return;
104}

Member Function Documentation

◆ BTCorr1()

const double EstTofCaliSvc::BTCorr1 ( double  ADC,
double  zHit,
unsigned int  id 
)
virtual

Implements IEstTofCaliSvc.

Definition at line 158 of file EstTofCaliSvc.cxx.

158 {
159 MsgStream log(msgSvc(), name());
160
161 double p1[nBarPar];
162 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
163 p1[i]=fBTofCal[id]->getP1(i);
164 }
165
166 log << MSG::DEBUG << "BTCorr1 id =" << id << " 1=" << p1[0] << " 2=" << p1[1] << " 3=" << p1[2] << " 4=" << p1[3] << " 5=" << p1[4] << " 6=" << p1[5] << " 7=" << p1[6] << " 8=" << p1[7] << " 9=" << p1[8] << endreq;
167
168 double tcorr1 = p1[0] + p1[1]/TMath::Sqrt(ADC) + p1[2]*z/TMath::Sqrt(ADC) + p1[3]/ADC + p1[4]*z + p1[5]*z*z + p1[6]*z*z*z;
169
170 return tcorr1;
171}
const unsigned int nBarPar
IMessageSvc * msgSvc()

Referenced by BTime1().

◆ BTCorr2()

const double EstTofCaliSvc::BTCorr2 ( double  ADC,
double  zHit,
unsigned int  id 
)
virtual

Implements IEstTofCaliSvc.

Definition at line 174 of file EstTofCaliSvc.cxx.

174 {
175 MsgStream log(msgSvc(), name());
176
177 double p2[nBarPar];
178 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
179 p2[i]=fBTofCal[id]->getP2(i);
180 }
181
182 log << MSG::DEBUG << "BTCorr2 id =" << id << " 1=" << p2[0] << " 2=" << p2[1] << " 3=" << p2[2] << " 4=" << p2[3] << " 5=" << p2[4] << " 6=" << p2[5] << " 7=" << p2[6] << " 8=" << p2[7] << " 9=" << p2[8] << endreq;
183
184 double tcorr2 = p2[0] + p2[1]/TMath::Sqrt(ADC) + p2[2]*z/TMath::Sqrt(ADC) + p2[3]/ADC + p2[4]*z + p2[5]*z*z + p2[6]*z*z*z;
185
186 return tcorr2;
187}

Referenced by BTime2().

◆ BTime1()

const double EstTofCaliSvc::BTime1 ( double  ADC,
double  TDC,
double  zHit,
unsigned  id 
)
virtual

Implements IEstTofCaliSvc.

Definition at line 240 of file EstTofCaliSvc.cxx.

240 {
241 MsgStream log(msgSvc(), name());
242
243 double tcorr1 = BTCorr1( ADC, z, id );
244 // double tcorr2 = BTCorrOffset1( z, id );
245 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
246
247 // log << MSG::DEBUG << "BTime1 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
248 log << MSG::DEBUG << "BTime1 id =" << id << " tcorr=" << tcorr1 << " total offset=" << tcorr3 << endreq;
249
250 // double time = TDC - tcorr1 - tcorr2 - tcorr3;
251 double time = TDC - tcorr1 - tcorr3;
252
253 if(time<0.) {
254 log<<MSG::WARNING<<"TofCaliSvc::BTime1() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
255 }
256 return time;
257}
Double_t time
const double BTCorr1(double ADC, double zHit, unsigned int id)

◆ BTime2()

const double EstTofCaliSvc::BTime2 ( double  ADC,
double  TDC,
double  zHit,
unsigned  id 
)
virtual

Implements IEstTofCaliSvc.

Definition at line 260 of file EstTofCaliSvc.cxx.

260 {
261 MsgStream log(msgSvc(), name());
262
263 double tcorr1 = BTCorr2( ADC, z, id );
264 // double tcorr2 = BTCorrOffset2( z, id );
265 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
266
267 // log << MSG::DEBUG << "BTime2 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
268 log << MSG::DEBUG << "BTime2 id =" << id << " tcorr=" << tcorr1 << " total offset=" << tcorr3 << endreq;
269
270 // double time = TDC - tcorr1 - tcorr2 - tcorr3;
271 double time = TDC - tcorr1 - tcorr3;
272
273 if(time<0.) {
274 log<<MSG::WARNING<<"TofCaliSvc::BTime2() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
275 }
276 return time;
277}
const double BTCorr2(double ADC, double zHit, unsigned int id)

◆ BTof()

BTofCal * EstTofCaliSvc::BTof ( unsigned  id) const
virtual

Implements IEstTofCaliSvc.

Definition at line 301 of file EstTofCaliSvc.cxx.

301 {
302 return fBTofCal[id];
303}

Referenced by Dump().

◆ BTofCommon()

BTofCommonCal * EstTofCaliSvc::BTofCommon ( ) const
virtual

Implements IEstTofCaliSvc.

Definition at line 309 of file EstTofCaliSvc.cxx.

309 {
310 return fBTofCommonCal[0];
311}

◆ Dump()

void EstTofCaliSvc::Dump ( )
virtual

Implements IEstTofCaliSvc.

Definition at line 313 of file EstTofCaliSvc.cxx.

313 {
314 std::cout<<"Now We can get the TOF Calibtration Service"<<std::endl;
315 std::cout<<"Barrel TOF Counter Number = "<<fBTofCal.size()<<std::endl;
316 std::cout<<"Endcap TOF Counter Number = "<<fETofCal.size()<<std::endl;
317
318 cout<<"The O Barrel TOF PMT1 p1[0] is"<<" "<<BTof(0)->getP1(0)<<endl;
319 cout<<"The 0 Barrel TOF PMT1 p1[1] is"<<" "<<BTof(0)->getP1(1)<<endl;
320}
BTofCal * BTof(unsigned id) const

Referenced by main().

◆ ETime()

const double EstTofCaliSvc::ETime ( double  ADC,
double  TDC,
double  rHit,
unsigned  id 
)
virtual

Implements IEstTofCaliSvc.

Definition at line 280 of file EstTofCaliSvc.cxx.

280 {
281 MsgStream log(msgSvc(), name());
282
283 double p[nEndPar];
284 for( int i=0; i<static_cast<int>(nEndPar); i++ ) {
285 p[i]=fETofCal[id]->getP(i);
286 }
287
288 log << MSG::DEBUG << "ETime id =" << id << " 1=" << p[0] << " 2=" << p[1] << " 3=" << p[2] << " 4=" << p[3] << " 5=" << p[4] << " 6=" << p[5] << " 7=" << p[6] << endreq;
289
290 double time=TDC-(p[0]+p[1]/TMath::Sqrt(ADC)+p[2]/ADC+p[3]*ADC+p[4]*rHit+p[5]*rHit*rHit+p[6]*rHit*rHit*rHit);
291
292 if(time<0.) {
293 MsgStream log(msgSvc(), name());
294 log<<MSG::WARNING<<"TofCaliSvc::ETime() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" r = "<< rHit <<" ID = "<<id<<endreq;
295 }
296
297 return time;
298}
const unsigned int nEndPar

◆ ETof()

ETofCal * EstTofCaliSvc::ETof ( unsigned  id) const
virtual

Implements IEstTofCaliSvc.

Definition at line 305 of file EstTofCaliSvc.cxx.

305 {
306 return fETofCal[id];
307}

◆ finalize()

StatusCode EstTofCaliSvc::finalize ( )
virtual

Definition at line 90 of file EstTofCaliSvc.cxx.

90 {
91 MsgStream log(msgSvc(), name());
92 log << MSG::INFO << name() << ": End of Run" << endreq;
93 return StatusCode::SUCCESS;
94}

◆ handle()

void EstTofCaliSvc::handle ( const Incident &  inc)

Definition at line 322 of file EstTofCaliSvc.cxx.

322 {
323 MsgStream log( messageService(), name() );
324 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
325
326 if ( inc.type() == "NewRun" ){
327 log << MSG::DEBUG << "New Run" << endreq;
328 // if(!m_hasbeeninitialized){
329 StatusCode sc= FillfromDatabase();
330 if(sc.isSuccess()){
331 m_hasbeeninitialized=true;
332 }
333 // }
334 }
335}

◆ initialize()

StatusCode EstTofCaliSvc::initialize ( )
virtual

Definition at line 57 of file EstTofCaliSvc.cxx.

57 {
58 m_hasbeeninitialized=false;
59 m_st=false;
60
61 MsgStream log(msgSvc(), name());
62 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
63
64 StatusCode sc = Service::initialize();
65 if ( sc.isFailure() ) return sc;
66
67 IIncidentSvc* incsvc;
68 sc = service("IncidentSvc", incsvc);
69 int priority = 100;
70 if( sc.isSuccess() ){
71 incsvc -> addListener(this, "NewRun", priority);
72 }
73
74 StatusCode scc;
75
76 log<<MSG::INFO << "setProperties()" << endreq;
77 scc = service("CalibDataSvc", m_pCalibDataSvc, true);
78 if ( !scc.isSuccess() ) {
79 log<<MSG::ERROR<<"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
80 return scc;
81 } else {
82 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
83 }
84 // Get properties from the JobOptionsSvc
85 scc = setProperties();
86
87 return sc;
88}

Referenced by main().

◆ queryInterface()

StatusCode EstTofCaliSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 47 of file EstTofCaliSvc.cxx.

47 {
48
49 if ( IID_IEstTofCaliSvc.versionMatch(riid) ) {
50 *ppvInterface = static_cast<IEstTofCaliSvc*> (this);
51 } else {
52 return Service::queryInterface(riid, ppvInterface) ;
53 }
54 return StatusCode::SUCCESS;
55}

◆ TOffset()

const double EstTofCaliSvc::TOffset ( )
virtual

Implements IEstTofCaliSvc.

Definition at line 234 of file EstTofCaliSvc.cxx.

234 {
235 double toffset = fBTofCommonCal[0]->getOffset(0);
236 return toffset;
237}

◆ ValidInfo()

const bool EstTofCaliSvc::ValidInfo ( )
inlinevirtual

Implements IEstTofCaliSvc.

Definition at line 46 of file EstTofCaliSvc.h.

46{return m_st;};

The documentation for this class was generated from the following files: