CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/CgemSegmentRecAlg/CgemSegmentRecAlg-00-00-06/CgemSegmentRecAlg/CgemSegmentRecAlg.h
Go to the documentation of this file.
1#ifndef CGEMSEGMENTRECALG_H
2#define CGEMSEGMENTRECALG_H
3#include "GaudiKernel/Algorithm.h"
4#include "CgemRecEvent/RecCgemCluster.h"
5#include "CgemRecEvent/RecCgemSegment.h"
6#include "McTruth/McParticle.h"
7
8#include "VertexFit/IVertexDbSvc.h"
9#include "GaudiKernel/NTuple.h"
10#include "GaudiKernel/INTupleSvc.h"
11
12#include "TROOT.h"
13#include "TObjArray.h"
14#include "TH1F.h"
15#include "TProfile.h"
16#include "TFile.h"
17#include "TFolder.h"
18
19#include <vector>
20
21#include <string>
22
23using namespace std;
24
25class CgemSegmentRecAlg:public Algorithm {
26 public:
27 CgemSegmentRecAlg(const std::string& name, ISvcLocator* pSvcLocator);
28 StatusCode execute();
29 StatusCode initialize();
30 StatusCode finalize();
31
32 StatusCode exe_v1();
33 StatusCode exe_v2();
34
35 void printInfo();
36 void resetData();
37
38 void getVertex(HepVector a, HepSymMatrix Ea, double& vr, double& vz);
39 void getMcTruth();
40 bool InZAr(double x, double y);
41 bool InPhiAr(double x, double y);
42
43 private:
44
45 int m_ver;
46 int m_debug; // control cout
47 int m_checkSingleTrkMC; // check study with single track MC
48
49 int m_run;
50 int m_evt;
51
52 int n_XVCluster[3];
53
54 vector<int> mVec_idXVClu[3];
55 vector<double> mVec_phiClu[3];
56 vector<int> mVec_idXClu[3];
57 vector<double> mVec_ZClu[3];
58 vector<int> mVec_idVClu[3];
59
60 //vector<vector<double>> mVec_dPhi21;
61 //vector<vector<double>> mVec_dPhi23;
62 //vector<vector<double>> mVec_dZ21;
63 //vector<vector<double>> mVec_dZ23;
64
65
66 int Ncut0;
67 //int Ncut1;
68
69 int N_cluster, N_strip, N_XV_cluster, N_hit, N_flag3, N_sim_strip, N_trk, N_N21, N_N23, N_sim_N21, N_sim_N23, N_OutRange;
70 int N_PiL2, N_PiE0, N_PiM7, N_Seg, N_Match, N_Event, N_3cluster;
71 int N_nonPi, N_ErrMat, N_CrossMat, N_OtherPar4, N_OtherPar3, N_OtherPar, N_inTrk3, N_InTrk, N_outTrk;
72 int N_4cluster, N_Match_hit, N_Match_all_hit;
73 int OutDetecter;
74
75 int cgem_totevt;
76 vector<int> m_pid;
77 int t_nTotTk;
78
79 bool m_dst;
80
81 map<int , RecCgemSegment*> m_seg_map;
82 map<int , RecCgemSegment*>::iterator m_seg_map_it;
83
84 vector<double> m_z_slope;
85 vector<double> m_z_Par1;
86 vector<double> m_z_Par2;
87 vector<double> m_z_Par3;
88 double m_z_nSigma, m_z_bound;
89 double m_phi_slope, m_phi_nSigma, m_phi_bound;
90 vector<double> m_phi_3Par;
91 vector<double> m_phi_4Par;
92 bool m_UseCut;
93 bool m_UseTesterSim;
94
95
96 // modified by yeh
97
98 int t_nTrkMC;
99 double t_t0Truth;
100 int t_pidTruth[100];
101 int t_motheridx[100];
102 double t_costhetaMC[100];
103 double t_phiMC[100];
104 double t_qMC[100];
105 double t_vzMC[100];
106 double t_vrMC[100];
107 double t_FvzMC[100];
108 double t_FvrMC[100];
109 double t_pxMC[100];
110 double t_pyMC[100];
111 double t_pzMC[100];
112 double t_ptMC[100];
113 double t_pMC[100];
114
115 // end
116
117
118 std::string m_fname;
119 std::string m_fmode;
120 std::string m_postfix;
121
122 // for the Cgem cluster
123 NTuple::Tuple* cgem_ntuple;
124 NTuple::Item<long> cgem_run;
125 NTuple::Item<long> cgem_evt;
126 //NTuple::Item<long> cgem_nTrk;
127 NTuple::Item<long> cgem_ncluster;
128 NTuple::Item<long> cgem_XV_ncluster;
129 NTuple::Item<int> cgem_test_nStrip;
130 NTuple::Item<int> cgem_Num21;
131 NTuple::Item<int> cgem_Num23;
132
133 NTuple::Array<int> cgem_nStrip;
134 NTuple::Array<int> cgem_nStrip_flagb;
135 NTuple::Array<int> cgem_XV_clusterid ;
136 NTuple::Array<int> cgem_XV_flag ;
137 NTuple::Array<int> cgem_XV_layerID ;
138 NTuple::Array<int> cgem_clusterid ;
139 NTuple::Array<int> cgem_layerid ;
140 NTuple::Array<int> cgem_sheetid ;
141 NTuple::Array<int> cgem_flag ;
142 NTuple::Array<double> cgem_energydeposit ;
143 NTuple::Array<double> cgem_recphi ;
144 NTuple::Array<double> cgem_recv ;
145 NTuple::Array<double> cgem_recZ ;
146 NTuple::Array<int> cgem_clusterflag_first;
147 NTuple::Array<int> cgem_clusterflag_second;
148 NTuple::Array<int> cgem_ident_ID;
149 NTuple::Array<int> cgem_strip_type;
150 NTuple::Array<int> cgem_strip_ID;
151 NTuple::Array<int> cgem_layer_ID;
152 NTuple::Array<int> cgem_sheet_ID;
153
154 NTuple::Array<int> cgem_IsTruth21;
155 NTuple::Array<int> cgem_IsTruth23;
156 NTuple::Array<int> cgem_hit_size1;
157 NTuple::Array<int> cgem_hit_id1;
158 NTuple::Array<int> cgem_hit_size2;
159 NTuple::Array<int> cgem_hit_id2;
160 NTuple::Array<int> cgem_hit_size3;
161 NTuple::Array<int> cgem_hit_id3;
162 NTuple::Array<double> cgem_deltaPhi21;
163 NTuple::Array<double> cgem_deltaZ21;
164 NTuple::Array<double> cgem_deltaPhi23;
165 NTuple::Array<double> cgem_deltaZ23;
166 NTuple::Array<double> cgem_pdg21;
167 NTuple::Array<double> cgem_pdg23;
168 // for cgem truth
169 int Ncut2;
170
171 NTuple::Item<int> m_mc_nHit;
172 // NTuple::Item<int> m_mc_nStrip;
173 NTuple::Item<int> mc_test_nStrip;
174 NTuple::Item<int> m_mc_Num21;
175 NTuple::Item<int> m_mc_Num23;
176 NTuple::Item<int> m_mc_Num1;
177 NTuple::Item<int> m_mc_Num3;
178
179 NTuple::Array<double> m_mc_deltaPhi21;
180 NTuple::Array<double> m_mc_deltaZ21;
181 NTuple::Array<int> m_mc_PDG21;
182 NTuple::Array<int> m_mc_hit_ID1;
183 NTuple::Array<int> m_mc_hit_ID2;
184 NTuple::Array<int> m_mc_hit_ID3;
185 NTuple::Array<int> m_mc_hit_PDG21;
186 NTuple::Array<int> m_mc_Track21;
187 NTuple::Array<double> m_mc_deltaPhi23;
188 NTuple::Array<double> m_mc_deltaZ23;
189 NTuple::Array<int> m_mc_PDG23;
190 NTuple::Array<int> m_mc_hit_PDG23;
191 NTuple::Array<int> m_mc_Track23;
192 NTuple::Array<int> m_mc_nStrip;
193 NTuple::Array<int> m_mc_nStripB;
194 NTuple::Array<int> m_mc_ID_track; /* ID of current track */
195 NTuple::Array<int> m_mc_ID_layer; /* ID of CgemLayer Hits belong to */
196 NTuple::Array<int> m_mc_pdg_code; /* ID of CgemLayer Hits belong to */
197 NTuple::Array<int> m_mc_ID_parent; /* ID of CgemLayer Hits belong to */
198 NTuple::Array<double> m_mc_E_deposit; /* Total energy deposited during the step */
199 NTuple::Array<double> m_mc_XYZ_pre_X; /* Position of Pre Point */
200 NTuple::Array<double> m_mc_XYZ_pre_Y; /* Position of Pre Point */
201 NTuple::Array<double> m_mc_XYZ_pre_Z; /* Position of Pre Point */
202 NTuple::Array<double> m_mc_XYZ_post_X; /* Position of Post Point */
203 NTuple::Array<double> m_mc_XYZ_post_Y; /* Position of Post Point */
204 NTuple::Array<double> m_mc_XYZ_post_Z; /* Position of Post Point */
205 NTuple::Array<double> m_mc_P_pre_X; /* Momentum of Pre Point */
206 NTuple::Array<double> m_mc_P_pre_Y; /* Momentum of Pre Point */
207 NTuple::Array<double> m_mc_P_pre_Z; /* Momentum of Pre Point */
208 NTuple::Array<double> m_mc_P_post_X; /* Momentum of Post Point */
209 NTuple::Array<double> m_mc_P_post_Y; /* Momentum of Post Point */
210 NTuple::Array<double> m_mc_P_post_Z; /* Momentum of Post Point */
211 NTuple::Array<double> m_mc_rec_v; /* rec_v */
212 NTuple::Array<double> m_mc_rec_phi; /* rec_phi */
213 NTuple::Array<double> m_mc_rec_z; /* rec_z */
214 NTuple::Array<int> m_mc_ident_ID;
215 NTuple::Array<int> m_mc_strip_type;
216 NTuple::Array<int> m_mc_strip_ID;
217 NTuple::Array<int> m_mc_layer_ID;
218 NTuple::Array<int> m_mc_sheet_ID;
219
220 NTuple::Item<int> m_mc_nTrk;
221 NTuple::Array<int> m_mc_pidTruth;
222 NTuple::Array<int> m_mc_motheridx;
223 NTuple::Array<double> m_mc_costaTruth;
224 NTuple::Array<double> m_mc_phiTruth;
225 NTuple::Array<double> m_mc_Final_vrTruth;
226 NTuple::Array<double> m_mc_Final_vzTruth;
227 NTuple::Array<double> m_mc_vrTruth;
228 NTuple::Array<double> m_mc_vzTruth;
229 NTuple::Array<double> m_mc_pxTruth;
230 NTuple::Array<double> m_mc_pyTruth;
231 NTuple::Array<double> m_mc_pzTruth;
232 NTuple::Array<double> m_mc_ptTruth;
233 NTuple::Array<double> m_mc_pTruth;
234 NTuple::Array<double> m_mc_qTruth;
235 NTuple::Array<double> m_mc_rateTrk;
236 NTuple::Array<double> m_mc_rateTruth;
237 // cgem truth end
238 //end
239
240 NTuple::Tuple* cut_ntuple;
241 NTuple::Item<int> cut_Num;
242 NTuple::Array<int> cut_IsTruth21;
243 NTuple::Array<int> cut_IsTruth23;
244 NTuple::Array<int> cut_pdg21;
245 NTuple::Array<int> cut_pdg23;
246 NTuple::Array<double> cut_deltaPhi21;
247 NTuple::Array<double> cut_deltaZ21;
248 NTuple::Array<double> cut_deltaPhi23;
249 NTuple::Array<double> cut_deltaZ23;
250
251};
252
253
254#endif /* CGEMSEGMENTRECALG_H */
StatusCode execute()
CgemSegmentRecAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize()
void getVertex(HepVector a, HepSymMatrix Ea, double &vr, double &vz)
StatusCode finalize()
bool InZAr(double x, double y)
bool InPhiAr(double x, double y)
StatusCode exe_v1()
StatusCode exe_v2()