BOSS 7.0.7
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 ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvIF)
 
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 ()
 
- Public Member Functions inherited from ISimplePIDSvc
virtual ~ISimplePIDSvc ()
 
virtual void setdedxminchi (double x)=0
 
virtual void settofminchi (double x)=0
 
virtual void seteidratio (double x)=0
 
virtual void preparePID (EvtRecTrack *track)=0
 
virtual bool iselectron (bool emc=false)=0
 
virtual bool ispion ()=0
 
virtual bool iskaon ()=0
 
virtual double probElectron ()=0
 
virtual double probMuon ()=0
 
virtual double probPion ()=0
 
virtual double probKaon ()=0
 
virtual double probProton ()=0
 
virtual double getdEdxChi (int i)=0
 
virtual double getTOFChi (int i)=0
 
virtual double getChi2 (int i)=0
 
virtual double getEmcLikelihood (int i)=0
 
virtual double getTofDt (int m, int n)=0
 
virtual double getTofPh (int n)=0
 
virtual double getTofZR (int n)=0
 
virtual int getTofCounter (int n)=0
 
virtual int getTofBarrel ()=0
 
virtual double getEmcE ()=0
 
virtual double getEmcE13 ()=0
 
virtual double getEmcE35 ()=0
 
virtual double getEmcLatMoment ()=0
 
virtual double getEmcSecMoment ()=0
 
virtual double getElectronLikelihood ()=0
 

Friends

class CnvFactory< SimplePIDSvc >
 

Additional Inherited Members

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

Detailed Description

Definition at line 24 of file SimplePIDSvc.h.

Constructor & Destructor Documentation

◆ SimplePIDSvc()

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

Definition at line 20 of file SimplePIDSvc.cxx.

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

◆ ~SimplePIDSvc()

SimplePIDSvc::~SimplePIDSvc ( )
virtual

Definition at line 29 of file SimplePIDSvc.cxx.

29{;}

Member Function Documentation

◆ finalize()

StatusCode SimplePIDSvc::finalize ( )
virtual

Definition at line 45 of file SimplePIDSvc.cxx.

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

◆ getChi2()

double SimplePIDSvc::getChi2 ( int  i)
virtual

Implements ISimplePIDSvc.

Definition at line 911 of file SimplePIDSvc.cxx.

912{
913 return pow(m_dedx_chi[i], 2) + pow(m_tof_chi[i], 2);
914}

◆ getdEdxChi()

double SimplePIDSvc::getdEdxChi ( int  i)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 50 of file SimplePIDSvc.h.

50{ return m_dedx_chi[i]; }

◆ getElectronLikelihood()

double SimplePIDSvc::getElectronLikelihood ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 66 of file SimplePIDSvc.h.

66{ return m_lh_electron; }

◆ getEmcE()

double SimplePIDSvc::getEmcE ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 61 of file SimplePIDSvc.h.

61{ return m_emc_e; }

◆ getEmcE13()

double SimplePIDSvc::getEmcE13 ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 62 of file SimplePIDSvc.h.

62{ return m_emc_e13; }

◆ getEmcE35()

double SimplePIDSvc::getEmcE35 ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 63 of file SimplePIDSvc.h.

63{ return m_emc_e35; }

◆ getEmcLatMoment()

double SimplePIDSvc::getEmcLatMoment ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 64 of file SimplePIDSvc.h.

64{ return m_emc_lat; }

◆ getEmcLikelihood()

double SimplePIDSvc::getEmcLikelihood ( int  i)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 52 of file SimplePIDSvc.h.

52{ return m_emc_likelihood[i]; }

◆ getEmcSecMoment()

double SimplePIDSvc::getEmcSecMoment ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 65 of file SimplePIDSvc.h.

65{ return m_emc_sec; }

◆ getTofBarrel()

int SimplePIDSvc::getTofBarrel ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 60 of file SimplePIDSvc.h.

60{ return m_tof_barrel; }

◆ getTOFChi()

double SimplePIDSvc::getTOFChi ( int  i)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 51 of file SimplePIDSvc.h.

51{ return m_tof_chi[i]; }

◆ getTofCounter()

int SimplePIDSvc::getTofCounter ( int  n)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 59 of file SimplePIDSvc.h.

59{ return m_tof_counter[n]; }

◆ getTofDt()

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

Implements ISimplePIDSvc.

Definition at line 56 of file SimplePIDSvc.h.

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

◆ getTofPh()

double SimplePIDSvc::getTofPh ( int  n)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 57 of file SimplePIDSvc.h.

57{ return m_tof_ph[n]; }

◆ getTofZR()

double SimplePIDSvc::getTofZR ( int  n)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 58 of file SimplePIDSvc.h.

58{ return m_tof_zr[n]; }

◆ initialize()

StatusCode SimplePIDSvc::initialize ( )
virtual

Definition at line 31 of file SimplePIDSvc.cxx.

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

◆ iselectron()

bool SimplePIDSvc::iselectron ( bool  emc = true)
virtual

Implements ISimplePIDSvc.

Definition at line 1047 of file SimplePIDSvc.cxx.

1048{
1049 if (!emc)
1050 {
1051 if (m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3])
1052 return true;
1053 else
1054 return false;
1055 }
1056 else
1057 {
1058 if (calEMCLikelihood())
1059 {
1060 if (m_lh_electron > m_eid_ratio)
1061 return true;
1062 else
1063 return false;
1064 }
1065 else
1066 {
1067 if (m_prob[0] > 0 && m_prob[0] > m_prob[2] && m_prob[0] > m_prob[3])
1068 return true;
1069 else
1070 return false;
1071 }
1072 }
1073}

◆ iskaon()

bool SimplePIDSvc::iskaon ( )
virtual

Implements ISimplePIDSvc.

Definition at line 1020 of file SimplePIDSvc.cxx.

1021{
1022 if (m_prob[3] > 0.00 && m_prob[3] > m_prob[2])
1023 return true;
1024 else
1025 return false;
1026}

◆ ispion()

bool SimplePIDSvc::ispion ( )
virtual

Implements ISimplePIDSvc.

Definition at line 1012 of file SimplePIDSvc.cxx.

1013{
1014 if (m_prob[2] > 0.00 && m_prob[2] > m_prob[3])
1015 return true;
1016 else
1017 return false;
1018}

◆ preparePID()

void SimplePIDSvc::preparePID ( EvtRecTrack track)
virtual

Implements ISimplePIDSvc.

Definition at line 91 of file SimplePIDSvc.cxx.

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

Implements ISimplePIDSvc.

Definition at line 44 of file SimplePIDSvc.h.

44{ return m_prob[0]; }

◆ probKaon()

double SimplePIDSvc::probKaon ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 47 of file SimplePIDSvc.h.

47{ return m_prob[3]; }

◆ probMuon()

double SimplePIDSvc::probMuon ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 45 of file SimplePIDSvc.h.

45{ return m_prob[1]; }

◆ probPion()

double SimplePIDSvc::probPion ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 46 of file SimplePIDSvc.h.

46{ return m_prob[2]; }

◆ probProton()

double SimplePIDSvc::probProton ( )
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 48 of file SimplePIDSvc.h.

48{ return m_prob[4]; }

◆ queryInterface()

StatusCode SimplePIDSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvIF 
)
virtual

Definition at line 77 of file SimplePIDSvc.cxx.

78{
79 if (ISimplePIDSvc::interfaceID().versionMatch(riid))
80 {
81 *ppvIF = dynamic_cast<ISimplePIDSvc*>(this);
82 }
83 else
84 {
85 return Service::queryInterface(riid, ppvIF);
86 }
87 addRef();
88 return StatusCode::SUCCESS;
89}
static const InterfaceID & interfaceID()
Definition: ISimplePIDSvc.h:15

◆ setdedxminchi()

void SimplePIDSvc::setdedxminchi ( double  x)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 36 of file SimplePIDSvc.h.

36{ m_dedx_chi_cut = x; }
double x[1000]

◆ seteidratio()

void SimplePIDSvc::seteidratio ( double  x)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 38 of file SimplePIDSvc.h.

38{ m_eid_ratio = x; }

◆ settofminchi()

void SimplePIDSvc::settofminchi ( double  x)
inlinevirtual

Implements ISimplePIDSvc.

Definition at line 37 of file SimplePIDSvc.h.

37{ m_tof_chi_cut = x; }

Friends And Related Function 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: