CGEM BOSS 6.6.5.f
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 ()
 
 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
 
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 ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description

Constructor & Destructor Documentation

◆ EstTofCaliSvc() [1/2]

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() [1/2]

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}

◆ EstTofCaliSvc() [2/2]

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

◆ ~EstTofCaliSvc() [2/2]

EstTofCaliSvc::~EstTofCaliSvc ( )

Member Function Documentation

◆ BTCorr1() [1/2]

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

Implements IEstTofCaliSvc.

Referenced by BTime1().

◆ BTCorr1() [2/2]

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

Implements IEstTofCaliSvc.

◆ BTCorr2() [1/2]

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

Implements IEstTofCaliSvc.

Referenced by BTime2().

◆ BTCorr2() [2/2]

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

Implements IEstTofCaliSvc.

◆ BTime1() [1/2]

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)

◆ BTime1() [2/2]

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

Implements IEstTofCaliSvc.

◆ BTime2() [1/2]

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)

◆ BTime2() [2/2]

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

Implements IEstTofCaliSvc.

◆ BTof() [1/2]

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().

◆ BTof() [2/2]

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

Implements IEstTofCaliSvc.

◆ BTofCommon() [1/2]

BTofCommonCal * EstTofCaliSvc::BTofCommon ( ) const
virtual

Implements IEstTofCaliSvc.

Definition at line 309 of file EstTofCaliSvc.cxx.

309 {
310 return fBTofCommonCal[0];
311}

◆ BTofCommon() [2/2]

BTofCommonCal * EstTofCaliSvc::BTofCommon ( ) const
virtual

Implements IEstTofCaliSvc.

◆ Dump() [1/2]

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().

◆ Dump() [2/2]

void EstTofCaliSvc::Dump ( )
virtual

Implements IEstTofCaliSvc.

◆ ETime() [1/2]

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

◆ ETime() [2/2]

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

Implements IEstTofCaliSvc.

◆ ETof() [1/2]

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

Implements IEstTofCaliSvc.

Definition at line 305 of file EstTofCaliSvc.cxx.

305 {
306 return fETofCal[id];
307}

◆ ETof() [2/2]

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

Implements IEstTofCaliSvc.

◆ finalize() [1/2]

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}

◆ finalize() [2/2]

virtual StatusCode EstTofCaliSvc::finalize ( )
virtual

◆ handle() [1/2]

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}

◆ handle() [2/2]

void EstTofCaliSvc::handle ( const Incident &  )

◆ initialize() [1/2]

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().

◆ initialize() [2/2]

virtual StatusCode EstTofCaliSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

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}

◆ queryInterface() [2/2]

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

◆ TOffset() [1/2]

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}

◆ TOffset() [2/2]

const double EstTofCaliSvc::TOffset ( )
virtual

Implements IEstTofCaliSvc.

◆ ValidInfo() [1/2]

const bool EstTofCaliSvc::ValidInfo ( )
inlinevirtual

Implements IEstTofCaliSvc.

Definition at line 46 of file InstallArea/include/EstTofCaliSvc/EstTofCaliSvc/EstTofCaliSvc.h.

46{return m_st;};

◆ ValidInfo() [2/2]

const bool EstTofCaliSvc::ValidInfo ( )
inlinevirtual

Implements IEstTofCaliSvc.

Definition at line 46 of file Tof/EstTofCaliSvc/EstTofCaliSvc-00-00-08/EstTofCaliSvc/EstTofCaliSvc.h.

46{return m_st;};

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