BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/EmcBhaCalib/EmcBhaCalib/EmcSelBhaEvent.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// Environment:
3// This software was developed for the BESIII collaboration. If you
4// use all or part of it, please give an appropriate acknowledgement.
5//
6// Copyright Information:
7// Copyright (C) 2005 IHEP
8//
9//------------------------------------------------------------------------
10
11#ifndef EMCSELBHAEVENT_H
12#define EMCSELBHAEVENT_H
13
14//-------------
15// C Headers --
16//-------------
17#include <ctime>
18
19#include <cstring>
20#include<list>
21
22#include "GaudiKernel/Algorithm.h"
23#include "GaudiKernel/Property.h"
24
25//Ntuple
26#include "GaudiKernel/NTuple.h"
27#include "EmcGeneralClass/EmcStructure.h"
28#include "EmcBhaCalib/EmcShower.h"
29#include "EmcBhaCalib/EmcShDigi.h"
30#include "EmcBhaCalib/EmcBhabhaEvent.h"
31#include "EmcBhaCalib/EmcBhabha.h"
32#include "EmcBhaCalib/EmcBhaCalibData.h"
33#include "EmcBhaCalib/BhabhaType.h"
34//#include "EmcBhaCalib/ReadBeamInfFromDb.h"
35
36#include "EmcCalibConstSvc/IEmcCalibConstSvc.h"
37#include "EmcCalibConstSvc/EmcCalibConstSvc.h"
38
39#include "BeamEnergySvc/IBeamEnergySvc.h"
40#include "BeamEnergySvc/BeamEnergySvc.h"
41
42using namespace std;
43
44class IEmcRecGeoSvc;
45class IBeamEnergySvc;
46// ---------------------
47// -- Class Interface --
48// ---------------------
49//
50// package EmcSelBhaEvent - Select Bhabha events(MCdata) for Emc-digi Calibration
51//
52// @author Chunxiu Liu (originator/contributor etc.);
53//
54
55class EmcSelBhaEvent:public Algorithm {
56
57 public:
58
59 //selected type
60 enum {m_oneProng=1, m_twoProng=2};
61
62 EmcSelBhaEvent(const std::string& name, ISvcLocator* pSvcLocator);
63
64
65 //--------------
66 // Destructor
67 //--------------
69
70 StatusCode initialize();
71 StatusCode execute();
72 StatusCode finalize();
73
74 //-----------------
75 bool passed() { return m_passed;}
76 void setPassed( bool passed) { m_passed = passed;}
77
78 int selectedType() const
79 {
80 return m_selectedType;
81 }
82
83 int selectedTrkID1() const
84 {
85 return m_selectedTrkID1;
86 }
87
88 int selectedTrkID2() const
89 {
90 return m_selectedTrkID2;
91 }
92
93 //-----------------
94 // matrix to convert theta,phi <-> index
95 int index(int theta, int phi) const {
96 int val = ((m_index)[theta][phi]);
97 return (val); }
98
99 // init Emc geometry (convertion matrix theta,phi <-> index)
100 void initGeom();
101
102 //--------------
103 StatusCode SelectBhabha();
104
105 StatusCode SelectFillBhabha();
106
108
109 //collect Bhabha event and fill matrix and vector of system of linear equations
111
112 //output matrix and vector to files
113 void OutputMV();
114
115 double findPhiDiff( double phi1, double phi2);
116
117
118 //read correction function f(theta) itheta=0:55
120
121 //read Esigma function sigma(theta) itheta=0:55
122 void readEsigma();
123
124 // energy deposition function 56(0:55) for shower selection of Bhabha calibration
126
127 // energy resolution function 56(0:55) for shower selection of Bhabha calibration
129
131
132
133 double Angle2ClosestShower( int ShowerID );
134
135 private :
136
137 // Declare r0, z0 cut for charged tracks
138 double m_vr0cut;
139 double m_vz0cut;
140
141 double m_lowEnergyShowerCut;
142 double m_highEnergyShowerCut;
143 double m_matchThetaCut ;
144 double m_matchPhiCut ;
145
146 double m_highMomentumCut;
147 double m_EoPMaxCut;
148 double m_EoPMinCut;
149 double m_minAngShEnergyCut;
150 double m_minAngCut;
151 double m_acolliCut;
152 double m_eNormCut;
153 double m_pNormCut;
154 double m_oneProngMomentumCut;
155
156/**selected event type */
157 int m_selectedType;
158 int m_selectedTrkID1;
159 int m_selectedTrkID2;
160
161 int m_Nothing;
162 int m_oneProngsSelected;
163 int m_twoProngsMatchedSelected;
164 int m_twoProngsOneMatchedSelected;
165
166 // calculate the expected energy of a Bhabha depending on theta
167 double expectedEnergy( long int ixtal ); //not been used now
168
169 //Correction funtion 56(0:55) parameter
170 double m_corFun[56];
171
172 //Esigma 56(0:55) as function of Itheta
173 double m_eSigma[56];
174
175 // energy deposition function 56(0:55) for shower selection of Bhabha calibration
176 double m_eDepEne[56];
177
178 double m_eRawMean[6240];
179 double m_eRawRMS[6240];
180
181 double m_eRawPeak[6240];
182 double m_eMcPeak[6240];
183
184 double m_eDepMean[6240];
185 double m_eDepPeak[6240];
186 double m_eDepSigma[6240];
187 //energy resolution
188 double m_eSigmaExp[56];
189 //cut off digis further away from the maxima digi
190 // of a shower in theta and phi
191
192 int m_digiRangeCut; //be not used now for MCdata
193
194 //low energy shower cut
195 double m_ShEneThreshCut;
196
197 // high energy shower cut
198 double m_ShEneLeptonCut;
199
200 // cut on minimum number of crystals of a shower in the event
201 int m_minNrXtalsShowerCut; //be not used now for MCdata
202
203 // cut on maximum number of crystals of a shower in the event
204 int m_maxNrXtalsShowerCut; //be not used now for MCdata
205
206 // cut on minimum difference of the two showers in phi
207 double m_phiDiffMinCut; //be not used now for MCdata
208
209 // cut on maximum difference of the two showers in phi
210 double m_phiDiffMaxCut; //be not used now for MCdata
211
212 // cut on number of showers above low energy threshold less this
213 int m_nrShThreshCut; //be not used now for MCdata
214
215 // cut on ratio measured to expected energy of the event
216 //double m_eNormCut; //be not used now for MCdata
217
218 // cut on minimum difference of the two showers in theta
219 double m_thetaDiffCut; //be not used now for MCdata
220
221 double m_LATCut; //be not used now for MCdata
222
223 // no shower closer than this angle
224 //double m_minAngCut; //be not used now for MCdata
225
226 //number of events passed
227 long int m_events;
228
229 //number of events selected
230 long int m_taken;
231
232 //number of events with OneProng
233
234 long int m_OneProng;
235 //number of events with TwoProngMatched
236 long int m_TwoProngMatched;
237 //number of events with TwoProngOneMatched
238 long int m_TwoProngOneMatched;
239
240 //number of events rejected
241 long int m_rejected;
242
243 //number of showers accepted
244 long m_showersAccepted;
245
246 // int m_oneProngsSelelected; //be not used now for MCdata
247 //int m_twoProngsSelected; //be not used now for MCdata
248
249
250 list<EmcShower> m_showerList;
251
252 //-------------
253 // fill Matrix of system of linear equations
254 void fillMatrix();
255
256 //write the matrix and vector also to file ?
257 bool m_writeMVToFile;
258 //file name extensions
259 std::string m_fileExt;
260
261 //file directory
262 std::string m_fileDir;
263
264 //input file directory
265 std::string m_inputFileDir;
266
267 //Selection method with "Ithe" and "Ixtal"
268 std::string m_selMethod;
269
270 //calibration data: matrix M, vector R and other stuff
271 EmcBhaCalibData* myCalibData;
272 //the Bhabha event that is filled with the two showers
273 EmcBhabhaEvent* myBhaEvt;
274
275 int m_nXtals;
276
277 //SigmaCut : selecting Bhabha events for digi-calibration
278 double m_sigmaCut;
279 //beam energy GeV
280 double m_beamEnergy;
281
282
283 bool m_ReadBeamEFromDB;
284 bool m_elecSaturation;
285 IBeamEnergySvc *m_BeamEnergySvc;
286 // ReadBeamInfFromDb m_readDb;
287 int m_irun;
288
289 //message output in the tool classes
290 int m_MsgFlag;
291
292 // matrix to convert theta,phi <-> index
293 int **m_index;
294 int m_measure[6240];
295 bool m_passed;
296 double m_inputConst[6240];
297 int m_event;
298 int m_run;
299 IEmcRecGeoSvc* m_iGeoSvc;
300
301 //IEmcCalibConstSvc* m_emcCalibConstSvc;
302
303};
304
305
306#endif // EMCSELBHAEVENT_H
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
Double_t phi2
Double_t phi1
double findPhiDiff(double phi1, double phi2)
void readRawPeakIxtal()
void readSigmaExp()
EmcSelBhaEvent(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode SelectBhabha()
StatusCode execute()
void readDepEneFun()
void CollectBhabha()
double Angle2ClosestShower(int ShowerID)
StatusCode initialize()
StatusCode SelectFillBhabha()
StatusCode finalize()