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