BOSS 8.0.0
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 17 of file TofQCorrSvc.h.

Constructor & Destructor Documentation

◆ TofQCorrSvc()

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

Definition at line 33 of file TofQCorrSvc.cxx.

34 : base_class( name, svcloc ) {}

Referenced by TofQCorrSvc().

◆ ~TofQCorrSvc()

TofQCorrSvc::~TofQCorrSvc ( )

Definition at line 87 of file TofQCorrSvc.cxx.

87{}

Member Function Documentation

◆ BQRaw1()

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

Definition at line 185 of file TofQCorrSvc.cxx.

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

◆ BQRaw2()

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

Definition at line 203 of file TofQCorrSvc.cxx.

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

◆ EQRaw()

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

Definition at line 220 of file TofQCorrSvc.cxx.

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

◆ finalize()

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" << endmsg;
84 return StatusCode::SUCCESS;
85}

◆ getBarEast()

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

Definition at line 89 of file TofQCorrSvc.cxx.

89{ return m_Bar_East[layer][no]; }

◆ getBarWest()

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

Definition at line 91 of file TofQCorrSvc.cxx.

91{ return m_Bar_West[layer][no]; }

◆ getEndcap()

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

Definition at line 93 of file TofQCorrSvc.cxx.

93{ return m_Endcap[layer][no]; }

◆ getTofQCorrInfo()

void TofQCorrSvc::getTofQCorrInfo ( )

Definition at line 110 of file TofQCorrSvc.cxx.

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

Referenced by handle().

◆ handle()

void TofQCorrSvc::handle ( const Incident & inc)

Definition at line 95 of file TofQCorrSvc.cxx.

95 {
96 MsgStream log( msgSvc(), name() );
97 log << MSG::DEBUG << "handle: " << inc.type() << endmsg;
98
99 SmartDataPtr<Event::EventHeader> eventHeader( m_eventSvc, "/Event/EventHeader" );
100 int run = eventHeader->runNumber();
101 if ( run < 0 || run > 11000 ) return;
102
103 if ( inc.type() == "NewRun" )
104 {
105 log << MSG::DEBUG << "New Run:" << run << endmsg;
107 }
108}
void getTofQCorrInfo()

◆ initialize()

StatusCode TofQCorrSvc::initialize ( )
virtual

Definition at line 47 of file TofQCorrSvc.cxx.

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

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