BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
SimplePIDSvc Class Reference

#include <SimplePIDSvc.h>

+ Inheritance diagram for SimplePIDSvc:

Public Member Functions

 SimplePIDSvc (const std::string &name, ISvcLocator *svcLoc)
 
virtual ~SimplePIDSvc ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void setdedxminchi (double x)
 
void settofminchi (double x)
 
void seteidratio (double x)
 
void preparePID (EvtRecTrack *track)
 
bool iselectron (bool emc=true)
 
bool ispion ()
 
bool iskaon ()
 
double probElectron ()
 
double probMuon ()
 
double probPion ()
 
double probKaon ()
 
double probProton ()
 
double getdEdxChi (int i)
 
double getTOFChi (int i)
 
double getEmcLikelihood (int i)
 
double getChi2 (int i)
 
double getTofDt (int m, int n)
 
double getTofPh (int n)
 
double getTofZR (int n)
 
int getTofCounter (int n)
 
int getTofBarrel ()
 
double getEmcE ()
 
double getEmcE13 ()
 
double getEmcE35 ()
 
double getEmcLatMoment ()
 
double getEmcSecMoment ()
 
double getElectronLikelihood ()
 

Friends

class CnvFactory< SimplePIDSvc >
 

Detailed Description

Definition at line 25 of file SimplePIDSvc.h.

Constructor & Destructor Documentation

◆ SimplePIDSvc()

SimplePIDSvc::SimplePIDSvc ( const std::string & name,
ISvcLocator * svcLoc )

Definition at line 21 of file SimplePIDSvc.cxx.

21 : base_class(name, svcLoc)
22{
23 declareProperty("DedxChiCut", m_dedx_chi_cut = 4);
24 declareProperty("TofChiCut", m_tof_chi_cut = 4);
25 declareProperty("IsTofCorr", m_tof_corr = true);
26 declareProperty("IsDedxCorr", m_dedx_corr = true);
27 declareProperty("EidRatio", m_eid_ratio = 0.80);
28}

◆ ~SimplePIDSvc()

SimplePIDSvc::~SimplePIDSvc ( )
virtual

Definition at line 30 of file SimplePIDSvc.cxx.

30{;}

Member Function Documentation

◆ finalize()

StatusCode SimplePIDSvc::finalize ( )
virtual

Definition at line 47 of file SimplePIDSvc.cxx.

48{
49 MsgStream log(messageService(), name());
50 log << MSG::INFO << "in SimplePIDSvc finalize()" << endreq;
51
52 StatusCode sc = Service::finalize();
53
54 for (unsigned int i = 0; i < 2; i++)
55 {
56 for (unsigned int j = 0; j < 4; j++)
57 {
58 f_dedx[i][j]->Close();
59 f_tof_q[i][j]->Close();
60 f_tof_bgcost[i][j]->Close();
61 f_tof_wgt[i][j]->Close();
62 f_tof_final[i][j]->Close();
63 f_tofec_q[i][j]->Close();
64 f_tofec_bg[i][j]->Close();
65 f_tofec_cost[i][j]->Close();
66 }
67 }
68 for (unsigned int i = 0; i < 3; i++)
69 {
70 for (unsigned int j = 0; j < 4; j++)
71 {
72 f_emc[i][j]->Close();
73 }
74 }
75
76 return sc;
77}

◆ getChi2()

double SimplePIDSvc::getChi2 ( int i)

Definition at line 1375 of file SimplePIDSvc.cxx.

1376{
1377 return pow(m_dedx_chi[i], 2) + pow(m_tof_chi[i], 2);
1378}

◆ getdEdxChi()

double SimplePIDSvc::getdEdxChi ( int i)
inline

Definition at line 51 of file SimplePIDSvc.h.

51{ return m_dedx_chi[i]; }

◆ getElectronLikelihood()

double SimplePIDSvc::getElectronLikelihood ( )
inline

Definition at line 67 of file SimplePIDSvc.h.

67{ return m_lh_electron; }

◆ getEmcE()

double SimplePIDSvc::getEmcE ( )
inline

Definition at line 62 of file SimplePIDSvc.h.

62{ return m_emc_e; }

◆ getEmcE13()

double SimplePIDSvc::getEmcE13 ( )
inline

Definition at line 63 of file SimplePIDSvc.h.

63{ return m_emc_e13; }

◆ getEmcE35()

double SimplePIDSvc::getEmcE35 ( )
inline

Definition at line 64 of file SimplePIDSvc.h.

64{ return m_emc_e35; }

◆ getEmcLatMoment()

double SimplePIDSvc::getEmcLatMoment ( )
inline

Definition at line 65 of file SimplePIDSvc.h.

65{ return m_emc_lat; }

◆ getEmcLikelihood()

double SimplePIDSvc::getEmcLikelihood ( int i)
inline

Definition at line 53 of file SimplePIDSvc.h.

53{ return m_emc_likelihood[i]; }

◆ getEmcSecMoment()

double SimplePIDSvc::getEmcSecMoment ( )
inline

Definition at line 66 of file SimplePIDSvc.h.

66{ return m_emc_sec; }

◆ getTofBarrel()

int SimplePIDSvc::getTofBarrel ( )
inline

Definition at line 61 of file SimplePIDSvc.h.

61{ return m_tof_barrel; }

◆ getTOFChi()

double SimplePIDSvc::getTOFChi ( int i)
inline

Definition at line 52 of file SimplePIDSvc.h.

52{ return m_tof_chi[i]; }

◆ getTofCounter()

int SimplePIDSvc::getTofCounter ( int n)
inline

Definition at line 60 of file SimplePIDSvc.h.

60{ return m_tof_counter[n]; }
const Int_t n

◆ getTofDt()

double SimplePIDSvc::getTofDt ( int m,
int n )
inline

Definition at line 57 of file SimplePIDSvc.h.

57{ return m_tof_dt[m][n]; }

◆ getTofPh()

double SimplePIDSvc::getTofPh ( int n)
inline

Definition at line 58 of file SimplePIDSvc.h.

58{ return m_tof_ph[n]; }

◆ getTofZR()

double SimplePIDSvc::getTofZR ( int n)
inline

Definition at line 59 of file SimplePIDSvc.h.

59{ return m_tof_zr[n]; }

◆ initialize()

StatusCode SimplePIDSvc::initialize ( )
virtual

Definition at line 32 of file SimplePIDSvc.cxx.

33{
34 MsgStream log(messageService(), name());
35 log << MSG::INFO << "in SimplePIDSvc initialize()" << endreq;
36
37 StatusCode sc = Service::initialize();
38
39 sc = serviceLocator()->service("EventDataSvc", eventSvc_, true);
40
41 loadHistogram();
42 loadSecondPar();//the second correct factor
43
44 return sc;
45}

◆ iselectron()

bool SimplePIDSvc::iselectron ( bool emc = true)

Definition at line 1511 of file SimplePIDSvc.cxx.

1512{
1513 if (!emc)
1514 {
1515 if (m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3])
1516 return true;
1517 else
1518 return false;
1519 }
1520 else
1521 {
1522 if (calEMCLikelihood())
1523 {
1524 if (m_lh_electron > m_eid_ratio)
1525 return true;
1526 else
1527 return false;
1528 }
1529 else
1530 {
1531 if (m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3])
1532 return true;
1533 else
1534 return false;
1535 }
1536 }
1537}

◆ iskaon()

bool SimplePIDSvc::iskaon ( )

Definition at line 1484 of file SimplePIDSvc.cxx.

1485{
1486 if (m_prob[3] > 0.00 && m_prob[3] > m_prob[2])
1487 return true;
1488 else
1489 return false;
1490}

◆ ispion()

bool SimplePIDSvc::ispion ( )

Definition at line 1476 of file SimplePIDSvc.cxx.

1477{
1478 if (m_prob[2] > 0.00 && m_prob[2] > m_prob[3])
1479 return true;
1480 else
1481 return false;
1482}

◆ preparePID()

void SimplePIDSvc::preparePID ( EvtRecTrack * track)

Definition at line 95 of file SimplePIDSvc.cxx.

96{
97
98 SmartDataPtr<Event::EventHeader> eventHeaderpid(eventSvc_, "/Event/EventHeader");
99 m_run = eventHeaderpid->runNumber();
100
101 if (track->isMdcKalTrackValid())
102 {
103 RecMdcKalTrack *mdckalTrk = track->mdcKalTrack();
104 RecMdcKalTrack::PidType trk_type[5] = {
110 };
111 double mass[5] = {
112 0.000511,
113 0.105658,
114 0.13957,
115 0.493677,
116 0.938272,
117 };
118 for(unsigned int pid = 0; pid < 5; pid++)
119 {
120 mdckalTrk->setPidType(trk_type[pid]);
121 m_p[pid] = mdckalTrk->p();
122 m_betagamma[pid] = m_p[pid] / mass[pid];
123 m_charge[pid] = mdckalTrk->charge();
124 m_cost[pid] = cos(mdckalTrk->theta());
125 }
126 }
127 else
128 {
129 for(unsigned int i = 0; i < 5; i++)
130 {
131 m_p[i] = -99;
132 m_betagamma[i] = -99;
133 m_cost[i] = -99;
134 m_charge[i] = 0;
135 }
136
137 }
138
139 //dE/dx PID
140 loadDedxInfo(track);
141 if (m_dedx_corr)
142 {
143 dedxCorrection();
144 dedxSecondCorrection();
145 }
146 //TOF PID
147 loadTOFInfo(track);
148 if (m_tof_corr)
149 {
150 if (m_tof_barrel == 1)
151 {
152 tofBarrelCorrection();
153 tofBarrelSecondCorrection();
154 }
155 else if (m_tof_barrel == 0)
156 {
157 tofEndcapCorrection();
158 tofEndcapSecondCorrection();
159 }
160 }
161 //EMC
162 loadEMCInfo(track);
163
164 calprob();
165}
double cos(const BesAngle a)
Definition BesAngle.h:213
double mass
const double theta() const
static void setPidType(PidType pidType)
const double p() const
const int charge() const
bool isMdcKalTrackValid()
Definition EvtRecTrack.h:44
RecMdcKalTrack * mdcKalTrack()
Definition EvtRecTrack.h:54

◆ probElectron()

double SimplePIDSvc::probElectron ( )
inline

Definition at line 45 of file SimplePIDSvc.h.

45{ return m_prob[0]; }

◆ probKaon()

double SimplePIDSvc::probKaon ( )
inline

Definition at line 48 of file SimplePIDSvc.h.

48{ return m_prob[3]; }

◆ probMuon()

double SimplePIDSvc::probMuon ( )
inline

Definition at line 46 of file SimplePIDSvc.h.

46{ return m_prob[1]; }

◆ probPion()

double SimplePIDSvc::probPion ( )
inline

Definition at line 47 of file SimplePIDSvc.h.

47{ return m_prob[2]; }

◆ probProton()

double SimplePIDSvc::probProton ( )
inline

Definition at line 49 of file SimplePIDSvc.h.

49{ return m_prob[4]; }

◆ setdedxminchi()

void SimplePIDSvc::setdedxminchi ( double x)
inline

Definition at line 37 of file SimplePIDSvc.h.

37{ m_dedx_chi_cut = x; }
Double_t x[10]

◆ seteidratio()

void SimplePIDSvc::seteidratio ( double x)
inline

Definition at line 39 of file SimplePIDSvc.h.

39{ m_eid_ratio = x; }

◆ settofminchi()

void SimplePIDSvc::settofminchi ( double x)
inline

Definition at line 38 of file SimplePIDSvc.h.

38{ m_tof_chi_cut = x; }

Friends And Related Symbol Documentation

◆ CnvFactory< SimplePIDSvc >

friend class CnvFactory< SimplePIDSvc >
friend

Definition at line 1 of file SimplePIDSvc.h.


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