BOSS 6.6.4.p03
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 queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
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
 
virtual double getVprop (int lay) const =0
 
virtual double getTprop (int lay, double z) const =0
 
virtual double driftTimeToDist (double drifttime, int layid, int cellid, int lr, double entrance=0.0) const =0
 
virtual double distToDriftTime (double dist, int layid, int cellid, int lr, double entrance=0.0) const =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual 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 =0
 
virtual void setXtBegin ()=0
 
virtual int getNextXtpar (int &key, double &par)=0
 
virtual void getXtpar (int layid, int entr, int lr, double par[]) const =0
 
virtual bool getNewXtpar ()=0
 
virtual TTree * getNewXtparTree (int layid, int entr, int lr) const =0
 
virtual double getT0 (int layid, int cellid) const =0
 
virtual double getT0 (int wireid) const =0
 
virtual double getDelT0 (int wireid) const =0
 
virtual double getTimeWalk (int layid, double Q) const =0
 
virtual double getQtpar (int layid, int ord) const =0
 
virtual double getWireEff (int layid, int cellid) const =0
 
virtual double getWireEff (int wireid) const =0
 
virtual void setSdBegin ()=0
 
virtual int getNextSdpar (int &key, double &par)=0
 
virtual void getSdpar (int layid, int entr, int lr, double par[]) const =0
 
virtual bool getR2tpar ()=0
 
virtual TTree * getR2tTree (int layid) const =0
 
virtual int getXtEntrIndex (double entrance) const =0
 
virtual int getSdEntrIndex (double entrance) const =0
 
virtual bool initCalibConst ()=0
 

Public Attributes

int m_run
 

Additional Inherited Members

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

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 38 of file MdcCalibFunSvc.cxx.

38 :
39 Service (name, svcloc), m_layInfSig(-1) {
40
41 // declare properties
42 declareProperty("CheckConst", m_checkConst = false);
43 declareProperty("LayerInfSig", m_layInfSig);
44 declareProperty("XtMode", m_xtMode = 1);
45 declareProperty("NewXtFile", m_xtfile);
46 declareProperty("ReadWireEffDb", m_readWireEffDb = true);
47 declareProperty("WireEffFile", m_wireEffFile);
48 declareProperty("LinearXT", m_linearXT = false);
49 m_outputXtMode = true;
50}

◆ ~MdcCalibFunSvc()

MdcCalibFunSvc::~MdcCalibFunSvc ( )

Definition at line 52 of file MdcCalibFunSvc.cxx.

52 {
53}

Member Function Documentation

◆ distToDriftTime()

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

Implements IMdcCalibFunSvc.

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 cout << "Warning in MdcCalibFunSvc: driftDist < 0" << endl;
231 time = 0.0;
232 } else if(dist < xtpar[0]){
233 time = 0.0;
234 } else if(dist < dm1){
235 for(ord=0; ord<5; ord++){
236 dxdtpar[ord] = (double)(ord+1) * xtpar[ord+1];
237 }
238 time = dist / 0.03;
239 while(1){
240 if( i > 50 ){
241 cout << "Warning in MdcCalibFunSvc: "
242 << "can not get the exact value in the dist-to-time conversion."
243 << endl;
244 time = dist / 0.03;
245 break;
246 }
247
248 x = 0.0;
249 for(ord=0; ord<6; ord++)
250 x += xtpar[ord] * pow(time, ord);
251
252 deltax = x - dist;
253 if( fabs(deltax) < 0.001 ){
254 break;
255 }
256
257 dxdt = 0.0;
258 for(ord=0; ord<5; ord++)
259 dxdt += dxdtpar[ord] * pow(time, ord);
260
261 time = time - (deltax / dxdt);
262 i++;
263 }
264 } else if(dist < dm2){
265 time = (dist - dm1) * (tm2 - tm1) / (dm2 - dm1) + tm1;
266 } else{
267 time = tm2;
268 }
269
270 if(m_linearXT) time = dist / 0.03;
271 return time;
272}
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

Referenced by EsTimeAlg::execute().

◆ driftTimeToDist()

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

Implements IMdcCalibFunSvc.

Definition at line 145 of file MdcCalibFunSvc.cxx.

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

Referenced by MdcxHit::d(), distToDriftTime(), MdcHit::driftDist(), TrkReco::execute(), and KalFitTrack::getDriftDist().

◆ finalize()

StatusCode MdcCalibFunSvc::finalize ( )
virtual

Definition at line 102 of file MdcCalibFunSvc.cxx.

102 {
103 MsgStream log(messageService(), name());
104 log << MSG::INFO << "MdcCalibFunSvc::finalize()" << endreq;
105
106 m_xtmap.clear();
107 m_t0.clear();
108 m_delt0.clear();
109 m_qtpar0.clear();
110 m_qtpar1.clear();
111 m_sdmap.clear();
112
113 return StatusCode::SUCCESS;
114}

◆ getDelT0()

double MdcCalibFunSvc::getDelT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 87 of file MdcCalibFunSvc.h.

87{ 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
virtual

Implements IMdcCalibFunSvc.

Definition at line 347 of file MdcCalibFunSvc.cxx.

349 {
350
351 return 1.0;
352}

◆ getNewXtpar()

bool MdcCalibFunSvc::getNewXtpar ( )
virtual

Implements IMdcCalibFunSvc.

Definition at line 411 of file MdcCalibFunSvc.cxx.

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

◆ getNewXtparTree()

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

Implements IMdcCalibFunSvc.

Definition at line 442 of file MdcCalibFunSvc.cxx.

442 {
443 MsgStream log(messageService(), name());
444 string fullPath = "/Calib/MdcCal";
445 SmartDataPtr<CalibData::MdcCalibData> calConst(m_pCalDataSvc, fullPath);
446 if( ! calConst ){
447 log << MSG::ERROR << "can not get MdcCalibConst via SmartPtr" << endreq;
448 return NULL;
449 }
450
451 TTree* newXtTree = calConst->getNewXtpar(layid,entr,lr);
452 return newXtTree;
453}

Referenced by getNewXtpar().

◆ getNextSdpar()

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

Implements IMdcCalibFunSvc.

Definition at line 551 of file MdcCalibFunSvc.cxx.

551 {
552 if( m_sditer != m_sdmap.end() ){
553 key = (*m_sditer).first;
554 par = (*m_sditer).second;
555 m_sditer++;
556 return 1;
557 }
558 else return 0;
559}
*************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 
)
virtual

Implements IMdcCalibFunSvc.

Definition at line 393 of file MdcCalibFunSvc.cxx.

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

◆ getQtpar()

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

Implements IMdcCalibFunSvc.

Definition at line 531 of file MdcCalibFunSvc.cxx.

531 {
532 if(0 == ord) return m_qtpar0[layid];
533 else if(1 == ord) return m_qtpar1[layid];
534 else {
535 cout << "wrong order number" << endl;
536 return 0.0;
537 }
538}

Referenced by getTimeWalk().

◆ getR2tpar()

bool MdcCalibFunSvc::getR2tpar ( )
virtual

Implements IMdcCalibFunSvc.

Definition at line 455 of file MdcCalibFunSvc.cxx.

455 {
456 for(int layid=0; layid<NLAYER; layid++){
457 int br_iEntr,br_lr;
458 double br_s,br_t;
459 TTree* r2tTree = getR2tTree(layid);
460 if(!r2tTree) return false;
461 r2tTree -> SetBranchAddress("iEntr", &br_iEntr);
462 r2tTree -> SetBranchAddress("lr", &br_lr);
463 r2tTree -> SetBranchAddress("s", &br_s);
464 r2tTree -> SetBranchAddress("t", &br_t);
465 int nEntries = r2tTree -> GetEntries();
466 for(int i=0; i<nEntries; i++){
467 r2tTree->GetEntry(i);
468 int bin = m_nR2t[layid][br_iEntr][br_lr];
469 if(bin>=200){
470 cout << "Error: number of sigma-time bins overflow" << endl;
471 return false;
472 }
473 m_tR2t[layid][br_iEntr][br_lr][bin] = br_t;
474 m_sR2t[layid][br_iEntr][br_lr][bin] = br_s;
475 m_nR2t[layid][br_iEntr][br_lr]++;
476 }
477 }
478 for(int layid=0; layid<NLAYER; layid++){
479 for(int iEntr=0; iEntr<NXTENTR; iEntr++){
480 for(int lr=0; lr<2; lr++){
481 if((m_nR2t[layid][iEntr][lr]<10) || (m_nR2t[layid][iEntr][lr]>=200)) return false;
482 }
483 }
484 }
485 return true;
486}
*******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
virtual

Implements IMdcCalibFunSvc.

Definition at line 488 of file MdcCalibFunSvc.cxx.

488 {
489 MsgStream log(messageService(), name());
490 string fullPath = "/Calib/MdcCal";
491 SmartDataPtr<CalibData::MdcCalibData> calConst(m_pCalDataSvc, fullPath);
492 if( ! calConst ){
493 log << MSG::ERROR << "can not get MdcCalibConst via SmartPtr" << endreq;
494 return NULL;
495 }
496
497 TTree* r2tTree = calConst->getR2tpar(layid);
498 return r2tTree;
499}

Referenced by getR2tpar().

◆ getSdEntrIndex()

int MdcCalibFunSvc::getSdEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

Definition at line 592 of file MdcCalibFunSvc.cxx.

592 {
593 int i;
594 int index;
595 int idmax = 5;
596 double aglpi = 3.141592653;
597 double aglmin = -1.570796327; // -90 degree
598 double aglmax = 1.570796327; // 90 degree
599 double delAngle = 0.523598776; // 30 degree
600
601 MsgStream log(messageService(), name());
602 if(entrance < aglmin){
603 log << MSG::WARNING << "entrance angle < -pi/2" << endreq;
604 while(1){
605 entrance += aglpi;
606 if(entrance >= aglmin) break;
607 }
608 } else if(entrance > aglmax){
609 log << MSG::WARNING << "entrance angle > pi/2" << endreq;
610 while(1){
611 entrance -= aglpi;
612 if(entrance <= aglmax) break;
613 }
614 }
615
616 index = (int)((entrance-aglmin) / delAngle);
617 if(index < 0) index = 0;
618 else if(index > idmax) index = idmax;
619
620 return index;
621}

Referenced by getSigmaLR().

◆ getSdpar()

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

Implements IMdcCalibFunSvc.

Definition at line 540 of file MdcCalibFunSvc.cxx.

540 {
541 int parId;
542 if( (entr < 0) || (entr >= 18) ){
543 entr = 17;
544 }
545 for(int bin=0; bin<NSDBIN; bin++){
546 parId = getSdparId(layid, entr, lr, bin);
547 par[bin] = m_sdpar[parId];
548 }
549}

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
virtual

Implements IMdcCalibFunSvc.

Definition at line 274 of file MdcCalibFunSvc.cxx.

276 {
277 double sigma;
278 if( (0 == lr) || (1 == lr) ){
279 sigma = getSigmaLR(layid, lr, dist, entrance, tanlam, z, Q);
280 } else{
281 double sl = getSigmaLR(layid, 0, dist, entrance, tanlam, z, Q);
282 double sr = getSigmaLR(layid, 1, dist, entrance, tanlam, z, Q);
283 sigma = (sl + sr) * 0.5;
284 }
285
286 if(layid == m_layInfSig) sigma = 9999.0;
287 return sigma;
288}
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 TrkReco::execute(), KalFitTrack::getSigma(), getSigma1(), and MdcHit::sigma().

◆ 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
virtual

Implements IMdcCalibFunSvc.

Definition at line 333 of file MdcCalibFunSvc.cxx.

335 {
336 double sigma1 = getSigma(layid, lr, dist, entrance, tanlam, z, Q);
337 return sigma1;
338}
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
virtual

Implements IMdcCalibFunSvc.

Definition at line 340 of file MdcCalibFunSvc.cxx.

342 {
343
344 return 0.0;
345}

◆ 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
virtual

Implements IMdcCalibFunSvc.

Definition at line 290 of file MdcCalibFunSvc.cxx.

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

Implements IMdcCalibFunSvc.

Definition at line 354 of file MdcCalibFunSvc.cxx.

355 {
356 if(!m_fgR2t){
357 cout << "ERROR: can not get sigma-time functions" << endl;
358 return -999.0;
359 } else if( (0 == lr) || (1 == lr) ){
360 return getSigmaToTLR(layid, lr, tdr, entrance, tanlam, z, Q);
361 } else{
362 double sl = getSigmaToTLR(layid, 0, tdr, entrance, tanlam, z, Q);
363 double sr = getSigmaToTLR(layid, 1, tdr, entrance, tanlam, z, Q);
364 double sigma = (sl + sr) * 0.5;
365 return sigma;
366 }
367}
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
virtual

Implements IMdcCalibFunSvc.

Definition at line 369 of file MdcCalibFunSvc.cxx.

370 {
371 double sigma;
372 int iEntr = getXtEntrIndex(entrance);
373 int nBin = m_nR2t[layid][iEntr][lr];
374 if(tdr < m_tR2t[layid][iEntr][lr][0]){
375 sigma = m_sR2t[layid][iEntr][lr][0];
376 } else if(tdr < m_tR2t[layid][iEntr][lr][nBin-1]){
377 for(int i=0; i<(nBin-1); i++){
378 if((tdr>=m_tR2t[layid][iEntr][lr][i]) && (tdr<m_tR2t[layid][iEntr][lr][i+1])){
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 } else{
388 sigma = m_sR2t[layid][iEntr][lr][nBin-1];
389 }
390 return sigma;
391}

Referenced by getSigmaToT().

◆ getT0() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 502 of file MdcCalibFunSvc.cxx.

502 {
503 int wireid = m_pMdcGeomSvc->Wire(layid, cellid)->Id();
504 double t0 = getT0(wireid);
505
506 return t0;
507}
virtual const MdcGeoWire *const Wire(unsigned id)=0
double getT0(int layid, int cellid) const
int Id(void) const
Definition: MdcGeoWire.h:127

Referenced by EsTimeAlg::execute(), TrkReco::execute(), KalFitTrack::getDriftTime(), getT0(), MdcxHit::process(), and MdcHit::setCalibSvc().

◆ getT0() [2/2]

double MdcCalibFunSvc::getT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 86 of file MdcCalibFunSvc.h.

86{ return m_t0[wireid]; }

◆ getTimeWalk()

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

Implements IMdcCalibFunSvc.

Definition at line 509 of file MdcCalibFunSvc.cxx.

509 {
510 double tw = 0.0;
511 double qtpar[2];
512 int ord;
513
514 if(Q < 0.0001) Q = 0.0001;
515
516 for(ord=0; ord<2; ord++){
517 qtpar[ord] = getQtpar(layid, ord);
518 }
519
520 tw = qtpar[0] + qtpar[1] / sqrt( Q );
521 if(m_run < 0) tw = 0.0; // for MC
522
523 return tw;
524}
double getQtpar(int layid, int ord) const

Referenced by EsTimeAlg::execute(), TrkReco::execute(), KalFitTrack::getDriftTime(), MdcxHit::process(), and MdcHit::setCalibSvc().

◆ getTprop()

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

Implements IMdcCalibFunSvc.

Definition at line 139 of file MdcCalibFunSvc.cxx.

139 {
140 double vp = getVprop(lay);
141 double tp = fabs(z - m_zst[lay]) / vp;
142 return tp;
143}
double getVprop(int lay) const

Referenced by MdcHit::driftTime(), and MdcxHit::tcor().

◆ getVprop()

double MdcCalibFunSvc::getVprop ( int  lay) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 213 of file MdcCalibFunSvc.h.

213 {
214 if(lay<8) return 220.0;
215 else return 240.0;
216}

Referenced by getTprop().

◆ getWireEff() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 526 of file MdcCalibFunSvc.cxx.

526 {
527 int wireid = m_pMdcGeomSvc->Wire(layid, cellid)->Id();
528 return m_wireEff[wireid];
529}

◆ getWireEff() [2/2]

double MdcCalibFunSvc::getWireEff ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 93 of file MdcCalibFunSvc.h.

93{ return m_wireEff[wireid]; }

◆ getXtEntrIndex()

int MdcCalibFunSvc::getXtEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

Definition at line 561 of file MdcCalibFunSvc.cxx.

561 {
562 int i;
563 int index;
564 int idmax = 17;
565 double aglpi = 3.141592653;
566 double aglmin = -1.570796327; // -90 degree
567 double aglmax = 1.570796327; // 90 degree
568 double delAngle = 0.174532925; // 10 degree
569
570 MsgStream log(messageService(), name());
571 if(entrance < aglmin){
572 log << MSG::WARNING << "entrance angle < -pi/2" << endreq;
573 while(1){
574 entrance += aglpi;
575 if(entrance >= aglmin) break;
576 }
577 } else if(entrance > aglmax){
578 log << MSG::WARNING << "entrance angle > pi/2" << endreq;
579 while(1){
580 entrance -= aglpi;
581 if(entrance <= aglmax) break;
582 }
583 }
584
585 index = (int)((entrance-aglmin) / delAngle);
586 if(index < 0) index = 0;
587 else if(index > idmax) index = idmax;
588
589 return index;
590}

Referenced by distToDriftTime(), and getSigmaToTLR().

◆ getXtpar()

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

Implements IMdcCalibFunSvc.

Definition at line 403 of file MdcCalibFunSvc.cxx.

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

Referenced by distToDriftTime().

◆ handle()

void MdcCalibFunSvc::handle ( const Incident &  inc)

Definition at line 116 of file MdcCalibFunSvc.cxx.

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

◆ initialize()

StatusCode MdcCalibFunSvc::initialize ( )
virtual

Definition at line 64 of file MdcCalibFunSvc.cxx.

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

◆ queryInterface()

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

Definition at line 55 of file MdcCalibFunSvc.cxx.

55 {
56 if( IID_IMdcCalibFunSvc.versionMatch(riid) ){
57 *ppvInterface = static_cast<IMdcCalibFunSvc*> (this);
58 } else{
59 return Service::queryInterface(riid, ppvInterface);
60 }
61 return StatusCode::SUCCESS;
62}

◆ setSdBegin()

void MdcCalibFunSvc::setSdBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 95 of file MdcCalibFunSvc.h.

95{ m_sditer = m_sdmap.begin(); }

◆ setXtBegin()

void MdcCalibFunSvc::setXtBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 79 of file MdcCalibFunSvc.h.

79{ 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: