BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
TofQElecSvc Class Reference

#include <TofQElecSvc.h>

+ Inheritance diagram for TofQElecSvc:

Public Member Functions

 TofQElecSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofQElecSvc ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
const unsigned int Board (bool barrel, int id, bool eastEnd)
 
const unsigned int Crate (bool barrel, int id, bool eastEnd)
 
const unsigned int Fee (bool barrel, int id, bool eastEnd)
 
const unsigned int Channel (bool barrel, int id, bool eastEnd)
 
const double BQTC1 (int id, double q)
 
const double BQTC2 (int id, double q)
 
const double EQTC (int id, double q)
 
const double BQChannel1 (int id, double qtc)
 
const double BQChannel2 (int id, double qtc)
 
const double EQChannel (int id, double qtc)
 

Detailed Description

Definition at line 17 of file TofQElecSvc.h.

Constructor & Destructor Documentation

◆ TofQElecSvc()

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

Definition at line 24 of file TofQElecSvc.cxx.

24 : base_class(name, svcloc) {
25 declareProperty("Run",m_run=1);
26}

◆ ~TofQElecSvc()

TofQElecSvc::~TofQElecSvc ( )

Definition at line 78 of file TofQElecSvc.cxx.

78 {
79 delete m_data;
80 return;
81}

Member Function Documentation

◆ Board()

const unsigned int TofQElecSvc::Board ( bool barrel,
int id,
bool eastEnd )

Definition at line 153 of file TofQElecSvc.cxx.

153 {
154 MsgStream log(msgSvc(), name());
155
156 if( barrel ) {
157 if( id<0 || id>175 ) {
158 log << MSG::WARNING <<"Board : TofId is out of Range, tofid=" << id << endreq;
159 return 1000;
160 }
161 }
162 else {
163 if( id<0 || id>95 ) {
164 log << MSG::WARNING <<"Board : TofId is out of Range, tofid=" << id << endreq;
165 return 1000;
166 }
167 }
168
169 unsigned int board;
170 if( barrel ) {
171 if( eastEnd ) {
172 board = (m_data->getBTof(id)).getNumEast(0);
173 }
174 else {
175 board = (m_data->getBTof(id)).getNumWest(0);
176 }
177 }
178 else {
179 board = (m_data->getETof(id)).getNum(0);
180 }
181
182 return board;
183}
IMessageSvc * msgSvc()
EndcapElec getETof(int cnt) const
BarrelElec getBTof(int cnt) const

◆ BQChannel1()

const double TofQElecSvc::BQChannel1 ( int id,
double qtc )

Definition at line 363 of file TofQElecSvc.cxx.

363 {
364 double qChannel = -999.0;
365 MsgStream log(msgSvc(), name());
366 if( id<0 || id>175 ) {
367 log << MSG::ERROR <<"BChannel1 : TofId is out of Range, tofid=" << id << endreq;
368 return qChannel;
369 }
370
371 double ratio = (m_data->getBTof(id)).getSimP1(0);
372 double p[10];
373 for(unsigned int i=0; i<10; i++ ) {
374 p[i] = (m_data->getBTof(id)).getSimP1(i+1);
375 }
376 qChannel = ( p[0] + p[1]*qtc + p[2]*qtc*qtc + p[3]*qtc*qtc*qtc )*( 1.0 - TMath::Erf((qtc-p[4])/p[5]) ) + ( p[6] + p[7]*qtc )*( 1.0 + TMath::Erf((qtc-p[8])/p[9]) );
377 qChannel = ratio*qChannel;
378
379 // cout << "Sim East tofid=" << id << " ratio=" << ratio;
380 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
381 // cout << endl;
382
383 return qChannel;
384}

◆ BQChannel2()

const double TofQElecSvc::BQChannel2 ( int id,
double qtc )

Definition at line 387 of file TofQElecSvc.cxx.

387 {
388 double qChannel = -999.0;
389 MsgStream log(msgSvc(), name());
390 if( id<0 || id>175 ) {
391 log << MSG::ERROR <<"BChannel2 : TofId is out of Range, tofid=" << id << endreq;
392 return qChannel;
393 }
394
395 double ratio = (m_data->getBTof(id)).getSimP2(0);
396 double p[10];
397 for(unsigned int i=0; i<10; i++ ) {
398 p[i] = (m_data->getBTof(id)).getSimP2(i+1);
399 }
400 qChannel = ( p[0] + p[1]*qtc + p[2]*qtc*qtc + p[3]*qtc*qtc*qtc )*( 1.0 - TMath::Erf((qtc-p[4])/p[5]) ) + ( p[6] + p[7]*qtc )*( 1.0 + TMath::Erf((qtc-p[8])/p[9]) );
401 qChannel = ratio*qChannel;
402
403 // cout << "Sim West tofid=" << id << " ratio=" << ratio;
404 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
405 // cout << endl;
406
407 return qChannel;
408}

◆ BQTC1()

const double TofQElecSvc::BQTC1 ( int id,
double q )

Definition at line 285 of file TofQElecSvc.cxx.

285 {
286 double qtcNew = -999.0;
287 MsgStream log(msgSvc(), name());
288 if( id<0 || id>175 ) {
289 log << MSG::WARNING <<"BQTC1 : TofId is out of Range, tofid=" << id << endreq;
290 return qtcNew;
291 }
292 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
293 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
294
295 double ratio = (m_data->getBTof(id)).getP1(0);
296 double p[10];
297 for(unsigned int i=0; i<10; i++ ) {
298 p[i] = (m_data->getBTof(id)).getP1(i+1);
299 }
300 q = q*ratio;
301 qtcNew = p[0] + p[1]*q + p[2]*q*q + p[3]*q*q*q + p[4]*q*q*q*q + p[7]*exp(p[5]*(q-p[6]));
302
303 // cout << "East tofid=" << id << " ratio=" << ratio;
304 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
305 // cout << endl;
306
307 return qtcNew;
308}
EvtComplex exp(const EvtComplex &c)
****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

◆ BQTC2()

const double TofQElecSvc::BQTC2 ( int id,
double q )

Definition at line 311 of file TofQElecSvc.cxx.

311 {
312 double qtcNew = -999.0;
313 MsgStream log(msgSvc(), name());
314 if( id<0 || id>175 ) {
315 log << MSG::WARNING <<"BQTC2 : TofId is out of Range, tofid=" << id << endreq;
316 return qtcNew;
317 }
318 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
319 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
320
321 double ratio = (m_data->getBTof(id)).getP2(0);
322 double p[10];
323 for(unsigned int i=0; i<10; i++ ) {
324 p[i] = (m_data->getBTof(id)).getP2(i+1);
325 }
326 q = q*ratio;
327 qtcNew = p[0] + p[1]*q + p[2]*q*q + p[3]*q*q*q + p[4]*q*q*q*q + p[7]*exp(p[5]*(q-p[6]));
328
329 // cout << "West tofid=" << id << " ratio=" << ratio;
330 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
331 // cout << endl;
332
333 return qtcNew;
334}

◆ Channel()

const unsigned int TofQElecSvc::Channel ( bool barrel,
int id,
bool eastEnd )

Definition at line 252 of file TofQElecSvc.cxx.

252 {
253 MsgStream log(msgSvc(), name());
254
255 if( barrel ) {
256 if( id<0 || id>175 ) {
257 log << MSG::WARNING <<"Channel : TofId is out of Range, tofid=" << id << endreq;
258 return 1000;
259 }
260 }
261 else {
262 if( id<0 || id>95 ) {
263 log << MSG::WARNING <<"Channel : TofId is out of Range, tofid=" << id << endreq;
264 return 1000;
265 }
266 }
267
268 unsigned int channel;
269 if( barrel ) {
270 if( eastEnd ) {
271 channel = (m_data->getBTof(id)).getNumEast(1);
272 }
273 else {
274 channel = (m_data->getBTof(id)).getNumWest(1);
275 }
276 }
277 else {
278 channel = (m_data->getETof(id)).getNum(1);
279 }
280
281 return channel;
282}

◆ Crate()

const unsigned int TofQElecSvc::Crate ( bool barrel,
int id,
bool eastEnd )

Definition at line 186 of file TofQElecSvc.cxx.

186 {
187 MsgStream log(msgSvc(), name());
188
189 if( barrel ) {
190 if( id<0 || id>175 ) {
191 log << MSG::WARNING <<"Crate : TofId is out of Range, tofid=" << id << endreq;
192 return 1000;
193 }
194 }
195 else {
196 if( id<0 || id>95 ) {
197 log << MSG::WARNING <<"Crate : TofId is out of Range, tofid=" << id << endreq;
198 return 1000;
199 }
200 }
201
202 unsigned int crate;
203 if( barrel ) {
204 if( eastEnd ) {
205 crate = (m_data->getBTof(id)).getNumEast(2);
206 }
207 else {
208 crate = (m_data->getBTof(id)).getNumWest(2);
209 }
210 }
211 else {
212 crate = (m_data->getETof(id)).getNum(2);
213 }
214
215 return crate;
216}

◆ EQChannel()

const double TofQElecSvc::EQChannel ( int id,
double qtc )

Definition at line 411 of file TofQElecSvc.cxx.

411 {
412 double qChannel = -999.0;
413 MsgStream log(msgSvc(), name());
414 if( id<0 || id>95 ) {
415 log << MSG::ERROR <<"EQTC : TofId is out of Range, tofid=" << id << endreq;
416 return qChannel;
417 }
418
419 double ratio = (m_data->getETof(id)).getSimP(0);
420 double p[10];
421 for(unsigned int i=0; i<10; i++ ) {
422 p[i] = (m_data->getETof(id)).getSimP(i+1);
423 }
424 qChannel = ( p[0] + p[1]*qtc + p[2]*qtc*qtc + p[3]*qtc*qtc*qtc )*( 1.0 - TMath::Erf((qtc-p[4])/p[5]) ) + ( p[6] + p[7]*qtc )*( 1.0 + TMath::Erf((qtc-p[8])/p[9]) );
425 qChannel = ratio*qChannel;
426
427 // cout << "Endcap tofid=" << id << " ratio=" << ratio;
428 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
429 // cout << endl;
430
431 return qChannel;
432}

◆ EQTC()

const double TofQElecSvc::EQTC ( int id,
double q )

Definition at line 337 of file TofQElecSvc.cxx.

337 {
338 double qtcNew = -999.0;
339 MsgStream log(msgSvc(), name());
340 if( id<0 || id>95 ) {
341 log << MSG::WARNING <<"EQTC : TofId is out of Range, tofid=" << id << endreq;
342 return qtcNew;
343 }
344 if( fabs(q-10000.0)<1.0e-6 ) { return 10000.0; }
345 else if( fabs(q+999.0)<1.0e-6 ) { return -999.0; }
346
347 double ratio = (m_data->getETof(id)).getP(0);
348 double p[10];
349 for(unsigned int i=0; i<10; i++ ) {
350 p[i] = (m_data->getETof(id)).getP(i+1);
351 }
352 q = q*ratio;
353 qtcNew = p[0] + p[1]*q + p[2]*q*q + p[3]*q*q*q + p[4]*q*q*q*q + p[7]*exp(p[5]*(q-p[6]));
354
355 // cout << "Endcap tofid=" << id << " ratio=" << ratio;
356 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
357 // cout << endl;
358
359 return qtcNew;
360}

◆ Fee()

const unsigned int TofQElecSvc::Fee ( bool barrel,
int id,
bool eastEnd )

Definition at line 219 of file TofQElecSvc.cxx.

219 {
220 MsgStream log(msgSvc(), name());
221
222 if( barrel ) {
223 if( id<0 || id>175 ) {
224 log << MSG::WARNING <<"Fee : TofId is out of Range, tofid=" << id << endreq;
225 return 1000;
226 }
227 }
228 else {
229 if( id<0 || id>95 ) {
230 log << MSG::WARNING <<"Fee : TofId is out of Range, tofid=" << id << endreq;
231 return 1000;
232 }
233 }
234
235 unsigned int crate;
236 if( barrel ) {
237 if( eastEnd ) {
238 crate = (m_data->getBTof(id)).getNumEast(3);
239 }
240 else {
241 crate = (m_data->getBTof(id)).getNumWest(3);
242 }
243 }
244 else {
245 crate = (m_data->getETof(id)).getNum(3);
246 }
247
248 return crate;
249}

◆ finalize()

StatusCode TofQElecSvc::finalize ( )
virtual

Definition at line 71 of file TofQElecSvc.cxx.

71 {
72 MsgStream log(msgSvc(), name());
73 log << MSG::INFO << name() << ": End of Run" << endreq;
74 return StatusCode::SUCCESS;
75}

◆ handle()

void TofQElecSvc::handle ( const Incident & inc)

Definition at line 141 of file TofQElecSvc.cxx.

141 {
142 MsgStream log( messageService(), name() );
143 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
144
145 if ( inc.type() == "NewRun" ){
146 log << MSG::DEBUG << "New Run" << endreq;
147 StatusCode sc= FillfromDatabase();
148 }
149 return;
150}

◆ initialize()

StatusCode TofQElecSvc::initialize ( )
virtual

Definition at line 39 of file TofQElecSvc.cxx.

39 {
40 m_hasbeeninitialized=false;
41
42 MsgStream log(msgSvc(), name());
43 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
44
45 StatusCode sc = Service::initialize();
46 if ( sc.isFailure() ) return sc;
47
48 IIncidentSvc* incsvc;
49 sc = service("IncidentSvc", incsvc);
50 int priority = 100;
51 if( sc.isSuccess() ){
52 incsvc -> addListener(this, "NewRun", priority);
53 }
54
55 StatusCode scc;
56
57 log<<MSG::INFO << "setProperties()" << endreq;
58 scc = service("CalibDataSvc", m_pCalibDataSvc, true);
59 if ( !scc.isSuccess() ) {
60 log<<MSG::ERROR<<"Could not get IDataProviderSvc interface of QElecXmlCnvSvc"<<endreq;
61 return scc;
62 } else {
63 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of QElecXmlCnvSvc"<<endreq;
64 }
65 // Get properties from the JobOptionsSvc
66 scc = setProperties();
67 m_data=0;
68 return sc;
69}

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