BOSS 7.0.2
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
 
 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
 
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 ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description

Constructor & Destructor Documentation

◆ MdcCalibFunSvc() [1/2]

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

◆ ~MdcCalibFunSvc() [1/2]

MdcCalibFunSvc::~MdcCalibFunSvc ( )

Definition at line 54 of file MdcCalibFunSvc.cxx.

54 {
55}

◆ MdcCalibFunSvc() [2/2]

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

◆ ~MdcCalibFunSvc() [2/2]

MdcCalibFunSvc::~MdcCalibFunSvc ( )

Member Function Documentation

◆ distToDriftTime() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 214 of file MdcCalibFunSvc.cxx.

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

◆ distToDriftTime() [2/2]

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

Implements IMdcCalibFunSvc.

◆ driftTimeToDist() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 149 of file MdcCalibFunSvc.cxx.

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

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

◆ driftTimeToDist() [2/2]

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

Implements IMdcCalibFunSvc.

◆ finalize() [1/2]

StatusCode MdcCalibFunSvc::finalize ( )
virtual

Definition at line 106 of file MdcCalibFunSvc.cxx.

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

◆ finalize() [2/2]

virtual StatusCode MdcCalibFunSvc::finalize ( )
virtual

◆ getDelT0() [1/2]

double MdcCalibFunSvc::getDelT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 87 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

87{ return m_delt0[wireid]; }

◆ getDelT0() [2/2]

double MdcCalibFunSvc::getDelT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 87 of file Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h.

87{ return m_delt0[wireid]; }

◆ getF() [1/2]

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

354 {
355
356 return 1.0;
357}

◆ getF() [2/2]

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.

◆ getNewXtpar() [1/2]

bool MdcCalibFunSvc::getNewXtpar ( )
virtual

Implements IMdcCalibFunSvc.

Definition at line 416 of file MdcCalibFunSvc.cxx.

416 {
417 MsgStream log(messageService(), name());
418 log << MSG::INFO << "read calib const from TCDS" << endreq;
419
420 for(int layid=0; layid<NLAYER; layid++){
421 for(int entr=0; entr<NXTENTR; entr++){
422 for(int lr=0; lr<2; lr++){
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 log << MSG::ERROR << "wrong X-T constants: layer " << layid
431 << ", iEntr " << entr << ", lr " << lr << endreq;
432 return false;
433 }
434 m_nNewXt[layid][entr][lr] = nEntries;
435 for(int i=0; i<nEntries; i++){
436 newXtTree->GetEntry(i);
437 m_vt[layid][entr][lr][i] = br_t;
438 m_vd[layid][entr][lr][i] = br_d;
439 }//end loop entries
440 }//end lr
441 }//end entr
442 }//end layid
443
444 return true;
445}
data SetBranchAddress("time",&time)
TTree * getNewXtparTree(int layid, int entr, int lr) const

◆ getNewXtpar() [2/2]

bool MdcCalibFunSvc::getNewXtpar ( )
virtual

Implements IMdcCalibFunSvc.

◆ getNewXtparTree() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 447 of file MdcCalibFunSvc.cxx.

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

Referenced by getNewXtpar().

◆ getNewXtparTree() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getNextSdpar() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 556 of file MdcCalibFunSvc.cxx.

556 {
557 if( m_sditer != m_sdmap.end() ){
558 key = (*m_sditer).first;
559 par = (*m_sditer).second;
560 m_sditer++;
561 return 1;
562 }
563 else return 0;
564}
*************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

◆ getNextSdpar() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getNextXtpar() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 398 of file MdcCalibFunSvc.cxx.

398 {
399 if( m_xtiter != m_xtmap.end() ){
400 key = (*m_xtiter).first;
401 par = (*m_xtiter).second;
402 m_xtiter++;
403 return 1;
404 }
405 else return 0;
406}

◆ getNextXtpar() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getQtpar() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 536 of file MdcCalibFunSvc.cxx.

536 {
537 if(0 == ord) return m_qtpar0[layid];
538 else if(1 == ord) return m_qtpar1[layid];
539 else {
540 cout << "wrong order number" << endl;
541 return 0.0;
542 }
543}

Referenced by getTimeWalk().

◆ getQtpar() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getR2tpar() [1/2]

bool MdcCalibFunSvc::getR2tpar ( )
virtual

Implements IMdcCalibFunSvc.

Definition at line 460 of file MdcCalibFunSvc.cxx.

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

◆ getR2tpar() [2/2]

bool MdcCalibFunSvc::getR2tpar ( )
virtual

Implements IMdcCalibFunSvc.

◆ getR2tTree() [1/2]

TTree * MdcCalibFunSvc::getR2tTree ( int  layid) const
virtual

Implements IMdcCalibFunSvc.

Definition at line 493 of file MdcCalibFunSvc.cxx.

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

Referenced by getR2tpar().

◆ getR2tTree() [2/2]

TTree * MdcCalibFunSvc::getR2tTree ( int  layid) const
virtual

Implements IMdcCalibFunSvc.

◆ getSdEntrIndex() [1/2]

int MdcCalibFunSvc::getSdEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

Definition at line 597 of file MdcCalibFunSvc.cxx.

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

Referenced by getSigmaLR().

◆ getSdEntrIndex() [2/2]

int MdcCalibFunSvc::getSdEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

◆ getSdpar() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 545 of file MdcCalibFunSvc.cxx.

545 {
546 int parId;
547 if( (entr < 0) || (entr >= 18) ){
548 entr = 17;
549 }
550 for(int bin=0; bin<NSDBIN; bin++){
551 parId = getSdparId(layid, entr, lr, bin);
552 par[bin] = m_sdpar[parId];
553 }
554}

Referenced by getSigmaLR().

◆ getSdpar() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getSigma() [1/2]

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

280 {
281 double sigma;
282 if( (0 == lr) || (1 == lr) ){
283 sigma = getSigmaLR(layid, lr, dist, entrance, tanlam, z, Q);
284 } else{
285 double sl = getSigmaLR(layid, 0, dist, entrance, tanlam, z, Q);
286 double sr = getSigmaLR(layid, 1, dist, entrance, tanlam, z, Q);
287 sigma = (sl + sr) * 0.5;
288 }
289
290 if(m_fixSigma) sigma = 0.001 * m_fixSigmaValue;
291 if(layid == m_layInfSig) sigma = 9999.0;
292 return sigma;
293}
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().

◆ getSigma() [2/2]

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.

◆ getSigma1() [1/2]

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

340 {
341 double sigma1 = getSigma(layid, lr, dist, entrance, tanlam, z, Q);
342 return sigma1;
343}
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

◆ getSigma1() [2/2]

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.

◆ getSigma2() [1/2]

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

347 {
348
349 return 0.0;
350}

◆ getSigma2() [2/2]

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.

◆ getSigmaLR() [1/2]

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

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

Referenced by getSigma().

◆ getSigmaLR() [2/2]

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.

◆ getSigmaToT() [1/2]

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

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

◆ getSigmaToT() [2/2]

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.

◆ getSigmaToTLR() [1/2]

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

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

Referenced by getSigmaToT().

◆ getSigmaToTLR() [2/2]

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.

◆ getT0() [1/4]

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

Implements IMdcCalibFunSvc.

Definition at line 507 of file MdcCalibFunSvc.cxx.

507 {
508 int wireid = m_pMdcGeomSvc->Wire(layid, cellid)->Id();
509 double t0 = getT0(wireid);
510
511 return t0;
512}
virtual const MdcGeoWire *const Wire(unsigned id)=0
double getT0(int layid, int cellid) const

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

◆ getT0() [2/4]

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

Implements IMdcCalibFunSvc.

◆ getT0() [3/4]

double MdcCalibFunSvc::getT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 86 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

86{ return m_t0[wireid]; }

◆ getT0() [4/4]

double MdcCalibFunSvc::getT0 ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 86 of file Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h.

86{ return m_t0[wireid]; }

◆ getTimeWalk() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 514 of file MdcCalibFunSvc.cxx.

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

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

◆ getTimeWalk() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getTprop() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 143 of file MdcCalibFunSvc.cxx.

143 {
144 double vp = getVprop(lay);
145 double tp = fabs(z - m_zst[lay]) / vp;
146 return tp;
147}

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

◆ getTprop() [2/2]

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

Implements IMdcCalibFunSvc.

◆ getVprop() [1/2]

double MdcCalibFunSvc::getVprop ( int  lay) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 215 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

215 {
216 if(lay<8) return 220.0;
217 else return 240.0;
218}

Referenced by getTprop().

◆ getVprop() [2/2]

double MdcCalibFunSvc::getVprop ( int  lay) const
virtual

Implements IMdcCalibFunSvc.

◆ getWireEff() [1/4]

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

Implements IMdcCalibFunSvc.

Definition at line 531 of file MdcCalibFunSvc.cxx.

531 {
532 int wireid = m_pMdcGeomSvc->Wire(layid, cellid)->Id();
533 return m_wireEff[wireid];
534}

◆ getWireEff() [2/4]

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

Implements IMdcCalibFunSvc.

◆ getWireEff() [3/4]

double MdcCalibFunSvc::getWireEff ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 93 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

93{ return m_wireEff[wireid]; }

◆ getWireEff() [4/4]

double MdcCalibFunSvc::getWireEff ( int  wireid) const
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 93 of file Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h.

93{ return m_wireEff[wireid]; }

◆ getXtEntrIndex() [1/2]

int MdcCalibFunSvc::getXtEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

Definition at line 566 of file MdcCalibFunSvc.cxx.

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

Referenced by distToDriftTime(), and getSigmaToTLR().

◆ getXtEntrIndex() [2/2]

int MdcCalibFunSvc::getXtEntrIndex ( double  entrance) const
virtual

Implements IMdcCalibFunSvc.

◆ getXtpar() [1/2]

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

Implements IMdcCalibFunSvc.

Definition at line 408 of file MdcCalibFunSvc.cxx.

408 {
409 int parId;
410 for(int ord=0; ord<8; ord++){
411 parId = getXtparId(layid, entr, lr, ord);
412 par[ord] = m_xtpar[parId];
413 }
414}

Referenced by distToDriftTime().

◆ getXtpar() [2/2]

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

Implements IMdcCalibFunSvc.

◆ handle() [1/2]

void MdcCalibFunSvc::handle ( const Incident &  inc)

Definition at line 120 of file MdcCalibFunSvc.cxx.

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

◆ handle() [2/2]

void MdcCalibFunSvc::handle ( const Incident &  )

◆ initialize() [1/2]

StatusCode MdcCalibFunSvc::initialize ( )
virtual

Definition at line 66 of file MdcCalibFunSvc.cxx.

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

◆ initialize() [2/2]

virtual StatusCode MdcCalibFunSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

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

Definition at line 57 of file MdcCalibFunSvc.cxx.

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

◆ queryInterface() [2/2]

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

◆ setSdBegin() [1/2]

void MdcCalibFunSvc::setSdBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 95 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

95{ m_sditer = m_sdmap.begin(); }

◆ setSdBegin() [2/2]

void MdcCalibFunSvc::setSdBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 95 of file Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h.

95{ m_sditer = m_sdmap.begin(); }

◆ setXtBegin() [1/2]

void MdcCalibFunSvc::setXtBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 79 of file InstallArea/include/MdcCalibFunSvc/MdcCalibFunSvc/MdcCalibFunSvc.h.

79{ m_xtiter = m_xtmap.begin(); }

◆ setXtBegin() [2/2]

void MdcCalibFunSvc::setXtBegin ( )
inlinevirtual

Implements IMdcCalibFunSvc.

Definition at line 79 of file Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h.

79{ m_xtiter = m_xtmap.begin(); }

Member Data Documentation

◆ m_run

int MdcCalibFunSvc::m_run

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