BOSS 7.0.4
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 queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
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)
 
 TofQElecSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofQElecSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
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)
 
virtual const unsigned int Board (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Crate (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Fee (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Channel (bool barrel, int id, bool eastEnd)=0
 
virtual const double BQTC1 (int id, double q)=0
 
virtual const double BQTC2 (int id, double q)=0
 
virtual const double EQTC (int id, double q)=0
 
virtual const double BQChannel1 (int id, double q)=0
 
virtual const double BQChannel2 (int id, double q)=0
 
virtual const double EQChannel (int id, double q)=0
 
virtual const unsigned int Board (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Crate (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Fee (bool barrel, int id, bool eastEnd)=0
 
virtual const unsigned int Channel (bool barrel, int id, bool eastEnd)=0
 
virtual const double BQTC1 (int id, double q)=0
 
virtual const double BQTC2 (int id, double q)=0
 
virtual const double EQTC (int id, double q)=0
 
virtual const double BQChannel1 (int id, double q)=0
 
virtual const double BQChannel2 (int id, double q)=0
 
virtual const double EQChannel (int id, double q)=0
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ TofQElecSvc() [1/2]

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

Definition at line 22 of file TofQElecSvc.cxx.

22 : Service(name, svcloc) {
23 declareProperty("Run",m_run=1);
24}

◆ ~TofQElecSvc() [1/2]

TofQElecSvc::~TofQElecSvc ( )

Definition at line 76 of file TofQElecSvc.cxx.

76 {
77 delete m_data;
78 return;
79}

◆ TofQElecSvc() [2/2]

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

◆ ~TofQElecSvc() [2/2]

TofQElecSvc::~TofQElecSvc ( )

Member Function Documentation

◆ Board() [1/2]

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

Implements ITofQElecSvc.

Definition at line 151 of file TofQElecSvc.cxx.

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

◆ Board() [2/2]

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

Implements ITofQElecSvc.

◆ BQChannel1() [1/2]

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

Implements ITofQElecSvc.

Definition at line 361 of file TofQElecSvc.cxx.

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

◆ BQChannel1() [2/2]

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

Implements ITofQElecSvc.

◆ BQChannel2() [1/2]

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

Implements ITofQElecSvc.

Definition at line 385 of file TofQElecSvc.cxx.

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

◆ BQChannel2() [2/2]

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

Implements ITofQElecSvc.

◆ BQTC1() [1/2]

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

Implements ITofQElecSvc.

Definition at line 283 of file TofQElecSvc.cxx.

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

◆ BQTC1() [2/2]

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

Implements ITofQElecSvc.

◆ BQTC2() [1/2]

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

Implements ITofQElecSvc.

Definition at line 309 of file TofQElecSvc.cxx.

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

◆ BQTC2() [2/2]

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

Implements ITofQElecSvc.

◆ Channel() [1/2]

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

Implements ITofQElecSvc.

Definition at line 250 of file TofQElecSvc.cxx.

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

◆ Channel() [2/2]

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

Implements ITofQElecSvc.

◆ Crate() [1/2]

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

Implements ITofQElecSvc.

Definition at line 184 of file TofQElecSvc.cxx.

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

◆ Crate() [2/2]

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

Implements ITofQElecSvc.

◆ EQChannel() [1/2]

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

Implements ITofQElecSvc.

Definition at line 409 of file TofQElecSvc.cxx.

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

◆ EQChannel() [2/2]

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

Implements ITofQElecSvc.

◆ EQTC() [1/2]

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

Implements ITofQElecSvc.

Definition at line 335 of file TofQElecSvc.cxx.

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

◆ EQTC() [2/2]

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

Implements ITofQElecSvc.

◆ Fee() [1/2]

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

Implements ITofQElecSvc.

Definition at line 217 of file TofQElecSvc.cxx.

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

◆ Fee() [2/2]

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

Implements ITofQElecSvc.

◆ finalize() [1/2]

StatusCode TofQElecSvc::finalize ( )
virtual

Definition at line 69 of file TofQElecSvc.cxx.

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

◆ finalize() [2/2]

virtual StatusCode TofQElecSvc::finalize ( )
virtual

◆ handle() [1/2]

void TofQElecSvc::handle ( const Incident &  inc)

Definition at line 139 of file TofQElecSvc.cxx.

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

◆ handle() [2/2]

void TofQElecSvc::handle ( const Incident &  )

◆ initialize() [1/2]

StatusCode TofQElecSvc::initialize ( )
virtual

Definition at line 37 of file TofQElecSvc.cxx.

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

◆ initialize() [2/2]

virtual StatusCode TofQElecSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

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

Definition at line 27 of file TofQElecSvc.cxx.

27 {
28
29 if ( IID_ITofQElecSvc.versionMatch(riid) ) {
30 *ppvInterface = static_cast<ITofQElecSvc*> (this);
31 } else {
32 return Service::queryInterface(riid, ppvInterface) ;
33 }
34 return StatusCode::SUCCESS;
35}

◆ queryInterface() [2/2]

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

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