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