BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCalibFunSvc Class Reference

#include <MdcCalibFunSvc.h>

Inheritance diagram for MdcCalibFunSvc:

Public Member Functions

 MdcCalibFunSvc (const std::string &name, ISvcLocator *svcloc)
 ~MdcCalibFunSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void handle (const Incident &)
double getVprop (int lay) const
double getTprop (int lay, double z) const
double driftTimeToDist (double drifttime, int layid, int cellid, int lr, double entrance=0.0) const
double distToDriftTime (double dist, int layid, int cellid, int lr, double entrance=0.0) const
double getSigma (int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getSigmaLR (int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getSigma1 (int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getSigma2 (int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getF (int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getSigmaToT (int layid, int lr, double tdr, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getSigmaToTLR (int layid, int lr, double tdr, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
void setXtBegin ()
int getNextXtpar (int &key, double &par)
void getXtpar (int layid, int entr, int lr, double par[]) const
bool getNewXtpar ()
TTree * getNewXtparTree (int layid, int entr, int lr) const
double getT0 (int layid, int cellid) const
double getT0 (int wireid) const
double getDelT0 (int wireid) const
double getTimeWalk (int layid, double Q) const
double getQtpar (int layid, int ord) const
double getWireEff (int layid, int cellid) const
double getWireEff (int wireid) const
void setSdBegin ()
int getNextSdpar (int &key, double &par)
void getSdpar (int layid, int entr, int lr, double par[]) const
bool getR2tpar ()
TTree * getR2tTree (int layid) const
int getXtEntrIndex (double entrance) const
int getSdEntrIndex (double entrance) const

Public Attributes

int m_run

Detailed Description

Definition at line 21 of file MdcCalibFunSvc.h.

Constructor & Destructor Documentation

◆ MdcCalibFunSvc()

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

Definition at line 34 of file MdcCalibFunSvc.cxx.

35 : base_class( name, svcloc ), m_layInfSig( -1 ) {
36
37 // declare properties
38 declareProperty( "CheckConst", m_checkConst = false );
39 declareProperty( "LayerInfSig", m_layInfSig );
40 declareProperty( "XtMode", m_xtMode = 1 );
41 declareProperty( "NewXtFile", m_xtfile );
42 declareProperty( "ReadWireEffDb", m_readWireEffDb = true );
43 declareProperty( "WireEffFile", m_wireEffFile );
44 declareProperty( "LinearXT", m_linearXT = false );
45 declareProperty( "FixSigma", m_fixSigma = false );
46 declareProperty( "FixSigmaValue", m_fixSigmaValue = 130.0 ); // micron
47 m_outputXtMode = true;
48}

Referenced by MdcCalibFunSvc().

◆ ~MdcCalibFunSvc()

MdcCalibFunSvc::~MdcCalibFunSvc ( )

Definition at line 50 of file MdcCalibFunSvc.cxx.

50{}

Member Function Documentation

◆ distToDriftTime()

double MdcCalibFunSvc::distToDriftTime ( double dist,
int layid,
int cellid,
int lr,
double entrance = 0.0 ) const

Definition at line 210 of file MdcCalibFunSvc.cxx.

211 {
212 int i = 0;
213 double time;
214 int ord;
215 double xtpar[8];
216 double dxdtpar[5];
217 double x;
218 double dxdt;
219 double deltax;
220
221 int entr = getXtEntrIndex( entrance );
222 getXtpar( layid, entr, lr, xtpar );
223
224 double tm1 = xtpar[6];
225 double tm2 = 2000.0;
226 double dm1 = driftTimeToDist( tm1, layid, cellid, lr, entrance );
227 double dm2 = driftTimeToDist( tm2, layid, cellid, lr, entrance );
228
229 if ( dist < 0 )
230 {
231 cout << "Warning in MdcCalibFunSvc: driftDist < 0" << endl;
232 time = 0.0;
233 }
234 else if ( dist < xtpar[0] ) { time = 0.0; }
235 else if ( dist < dm1 )
236 {
237 for ( ord = 0; ord < 5; ord++ ) { dxdtpar[ord] = (double)( ord + 1 ) * xtpar[ord + 1]; }
238 time = dist / 0.03;
239 while ( 1 )
240 {
241 if ( i > 50 )
242 {
243 cout << "Warning in MdcCalibFunSvc: "
244 << "can not get the exact value in the dist-to-time conversion." << endl;
245 time = dist / 0.03;
246 break;
247 }
248
249 x = 0.0;
250 for ( ord = 0; ord < 6; ord++ ) x += xtpar[ord] * pow( time, ord );
251
252 deltax = x - dist;
253 if ( fabs( deltax ) < 0.001 ) { break; }
254
255 dxdt = 0.0;
256 for ( ord = 0; ord < 5; ord++ ) dxdt += dxdtpar[ord] * pow( time, ord );
257
258 time = time - ( deltax / dxdt );
259 i++;
260 }
261 }
262 else if ( dist < dm2 ) { time = ( dist - dm1 ) * ( tm2 - tm1 ) / ( dm2 - dm1 ) + tm1; }
263 else { time = tm2; }
264
265 if ( m_linearXT ) time = dist / 0.03;
266 return time;
267}
Double_t x[10]
Double_t time
double driftTimeToDist(double drifttime, int layid, int cellid, int lr, double entrance=0.0) const
void getXtpar(int layid, int entr, int lr, double par[]) const
int getXtEntrIndex(double entrance) const

◆ driftTimeToDist()

double MdcCalibFunSvc::driftTimeToDist ( double drifttime,
int layid,
int cellid,
int lr,
double entrance = 0.0 ) const

Definition at line 142 of file MdcCalibFunSvc.cxx.

143 {
144 double dist;
145 if ( 0 == m_xtMode ) { dist = t2dPoly( drifttime, layid, cellid, lr, entrance ); }
146 else
147 {
148 if ( ( 0 == lr ) || ( 1 == lr ) )
149 dist = t2dInter( drifttime, layid, cellid, lr, entrance );
150 else
151 {
152 double dl = t2dInter( drifttime, layid, cellid, lr, entrance );
153 double dr = t2dInter( drifttime, layid, cellid, lr, entrance );
154 dist = ( dl + dr ) * 0.5;
155 }
156 }
157 // cout << setw(15) << drifttime << setw(15) << dist << endl;
158 if ( m_linearXT ) dist = 0.03 * drifttime;
159 return dist;
160}

Referenced by distToDriftTime().

◆ finalize()

StatusCode MdcCalibFunSvc::finalize ( )
virtual

Definition at line 100 of file MdcCalibFunSvc.cxx.

100 {
101 MsgStream log( msgSvc(), name() );
102 log << MSG::INFO << "MdcCalibFunSvc::finalize()" << endmsg;
103
104 m_xtmap.clear();
105 m_t0.clear();
106 m_delt0.clear();
107 m_qtpar0.clear();
108 m_qtpar1.clear();
109 m_sdmap.clear();
110
111 return StatusCode::SUCCESS;
112}
IMessageSvc * msgSvc()

◆ getDelT0()

double MdcCalibFunSvc::getDelT0 ( int wireid) const
inline

Definition at line 80 of file MdcCalibFunSvc.h.

80{ return m_delt0[wireid]; }

◆ getF()

double MdcCalibFunSvc::getF ( int layid,
int lr,
double dist,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 342 of file MdcCalibFunSvc.cxx.

343 {
344
345 return 1.0;
346}

◆ getNewXtpar()

bool MdcCalibFunSvc::getNewXtpar ( )

Definition at line 413 of file MdcCalibFunSvc.cxx.

413 {
414 MsgStream log( msgSvc(), name() );
415 log << MSG::INFO << "read calib const from TCDS" << endmsg;
416
417 for ( int layid = 0; layid < NLAYER; layid++ )
418 {
419 for ( int entr = 0; entr < NXTENTR; entr++ )
420 {
421 for ( int lr = 0; lr < 2; lr++ )
422 {
423 double br_t, br_d;
424 TTree* newXtTree = getNewXtparTree( layid, entr, lr );
425 if ( !newXtTree ) return false;
426 newXtTree->SetBranchAddress( "t", &br_t );
427 newXtTree->SetBranchAddress( "d", &br_d );
428 int nEntries = newXtTree->GetEntries();
429 if ( ( nEntries < 10 ) || ( nEntries >= 200 ) )
430 {
431 log << MSG::ERROR << "wrong X-T constants: layer " << layid << ", iEntr " << entr
432 << ", lr " << lr << endmsg;
433 return false;
434 }
435 m_nNewXt[layid][entr][lr] = nEntries;
436 for ( int i = 0; i < nEntries; i++ )
437 {
438 newXtTree->GetEntry( i );
439 m_vt[layid][entr][lr][i] = br_t;
440 m_vd[layid][entr][lr][i] = br_d;
441 } // end loop entries
442 } // end lr
443 } // end entr
444 } // end layid
445
446 return true;
447}
TTree * getNewXtparTree(int layid, int entr, int lr) const

◆ getNewXtparTree()

TTree * MdcCalibFunSvc::getNewXtparTree ( int layid,
int entr,
int lr ) const

Definition at line 449 of file MdcCalibFunSvc.cxx.

449 {
450 MsgStream log( msgSvc(), name() );
451 string fullPath = "/Calib/MdcCal";
452 SmartDataPtr<CalibData::MdcCalibData> calConst( m_pCalDataSvc, fullPath );
453 if ( !calConst )
454 {
455 log << MSG::ERROR << "can not get MdcCalibConst via SmartPtr" << endmsg;
456 return NULL;
457 }
458
459 TTree* newXtTree = calConst->getNewXtpar( layid, entr, lr );
460 return newXtTree;
461}

Referenced by getNewXtpar().

◆ getNextSdpar()

int MdcCalibFunSvc::getNextSdpar ( int & key,
double & par )

Definition at line 564 of file MdcCalibFunSvc.cxx.

564 {
565 if ( m_sditer != m_sdmap.end() )
566 {
567 key = ( *m_sditer ).first;
568 par = ( *m_sditer ).second;
569 m_sditer++;
570 return 1;
571 }
572 else return 0;
573}
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition Taupair.h:42

◆ getNextXtpar()

int MdcCalibFunSvc::getNextXtpar ( int & key,
double & par )

Definition at line 393 of file MdcCalibFunSvc.cxx.

393 {
394 if ( m_xtiter != m_xtmap.end() )
395 {
396 key = ( *m_xtiter ).first;
397 par = ( *m_xtiter ).second;
398 m_xtiter++;
399 return 1;
400 }
401 else return 0;
402}

◆ getQtpar()

double MdcCalibFunSvc::getQtpar ( int layid,
int ord ) const

Definition at line 544 of file MdcCalibFunSvc.cxx.

544 {
545 if ( 0 == ord ) return m_qtpar0[layid];
546 else if ( 1 == ord ) return m_qtpar1[layid];
547 else
548 {
549 cout << "wrong order number" << endl;
550 return 0.0;
551 }
552}

Referenced by getTimeWalk().

◆ getR2tpar()

bool MdcCalibFunSvc::getR2tpar ( )

Definition at line 463 of file MdcCalibFunSvc.cxx.

463 {
464 for ( int layid = 0; layid < NLAYER; layid++ )
465 {
466 int br_iEntr, br_lr;
467 double br_s, br_t;
468 TTree* r2tTree = getR2tTree( layid );
469 if ( !r2tTree ) return false;
470 r2tTree->SetBranchAddress( "iEntr", &br_iEntr );
471 r2tTree->SetBranchAddress( "lr", &br_lr );
472 r2tTree->SetBranchAddress( "s", &br_s );
473 r2tTree->SetBranchAddress( "t", &br_t );
474 int nEntries = r2tTree->GetEntries();
475 for ( int i = 0; i < nEntries; i++ )
476 {
477 r2tTree->GetEntry( i );
478 int bin = m_nR2t[layid][br_iEntr][br_lr];
479 if ( bin >= 200 )
480 {
481 cout << "Error: number of sigma-time bins overflow" << endl;
482 return false;
483 }
484 m_tR2t[layid][br_iEntr][br_lr][bin] = br_t;
485 m_sR2t[layid][br_iEntr][br_lr][bin] = br_s;
486 m_nR2t[layid][br_iEntr][br_lr]++;
487 }
488 }
489 for ( int layid = 0; layid < NLAYER; layid++ )
490 {
491 for ( int iEntr = 0; iEntr < NXTENTR; iEntr++ )
492 {
493 for ( int lr = 0; lr < 2; lr++ )
494 {
495 if ( ( m_nR2t[layid][iEntr][lr] < 10 ) || ( m_nR2t[layid][iEntr][lr] >= 200 ) )
496 return false;
497 }
498 }
499 }
500 return true;
501}
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
Definition FoamA.h:85
TTree * getR2tTree(int layid) const

◆ getR2tTree()

TTree * MdcCalibFunSvc::getR2tTree ( int layid) const

Definition at line 503 of file MdcCalibFunSvc.cxx.

503 {
504 MsgStream log( msgSvc(), name() );
505 string fullPath = "/Calib/MdcCal";
506 SmartDataPtr<CalibData::MdcCalibData> calConst( m_pCalDataSvc, fullPath );
507 if ( !calConst )
508 {
509 log << MSG::ERROR << "can not get MdcCalibConst via SmartPtr" << endmsg;
510 return NULL;
511 }
512
513 TTree* r2tTree = calConst->getR2tpar( layid );
514 return r2tTree;
515}

Referenced by getR2tpar().

◆ getSdEntrIndex()

int MdcCalibFunSvc::getSdEntrIndex ( double entrance) const

Definition at line 611 of file MdcCalibFunSvc.cxx.

611 {
612 int i;
613 int index;
614 int idmax = 5;
615 double aglpi = 3.141592653;
616 double aglmin = -1.570796327; // -90 degree
617 double aglmax = 1.570796327; // 90 degree
618 double delAngle = 0.523598776; // 30 degree
619
620 MsgStream log( msgSvc(), name() );
621 if ( entrance < aglmin )
622 {
623 log << MSG::WARNING << "entrance angle < -pi/2" << endmsg;
624 while ( 1 )
625 {
626 entrance += aglpi;
627 if ( entrance >= aglmin ) break;
628 }
629 }
630 else if ( entrance > aglmax )
631 {
632 log << MSG::WARNING << "entrance angle > pi/2" << endmsg;
633 while ( 1 )
634 {
635 entrance -= aglpi;
636 if ( entrance <= aglmax ) break;
637 }
638 }
639
640 index = (int)( ( entrance - aglmin ) / delAngle );
641 if ( index < 0 ) index = 0;
642 else if ( index > idmax ) index = idmax;
643
644 return index;
645}

Referenced by getSigmaLR().

◆ getSdpar()

void MdcCalibFunSvc::getSdpar ( int layid,
int entr,
int lr,
double par[] ) const

Definition at line 554 of file MdcCalibFunSvc.cxx.

554 {
555 int parId;
556 if ( ( entr < 0 ) || ( entr >= 18 ) ) { entr = 17; }
557 for ( int bin = 0; bin < NSDBIN; bin++ )
558 {
559 parId = getSdparId( layid, entr, lr, bin );
560 par[bin] = m_sdpar[parId];
561 }
562}

Referenced by getSigmaLR().

◆ getSigma()

double MdcCalibFunSvc::getSigma ( int layid,
int lr,
double dist,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 269 of file MdcCalibFunSvc.cxx.

270 {
271 double sigma;
272 if ( ( 0 == lr ) || ( 1 == lr ) )
273 { sigma = getSigmaLR( layid, lr, dist, entrance, tanlam, z, Q ); }
274 else
275 {
276 double sl = getSigmaLR( layid, 0, dist, entrance, tanlam, z, Q );
277 double sr = getSigmaLR( layid, 1, dist, entrance, tanlam, z, Q );
278 sigma = ( sl + sr ) * 0.5;
279 }
280
281 if ( m_fixSigma ) sigma = 0.001 * m_fixSigmaValue;
282 if ( layid == m_layInfSig ) sigma = 9999.0;
283 return sigma;
284}
double getSigmaLR(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const

Referenced by getSigma1().

◆ getSigma1()

double MdcCalibFunSvc::getSigma1 ( int layid,
int lr,
double dist,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 330 of file MdcCalibFunSvc.cxx.

331 {
332 double sigma1 = getSigma( layid, lr, dist, entrance, tanlam, z, Q );
333 return sigma1;
334}
double getSigma(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const

◆ getSigma2()

double MdcCalibFunSvc::getSigma2 ( int layid,
int lr,
double dist,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 336 of file MdcCalibFunSvc.cxx.

337 {
338
339 return 0.0;
340}

◆ getSigmaLR()

double MdcCalibFunSvc::getSigmaLR ( int layid,
int lr,
double dist,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 286 of file MdcCalibFunSvc.cxx.

287 {
288
289 double sigma = 9999.0;
290 double par[NSDBIN];
291
292 int entr = getSdEntrIndex( entrance );
293 getSdpar( layid, entr, lr, par );
294
295 int nmaxBin;
296 double dw = 0.5; // width of each distance bin
297 double dmin = 0.25; // mm
298 if ( layid < 8 )
299 {
300 nmaxBin = 20; // 11->20 2011-12-10
301 }
302 else
303 {
304 nmaxBin = 20; // 15->20 2011-12-10
305 }
306
307 double dref[2];
308 double distAbs = fabs( dist );
309 if ( distAbs < dmin ) { sigma = par[0]; }
310 else
311 {
312 int bin = (int)( ( distAbs - dmin ) / dw );
313 if ( bin >= nmaxBin ) { sigma = par[nmaxBin]; }
314 else if ( bin < 0 ) { sigma = par[0]; }
315 else
316 {
317 dref[0] = (double)bin * dw + 0.25;
318 dref[1] = (double)( bin + 1 ) * dw + 0.25;
319 if ( ( dref[1] - dref[0] ) <= 0 ) { sigma = 9999.0; }
320 else
321 {
322 sigma = ( par[bin + 1] - par[bin] ) * ( distAbs - dref[0] ) / ( dref[1] - dref[0] ) +
323 par[bin];
324 }
325 }
326 }
327 return sigma;
328}
#define dmin(a, b)
int getSdEntrIndex(double entrance) const
void getSdpar(int layid, int entr, int lr, double par[]) const

Referenced by getSigma().

◆ getSigmaToT()

double MdcCalibFunSvc::getSigmaToT ( int layid,
int lr,
double tdr,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 348 of file MdcCalibFunSvc.cxx.

349 {
350 if ( !m_fgR2t )
351 {
352 cout << "ERROR: can not get sigma-time functions" << endl;
353 return -999.0;
354 }
355 else if ( ( 0 == lr ) || ( 1 == lr ) )
356 { return getSigmaToTLR( layid, lr, tdr, entrance, tanlam, z, Q ); }
357 else
358 {
359 double sl = getSigmaToTLR( layid, 0, tdr, entrance, tanlam, z, Q );
360 double sr = getSigmaToTLR( layid, 1, tdr, entrance, tanlam, z, Q );
361 double sigma = ( sl + sr ) * 0.5;
362 return sigma;
363 }
364}
double getSigmaToTLR(int layid, int lr, double tdr, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const

◆ getSigmaToTLR()

double MdcCalibFunSvc::getSigmaToTLR ( int layid,
int lr,
double tdr,
double entrance = 0.0,
double tanlam = 0.0,
double z = 0.0,
double Q = 1000.0 ) const

Definition at line 366 of file MdcCalibFunSvc.cxx.

367 {
368 double sigma=0;
369 int iEntr = getXtEntrIndex( entrance );
370 int nBin = m_nR2t[layid][iEntr][lr];
371 if ( tdr < m_tR2t[layid][iEntr][lr][0] ) { sigma = m_sR2t[layid][iEntr][lr][0]; }
372 else if ( tdr < m_tR2t[layid][iEntr][lr][nBin - 1] )
373 {
374 for ( int i = 0; i < ( nBin - 1 ); i++ )
375 {
376 if ( ( tdr >= m_tR2t[layid][iEntr][lr][i] ) &&
377 ( tdr < m_tR2t[layid][iEntr][lr][i + 1] ) )
378 {
379 double t1 = m_tR2t[layid][iEntr][lr][i];
380 double t2 = m_tR2t[layid][iEntr][lr][i + 1];
381 double s1 = m_sR2t[layid][iEntr][lr][i];
382 double s2 = m_sR2t[layid][iEntr][lr][i + 1];
383 sigma = ( tdr - t1 ) * ( s2 - s1 ) / ( t2 - t1 ) + s1;
384 break;
385 }
386 }
387
388 }
389 else { sigma = m_sR2t[layid][iEntr][lr][nBin - 1]; }
390 return sigma;
391}

Referenced by getSigmaToT().

◆ getT0() [1/2]

double MdcCalibFunSvc::getT0 ( int layid,
int cellid ) const

Definition at line 517 of file MdcCalibFunSvc.cxx.

517 {
518 int wireid = m_pMdcGeomSvc->Wire( layid, cellid )->Id();
519 double t0 = getT0( wireid );
520
521 return t0;
522}
double getT0(int layid, int cellid) const

Referenced by getT0().

◆ getT0() [2/2]

double MdcCalibFunSvc::getT0 ( int wireid) const
inline

Definition at line 79 of file MdcCalibFunSvc.h.

79{ return m_t0[wireid]; }

◆ getTimeWalk()

double MdcCalibFunSvc::getTimeWalk ( int layid,
double Q ) const

Definition at line 524 of file MdcCalibFunSvc.cxx.

524 {
525 double tw = 0.0;
526 double qtpar[2];
527 int ord;
528
529 if ( Q < 0.0001 ) Q = 0.0001;
530
531 for ( ord = 0; ord < 2; ord++ ) { qtpar[ord] = getQtpar( layid, ord ); }
532
533 tw = qtpar[0] + qtpar[1] / sqrt( Q );
534 if ( m_run < 0 ) tw = 0.0; // for MC
535
536 return tw;
537}
double getQtpar(int layid, int ord) const

◆ getTprop()

double MdcCalibFunSvc::getTprop ( int lay,
double z ) const

Definition at line 136 of file MdcCalibFunSvc.cxx.

136 {
137 double vp = getVprop( lay );
138 double tp = fabs( z - m_zst[lay] ) / vp;
139 return tp;
140}
double getVprop(int lay) const

◆ getVprop()

double MdcCalibFunSvc::getVprop ( int lay) const
inline

Definition at line 207 of file MdcCalibFunSvc.h.

207 {
208 if ( lay < 8 ) return 220.0;
209 else return 240.0;
210}

Referenced by getTprop().

◆ getWireEff() [1/2]

double MdcCalibFunSvc::getWireEff ( int layid,
int cellid ) const

Definition at line 539 of file MdcCalibFunSvc.cxx.

539 {
540 int wireid = m_pMdcGeomSvc->Wire( layid, cellid )->Id();
541 return m_wireEff[wireid];
542}

◆ getWireEff() [2/2]

double MdcCalibFunSvc::getWireEff ( int wireid) const
inline

Definition at line 86 of file MdcCalibFunSvc.h.

86{ return m_wireEff[wireid]; }

◆ getXtEntrIndex()

int MdcCalibFunSvc::getXtEntrIndex ( double entrance) const

Definition at line 575 of file MdcCalibFunSvc.cxx.

575 {
576 int i;
577 int index;
578 int idmax = 17;
579 double aglpi = 3.141592653;
580 double aglmin = -1.570796327; // -90 degree
581 double aglmax = 1.570796327; // 90 degree
582 double delAngle = 0.174532925; // 10 degree
583
584 MsgStream log( msgSvc(), name() );
585 if ( entrance < aglmin )
586 {
587 log << MSG::WARNING << "entrance angle < -pi/2" << endmsg;
588 while ( 1 )
589 {
590 entrance += aglpi;
591 if ( entrance >= aglmin ) break;
592 }
593 }
594 else if ( entrance > aglmax )
595 {
596 log << MSG::WARNING << "entrance angle > pi/2" << endmsg;
597 while ( 1 )
598 {
599 entrance -= aglpi;
600 if ( entrance <= aglmax ) break;
601 }
602 }
603
604 index = (int)( ( entrance - aglmin ) / delAngle );
605 if ( index < 0 ) index = 0;
606 else if ( index > idmax ) index = idmax;
607
608 return index;
609}

Referenced by distToDriftTime(), and getSigmaToTLR().

◆ getXtpar()

void MdcCalibFunSvc::getXtpar ( int layid,
int entr,
int lr,
double par[] ) const

Definition at line 404 of file MdcCalibFunSvc.cxx.

404 {
405 int parId;
406 for ( int ord = 0; ord < 8; ord++ )
407 {
408 parId = getXtparId( layid, entr, lr, ord );
409 par[ord] = m_xtpar[parId];
410 }
411}

Referenced by distToDriftTime().

◆ handle()

void MdcCalibFunSvc::handle ( const Incident & inc)

Definition at line 114 of file MdcCalibFunSvc.cxx.

114 {
115 MsgStream log( msgSvc(), name() );
116 log << MSG::DEBUG << "handle: " << inc.type() << endmsg;
117
118 if ( inc.type() == "NewRun" )
119 {
120 log << MSG::DEBUG << "NewRun" << endmsg;
121
122 if ( !initCalibConst() )
123 {
124 log << MSG::ERROR << "can not initilize Mdc Calib Constants" << endl
125 << " Please insert the following statement "
126 << "in your \"jobOption.txt\" "
127 << "before the include file of Mdc Reconstruction: " << endl
128 << " "
129 << "#include \"$CALIBSVCROOT/share/job-CalibData.txt\"" << endl
130 << " If still error, please contact with Wu Linghui "
131 << "(wulh@mail.ihep.ac.cn)." << endmsg;
132 }
133 }
134}

◆ initialize()

StatusCode MdcCalibFunSvc::initialize ( )
virtual

Definition at line 61 of file MdcCalibFunSvc.cxx.

61 {
62 MsgStream log( msgSvc(), name() );
63 log << MSG::INFO << "MdcCalibFunSvc::initialize()" << endmsg;
64
65 StatusCode sc = Service::initialize();
66 if ( sc.isFailure() ) return sc;
67
68 IIncidentSvc* incsvc;
69 sc = service( "IncidentSvc", incsvc );
70 int priority = 100;
71 if ( sc.isSuccess() ) { incsvc->addListener( this, "NewRun", priority ); }
72
73 sc = service( "CalibDataSvc", m_pCalDataSvc, true );
74 if ( sc == StatusCode::SUCCESS )
75 { log << MSG::INFO << "Retrieve IDataProviderSvc" << endmsg; }
76 else { log << MSG::FATAL << "can not get IDataProviderSvc" << endmsg; }
77
78 sc = service( "MdcGeomSvc", m_pMdcGeomSvc );
79 if ( sc != StatusCode::SUCCESS )
80 {
81 log << MSG::ERROR << "can not use MdcGeomSvc" << endmsg;
82 return StatusCode::FAILURE;
83 }
84
85 if ( m_fixSigma ) cout << "Fix MDC sigma to " << m_fixSigmaValue << " micron." << endl;
86
87 m_updateNum = 0;
88 for ( int wir = 0; wir < 6796; wir++ ) m_wireEff[wir] = 1.0;
89 for ( int lay = 0; lay < NLAYER; lay++ )
90 {
91 for ( int iEntr = 0; iEntr < NXTENTR; iEntr++ )
92 {
93 for ( int lr = 0; lr < 2; lr++ ) m_nR2t[lay][iEntr][lr] = 0;
94 }
95 }
96
97 return StatusCode::SUCCESS;
98}

◆ setSdBegin()

void MdcCalibFunSvc::setSdBegin ( )
inline

Definition at line 88 of file MdcCalibFunSvc.h.

88{ m_sditer = m_sdmap.begin(); }

◆ setXtBegin()

void MdcCalibFunSvc::setXtBegin ( )
inline

Definition at line 72 of file MdcCalibFunSvc.h.

72{ m_xtiter = m_xtmap.begin(); }

Member Data Documentation

◆ m_run

int MdcCalibFunSvc::m_run

Definition at line 34 of file MdcCalibFunSvc.h.

Referenced by getTimeWalk().


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