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