BOSS 7.1.2
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 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)
 

Detailed Description

Definition at line 16 of file TofQCorrSvc.h.

Constructor & Destructor Documentation

◆ TofQCorrSvc()

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

Definition at line 31 of file TofQCorrSvc.cxx.

31 : base_class(name, svcloc) {
32}

◆ ~TofQCorrSvc()

TofQCorrSvc::~TofQCorrSvc ( )

Definition at line 89 of file TofQCorrSvc.cxx.

89 {
90}

Member Function Documentation

◆ BQRaw1()

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

Definition at line 188 of file TofQCorrSvc.cxx.

188 {
189 MsgStream log(msgSvc(), name());
190 double qraw = -999.0;
191 if( id<0 || id>175 ) {
192 log << MSG::WARNING << "BQRaw1 : TofId is out of range, tofid = " << id << endreq;
193 return qraw;
194 }
195 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
196 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
197 double a = m_Bar_East[id][2];
198 double b = m_Bar_East[id][1];
199 double c = m_Bar_East[id][0] - q/2.5;
200 qraw = ( sqrt( b*b - 4.0*a*c ) - b )/( 2.0*a );
201
202 return qraw;
203}
****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
IMessageSvc * msgSvc()
const double b
Definition slope.cxx:9

◆ BQRaw2()

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

Definition at line 206 of file TofQCorrSvc.cxx.

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

◆ EQRaw()

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

Definition at line 223 of file TofQCorrSvc.cxx.

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

◆ finalize()

StatusCode TofQCorrSvc::finalize ( )
virtual

Definition at line 82 of file TofQCorrSvc.cxx.

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

◆ getBarEast()

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

Definition at line 93 of file TofQCorrSvc.cxx.

93 {
94 return m_Bar_East[layer][no];
95}
const int no

◆ getBarWest()

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

Definition at line 98 of file TofQCorrSvc.cxx.

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

◆ getEndcap()

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

Definition at line 103 of file TofQCorrSvc.cxx.

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

◆ getTofQCorrInfo()

void TofQCorrSvc::getTofQCorrInfo ( )

Definition at line 123 of file TofQCorrSvc.cxx.

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

◆ handle()

void TofQCorrSvc::handle ( const Incident & inc)

Definition at line 108 of file TofQCorrSvc.cxx.

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

◆ initialize()

StatusCode TofQCorrSvc::initialize ( )
virtual

Definition at line 46 of file TofQCorrSvc.cxx.

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

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