BOSS 8.0.0
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 27 of file SimplePIDSvc.h.

Constructor & Destructor Documentation

◆ SimplePIDSvc()

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

Definition at line 19 of file SimplePIDSvc.cxx.

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

Referenced by SimplePIDSvc().

◆ ~SimplePIDSvc()

SimplePIDSvc::~SimplePIDSvc ( )
virtual

Definition at line 28 of file SimplePIDSvc.cxx.

28{ ; }

Member Function Documentation

◆ finalize()

StatusCode SimplePIDSvc::finalize ( )
virtual

Definition at line 44 of file SimplePIDSvc.cxx.

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

◆ getChi2()

double SimplePIDSvc::getChi2 ( int i)

Definition at line 1557 of file SimplePIDSvc.cxx.

1557 {
1558 return pow( m_dedx_chi[i], 2 ) + pow( m_tof_chi[i], 2 );
1559}

◆ getdEdxChi()

double SimplePIDSvc::getdEdxChi ( int i)
inline

Definition at line 52 of file SimplePIDSvc.h.

52{ return m_dedx_chi[i]; }

◆ getElectronLikelihood()

double SimplePIDSvc::getElectronLikelihood ( )
inline

Definition at line 68 of file SimplePIDSvc.h.

68{ return m_lh_electron; }

◆ getEmcE()

double SimplePIDSvc::getEmcE ( )
inline

Definition at line 63 of file SimplePIDSvc.h.

63{ return m_emc_e; }

◆ getEmcE13()

double SimplePIDSvc::getEmcE13 ( )
inline

Definition at line 64 of file SimplePIDSvc.h.

64{ return m_emc_e13; }

◆ getEmcE35()

double SimplePIDSvc::getEmcE35 ( )
inline

Definition at line 65 of file SimplePIDSvc.h.

65{ return m_emc_e35; }

◆ getEmcLatMoment()

double SimplePIDSvc::getEmcLatMoment ( )
inline

Definition at line 66 of file SimplePIDSvc.h.

66{ return m_emc_lat; }

◆ getEmcLikelihood()

double SimplePIDSvc::getEmcLikelihood ( int i)
inline

Definition at line 54 of file SimplePIDSvc.h.

54{ return m_emc_likelihood[i]; }

◆ getEmcSecMoment()

double SimplePIDSvc::getEmcSecMoment ( )
inline

Definition at line 67 of file SimplePIDSvc.h.

67{ return m_emc_sec; }

◆ getTofBarrel()

int SimplePIDSvc::getTofBarrel ( )
inline

Definition at line 62 of file SimplePIDSvc.h.

62{ return m_tof_barrel; }

◆ getTOFChi()

double SimplePIDSvc::getTOFChi ( int i)
inline

Definition at line 53 of file SimplePIDSvc.h.

53{ return m_tof_chi[i]; }

◆ getTofCounter()

int SimplePIDSvc::getTofCounter ( int n)
inline

Definition at line 61 of file SimplePIDSvc.h.

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

◆ getTofDt()

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

Definition at line 58 of file SimplePIDSvc.h.

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

◆ getTofPh()

double SimplePIDSvc::getTofPh ( int n)
inline

Definition at line 59 of file SimplePIDSvc.h.

59{ return m_tof_ph[n]; }

◆ getTofZR()

double SimplePIDSvc::getTofZR ( int n)
inline

Definition at line 60 of file SimplePIDSvc.h.

60{ return m_tof_zr[n]; }

◆ initialize()

StatusCode SimplePIDSvc::initialize ( )
virtual

Definition at line 30 of file SimplePIDSvc.cxx.

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

◆ iselectron()

bool SimplePIDSvc::iselectron ( bool emc = true)

Definition at line 1675 of file SimplePIDSvc.cxx.

1675 {
1676 if ( !emc )
1677 {
1678 if ( m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3] ) return true;
1679 else return false;
1680 }
1681 else
1682 {
1683 if ( calEMCLikelihood() )
1684 {
1685 if ( m_lh_electron > m_eid_ratio ) return true;
1686 else return false;
1687 }
1688 else
1689 {
1690 if ( m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3] ) return true;
1691 else return false;
1692 }
1693 }
1694}

◆ iskaon()

bool SimplePIDSvc::iskaon ( )

Definition at line 1655 of file SimplePIDSvc.cxx.

1655 {
1656 if ( m_prob[3] > 0.00 && m_prob[3] > m_prob[2] ) return true;
1657 else return false;
1658}

◆ ispion()

bool SimplePIDSvc::ispion ( )

Definition at line 1650 of file SimplePIDSvc.cxx.

1650 {
1651 if ( m_prob[2] > 0.00 && m_prob[2] > m_prob[3] ) return true;
1652 else return false;
1653}

◆ preparePID()

void SimplePIDSvc::preparePID ( EvtRecTrack * track)

Definition at line 87 of file SimplePIDSvc.cxx.

87 {
88
89 SmartDataPtr<Event::EventHeader> eventHeaderpid( eventSvc_, "/Event/EventHeader" );
90 m_run = eventHeaderpid->runNumber();
91
92 if ( track->isMdcKalTrackValid() )
93 {
94 RecMdcKalTrack* mdckalTrk = track->mdcKalTrack();
95 RecMdcKalTrack::PidType trk_type[5] = {
98 };
99 double mass[5] = {
100 0.000511, 0.105658, 0.13957, 0.493677, 0.938272,
101 };
102 for ( unsigned int pid = 0; pid < 5; pid++ )
103 {
104 mdckalTrk->setPidType( trk_type[pid] );
105 m_p[pid] = mdckalTrk->p();
106 m_betagamma[pid] = m_p[pid] / mass[pid];
107 m_charge[pid] = mdckalTrk->charge();
108 m_cost[pid] = cos( mdckalTrk->theta() );
109 }
110 }
111 else
112 {
113 for ( unsigned int i = 0; i < 5; i++ )
114 {
115 m_p[i] = -99;
116 m_betagamma[i] = -99;
117 m_cost[i] = -99;
118 m_charge[i] = 0;
119 }
120 }
121
122 // dE/dx PID
123 loadDedxInfo( track );
124 if ( m_dedx_corr )
125 {
126 dedxCorrection();
127 dedxSecondCorrection();
128 }
129 // TOF PID
130 loadTOFInfo( track );
131 if ( m_tof_corr )
132 {
133 if ( m_tof_barrel == 1 )
134 {
135 tofBarrelCorrection();
136 tofBarrelSecondCorrection();
137 }
138 else if ( m_tof_barrel == 0 )
139 {
140 tofEndcapCorrection();
141 tofEndcapSecondCorrection();
142 }
143 }
144 // EMC
145 loadEMCInfo( track );
146
147 calprob();
148}
double mass

◆ probElectron()

double SimplePIDSvc::probElectron ( )
inline

Definition at line 46 of file SimplePIDSvc.h.

46{ return m_prob[0]; }

◆ probKaon()

double SimplePIDSvc::probKaon ( )
inline

Definition at line 49 of file SimplePIDSvc.h.

49{ return m_prob[3]; }

◆ probMuon()

double SimplePIDSvc::probMuon ( )
inline

Definition at line 47 of file SimplePIDSvc.h.

47{ return m_prob[1]; }

◆ probPion()

double SimplePIDSvc::probPion ( )
inline

Definition at line 48 of file SimplePIDSvc.h.

48{ return m_prob[2]; }

◆ probProton()

double SimplePIDSvc::probProton ( )
inline

Definition at line 50 of file SimplePIDSvc.h.

50{ return m_prob[4]; }

◆ setdedxminchi()

void SimplePIDSvc::setdedxminchi ( double x)
inline

Definition at line 38 of file SimplePIDSvc.h.

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

◆ seteidratio()

void SimplePIDSvc::seteidratio ( double x)
inline

Definition at line 40 of file SimplePIDSvc.h.

40{ m_eid_ratio = x; }

◆ settofminchi()

void SimplePIDSvc::settofminchi ( double x)
inline

Definition at line 39 of file SimplePIDSvc.h.

39{ m_tof_chi_cut = x; }

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