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