BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TofQCorrSvc Class Reference

#include <TofQCorrSvc.h>

+ Inheritance diagram for TofQCorrSvc:

Public Member Functions

 TofQCorrSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofQCorrSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void getTofQCorrInfo ()
 
const double getBarEast (int layer, int no)
 
const double getBarWest (int layer, int no)
 
const double getEndcap (int layer, int no)
 
const double BQRaw1 (int id, double q)
 
const double BQRaw2 (int id, double q)
 
const double EQRaw (int id, double q)
 
 TofQCorrSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofQCorrSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
void getTofQCorrInfo ()
 
const double getBarEast (int layer, int no)
 
const double getBarWest (int layer, int no)
 
const double getEndcap (int layer, int no)
 
const double BQRaw1 (int id, double q)
 
const double BQRaw2 (int id, double q)
 
const double EQRaw (int id, double q)
 
virtual const double getBarEast (int layer, int no)=0
 
virtual const double getBarWest (int layer, int no)=0
 
virtual const double getEndcap (int layer, int no)=0
 
virtual const double BQRaw1 (int id, double q)=0
 
virtual const double BQRaw2 (int id, double q)=0
 
virtual const double EQRaw (int id, double q)=0
 
virtual const double getBarEast (int layer, int no)=0
 
virtual const double getBarWest (int layer, int no)=0
 
virtual const double getEndcap (int layer, int no)=0
 
virtual const double BQRaw1 (int id, double q)=0
 
virtual const double BQRaw2 (int id, double q)=0
 
virtual const double EQRaw (int id, double q)=0
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ TofQCorrSvc() [1/2]

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

Definition at line 30 of file TofQCorrSvc.cxx.

30 : Service(name, svcloc) {
31}

◆ ~TofQCorrSvc() [1/2]

TofQCorrSvc::~TofQCorrSvc ( )

Definition at line 88 of file TofQCorrSvc.cxx.

88 {
89}

◆ TofQCorrSvc() [2/2]

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

◆ ~TofQCorrSvc() [2/2]

TofQCorrSvc::~TofQCorrSvc ( )

Member Function Documentation

◆ BQRaw1() [1/2]

const double TofQCorrSvc::BQRaw1 ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

Definition at line 187 of file TofQCorrSvc.cxx.

187 {
188 MsgStream log(msgSvc(), name());
189 double qraw = -999.0;
190 if( id<0 || id>175 ) {
191 log << MSG::WARNING << "BQRaw1 : TofId is out of range, tofid = " << id << endreq;
192 return qraw;
193 }
194 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
195 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
196 double a = m_Bar_East[id][2];
197 double b = m_Bar_East[id][1];
198 double c = m_Bar_East[id][0] - q/2.5;
199 qraw = ( sqrt( b*b - 4.0*a*c ) - b )/( 2.0*a );
200
201 return qraw;
202}
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition: KKsem.h:33

◆ BQRaw1() [2/2]

const double TofQCorrSvc::BQRaw1 ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

◆ BQRaw2() [1/2]

const double TofQCorrSvc::BQRaw2 ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

Definition at line 205 of file TofQCorrSvc.cxx.

205 {
206 MsgStream log(msgSvc(), name());
207 double qraw = -999.0;
208 if( id<0 || id>175 ) {
209 log << MSG::WARNING << "BQRaw2 : TofId is out of range, tofid = " << id << endreq;
210 return qraw;
211 }
212 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
213 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
214 double a = m_Bar_West[id][2];
215 double b = m_Bar_West[id][1];
216 double c = m_Bar_West[id][0] - q/2.5;
217 qraw = ( sqrt( b*b - 4.0*a*c ) - b )/( 2.0*a );
218 return qraw;
219}

◆ BQRaw2() [2/2]

const double TofQCorrSvc::BQRaw2 ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

◆ EQRaw() [1/2]

const double TofQCorrSvc::EQRaw ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

Definition at line 222 of file TofQCorrSvc.cxx.

222 {
223 MsgStream log(msgSvc(), name());
224 double qraw = -999.0;
225 if( id<0 || id>95 ) {
226 log << MSG::WARNING << "EQRaw : TofId is out of range, tofid = " << id << endreq;
227 return qraw;
228 }
229 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
230 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
231 double a = m_Endcap[id][2];
232 double b = m_Endcap[id][1];
233 double c = m_Endcap[id][0] - q/2.5;
234 qraw = ( sqrt( b*b - 4.0*a*c ) - b )/( 2.0*a );
235 return qraw;
236}

◆ EQRaw() [2/2]

const double TofQCorrSvc::EQRaw ( int  id,
double  q 
)
virtual

Implements ITofQCorrSvc.

◆ finalize() [1/2]

StatusCode TofQCorrSvc::finalize ( )
virtual

Definition at line 81 of file TofQCorrSvc.cxx.

81 {
82 MsgStream log(msgSvc(), name());
83 log << MSG::INFO << name() << ": End of Run" << endreq;
84 return StatusCode::SUCCESS;
85}

◆ finalize() [2/2]

virtual StatusCode TofQCorrSvc::finalize ( )
virtual

◆ getBarEast() [1/2]

const double TofQCorrSvc::getBarEast ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

Definition at line 92 of file TofQCorrSvc.cxx.

92 {
93 return m_Bar_East[layer][no];
94}

◆ getBarEast() [2/2]

const double TofQCorrSvc::getBarEast ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

◆ getBarWest() [1/2]

const double TofQCorrSvc::getBarWest ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

Definition at line 97 of file TofQCorrSvc.cxx.

97 {
98 return m_Bar_West[layer][no];
99}

◆ getBarWest() [2/2]

const double TofQCorrSvc::getBarWest ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

◆ getEndcap() [1/2]

const double TofQCorrSvc::getEndcap ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

Definition at line 102 of file TofQCorrSvc.cxx.

102 {
103 return m_Endcap[layer][no];
104}

◆ getEndcap() [2/2]

const double TofQCorrSvc::getEndcap ( int  layer,
int  no 
)
virtual

Implements ITofQCorrSvc.

◆ getTofQCorrInfo() [1/2]

void TofQCorrSvc::getTofQCorrInfo ( )

Definition at line 122 of file TofQCorrSvc.cxx.

122 {
123 MsgStream log(messageService(), name());
124 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
125 int run = eventHeader->runNumber();
126 if(run<0){
127 log << MSG::INFO << "This data is the MC sample with the Run Number: " << run << endreq;
128 run=-run;
129 }
130 // unsigned long *lengths;
131 char stmt1[200];
132 sprintf(stmt1,"select TOFCalib "
133 "from RunParams where run_number = %d", run);
134
136 int row_no = m_dbsvc->query("run",stmt1,res);
137 if(!row_no){
138 log << MSG::ERROR<<"search errror"<<endreq;
139 exit(1);
140 }
141 long int runNo;
142 DatabaseRecord* records1 = res[0];
143 sscanf((*records1)["TOFCalib"], "%ld", &runNo);
144
145 char stmt2[200];
146 sprintf(stmt2,"select be,end,counter,a1,a2,a3 "
147 "from TOF_Q where run_number = %ld", runNo);
148
149 res.clear();
150 row_no = m_dbsvc->query("run",stmt2,res);
151 if(!row_no){
152 log << MSG::ERROR<<"search errror"<<endreq;
153 exit(1);
154 }
155
156 long int be,end,counter;
157 double sql_result[3];
158
159 for(int jjj=0;jjj<row_no;jjj++){
160 DatabaseRecord* records2 = res[jjj];
161 sscanf((*records2)["be"], "%ld", &be);
162 sscanf((*records2)["end"], "%ld", &end);
163 sscanf((*records2)["counter"], "%ld", &counter);
164 sscanf((*records2)["a1"], "%lf", &sql_result[0]);
165 sscanf((*records2)["a2"], "%lf", &sql_result[1]);
166 sscanf((*records2)["a3"], "%lf", &sql_result[2]);
167 if(be==0&&end==0){
168 m_Endcap[counter][0]=sql_result[0];
169 m_Endcap[counter][1]=sql_result[1];
170 m_Endcap[counter][2]=sql_result[2];
171 }
172 if(be==1&&end==0){
173 m_Bar_East[counter][0]=sql_result[0];
174 m_Bar_East[counter][1]=sql_result[1];
175 m_Bar_East[counter][2]=sql_result[2];
176 }
177 if(be==1&&end==1){
178 m_Bar_West[counter][0]=sql_result[0];
179 m_Bar_West[counter][1]=sql_result[1];
180 m_Bar_West[counter][2]=sql_result[2];
181 }
182}
183res.clear();
184}
int runNo
Definition: DQA_TO_DB.cxx:12
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0

Referenced by handle().

◆ getTofQCorrInfo() [2/2]

void TofQCorrSvc::getTofQCorrInfo ( )

◆ handle() [1/2]

void TofQCorrSvc::handle ( const Incident &  inc)

Definition at line 107 of file TofQCorrSvc.cxx.

107 {
108 MsgStream log( messageService(), name() );
109 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
110
111 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
112 int run = eventHeader->runNumber();
113 if( run<0 || run>11000 ) return;
114
115 if ( inc.type() == "NewRun" ){
116 log << MSG::DEBUG << "New Run:" << run << endreq;
118 }
119}
void getTofQCorrInfo()

◆ handle() [2/2]

void TofQCorrSvc::handle ( const Incident &  )

◆ initialize() [1/2]

StatusCode TofQCorrSvc::initialize ( )
virtual

Definition at line 45 of file TofQCorrSvc.cxx.

45 {
46
47 MsgStream log(msgSvc(), name());
48 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
49
50 StatusCode sc = Service::initialize();
51 if ( sc.isFailure() ) return sc;
52
53 IIncidentSvc* incsvc;
54 sc = service("IncidentSvc", incsvc);
55 int priority = 100;
56 if( sc.isSuccess() ){
57 incsvc -> addListener(this, "NewRun", priority);
58 }
59
60 sc = serviceLocator()->service("DatabaseSvc",m_dbsvc,true);
61 if (sc .isFailure() ) {
62 log << MSG::ERROR << "Unable to find DatabaseSvc " << endreq;
63 return sc;
64 }
65
66
67 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
68 if (sc .isFailure() ) {
69 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
70 return sc;
71 }
72
73 StatusCode scc;
74 log<<MSG::INFO << "setProperties()" << endreq;
75 scc = setProperties();
76 m_runNo=0;
77 return sc;
78}

◆ initialize() [2/2]

virtual StatusCode TofQCorrSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

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

Definition at line 34 of file TofQCorrSvc.cxx.

34 {
35
36 if ( IID_ITofQCorrSvc.versionMatch(riid) ) {
37 *ppvInterface = static_cast<ITofQCorrSvc*> (this);
38 } else {
39 return Service::queryInterface(riid, ppvInterface) ;
40 }
41 return StatusCode::SUCCESS;
42}

◆ queryInterface() [2/2]

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

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