BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
SimplePIDSvc.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: PID for psi(3770) data *
3 * Package: SimplePIDSvc *
4 * File: SimplePIDSvc.h $v8 2013/11/12$ *
5 * Authors: *
6 * Chunlei LIU, [email protected] *
7 * Tian MA, [email protected] *
8 * *
9 *****************************************************************************/
10
11#ifndef SIMPLE_PID_SVC_H
12#define SIMPLE_PID_SVC_H
13
14#include "GaudiKernel/Service.h"
17#include "TH1D.h"
18#include "TH2D.h"
19#include "TFile.h"
20
21class IDataProviderSvc;
22template <class TYPE> class CnvFactory;
23
24//class SimplePIDSvc : public Service, virtual public ISimplePIDSvc
25class SimplePIDSvc : public extends<Service, ISimplePIDSvc>
26{
27 friend class CnvFactory<SimplePIDSvc>;
28
29public:
30 SimplePIDSvc(const std::string& name, ISvcLocator* svcLoc);
31 virtual ~SimplePIDSvc();
32
33 virtual StatusCode initialize();
34 virtual StatusCode finalize();
35 //virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF);
36
37 void setdedxminchi(double x) { m_dedx_chi_cut = x; }
38 void settofminchi(double x) { m_tof_chi_cut = x; }
39 void seteidratio(double x) { m_eid_ratio = x; }
40 void preparePID(EvtRecTrack* track);
41 bool iselectron(bool emc = true);
42 bool ispion();
43 bool iskaon();
44 // probabilities (dE/dx + TOF)
45 double probElectron() { return m_prob[0]; }
46 double probMuon() { return m_prob[1]; }
47 double probPion() { return m_prob[2]; }
48 double probKaon() { return m_prob[3]; }
49 double probProton() { return m_prob[4]; }
50
51 double getdEdxChi(int i) { return m_dedx_chi[i]; }
52 double getTOFChi(int i) { return m_tof_chi[i]; }
53 double getEmcLikelihood(int i) { return m_emc_likelihood[i]; }
54 double getChi2(int i);
55
56 // get TOF&EMC info for internal test & check
57 double getTofDt(int m, int n) { return m_tof_dt[m][n]; }
58 double getTofPh(int n) { return m_tof_ph[n]; }
59 double getTofZR(int n) { return m_tof_zr[n]; }
60 int getTofCounter(int n) { return m_tof_counter[n]; }
61 int getTofBarrel() { return m_tof_barrel; }
62 double getEmcE() { return m_emc_e; }
63 double getEmcE13() { return m_emc_e13; }
64 double getEmcE35() { return m_emc_e35; }
65 double getEmcLatMoment() { return m_emc_lat; }
66 double getEmcSecMoment() { return m_emc_sec; }
67 double getElectronLikelihood() { return m_lh_electron; }
68
69private:
70 int getRunIdx(int run_no);
71 int findBin(double *a, int length, double value);
72 void loadDedxInfo(EvtRecTrack *track);
73 void loadTOFInfo(EvtRecTrack *track);
74 void loadEMCInfo(EvtRecTrack *track);
75 void loadHistogram();
76 void dedxCorrection();
77 void tofBarrelCorrection();
78 void tofEndcapCorrection();
79 void calprob();
80 bool calEMCLikelihood();
81
82 void dedxSecondCorrection();
83 void tofBarrelSecondCorrection();
84 void tofEndcapSecondCorrection();
85 void loadSecondPar();
86
87 // variables in job_options
88 bool m_dedx_corr;
89 bool m_tof_corr;
90 double m_dedx_chi_cut;
91 double m_tof_chi_cut;
92 double m_eid_ratio;
93
94 IDataProviderSvc* eventSvc_;
95 int m_run; // run number
96
97 bool m_dedx_only[5];
98 double m_p[5];
99 double m_cost[5];
100 int m_charge[5];
101 double m_betagamma[5];
102
103 // TOF info
104 double m_tof_dt[8][5];
105 double m_tof_ph[8];
106 double m_tof_zr[2];
107 int m_tof_counter[2];
108 volatile int m_tof_barrel;
109 // EMC info
110 double m_emc_e;
111 double m_emc_eop[5];
112 double m_emc_e13;
113 double m_emc_e35;
114 double m_emc_sec;
115 double m_emc_lat;
116
117 // chisquares & probilites for each hypothesis
118 double m_dedx_chi[5];
119 double m_tof_chi[5];
120 double m_emc_likelihood[5];
121 double m_prob[5];
122 double m_lh_electron;
123
124 // dedx correction histogram
125 // (p, m)
126 // p: 0-electron 1-k,pi
127 // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
128 TH2D *h_dedx_p_offset[2][4];
129 TH2D *h_dedx_p_sigma[2][4];
130 TH2D *h_dedx_m_offset[2][4];
131 TH2D *h_dedx_m_sigma[2][4];
132
133 // tof barrel correction histogram
134 // (p, m, n)
135 // p: 0-electron 1-k,pi
136 // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
137 // n: 0-inner east, 1-inner west, 2-outer east, 3-outer west
138 TH1D *h_tof_p_q_offset[2][4][4];
139 TH1D *h_tof_p_q_sigma[2][4][4];
140 TH1D *h_tof_m_q_offset[2][4][4];
141 TH1D *h_tof_m_q_sigma[2][4][4];
142 TH2D *h_tof_p_bgcost_offset[2][4][4];
143 TH2D *h_tof_p_bgcost_sigma[2][4][4];
144 TH2D *h_tof_m_bgcost_offset[2][4][4];
145 TH2D *h_tof_m_bgcost_sigma[2][4][4];
146
147 TH2D *h_tof_p_wgt[2][4][15][5];
148 TH2D *h_tof_m_wgt[2][4][15][5];
149 TH2D *h_tof_p_final_offset[2][4][15];
150 TH2D *h_tof_p_final_sigma[2][4][15];
151 TH2D *h_tof_m_final_offset[2][4][15];
152 TH2D *h_tof_m_final_sigma[2][4][15];
153
154 // tof endcap correction histogram
155 // (p, m, n)
156 // p: 0-electron 1-k,pi
157 // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
158 // n: 0-east, 1-west
159 TH1D *h_tofec_p_q_offset[2][4][2];
160 TH1D *h_tofec_p_q_sigma[2][4][2];
161 TH1D *h_tofec_m_q_offset[2][4][2];
162 TH1D *h_tofec_m_q_sigma[2][4][2];
163 TH1D *h_tofec_p_bg_offset[2][4][2];
164 TH1D *h_tofec_p_bg_sigma[2][4][2];
165 TH1D *h_tofec_m_bg_offset[2][4][2];
166 TH1D *h_tofec_m_bg_sigma[2][4][2];
167 TH1D *h_tofec_p_cost_offset[2][4][2];
168 TH1D *h_tofec_p_cost_sigma[2][4][2];
169 TH1D *h_tofec_m_cost_offset[2][4][2];
170 TH1D *h_tofec_m_cost_sigma[2][4][2];
171
172 // emc histogram
173 // (p, q, m, n)
174 // p: 0-electron, 1-pion, 2-kaon
175 // q: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
176 // m: 15 momentum-bin
177 // n: 25 cost-bin
178 TH1D *h_emc_ep[3][4][15][25];
179 TH1D *h_emc_e35[3][4][15][25];
180
181 // TFiles
182 TFile *f_dedx[2][4];
183 TFile *f_tof_q[2][4];
184 TFile *f_tof_bgcost[2][4];
185 TFile *f_tof_wgt[2][4];
186 TFile *f_tof_final[2][4];
187 TFile *f_tofec_q[2][4];
188 TFile *f_tofec_bg[2][4];
189 TFile *f_tofec_cost[2][4];
190 TFile *f_emc[3][4];
191
192
193 //Extended from 6 to 9 by Yijia Zeng for round 16 data
194 //Extended from 9 to 12 by Yijia Zeng for round 17 data
195 double m_gaussion_mean[12][4][10];
196 double m_gaussion_sigma[12][4][10];
197 double m_gaussion_sigmab[12][4][10];
198
199
200};
201
202#endif //SIMPLE_PID_SVC_H
const Int_t n
Double_t x[10]
NTuple::Item< double > m_p
Definition MdcHistItem.h:75
double probPion()
void settofminchi(double x)
int getTofCounter(int n)
int getTofBarrel()
SimplePIDSvc(const std::string &name, ISvcLocator *svcLoc)
double probProton()
double getdEdxChi(int i)
virtual ~SimplePIDSvc()
void seteidratio(double x)
double getEmcE()
double getEmcSecMoment()
double getChi2(int i)
void preparePID(EvtRecTrack *track)
void setdedxminchi(double x)
double getTofPh(int n)
double probMuon()
double getEmcLikelihood(int i)
virtual StatusCode initialize()
double getEmcE35()
double getEmcLatMoment()
double getTofDt(int m, int n)
bool iselectron(bool emc=true)
double getEmcE13()
double getElectronLikelihood()
double getTofZR(int n)
virtual StatusCode finalize()
double probKaon()
double getTOFChi(int i)
double probElectron()