BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
TofEnergyCalibSvc Class Reference

#include <TofEnergyCalibSvc.h>

+ Inheritance diagram for TofEnergyCalibSvc:

Public Member Functions

 TofEnergyCalibSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofEnergyCalibSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void SetIsData (const std::string &_IsData)
 
std::string GetIsData () const
 
void SetBossRelease (const std::string &_bossrelease)
 
std::string GetBossRelease () const
 
double getCalibConst () const
 
double getPara1 () const
 
double getPara2 () const
 
double getPara3 () const
 
double getPara4 () const
 
double getPara5 () const
 
void setCalibConst (double _CalibConst)
 
void setPara1 (double _Para1)
 
void setPara2 (double _Para2)
 
void setPara3 (double _Para3)
 
void setPara4 (double _Para4)
 
void setPara5 (double _Para5)
 
bool getTofEnergyCalibSvcInfo ()
 
 TofEnergyCalibSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofEnergyCalibSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void SetIsData (const std::string &_IsData)
 
std::string GetIsData () const
 
void SetBossRelease (const std::string &_bossrelease)
 
std::string GetBossRelease () const
 
double getCalibConst () const
 
double getPara1 () const
 
double getPara2 () const
 
double getPara3 () const
 
double getPara4 () const
 
double getPara5 () const
 
void setCalibConst (double _CalibConst)
 
void setPara1 (double _Para1)
 
void setPara2 (double _Para2)
 
void setPara3 (double _Para3)
 
void setPara4 (double _Para4)
 
void setPara5 (double _Para5)
 
bool getTofEnergyCalibSvcInfo ()
 
virtual void SetIsData (const std::string &_IsData)=0
 
virtual std::string GetIsData () const =0
 
virtual void SetBossRelease (const std::string &_bossrelease)=0
 
virtual std::string GetBossRelease () const =0
 
virtual bool getTofEnergyCalibSvcInfo ()=0
 
virtual double getCalibConst () const =0
 
virtual double getPara1 () const =0
 
virtual double getPara2 () const =0
 
virtual double getPara3 () const =0
 
virtual double getPara4 () const =0
 
virtual double getPara5 () const =0
 
virtual void SetIsData (const std::string &_IsData)=0
 
virtual std::string GetIsData () const =0
 
virtual void SetBossRelease (const std::string &_bossrelease)=0
 
virtual std::string GetBossRelease () const =0
 
virtual bool getTofEnergyCalibSvcInfo ()=0
 
virtual double getCalibConst () const =0
 
virtual double getPara1 () const =0
 
virtual double getPara2 () const =0
 
virtual double getPara3 () const =0
 
virtual double getPara4 () const =0
 
virtual double getPara5 () const =0
 

Public Attributes

IDatabaseSvcm_dbsvc
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ TofEnergyCalibSvc() [1/2]

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

◆ ~TofEnergyCalibSvc() [1/2]

TofEnergyCalibSvc::~TofEnergyCalibSvc ( )

Definition at line 55 of file TofEnergyCalibSvc.cxx.

55 {
56}

◆ TofEnergyCalibSvc() [2/2]

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

◆ ~TofEnergyCalibSvc() [2/2]

TofEnergyCalibSvc::~TofEnergyCalibSvc ( )

Member Function Documentation

◆ finalize() [1/2]

StatusCode TofEnergyCalibSvc::finalize ( )
virtual

Definition at line 97 of file TofEnergyCalibSvc.cxx.

97 {
98 MsgStream log(messageService(), name());
99 log << MSG::INFO << "TofEnergyCalibSvc::finalize()" << endreq;
100 // if(m_connect_offline) delete m_connect_offline;
101 return StatusCode::SUCCESS;
102}

◆ finalize() [2/2]

virtual StatusCode TofEnergyCalibSvc::finalize ( )
virtual

◆ GetBossRelease() [1/2]

std::string TofEnergyCalibSvc::GetBossRelease ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 52 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

52{return m_bossRelease;}

◆ GetBossRelease() [2/2]

std::string TofEnergyCalibSvc::GetBossRelease ( ) const
inlinevirtual

◆ getCalibConst() [1/2]

double TofEnergyCalibSvc::getCalibConst ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 53 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

53{ return m_CalibConst;}

◆ getCalibConst() [2/2]

double TofEnergyCalibSvc::getCalibConst ( ) const
inlinevirtual

◆ GetIsData() [1/2]

std::string TofEnergyCalibSvc::GetIsData ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 50 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

50{return m_IsData;}

◆ GetIsData() [2/2]

std::string TofEnergyCalibSvc::GetIsData ( ) const
inlinevirtual

◆ getPara1() [1/2]

double TofEnergyCalibSvc::getPara1 ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 54 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

54{ return m_Para1;}

◆ getPara1() [2/2]

double TofEnergyCalibSvc::getPara1 ( ) const
inlinevirtual

◆ getPara2() [1/2]

double TofEnergyCalibSvc::getPara2 ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 55 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

55{ return m_Para2;}

◆ getPara2() [2/2]

double TofEnergyCalibSvc::getPara2 ( ) const
inlinevirtual

◆ getPara3() [1/2]

double TofEnergyCalibSvc::getPara3 ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 56 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

56{ return m_Para3;}

◆ getPara3() [2/2]

double TofEnergyCalibSvc::getPara3 ( ) const
inlinevirtual

◆ getPara4() [1/2]

double TofEnergyCalibSvc::getPara4 ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 57 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

57{ return m_Para4;}

◆ getPara4() [2/2]

double TofEnergyCalibSvc::getPara4 ( ) const
inlinevirtual

◆ getPara5() [1/2]

double TofEnergyCalibSvc::getPara5 ( ) const
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 58 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

58{ return m_Para5;}

◆ getPara5() [2/2]

double TofEnergyCalibSvc::getPara5 ( ) const
inlinevirtual

◆ getTofEnergyCalibSvcInfo() [1/2]

bool TofEnergyCalibSvc::getTofEnergyCalibSvcInfo ( )
virtual

Implements ITofEnergyCalibSvc.

Definition at line 117 of file TofEnergyCalibSvc.cxx.

117 {
118 MsgStream log(messageService(), name());
119 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
120 int run = eventHeader->runNumber();
121 cout<<"Run in getTofEnergyCalibSvcInfo() is: "<<run<<endl;
122
123 char stmt1[400];
124 if(run<0) {
125 cout << "This data is the MC sample with the Run Number: " << run << endl;
126 run = -run;
127 }
128
129 if(m_bossRelease=="default") m_bossRelease = getenv("BES_RELEASE");
130 sprintf(stmt1, "select CalibConst,Para1,Para2,Para3,Para4,Para5 from TofEnergyCalib where BossVer = '%s' and RunFrom <= %d and RunTo >= %d and IsData = '%s'", m_bossRelease.c_str(), run, run, m_IsData.c_str());
131 cout<<"stmt is:"<<stmt1<<endl;
133 int row_no = m_dbsvc->query("offlinedb",stmt1,res);
134 if( row_no > 0 ) {
135 DatabaseRecord& dbrec = *res[row_no-1];
136 m_CalibConst = dbrec.GetDouble("CalibConst");
137 m_Para1 = dbrec.GetDouble("Para1");
138 m_Para2 = dbrec.GetDouble("Para2");
139 m_Para3 = dbrec.GetDouble("Para3");
140 m_Para4 = dbrec.GetDouble("Para4");
141 m_Para5 = dbrec.GetDouble("Para5");
142 cout<<"m_CalibConst is:"<<m_CalibConst<<endl;
143 cout << "Successfully fetch TofEnergyCalibSvc information for run: "
144 << run << endl;
145 return true;
146 } else if( row_no<=0 ) {
147 cout << " TofEnergyCalibSvc:: can not found TofEnergyCalibSvc information of run:"
148 << run << ", boss version " << m_bossRelease << endl;
149 exit(1);
150 return false;
151 }
152 return true;
153}
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0

Referenced by handle().

◆ getTofEnergyCalibSvcInfo() [2/2]

bool TofEnergyCalibSvc::getTofEnergyCalibSvcInfo ( )
virtual

Implements ITofEnergyCalibSvc.

◆ handle() [1/2]

void TofEnergyCalibSvc::handle ( const Incident &  inc)

Definition at line 104 of file TofEnergyCalibSvc.cxx.

104 {
105 MsgStream log( messageService(), name() );
106 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
107
108 if ( inc.type() == "NewRun" ){
109 log << MSG::DEBUG << "NewRun" << endreq;
111 log << MSG::ERROR << "can not initilize Tof energy Calib Constants" << endreq;
112 }
113 }
114}

◆ handle() [2/2]

void TofEnergyCalibSvc::handle ( const Incident &  )

◆ initialize() [1/2]

StatusCode TofEnergyCalibSvc::initialize ( )
virtual

Definition at line 67 of file TofEnergyCalibSvc.cxx.

67 {
68 MsgStream log(messageService(), name());
69 log << MSG::INFO << "TofEnergyCalibSvc::initialize()" << endreq;
70
71 StatusCode sc = Service::initialize();
72 if( sc.isFailure() ) return sc;
73
74
75 IIncidentSvc* incsvc;
76 sc = service("IncidentSvc", incsvc);
77 int priority = 100;
78 if( sc.isSuccess() ){
79 incsvc -> addListener(this, "NewRun", priority);
80 }
81
82 sc = serviceLocator()->service("DatabaseSvc",m_dbsvc,true);
83 if (sc .isFailure() ) {
84 log << MSG::ERROR << "Unable to find DatabaseSvc " << endreq;
85 return sc;
86 }
87
88 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
89 if (sc .isFailure() ) {
90 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
91 return sc;
92 }
93
94 return StatusCode::SUCCESS;
95}

◆ initialize() [2/2]

virtual StatusCode TofEnergyCalibSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

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

Definition at line 58 of file TofEnergyCalibSvc.cxx.

58 {
59 if( IID_ITofEnergyCalibSvc.versionMatch(riid) ){
60 *ppvInterface = static_cast<ITofEnergyCalibSvc*> (this);
61 } else{
62 return Service::queryInterface(riid, ppvInterface);
63 }
64 return StatusCode::SUCCESS;
65}

◆ queryInterface() [2/2]

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

◆ SetBossRelease() [1/2]

void TofEnergyCalibSvc::SetBossRelease ( const std::string &  _bossrelease)
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 51 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

51{m_bossRelease = _bossrelease;}

◆ SetBossRelease() [2/2]

void TofEnergyCalibSvc::SetBossRelease ( const std::string &  _bossrelease)
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 51 of file Tof/TofEnergyCalibSvc/TofEnergyCalibSvc-00-00-01/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

51{m_bossRelease = _bossrelease;}

◆ setCalibConst() [1/2]

void TofEnergyCalibSvc::setCalibConst ( double  _CalibConst)
inline

Definition at line 59 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

59{m_CalibConst=_CalibConst;}

◆ setCalibConst() [2/2]

void TofEnergyCalibSvc::setCalibConst ( double  _CalibConst)
inline

Definition at line 59 of file Tof/TofEnergyCalibSvc/TofEnergyCalibSvc-00-00-01/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

59{m_CalibConst=_CalibConst;}

◆ SetIsData() [1/2]

void TofEnergyCalibSvc::SetIsData ( const std::string &  _IsData)
inlinevirtual

Implements ITofEnergyCalibSvc.

Definition at line 49 of file InstallArea/include/TofEnergyCalibSvc/TofEnergyCalibSvc/TofEnergyCalibSvc.h.

49{m_IsData = _IsData;}

◆ SetIsData() [2/2]

void TofEnergyCalibSvc::SetIsData ( const std::string &  _IsData)
inlinevirtual

◆ setPara1() [1/2]

void TofEnergyCalibSvc::setPara1 ( double  _Para1)
inline

◆ setPara1() [2/2]

void TofEnergyCalibSvc::setPara1 ( double  _Para1)
inline

◆ setPara2() [1/2]

void TofEnergyCalibSvc::setPara2 ( double  _Para2)
inline

◆ setPara2() [2/2]

void TofEnergyCalibSvc::setPara2 ( double  _Para2)
inline

◆ setPara3() [1/2]

void TofEnergyCalibSvc::setPara3 ( double  _Para3)
inline

◆ setPara3() [2/2]

void TofEnergyCalibSvc::setPara3 ( double  _Para3)
inline

◆ setPara4() [1/2]

void TofEnergyCalibSvc::setPara4 ( double  _Para4)
inline

◆ setPara4() [2/2]

void TofEnergyCalibSvc::setPara4 ( double  _Para4)
inline

◆ setPara5() [1/2]

void TofEnergyCalibSvc::setPara5 ( double  _Para5)
inline

◆ setPara5() [2/2]

void TofEnergyCalibSvc::setPara5 ( double  _Para5)
inline

Member Data Documentation

◆ m_dbsvc


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