CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemClusterCreate.h
Go to the documentation of this file.
1#ifndef CGEMCLUSTERCREATE
2#define CGEMCLUSTERCREATE
3//Head File//
4#include "GaudiKernel/Algorithm.h"
7
12
15
16#include "GaudiKernel/NTuple.h"
17#include "GaudiKernel/INTupleSvc.h"
19
20//#include "CgemSim/BesCgemGeoParameter.hh"
24
25#include <map>
26#include <utility>
27#include <vector>
28
29class BesTimer;
30
32 int begin;
33 int end;
34};
35
36class CgemClusterCreate : public Algorithm
37{
38 public:
39 CgemClusterCreate(const std::string& name, ISvcLocator* pSvcLocator);
41
42 StatusCode initialize();
43 StatusCode execute ();
44 StatusCode finalize ();
45
46 private:
47 int myPrintFlag;
48 int myMotherParticleID;
49 int myMethod;// 0: array by Guo Yue, 1: map by Wang Liangliang (CC only), 2: toyClustering
50 int myNtuple;// save Ntuple (1) or not (0)
51 int m_fillOption;
52 int m_selGoodDigi; // 0: no selection, 1: select good digi, -1: noisy digi
53 int m_selectTPC;
54 int m_totEvt;
55 string m_LUTfile;
56 double myClusterEff;
57
58 CgemLUTReader *lutreader;
59 NTupleHelper* myNTupleHelper;
60
61 //BesCgemGeoParameter *myCgemGeoPar;
62 CgemGeomSvc* myCgemGeomSvc;
63 int myNCgemLayers;
64 int myNSheets[4];
65 double myRXstrips[4];
66 double myRVstrips[4];
67 //CgemLayer myCgemLayer[4];
68 CgemGeoLayer* myCgemLayer[4];
69
70 ICgemCalibFunSvc* myCgemCalibSvc;
71
72 BesTimer* m_timer;
73
74 NTuple::Tuple* m_nt1;
75 NTuple::Item<int> m_evt1;
76 NTuple::Item<long> m_ncluster;
77 NTuple::Array<int> m_layerid,m_sheetid,m_flag,m_clusterid;
78 NTuple::Array<double> m_energy,m_recphi,m_recv;
79
80 NTuple::Tuple* m_nt2;
81 NTuple::Item<int> m_evt2;
82 NTuple::Item<long> m_nxvcluster;
83 NTuple::Array<double> m_pphi,m_pv;
84 NTuple::Array<int> m_player,m_psheet;
85 NTuple::Array<int> m_nxstrip,m_nvstrip;
86
87 NTuple::Tuple* m_nt3;
88 NTuple::Item<int> m_evt3;
89 NTuple::Item<long> m_ntruth;
90 NTuple::Array<int> m_layer,m_sheet;
91 NTuple::Array<double> m_phipre,m_zpre,m_phipost,m_zpost,m_tphi,m_tv;
92
93 NTuple::Tuple* m_nt5;
94 NTuple::Item<int> m_evt;
95 NTuple::Item<double> m_evttime;
96
97 NTuple::Tuple* m_nt6;
98 NTuple::Item<int> m_evt6;
99 NTuple::Item<long> m_ndtruth;
100 NTuple::Array<int> m_tlayer,m_tsheet;
101 NTuple::Array<double> m_dtphi,m_dtv;
102
103 NTuple::Tuple* m_nt7;
104 NTuple::Item<int> m_evt7;
105 NTuple::Item<long> m_ndrec;
106 NTuple::Array<int> m_dlayer,m_dsheet,m_dcluster;
107 NTuple::Array<double> m_drecphi,m_drecv;
108
109 int m_strip[3][2][2][1500];
110 //int m_cluster[3][2][2][1500];
111 double m_edep[3][2][2][1500];
112 // | | | |
113 // | | | \- strip id
114 // | | \- x or v flag
115 // | \- sheet
116 // \- layer
117 typedef pair<ClusterFlag,ClusterFlag> flagxv;
118 std::vector<ClusterFlag> m_x_group;
119 std::vector<ClusterFlag> m_v_group;
120 // 0 -> x ; 1 -> v
121 std::vector<flagxv> m_xv_group;
122 std::vector<ClusterFlag> m_mid_group;
123 std::vector<int> m_sameID;
124
125
126 typedef pair<int,int> keytype;
127 typedef pair<double,double> postype;
128 map<keytype,RecCgemCluster*> m_x_map;
129 map<keytype,RecCgemCluster*>::iterator m_x_map_it;
130 map<keytype,RecCgemCluster*> m_v_map;
131 map<keytype,RecCgemCluster*>::iterator m_v_map_it;
132 map<keytype,RecCgemCluster*> m_xv_map;
133 map<keytype,RecCgemCluster*>::iterator m_xv_map_it;
134 map<keytype,flagxv> m_trans_map;
135 map<keytype,flagxv>::iterator m_trans_map_it;
136 map<keytype,postype> m_driftrec_map;
137 map<keytype,postype>::iterator m_driftrec_map_it;
138 map<keytype,keytype> m_strip_map;
139 map<keytype,keytype>::iterator m_strip_map_it;
140 map<keytype,postype> m_pos_map;
141 map<keytype,postype>::iterator m_pos_map_it;
142
143
144
145
146
147
148 private:
149
150 bool isGoodDigi(CgemDigiCol::iterator iter);
151 bool selDigi(CgemDigiCol::iterator iter, int sel=1);
152 // time window for digi [ns]
153 double m_minDigiTime;
154 double m_maxDigiTime;
155 // min charge for digi
156 double myQMin;
157
158 void hist_def();
159 void reset();
160
161 void processstrips(int k);
162 void transcluster();
163 void mixcluster();
164 void posxfind(RecCgemCluster* reccluster);
165 void posvfind(RecCgemCluster* reccluster);
166 void posxvfind(RecCgemCluster* reccluster);
167 void posindrift(RecCgemCluster* reccluster);
168
169 void fillMCTruth();
170 void fillMCTruth(int run, int evt);
171 void fillRecData(int run, int evt);
172
173 StatusCode method0();// CC v0
174 StatusCode method1();// CC v1
175 StatusCode method2();// CC + mTPC v0
176 StatusCode toyCluster();
177 void checkRecCgemClusterCol(void);
178
179 float get_Time(CgemDigiCol::iterator iDigiCol);
180 float get_TimeWalk(CgemDigiCol::iterator iDigiCol);
181 float get_TimeRising(CgemDigiCol::iterator iDigiCol);
182 float get_TimeReference(CgemDigiCol::iterator iDigiCol);
183
184 // for method1,2
185 map<int,CgemDigiCol::iterator> myFiredStripMap[3][2][2];//[layer][sheet][XV]
186 void resetFiredStripMap();
187 /*
188 // for one event
189 int myNCluster[3][3];//[layer][XV] (0:X, 1:V, 2:XV)
190 vector<int> m_iStart_cluster[3][2][2];//[layer][sheet][XV]
191 vector<int> m_iEnd_cluster[3][2][2];
192 vector<double> m_E_cluster[3][2][2];//[layer][sheet][X or V or XV]
193 vector<int> m_id_cluster[3][2][3];// index in aCgemClusterCol
194 vector<double> m_vecPosCC_cluster[3][2][3];//[layer][sheet][X or V or XV]
195 vector<int> m_idxCluster[3][2][2]; // cluster index in iStart_cluster etc for XV clusters, [layer][sheet][XV]
196 vector<int> m_idxBoundaryXVcluster[3][2][2];// keep the index in idxCluster for XV cluster at X boundaries, [layer][sheet][end or start]
197 // for charge centroid
198 double mySumQ;
199 double mySumQX;
200 // for m-TPC
201 vector<double> m_vecPos_strips;
202 vector<double> m_vecTime_strips;
203 // reset the variables
204 void resetForEvent();
205 void resetForCluster();
206 */
207
208
209 NTuple::Tuple* m_rec_nt;
210 NTuple::Item<int> m_rec_run;
211 NTuple::Item<int> m_rec_evt;
212 NTuple::Item<int> m_rec_ncluster;
213 NTuple::Array<int> m_rec_clusterid;
214 NTuple::Array<int> m_rec_layerid;
215 NTuple::Array<int> m_rec_sheetid;
216 NTuple::Array<int> m_rec_flag;
217 NTuple::Array<double> m_rec_energydeposit;
218 NTuple::Array<double> m_rec_recphi;
219 NTuple::Array<double> m_rec_recv;
220 NTuple::Array<double> m_rec_recZ;
221 NTuple::Array<int> m_rec_clusterflagb;
222 NTuple::Array<int> m_rec_clusterflage;
223
224 NTuple::Tuple* m_mc_nt;
225 NTuple::Item<int> m_mc_run;
226 NTuple::Item<int> m_mc_evt;
227 NTuple::Item<int> m_mc_nhit;
228 NTuple::Array<int> m_mc_trackID;
229 NTuple::Array<int> m_mc_layerID;
230 NTuple::Array<int> m_mc_pdg;
231 NTuple::Array<int> m_mc_parentID;
232 NTuple::Array<double> m_mc_E_deposit;
233 NTuple::Array<double> m_mc_XYZ_pre_x;
234 NTuple::Array<double> m_mc_XYZ_pre_y;
235 NTuple::Array<double> m_mc_XYZ_pre_z;
236 NTuple::Array<double> m_mc_XYZ_post_x;
237 NTuple::Array<double> m_mc_XYZ_post_y;
238 NTuple::Array<double> m_mc_XYZ_post_z;
239 NTuple::Array<double> m_mc_P_pre_x;
240 NTuple::Array<double> m_mc_P_pre_y;
241 NTuple::Array<double> m_mc_P_pre_z;
242 NTuple::Array<double> m_mc_P_post_x;
243 NTuple::Array<double> m_mc_P_post_y;
244 NTuple::Array<double> m_mc_P_post_z;
245
246};
247#endif
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)