BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
TofCorrPID Class Reference

#include <TofCorrPID.h>

+ Inheritance diagram for TofCorrPID:

Public Member Functions

 ~TofCorrPID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double offset (int n) const
 
double sigma (int n) const
 
int ndof () const
 
int ipmt () const
 
double dt (int ipar, int ipmt) const
 
double dtCorr (int ipar, int ipmt) const
 
double sigCorr (int ipar, int ipmt) const
 
double chiCorr (int ipar, int ipmt) const
 
 ~TofCorrPID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double offset (int n) const
 
double sigma (int n) const
 
int ndof () const
 
int ipmt () const
 
double dt (int ipar, int ipmt) const
 
double dtCorr (int ipar, int ipmt) const
 
double sigCorr (int ipar, int ipmt) const
 
double chiCorr (int ipar, int ipmt) const
 
- Public Member Functions inherited from ParticleIDBase
 ParticleIDBase ()
 
virtual ~ParticleIDBase ()
 
virtual void init ()=0
 
virtual void calculate ()=0
 
virtual bool IsPidInfoValid () const =0
 
virtual double chi (int n) const =0
 
virtual double prob (int n) const =0
 
virtual int ndof () const =0
 
EvtRecTrackPidTrk () const
 
void setRecTrack (EvtRecTrack *trk)
 
double chiMinCut () const
 
void setChiMinCut (const double chi=4)
 
double chiMaxCut () const
 
void setChiMaxCut (const double chi=6)
 
double pdfMinSigmaCut () const
 
void setPdfMinSigmaCut (const double pdf=4)
 
double getRunNo () const
 
void setRunNo (const double runh=8093)
 
double p ()
 
double pt ()
 
double charge ()
 
double xmass (int n)
 
double velc ()
 
double probCalculate (double chi2, int n)
 
double pdfCalculate (double offset, double sigma)
 
double interpolation (double *x, double *y, double x1)
 
double pol2 (double x, double *par)
 
double pol3 (double x, double *par)
 
double pol4 (double x, double *par)
 
int useDedx () const
 
int useTof () const
 
int useTof1 () const
 
int useTof2 () const
 
int useTofE () const
 
int useTofQ () const
 
int useTofC () const
 
int useTofCorr () const
 
int useEmc () const
 
int useMuc () const
 
int onlyPionKaon () const
 
int onlyPionKaonProton () const
 
int onlyPionKaonElectron () const
 
int all () const
 
int onlyElectron () const
 
int onlyMuon () const
 
int onlyPion () const
 
int onlyKaon () const
 
int onlyProton () const
 
int methodLikelihood () const
 
int methodProbability () const
 
int methodNeuronNetwork () const
 
int dedxValid () const
 
int tofValid () const
 
int tofeValid () const
 
int tofqValid () const
 
int tofcValid () const
 
int tofcorrValid () const
 
int emcValid () const
 
int mucValid () const
 
void set_path (const char *s_path=0)
 
void set_path (std::string s_path)
 
 ParticleIDBase ()
 
virtual ~ParticleIDBase ()
 
virtual void init ()=0
 
virtual void calculate ()=0
 
virtual bool IsPidInfoValid () const =0
 
virtual double chi (int n) const =0
 
virtual double prob (int n) const =0
 
virtual int ndof () const =0
 
EvtRecTrackPidTrk () const
 
void setRecTrack (EvtRecTrack *trk)
 
double chiMinCut () const
 
void setChiMinCut (const double chi=4)
 
double chiMaxCut () const
 
void setChiMaxCut (const double chi=6)
 
double pdfMinSigmaCut () const
 
void setPdfMinSigmaCut (const double pdf=4)
 
double getRunNo () const
 
void setRunNo (const double runh=8093)
 
double p ()
 
double pt ()
 
double charge ()
 
double xmass (int n)
 
double velc ()
 
double probCalculate (double chi2, int n)
 
double pdfCalculate (double offset, double sigma)
 
double interpolation (double *x, double *y, double x1)
 
double pol2 (double x, double *par)
 
double pol3 (double x, double *par)
 
double pol4 (double x, double *par)
 
int useDedx () const
 
int useTof () const
 
int useTof1 () const
 
int useTof2 () const
 
int useTofE () const
 
int useTofQ () const
 
int useTofC () const
 
int useTofCorr () const
 
int useEmc () const
 
int useMuc () const
 
int onlyPionKaon () const
 
int onlyPionKaonProton () const
 
int onlyPionKaonElectron () const
 
int all () const
 
int onlyElectron () const
 
int onlyMuon () const
 
int onlyPion () const
 
int onlyKaon () const
 
int onlyProton () const
 
int methodLikelihood () const
 
int methodProbability () const
 
int methodNeuronNetwork () const
 
int dedxValid () const
 
int tofValid () const
 
int tofeValid () const
 
int tofqValid () const
 
int tofcValid () const
 
int tofcorrValid () const
 
int emcValid () const
 
int mucValid () const
 
void set_path (const char *s_path=0)
 
void set_path (std::string s_path)
 

Static Public Member Functions

static TofCorrPIDinstance ()
 
static TofCorrPIDinstance ()
 

Protected Member Functions

int particleIDCalculation ()
 
int neuronPIDCalculation ()
 
int LikelihoodCalculation ()
 
void inputParameter (int run)
 
double offsetTof (unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
 
double offsetTof (unsigned int ispecies, int tofid, double zrhit, double betaGamma, int charge, double dt)
 
double offsetTof (unsigned int ispecies, int tofid1, int tofid2, double zrhit1, double zrhit2, double betaGamma, int charge, double dt)
 
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
 
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, double zrhit, double betaGamma)
 
double qCurveFunc (unsigned int layer, double betaGamma)
 
double bSigma (unsigned int end, int tofid, double zrhit)
 
double bSigma (int tofid[2], double zrhit[2])
 
double eSigma (int tofid, double zrhit)
 
bool correlationCheck (unsigned int ipmt)
 
int particleIDCalculation ()
 
int neuronPIDCalculation ()
 
int LikelihoodCalculation ()
 
void inputParameter (int run)
 
double offsetTof (unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
 
double offsetTof (unsigned int ispecies, int tofid, double zrhit, double betaGamma, int charge, double dt)
 
double offsetTof (unsigned int ispecies, int tofid1, int tofid2, double zrhit1, double zrhit2, double betaGamma, int charge, double dt)
 
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
 
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, double zrhit, double betaGamma)
 
double qCurveFunc (unsigned int layer, double betaGamma)
 
double bSigma (unsigned int end, int tofid, double zrhit)
 
double bSigma (int tofid[2], double zrhit[2])
 
double eSigma (int tofid, double zrhit)
 
bool correlationCheck (unsigned int ipmt)
 
virtual int particleIDCalculation ()=0
 
virtual int LikelihoodCalculation ()=0
 
virtual int particleIDCalculation ()=0
 
virtual int LikelihoodCalculation ()=0
 

Additional Inherited Members

- Static Protected Attributes inherited from ParticleIDBase
static std::string path = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ ~TofCorrPID() [1/2]

TofCorrPID::~TofCorrPID ( )
inline

◆ ~TofCorrPID() [2/2]

TofCorrPID::~TofCorrPID ( )
inline

Member Function Documentation

◆ bSigma() [1/4]

double TofCorrPID::bSigma ( int  tofid[2],
double  zrhit[2] 
)
protected

Definition at line 937 of file TofCorrPID.cxx.

937 {
938
939 double sigma1 = bSigma( 2, tofid[0], zrhit[0] );
940 double sigma2 = bSigma( 2, tofid[1], zrhit[1] );
941 double sigmaCorr2 = m_p_common*m_p_common;
942 double sigma = ( sigma1*sigma1*sigma2*sigma2 - sigmaCorr2*sigmaCorr2 )/( sigma1*sigma1 + sigma2*sigma2 - 2.0*sigmaCorr2 );
943 sigma = sqrt(fabs(sigma));
944
945 return sigma;
946}
double bSigma(unsigned int end, int tofid, double zrhit)
Definition: TofCorrPID.cxx:919

◆ bSigma() [2/4]

double TofCorrPID::bSigma ( int  tofid[2],
double  zrhit[2] 
)
protected

◆ bSigma() [3/4]

double TofCorrPID::bSigma ( unsigned int  end,
int  tofid,
double  zrhit 
)
protected

Definition at line 919 of file TofCorrPID.cxx.

919 {
920
921 double func[5];
922 func[0] = 1.0;
923 func[1] = zrhit;
924 func[2] = zrhit*zrhit;
925 func[3] = zrhit*zrhit*zrhit;
926 func[4] = zrhit*zrhit*zrhit*zrhit;
927
928 double sigma = 0.0;
929 for( unsigned int i=0; i<5; i++ ) {
930 sigma += m_p_weight[tofid][end][i]*func[i];
931 }
932
933 return sigma;
934}

Referenced by bSigma(), offsetTof(), and sigmaTof().

◆ bSigma() [4/4]

double TofCorrPID::bSigma ( unsigned int  end,
int  tofid,
double  zrhit 
)
protected

◆ calculate() [1/2]

void TofCorrPID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 62 of file TofCorrPID.cxx.

62 {
63 if(particleIDCalculation() == 0) m_ndof=1;
64}
int particleIDCalculation()
Definition: TofCorrPID.cxx:67

◆ calculate() [2/2]

void TofCorrPID::calculate ( )
virtual

Implements ParticleIDBase.

◆ chi() [1/2]

double TofCorrPID::chi ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 24 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

24{ return m_chi[n]; }
const Int_t n

◆ chi() [2/2]

double TofCorrPID::chi ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 24 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

24{ return m_chi[n]; }

◆ chiCorr() [1/2]

double TofCorrPID::chiCorr ( int  ipar,
int  ipmt 
) const
inline

◆ chiCorr() [2/2]

double TofCorrPID::chiCorr ( int  ipar,
int  ipmt 
) const
inline

Definition at line 34 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

34{ return m_chiCorr[ipar][ipmt]; }

◆ correlationCheck() [1/2]

bool TofCorrPID::correlationCheck ( unsigned int  ipmt)
protected

Definition at line 965 of file TofCorrPID.cxx.

965 {
966 bool chiCut = false;
967 bool good = false;
968 double pdftemp = 0;
969 for( unsigned int i=0; i<5; i++ ) {
970 if( ( m_chiCorr[i][ipmt]>(0.0-chiMinCut()) && m_chiCorr[i][ipmt]<chiMaxCut() ) && !good ) { good=true; }
971 double ppp = pdfCalculate(m_chiCorr[i][ipmt],1);
972 if( fabs(ppp) > pdftemp) { pdftemp = fabs(ppp); }
973 }
974 m_pdfmin = pdftemp;
975 if( pdftemp < pdfCalculate(pdfMinSigmaCut(),1) ) return chiCut;
976 if( !good ) return chiCut;
977 chiCut = true;
978 return chiCut;
979}
double pdfCalculate(double offset, double sigma)

Referenced by particleIDCalculation().

◆ correlationCheck() [2/2]

bool TofCorrPID::correlationCheck ( unsigned int  ipmt)
protected

◆ dt() [1/2]

double TofCorrPID::dt ( int  ipar,
int  ipmt 
) const
inline

Definition at line 31 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

31{ return m_dt[ipar][ipmt]; }

Referenced by ParticleID::dt().

◆ dt() [2/2]

double TofCorrPID::dt ( int  ipar,
int  ipmt 
) const
inline

Definition at line 31 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

31{ return m_dt[ipar][ipmt]; }

◆ dtCorr() [1/2]

double TofCorrPID::dtCorr ( int  ipar,
int  ipmt 
) const
inline

Definition at line 32 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

32{ return m_dtCorr[ipar][ipmt]; }

Referenced by ParticleID::dtCorr().

◆ dtCorr() [2/2]

double TofCorrPID::dtCorr ( int  ipar,
int  ipmt 
) const
inline

Definition at line 32 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

32{ return m_dtCorr[ipar][ipmt]; }

◆ eSigma() [1/2]

double TofCorrPID::eSigma ( int  tofid,
double  zrhit 
)
protected

Definition at line 949 of file TofCorrPID.cxx.

949 {
950
951 double func[5];
952 func[0] = 1.0;
953 func[1] = zrhit;
954 func[2] = zrhit*zrhit;
955
956 double sigma = 0.0;
957 for( unsigned int i=0; i<3; i++ ) {
958 sigma += m_ec_sigma[tofid][i]*func[i];
959 }
960
961 return sigma;
962}

Referenced by sigmaTof().

◆ eSigma() [2/2]

double TofCorrPID::eSigma ( int  tofid,
double  zrhit 
)
protected

◆ init() [1/2]

void TofCorrPID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 30 of file TofCorrPID.cxx.

30 {
31
32 for(int i = 0; i < 5; i++) {
33 m_chi[i] = -100.0;
34 m_prob[i] = -1.0;
35 m_sigma[i] = 10.0;
36 m_offset[i] = -1000.0;
37 }
38 m_chimin = -99.0;
39 m_chimax = 99.0;
40 m_pdfmin = 99.;
41 m_ndof = 0;
42
43 m_ipmt = -1;
44 for( unsigned int i=0; i<5; i++ ) {
45 for( unsigned int j=0; j<7; j++ ) {
46 m_dt[i][j] = -1000.0;
47 m_dtCorr[i][j] = -1000.0;
48 m_sigCorr[i][j] = 10.0;
49 m_chiCorr[i][j] = 100.0;
50 }
51 }
52
53 int run = getRunNo();
54 if( !( abs(run)>=m_runBegin && abs(run)<=m_runEnd ) ) {
56 }
57
58 return;
59}
void inputParameter(int run)
Definition: TofCorrPID.cxx:304

◆ init() [2/2]

void TofCorrPID::init ( )
virtual

Implements ParticleIDBase.

◆ inputParameter() [1/2]

void TofCorrPID::inputParameter ( int  run)
protected

Definition at line 304 of file TofCorrPID.cxx.

304 {
305
306 std::string filePath = path + "/share/TofCorrPID/";
307
308 filePath = filePath + "jpsi2012";
309 m_runBegin = 0;
310 m_runEnd = 80000;
311
312 if( run>0 ) {
313 filePath = filePath + "/data/";
314 }
315 else {
316 filePath = filePath + "/mc/";
317 }
318
319
320 // weight from tof calibration
321 std::string fileWeight = filePath + "calib_barrel_sigma.txt";
322 ifstream inputWeight( fileWeight.c_str(), std::ios_base::in );
323 if( !inputWeight ) {
324 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileWeight << endl;
325 exit(1);
326 }
327
328 for( unsigned int tofid=0; tofid<176; tofid++ ) {
329 for( unsigned int readout=0; readout<3; readout++ ) {
330 for( unsigned int p_i=0; p_i<5; p_i++ ) {
331 inputWeight >> m_p_weight[tofid][readout][p_i];
332 }
333 }
334 }
335 // cout << "finish read " << fileWeight << endl;
336
337 // common item, from bunch size and bunch time
338 std::string fileCommon = filePath + "calib_barrel_common.txt";
339 ifstream inputCommon( fileCommon.c_str(), std::ios_base::in );
340 if( !inputCommon ) {
341 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileCommon << endl;
342 exit(1);
343 }
344 inputCommon >> m_p_common;
345 // cout << "finish read " << fileCommon << endl;
346
347 // endcap sigma
348 std::string fileEcSigma = filePath + "calib_endcap_sigma.txt";
349 ifstream inputEcSigma( fileEcSigma.c_str(), std::ios_base::in );
350 if( !inputEcSigma ) {
351 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileEcSigma << endl;
352 exit(1);
353 }
354
355 for( unsigned int tofid=0; tofid<96; tofid++ ) {
356 for( unsigned int p_i=0; p_i<3; p_i++ ) {
357 inputEcSigma >> m_ec_sigma[tofid][p_i];
358 }
359 }
360 // cout << "finish read " << fileEcSigma << endl;
361
362 // curve of betaGamma versus Q0
363 std::string fileQ0BetaGamma = filePath + "curve_Q0_BetaGamma.txt";
364 ifstream inputQ0BetaGamma( fileQ0BetaGamma.c_str(), std::ios_base::in );
365 if( !inputQ0BetaGamma ) {
366 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileQ0BetaGamma << endl;
367 exit(1);
368 }
369 // barrel layer1 layer2 and endcap
370 for( unsigned int layer=0; layer<3; layer++ ) {
371 for( unsigned int ipar=0; ipar<5; ipar++ ) {
372 inputQ0BetaGamma >> m_q0_bg[layer][ipar];
373 }
374 }
375 // cout << "finish read " << fileQ0BetaGamma << endl;
376
377 // paramter of A and B
378 std::string fileParAB = filePath + "parameter_A_B.txt";
379 ifstream inputParAB( fileParAB.c_str(), std::ios_base::in );
380 if( !inputParAB ) {
381 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileParAB << endl;
382 exit(1);
383 }
384
385 // Jpsi2012
386 // 0: pion/kaon, 1: proton/anti-proton
387 // 0: inner east, 1: inner west, 2: outer east, 3: outer west, 4: west endcap
388 // 0: plus, 1: minus
389 // 0: parameter A, 1: parameter B
390 for( unsigned int ispecies=0; ispecies<2; ispecies++ ) {
391 for( unsigned int ipmt=0; ipmt<5; ipmt++ ) {
392 for( unsigned int icharge=0; icharge<2; icharge++ ) {
393 for( unsigned int iab=0; iab<2; iab++ ) {
394 for( unsigned int ipar=0; ipar<11; ipar++ ) {
395 inputParAB >> m_par_ab_12[ispecies][ipmt][icharge][iab][ipar];
396 }
397 }
398 }
399 }
400 }
401
402 // sigma for pion, kaon and proton
403 std::string fileSigma = filePath + "parameter_sigma.txt";
404 ifstream inputSigma( fileSigma.c_str(), std::ios_base::in );
405 if( !inputSigma ) {
406 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileSigma << endl;
407 exit(1);
408 }
409 // Jpsi2009 & Jpsi2012
410 // 0: pion, 1: kaon, 2: proton, 3: anti-proton
411 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
412 // 4: inner layer, 5: outer layer, 6: double layer
413 // 7: west endcap
414 for( unsigned int ispecies=0; ispecies<4; ispecies++ ) {
415 for( unsigned int ipmt=0; ipmt<8; ipmt++ ) {
416 for( unsigned int ipar=0; ipar<12; ipar++ ) {
417 inputSigma >> m_par_sigma[ispecies][ipmt][ipar];
418 }
419 }
420 }
421
422 // offset for low momentum proton and anti-proton
423 std::string fileProtonOffset = filePath + "parameter_offset_proton.txt";
424 ifstream inputProtonOffset( fileProtonOffset.c_str(), std::ios_base::in );
425 if( !inputProtonOffset ) {
426 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileProtonOffset << endl;
427 exit(1);
428 }
429
430 // Jpsi2012
431 // 0: proton, 1: anti-proton
432 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
433 // 4: inner layer, 5: outer layer, 6: double layer
434 // 7: west endcap
435 for( unsigned int ispecies=0; ispecies<2; ispecies++ ) {
436 for( unsigned int ipmt=0; ipmt<8; ipmt++ ) {
437 for( unsigned int ipar=0; ipar<20; ipar++ ) {
438 if( ipmt!=7 ) {
439 for( unsigned int jpar=0; jpar<46; jpar++ ) {
440 inputProtonOffset >> m_p_offset_12[ispecies][ipmt][ipar][jpar];
441 }
442 }
443 else {
444 for( unsigned int jpar=0; jpar<7; jpar++ ) {
445 inputProtonOffset >> m_p_offset_ec12[ispecies][ipar][jpar];
446 }
447 }
448 }
449 }
450 }
451 // cout << "finish read " << fileProtonOffset << endl;
452
453 // sigma for low momentum proton and anti-proton
454 std::string fileProtonSigma = filePath + "parameter_sigma_proton.txt";
455 ifstream inputProtonSigma( fileProtonSigma.c_str(), std::ios_base::in );
456 if( !inputProtonSigma ) {
457 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileProtonSigma << endl;
458 exit(1);
459 }
460
461 // Jpsi2012
462 // 0: proton, 1: anti-proton
463 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
464 // 4: inner layer, 5: outer layer, 6: double layer
465 // 7: west endcap
466 for( unsigned int ispecies=0; ispecies<2; ispecies++ ) {
467 for( unsigned int ipmt=0; ipmt<8; ipmt++ ) {
468 for( unsigned int ipar=0; ipar<20; ipar++ ) {
469 if( ipmt!=7 ) {
470 for( unsigned int jpar=0; jpar<46; jpar++ ) {
471 inputProtonSigma >> m_p_sigma_12[ispecies][ipmt][ipar][jpar];
472 }
473 }
474 else {
475 for( unsigned int jpar=0; jpar<7; jpar++ ) {
476 inputProtonSigma >> m_p_sigma_ec12[ispecies][ipar][jpar];
477 }
478 }
479 }
480 }
481 }
482 // cout << "finish read " << fileProtonSigma << endl;
483
484 return;
485}

Referenced by init().

◆ inputParameter() [2/2]

void TofCorrPID::inputParameter ( int  run)
protected

◆ instance() [1/2]

TofCorrPID * TofCorrPID::instance ( )
static

Definition at line 20 of file TofCorrPID.cxx.

20 {
21 if(!m_pointer) m_pointer = new TofCorrPID();
22 return m_pointer;
23}

Referenced by ParticleID::init().

◆ instance() [2/2]

static TofCorrPID * TofCorrPID::instance ( )
static

◆ ipmt() [1/2]

int TofCorrPID::ipmt ( ) const
inline

◆ ipmt() [2/2]

int TofCorrPID::ipmt ( ) const
inline

Definition at line 30 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

30{ return m_ipmt; }

◆ IsPidInfoValid() [1/2]

bool TofCorrPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

23{ return (m_ndof > 0); }

◆ IsPidInfoValid() [2/2]

bool TofCorrPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

23{ return (m_ndof > 0); }

◆ LikelihoodCalculation() [1/2]

int TofCorrPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 40 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

40{return -1;}

◆ LikelihoodCalculation() [2/2]

int TofCorrPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 40 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

40{return -1;}

◆ ndof() [1/2]

int TofCorrPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 28 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

28{ return m_ndof; }

◆ ndof() [2/2]

int TofCorrPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 28 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

28{ return m_ndof; }

◆ neuronPIDCalculation() [1/2]

int TofCorrPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 39 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

39{ return -1;}

◆ neuronPIDCalculation() [2/2]

int TofCorrPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 39 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

39{ return -1;}

◆ offset() [1/2]

double TofCorrPID::offset ( int  n) const
inline

Definition at line 26 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

26{ return m_offset[n]; }

Referenced by ParticleID::offset(), and particleIDCalculation().

◆ offset() [2/2]

double TofCorrPID::offset ( int  n) const
inline

Definition at line 26 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

26{ return m_offset[n]; }

◆ offsetTof() [1/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
bool  barrel,
unsigned int  ipmt,
double  betaGamma,
int  charge,
double  zrhit,
double  dt 
)
protected

Definition at line 488 of file TofCorrPID.cxx.

488 {
489 if( ispecies==0 || ispecies==1 ) { return dt; }
490
491 double deltaT = -1000.0;
492 if( ( ipmt>= 4 && barrel ) || ( ipmt!=7 && ipmt!=8 && !barrel ) || betaGamma<0.0 || abs(charge)!=1 || fabs(zrhit)>120.0 ) {
493 cout << "Particle::TofCorrPID: offsetTof for single end: the input parameter are NOT correct! Please check them!" << endl;
494 return deltaT;
495 }
496 unsigned int layer=0;
497 if( barrel ) {
498 if( ipmt==0 || ipmt==1 ) { layer=0; }
499 else if( ipmt==2 || ipmt==3 ) { layer=1; }
500 }
501 else { layer=2; }
502 double q0 = qCurveFunc( layer, betaGamma );
503
504 unsigned int inumber=ipmt;
505 if( !barrel ) { inumber=4; }
506
507 double func[9];
508 for( unsigned int i=0; i<9; i++ ) {
509 func[i]=0.0;
510 }
511
512 double parA = 0.0;
513 double parB = 0.0;
514
515 // Jpsi2012
516 func[0] = 1.0;
517 for( unsigned int i=1; i<8; i++ ) {
518 func[i] = func[i-1]*zrhit;
519 }
520
521 unsigned int iparticle=0;
522 if( ispecies==2 || ispecies==3 ) { iparticle=0; }
523 else if( ispecies==4 ) { iparticle=1; }
524 unsigned int icharge=0;
525 if( charge==1 ) { icharge=0; }
526 else if( charge==-1 ) { icharge=1; }
527
528 if( ispecies!=4 || betaGamma*xmass(4)>0.8 ) {
529 for( unsigned int i=0; i<8; i++ ) {
530 if( i<5 ) {
531 parA += m_par_ab_12[iparticle][inumber][icharge][0][i]*func[i];
532 parB += m_par_ab_12[iparticle][inumber][icharge][1][i]*func[i];
533 }
534 else if( i>=5 ) {
535 parA += m_par_ab_12[iparticle][inumber][icharge][0][i+3]*func[i];
536 parB += m_par_ab_12[iparticle][inumber][icharge][1][i+3]*func[i];
537 }
538 }
539 for( unsigned int iab=0; iab<2; iab++ ) {
540 func[8] = m_par_ab_12[iparticle][inumber][icharge][iab][5]*TMath::Gaus(zrhit,m_par_ab_12[iparticle][inumber][icharge][iab][6], m_par_ab_12[iparticle][inumber][icharge][iab][7]);
541 if( iab==0 ) {
542 parA += func[8];
543 }
544 else if( iab==1 ) {
545 parB += func[8];
546 }
547 }
548 }
549
550 double tcorr = parA + parB/sqrt(q0);
551
552 // barrel TOF low momentum proton and anti-proton
553 // Jpsi2012
554 if( barrel && ispecies==4 && betaGamma*xmass(4)<0.8 ) {
555 int nzbin = 46;
556 double zbegin = -115.0;
557 double zend = 115.0;
558 double zstep = (zend-zbegin)/nzbin;
559
560 double nbgbin = 20.0;
561 double bgbegin = 0.3;
562 double bgend = 0.8;
563 double bgstep;
564 bgstep = (bgend-bgbegin)/nbgbin;
565
566 int izbin = static_cast<int>((zrhit-zbegin)/zstep);
567 if( izbin<0 ) { izbin=0; }
568 else if( izbin>=nzbin ) { izbin=nzbin-1; }
569 int ibgbin = static_cast<int>((betaGamma*xmass(4)-bgbegin)/bgstep);
570 if( ibgbin<0 ) { ibgbin=0; }
571 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
572
573 if( charge==1 ) {
574 tcorr = m_p_offset_12[0][ipmt][ibgbin][izbin];
575 }
576 else {
577 tcorr = m_p_offset_12[1][ipmt][ibgbin][izbin];
578 }
579 }
580 else if( !barrel && ispecies==4 && betaGamma*xmass(4)<0.8 ) {
581 int nrbin = 7;
582 double rbegin = 55.0;
583 double rend = 83.0;
584 double rstep = (rend-rbegin)/nrbin;
585
586 double nbgbin = 20.0;
587 double bgbegin = 0.3;
588 double bgend = 0.8;
589 double bgstep;
590 bgstep = (bgend-bgbegin)/nbgbin;
591
592 int irbin = static_cast<int>((zrhit-rbegin)/rstep);
593 if( irbin<0 ) { irbin=0; }
594 else if( irbin>=nrbin ) { irbin=nrbin-1; }
595 int ibgbin = static_cast<int>((betaGamma*xmass(4)-bgbegin)/bgstep);
596 if( ibgbin<0 ) { ibgbin=0; }
597 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
598
599 if( charge==1 ) {
600 tcorr = m_p_offset_ec12[0][ibgbin][irbin];
601 }
602 else {
603 tcorr = m_p_offset_ec12[1][ibgbin][irbin];
604 }
605 }
606
607 deltaT = dt - tcorr;
608
609 return deltaT;
610}
const double xmass[5]
Definition: Gam4pikp.cxx:50
TGraph2DErrors * dt
Definition: McCor.cxx:45
double qCurveFunc(unsigned int layer, double betaGamma)
Definition: TofCorrPID.cxx:904

Referenced by particleIDCalculation().

◆ offsetTof() [2/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
bool  barrel,
unsigned int  ipmt,
double  betaGamma,
int  charge,
double  zrhit,
double  dt 
)
protected

◆ offsetTof() [3/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
int  tofid,
double  zrhit,
double  betaGamma,
int  charge,
double  dt 
)
protected

Definition at line 613 of file TofCorrPID.cxx.

613 {
614 if( ispecies==0 || ispecies==1 ) { return dt; }
615
616 double deltaT = -1000.0;
617 if( tofid<0 || tofid>=176 ) {
618 cout << "Particle::TofCorrPID: offsetTof for single layer: the input parameter are NOT correct! Please check them!" << endl;
619 exit(1);
620 }
621 int pmt[3] = { -9, -9, -9 };
622 if( tofid>=0 && tofid<=87 ) {
623 pmt[0] = 0;
624 pmt[1] = 1;
625 pmt[2] = 4;
626 }
627 else {
628 pmt[0] = 2;
629 pmt[1] = 3;
630 pmt[2] = 5;
631 }
632
633 double sigmaCorr2 = m_p_common*m_p_common;
634 double sigmaLeft = bSigma( 0, tofid, zrhit );
635 double sigmaLeft2 = sigmaLeft*sigmaLeft;
636 double sigmaRight = bSigma( 1, tofid, zrhit );
637 double sigmaRight2 = sigmaRight*sigmaRight;
638
639 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
640 deltaT = fraction*m_dtCorr[ispecies][pmt[0]] + (1.0-fraction)*m_dtCorr[ispecies][pmt[1]];
641
642 // Jpsi2012
643 double tcorr = 0.0;
644 unsigned int ipmt = 4;
645 if( tofid>=88 && tofid<176 ) { ipmt = 5; }
646 if( ispecies==4 && betaGamma*xmass(4)<0.8 ) {
647 int nzbin = 46;
648 double zbegin = -115.0;
649 double zend = 115.0;
650 double zstep = (zend-zbegin)/nzbin;
651
652 double nbgbin = 20.0;
653 double bgbegin = 0.3;
654 double bgend = 0.8;
655 double bgstep;
656 bgstep = (bgend-bgbegin)/nbgbin;
657
658 int izbin = static_cast<int>((zrhit-zbegin)/zstep);
659 if( izbin<0 ) { izbin=0; }
660 else if( izbin>=nzbin ) { izbin=nzbin-1; }
661 int ibgbin = static_cast<int>((betaGamma*xmass(4)-bgbegin)/bgstep);
662 if( ibgbin<0 ) { ibgbin=0; }
663 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
664
665 if( charge==1 ) {
666 tcorr = m_p_offset_12[0][ipmt][ibgbin][izbin];
667 }
668 else {
669 tcorr = m_p_offset_12[1][ipmt][ibgbin][izbin];
670 }
671 }
672 deltaT = deltaT - tcorr;
673
674 return deltaT;
675}

◆ offsetTof() [4/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
int  tofid,
double  zrhit,
double  betaGamma,
int  charge,
double  dt 
)
protected

◆ offsetTof() [5/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
int  tofid1,
int  tofid2,
double  zrhit1,
double  zrhit2,
double  betaGamma,
int  charge,
double  dt 
)
protected

Definition at line 678 of file TofCorrPID.cxx.

678 {
679 if( ispecies==0 || ispecies==1 ) { return dt; }
680
681 double deltaT = -1000.0;
682 if( tofid1<0 || tofid1>=88 || tofid2<88 || tofid2>=176 ) {
683 cout << "Particle::TofCorrPID: offsetTof for double layer: the input parameter are NOT correct! Please check them!" << endl;
684 exit(1);
685 }
686
687 double sigmaCorr2 = m_p_common*m_p_common;
688 double sigmaInner = bSigma( 2, tofid1, zrhit1 );
689 double sigmaInner2 = sigmaInner*sigmaInner;
690 double sigmaOuter = bSigma( 2, tofid2, zrhit2 );
691 double sigmaOuter2 = sigmaOuter*sigmaOuter;
692 double sigma = sqrt( (sigmaInner2*sigmaOuter2-sigmaCorr2*sigmaCorr2)/(sigmaInner2+sigmaOuter2-2.0*sigmaCorr2) );
693
694 m_sigma[0] = sigma;
695 m_sigma[1] = sigma;
696
697 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
698 deltaT = fraction*m_dtCorr[ispecies][4] + (1.0-fraction)*m_dtCorr[ispecies][5];
699
700 // Jpsi2012
701 double tcorr = 0.0;
702 if( ispecies==4 && betaGamma*xmass(4)<0.8 ) {
703 int nzbin = 46;
704 double zbegin = -115.0;
705 double zend = 115.0;
706 double zstep = (zend-zbegin)/nzbin;
707
708 double nbgbin = 20.0;
709 double bgbegin = 0.3;
710 double bgend = 0.8;
711 double bgstep;
712 bgstep = (bgend-bgbegin)/nbgbin;
713
714 int izbin = static_cast<int>((zrhit1-zbegin)/zstep);
715 if( izbin<0 ) { izbin=0; }
716 else if( izbin>=nzbin ) { izbin=nzbin-1; }
717 int ibgbin = static_cast<int>((betaGamma*xmass(4)-bgbegin)/bgstep);
718 if( ibgbin<0 ) { ibgbin=0; }
719 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
720
721 if( charge==1 ) {
722 tcorr = m_p_offset_12[0][6][ibgbin][izbin];
723 }
724 else {
725 tcorr = m_p_offset_12[1][6][ibgbin][izbin];
726 }
727 }
728 deltaT = deltaT - tcorr;
729
730 return deltaT;
731}

◆ offsetTof() [6/6]

double TofCorrPID::offsetTof ( unsigned int  ispecies,
int  tofid1,
int  tofid2,
double  zrhit1,
double  zrhit2,
double  betaGamma,
int  charge,
double  dt 
)
protected

◆ particleIDCalculation() [1/2]

int TofCorrPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 67 of file TofCorrPID.cxx.

67 {
68 int irc=-1;
69
70 EvtRecTrack* recTrk = PidTrk();
71 if(!(recTrk->isMdcTrackValid())) return irc;
72 if(!(recTrk->isMdcKalTrackValid())) return irc;
73 if(!(recTrk->isExtTrackValid())) return irc;
74 if(!(recTrk->isTofTrackValid())) return irc;
75
76#ifndef BEAN
77 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
78 SmartRefVector<RecTofTrack>::iterator it;
79#else
80 const std::vector<TTofTrack* >& tofTrk = recTrk->tofTrack();
81 std::vector<TTofTrack* >::const_iterator it;
82#endif
83
84 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
85 int charge = mdcTrk->charge();
86
87 double p[5], betaGamma[5];
88 RecMdcKalTrack* kalTrk = recTrk->mdcKalTrack();
89 for( int i=0; i<5; i++ ) {
90 if( i==0 ) {
92 }
93 else if( i==1 ) {
95 }
96 else if( i==2 ) {
98 }
99 else if( i==3 ) {
101 }
102 else if( i==4 ) {
104 }
105#ifndef BEAN
106 HepLorentzVector ptrk = kalTrk->p4();
107#else
108 HepLorentzVector ptrk = kalTrk->p4( xmass(i) );
109#endif
110 p[i] = ptrk.rho();
111 betaGamma[i] = p[i]/xmass(i);
112 }
113
114 double zrhit[2];
115 RecExtTrack* extTrk = recTrk->extTrack();
116 zrhit[0] = extTrk->tof1Position().z();
117 zrhit[1] = extTrk->tof2Position().z();
118
119 int tofid[2] = { -9, -9 };
120
121 m_ipmt = -1;
122 bool readFile = false;
123 bool signal[2] = { false, false };
124 TofHitStatus *hitst = new TofHitStatus;
125 for( it = tofTrk.begin(); it!=tofTrk.end(); it++ ) {
126 unsigned int st = (*it)->status();
127 hitst->setStatus(st);
128 if( hitst->is_raw() ) return irc; // TOF no hit
129 bool barrel = hitst->is_barrel();
130 bool ismrpc = hitst->is_mrpc();
131 if( !barrel && !ismrpc ) { zrhit[0] = extTrk->tof1Position().rho(); }
132 bool readout = hitst->is_readout();
133 bool counter = hitst->is_counter();
134 bool cluster = hitst->is_cluster();
135 int layer = hitst->layer();
136 tofid[layer-1] = (*it)->tofID();
137 bool east = hitst->is_east();
138 double tof = (*it)->tof();
139 unsigned int ipmt = 0;
140 if( readout ) {
141 // barrel: 0:inner east, 1:inner west, 2:outer east, 3: outer west
142 // endcap: 7:east endcap, 8:west endcap
143 if( barrel ) { ipmt = ( ( st & 0xC0 ) >> 5 ) + ( ( ( st ^ 0x20 ) & 0x20 ) >> 5 ) - 2; }
144 else {
145 if( !ismrpc ) {
146 if( tofid[0]<=47 ) { ipmt = 7; }
147 else { ipmt = 8; }
148 }
149 else {
150 if( tofid[0]<=35 ) { ipmt = 7; }
151 else { ipmt = 8; }
152 }
153 }
154
155 for( unsigned int i=0; i<5; i++ ) {
156 double offset = (*it)->toffset(i);
157 double texp = (*it)->texp(i);
158 if( texp<0.0 ) continue;
159 double dt = tof - offset - texp;
160 if( barrel ) {
161 m_dt[i][ipmt] = dt;
162 m_dtCorr[i][ipmt] = offsetTof( i, barrel, ipmt, betaGamma[i], charge, zrhit[layer-1], dt );
163 m_sigCorr[i][ipmt] = sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
164 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt]/m_sigCorr[i][ipmt];
165 }
166 else {
167 if( !ismrpc ) {
168 m_dt[i][0] = dt;
169 m_dtCorr[i][0] = offsetTof( i, barrel, ipmt, betaGamma[i], charge, zrhit[layer-1], dt );
170 m_sigCorr[i][0] = sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
171 m_chiCorr[i][0] = m_dtCorr[i][ipmt]/m_sigCorr[i][ipmt];
172 }
173 else {
174 m_dt[i][0] = dt;
175 m_dtCorr[i][0] = dt;
176 m_sigCorr[i][0] = 0.065;
177 m_chiCorr[i][0] = m_dtCorr[i][0]/m_sigCorr[i][0];
178 }
179 }
180 }
181 if( counter && cluster ) {
182 m_ipmt = ipmt;
183 for( unsigned int i=0; i<5; i++ ) {
184 if( ((*it)->texp(i))>0.0 ) {
185 if( barrel ) {
186 m_offset[i] = m_dtCorr[i][ipmt];
187 m_sigma[i] = m_sigCorr[i][ipmt];
188 }
189 else {
190 m_offset[i] = m_dtCorr[i][0];
191 m_sigma[i] = m_sigCorr[i][0];
192 }
193 }
194 }
195 }
196 }
197 else {
198 if( counter ) {
199 ipmt = layer+3;
200 for( unsigned int i=0; i<5; i++ ) {
201 double offset = (*it)->toffset(i);
202 double texp = (*it)->texp(i);
203 if( texp<0.0 ) continue;
204 double dt = tof - offset - texp;
205 if( barrel ) {
206 m_dt[i][ipmt] = dt;
207 m_dtCorr[i][ipmt] = offsetTof( i, tofid[layer-1], zrhit[layer-1], betaGamma[i], charge, dt );
208 m_sigCorr[i][ipmt] = sigmaTof( i, charge, barrel, layer+3, &tofid[0], &zrhit[0], betaGamma[i] );
209 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt]/m_sigCorr[i][ipmt];
210 }
211 else {
212 if( ismrpc ) {
213 m_dt[i][0] = dt;
214 m_dtCorr[i][0] = dt;
215 m_sigCorr[i][0] = 0.065;
216 m_chiCorr[i][0] = m_dtCorr[i][0]/m_sigCorr[i][0];
217 }
218 else {
219 cout << "ParticleID: TofCorr::particleIDCalculation: Endcap Scintillator TOF have more than one end!!!" << endl;
220 }
221 }
222 }
223 if( cluster ) {
224 m_ipmt = ipmt;
225 for( unsigned int i=0; i<5; i++ ) {
226 if( ((*it)->texp(i))>0.0 ) {
227 if( barrel ) {
228 m_offset[i] = m_dtCorr[i][ipmt];
229 m_sigma[i] = m_sigCorr[i][ipmt];
230 }
231 else {
232 m_offset[i] = m_dtCorr[i][0];
233 m_sigma[i] = m_sigCorr[i][0];
234 }
235 }
236 }
237 }
238 else {
239 signal[layer-1] = correlationCheck( ipmt );
240 }
241 }
242 else {
243 if( cluster ) {
244 ipmt = 6;
245 for( unsigned int i=0; i<5; i++ ) {
246 double offset = (*it)->toffset(i);
247 double texp = (*it)->texp(i);
248 if( texp<0.0 ) continue;
249 double dt = tof - offset - texp;
250 m_dt[i][ipmt] = dt;
251 m_dtCorr[i][ipmt] = offsetTof( i, tofid[0], tofid[1], zrhit[0], zrhit[1], betaGamma[i], charge, dt );
252 m_sigCorr[i][ipmt] = sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
253 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt]/m_sigCorr[i][ipmt];
254 }
255 if( signal[0] && signal[1] ) {
256 m_ipmt = 6;
257 for( unsigned int i=0; i<5; i++ ) {
258 m_offset[i] = m_dtCorr[i][ipmt];
259 m_sigma[i] = m_sigCorr[i][ipmt];
260 }
261 }
262 else if( signal[0] && !signal[1] ) {
263 m_ipmt = 4;
264 for( unsigned int i=0; i<5; i++ ) {
265 m_offset[i] = m_dtCorr[i][4];
266 m_sigma[i] = m_sigCorr[i][4];
267 }
268 }
269 else if( !signal[0] && signal[1] ) {
270 m_ipmt = 5;
271 for( unsigned int i=0; i<5; i++ ) {
272 m_offset[i] = m_dtCorr[i][5];
273 m_sigma[i] = m_sigCorr[i][5];
274 }
275 }
276 else return irc;
277 }
278 }
279 }
280 }
281
282
283 double pdftemp = 0;
284 for( unsigned int i=0; i<5; i++ ) {
285 m_chi[i] = m_offset[i]/m_sigma[i];
286 if( m_chi[i]<0. && m_chi[i]>m_chimin ) { m_chimin = m_chi[i]; }
287 if( m_chi[i]>0. && m_chi[i]<m_chimax ) { m_chimax = m_chi[i]; }
288 double ppp = pdfCalculate(m_chi[i],1);
289 if( fabs(ppp) > pdftemp) { pdftemp = fabs(ppp); }
290 }
291
292 m_pdfmin = pdftemp;
293 if( pdftemp < pdfCalculate(pdfMinSigmaCut(),1) ) return irc;
294 if( ( m_chimin > -90.0 && (0-m_chimin)>chiMinCut() ) && ( m_chimax < 90.0 && m_chimax>chiMaxCut() ) ) return irc;
295 for(int i = 0; i < 5; i++) {
296 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
297 }
298
299 irc = 0;
300 return irc;
301}
const HepLorentzVector p4() const
double probCalculate(double chi2, int n)
double sigmaTof(unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
Definition: TofCorrPID.cxx:734
double offsetTof(unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
Definition: TofCorrPID.cxx:488
bool correlationCheck(unsigned int ipmt)
Definition: TofCorrPID.cxx:965
void setStatus(unsigned int status)

Referenced by calculate().

◆ particleIDCalculation() [2/2]

int TofCorrPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

◆ prob() [1/2]

double TofCorrPID::prob ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 25 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

25{ return m_prob[n]; }

◆ prob() [2/2]

double TofCorrPID::prob ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 25 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

25{ return m_prob[n]; }

◆ qCurveFunc() [1/2]

double TofCorrPID::qCurveFunc ( unsigned int  layer,
double  betaGamma 
)
protected

Definition at line 904 of file TofCorrPID.cxx.

904 {
905 double q0 = -100.0;
906 if( layer>=3 || betaGamma<0.0 ) {
907 cout << "Particle::TofCorrPID::qCurveFunc: the input parameter are NOT correct! Please check them!" << endl;
908 return q0;
909 }
910
911 double beta = betaGamma/sqrt(1.0+betaGamma*betaGamma);
912 double logterm = log( m_q0_bg[layer][2]+pow((1.0/betaGamma), m_q0_bg[layer][4] ) );
913 q0 = m_q0_bg[layer][0]*( m_q0_bg[layer][1]-pow( beta, m_q0_bg[layer][3] ) - logterm )/pow( beta, m_q0_bg[layer][3] );
914
915 return q0;
916}

Referenced by offsetTof().

◆ qCurveFunc() [2/2]

double TofCorrPID::qCurveFunc ( unsigned int  layer,
double  betaGamma 
)
protected

◆ sigCorr() [1/2]

double TofCorrPID::sigCorr ( int  ipar,
int  ipmt 
) const
inline

Definition at line 33 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

33{ return m_sigCorr[ipar][ipmt]; }

Referenced by ParticleID::sigCorr().

◆ sigCorr() [2/2]

double TofCorrPID::sigCorr ( int  ipar,
int  ipmt 
) const
inline

Definition at line 33 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

33{ return m_sigCorr[ipar][ipmt]; }

◆ sigma() [1/2]

double TofCorrPID::sigma ( int  n) const
inline

Definition at line 27 of file Analysis/ParticleID/ParticleID-00-04-61/ParticleID/TofCorrPID.h.

27{ return m_sigma[n]; }

Referenced by bSigma(), eSigma(), offsetTof(), ParticleID::sigma(), and sigmaTof().

◆ sigma() [2/2]

double TofCorrPID::sigma ( int  n) const
inline

Definition at line 27 of file InstallArea/include/ParticleID/ParticleID/TofCorrPID.h.

27{ return m_sigma[n]; }

◆ sigmaTof() [1/4]

double TofCorrPID::sigmaTof ( unsigned int  ispecies,
int  charge,
bool  barrel,
unsigned int  ipmt,
double  zrhit,
double  betaGamma 
)
protected

Definition at line 777 of file TofCorrPID.cxx.

777 {
778
779 int ibgbin = -1;
780 int izbin = 0;
781 // Jpsi2012
782 if( ispecies==4 && (betaGamma*xmass(4))<0.8 ) {
783 double nbgbin = 20.0;
784 double bgbegin = 0.3;
785 double bgend = 0.8;
786 double bgstep;
787 bgstep = (bgend-bgbegin)/nbgbin;
788 ibgbin = static_cast<int>((betaGamma*xmass(4)-bgbegin)/bgstep);
789
790 if( ibgbin<0 ) { ibgbin=0; }
791 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
792
793 if( barrel ) {
794 int nzbin = 46;
795 double zbegin = -115.0;
796 double zend = 115.0;
797 double zstep = (zend-zbegin)/nzbin;
798
799 izbin = static_cast<int>((zrhit-zbegin)/zstep);
800 if( izbin<0 ) { izbin=0; }
801 else if( izbin>=nzbin ) { izbin=nzbin-1; }
802 }
803 else {
804 int nzbin = 7;
805 double zbegin = 55.0;
806 double zend = 83.0;
807 double zstep = (zend-zbegin)/nzbin;
808
809 izbin = static_cast<int>((zrhit-zbegin)/zstep);
810 if( izbin<0 ) { izbin=0; }
811 else if( izbin>=nzbin ) { izbin=nzbin-1; }
812 }
813 }
814
815 unsigned int numParam = 4;
816 double func[12];
817 for( unsigned int i=0; i<4; i++ ) {
818 if( i==0 ) { func[i] = 1.0; }
819 else {
820 func[i] = func[i-1]*zrhit;
821 }
822 }
823 for( unsigned int i=4; i<12; i++ ) {
824 func[i] = 0.0;
825 }
826
827 // Jpsi2012
828 if( barrel ) { // barrel
829 if( ispecies==2 || ispecies==3 ) { // pion / kaon
830 for( unsigned int i=4; i<10; i++ ) {
831 func[i] = func[i-1]*zrhit;
832 }
833 func[10] = 1.0/(115.0-zrhit)/(115.0-zrhit);
834 func[11] = 1.0/(115.0+zrhit)/(115.0+zrhit);
835 numParam = 12;
836 }
837 else if( ispecies==4 ) { // proton / anti-proton
838 for( unsigned int i=4; i<12; i++ ) {
839 func[i] = func[i-1]*zrhit;
840 }
841 numParam = 12;
842 }
843 }
844 else { // endcap
845 numParam = 4;
846 }
847
848 unsigned int inumber = ipmt;
849 if( !barrel ) { inumber=7; }
850
851 double sigma = 0.0;
852 if( ispecies==2 || ispecies==3 ) { // pion / kaon
853 for( unsigned int i=0; i<numParam; i++ ) {
854 sigma += m_par_sigma[ispecies-2][inumber][i]*func[i];
855 }
856 }
857 else if( ispecies==4 ) {
858 if( ibgbin!=-1 ) {
859 // Jpsi2012
860 if( barrel ) {
861 if( charge==1 ) {
862 sigma = m_p_sigma_12[0][inumber][ibgbin][izbin];
863 }
864 else {
865 sigma = m_p_sigma_12[1][inumber][ibgbin][izbin];
866 }
867 }
868 else {
869 if( charge==1 ) {
870 sigma = m_p_sigma_ec12[0][ibgbin][izbin];
871 }
872 else {
873 sigma = m_p_sigma_ec12[1][ibgbin][izbin];
874 }
875 }
876 if( fabs(sigma+999.0)<1.0e-6 ) {
877 sigma = 0.001;
878 }
879 }
880 else {
881 for( unsigned int i=0; i<numParam; i++ ) {
882 if( charge==1 ) {
883 sigma += m_par_sigma[2][inumber][i]*func[i];
884 }
885 else {
886 sigma += m_par_sigma[3][inumber][i]*func[i];
887 }
888 }
889 }
890 }
891
892 // Jpsi2012
893 int run = getRunNo();
894 if( run>0 ) {
895 if( ispecies==2 ) {
896 sigma = sigma*(TMath::Exp((betaGamma-0.356345)/(-0.767124))+0.994072);
897 }
898 }
899
900 return sigma;
901}

◆ sigmaTof() [2/4]

double TofCorrPID::sigmaTof ( unsigned int  ispecies,
int  charge,
bool  barrel,
unsigned int  ipmt,
double  zrhit,
double  betaGamma 
)
protected

◆ sigmaTof() [3/4]

double TofCorrPID::sigmaTof ( unsigned int  ispecies,
int  charge,
bool  barrel,
unsigned int  ipmt,
int  tofid[2],
double  zrhit[2],
double  betaGamma 
)
protected

Definition at line 734 of file TofCorrPID.cxx.

734 {
735
736 double sigma = 1.0e-6;
737
738 if( ispecies==0 || ispecies==1 ) {
739 if( barrel ) {
740 if( ipmt==0 ) {
741 sigma = bSigma( 0, tofid[0], zrhit[0] );
742 }
743 else if( ipmt==1 ) {
744 sigma = bSigma( 1, tofid[0], zrhit[0] );
745 }
746 else if( ipmt==2 ) {
747 sigma = bSigma( 0, tofid[1], zrhit[1] );
748 }
749 else if( ipmt==3 ) {
750 sigma = bSigma( 1, tofid[1], zrhit[1] );
751 }
752 else if( ipmt==4 ) {
753 sigma = bSigma( 2, tofid[0], zrhit[0] );
754 }
755 else if( ipmt==5 ) {
756 sigma = bSigma( 2, tofid[1], zrhit[1] );
757 }
758 else if( ipmt==6 ) {
759 sigma = bSigma( &tofid[0], &zrhit[0] );
760 }
761 }
762 else {
763 sigma = eSigma( tofid[0], zrhit[0] );
764 }
765 }
766 else {
767 unsigned int iz = 0;
768 if( ipmt==2 || ipmt==3 || ipmt==5 ) { iz=1; }
769
770 sigma = sigmaTof( ispecies, charge, barrel, ipmt, zrhit[iz], betaGamma );
771 }
772
773 return sigma;
774}
double eSigma(int tofid, double zrhit)
Definition: TofCorrPID.cxx:949

Referenced by particleIDCalculation(), and sigmaTof().

◆ sigmaTof() [4/4]

double TofCorrPID::sigmaTof ( unsigned int  ispecies,
int  charge,
bool  barrel,
unsigned int  ipmt,
int  tofid[2],
double  zrhit[2],
double  betaGamma 
)
protected

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