forked from LUHEP/NA61_Analysis_2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NA61_LRC_2_Handler.h
409 lines (342 loc) · 10 KB
/
NA61_LRC_2_Handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
#ifndef SHINELIB
#define SHINELIB
#include <evt/Event.h>
#include <evt/RecEvent.h>
#include <evt/rec/Trigger.h>
#include <fwk/CentralConfig.h>
#include <utl/ShineUnits.h>
#include <io/EventFile.h>
#include <io/EventFileChain.h>
#include <utl/ShineUnits.h>
#include <evt/rec/RecEventConst.h>
#include <det/TriggerConst.h>
#include <utl/MathConst.h>
#include <utl/PhysicalConst.h>
#include <evt/EventHeader.h>
#include <det/TPCConst.h>
#include <det/Target.h>
#include <det/TargetConst.h>
#include <det/PSD.h>
#include <det/BPD.h>
#include <det/Beam.h>
#include <det/Detector.h>
#endif
#ifndef ROOTLIB
#define ROOTLIB
#include <TFile.h>
#include <TH1D.h>
#include <TH1F.h>
#include <TH2D.h>
#include <TH3D.h>
#include <TH3.h>
#include <TCutG.h>
#include <TProfile.h>
#include <TList.h>
#include <TString.h>
#include <TMath.h>
#include <utl/Vector.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TLegend.h>
#include <THnSparse.h>
#endif
#ifndef CUTLIST
#define CUTLIST
#include "NA61_LRC_2_Cut_List.h"
#endif
#include <iostream>
#include <fstream>
using namespace std;
using namespace io;
using namespace utl;
using namespace evt;
using namespace evt::rec;
class StatEventInfo
{
public:
StatEventInfo() { myReset == false; this->Reset(); }
~StatEventInfo() {}
void Reset();
void DissectEvent(Event &event);
double_t myFitVtxZ;
double_t myFitVtxX;
double_t myFitVtxY;
double_t myBPD[6];
double_t myEnergyPSD;
vector<double> myTimeStructureWFA; //Ya pomenyal
unsigned int myRunNumber;
double_t myS5ADC;
private:
bool myReset;
};
class StatPSDInfo
{
public:
StatPSDInfo() { myReset == false; this->Reset(); }
~StatPSDInfo(){}
void Reset();
void DissectEvent(Event &event);
double_t myEnergyPSD;
private:
bool myReset;
};
class BaseHandler
{
public:
BaseHandler(const char* nameOut);
BaseHandler(const char* nameOut, bool simE);
void Raw();
virtual void Simulation();
bool IsItRaw();
virtual ~BaseHandler() {}
virtual void EndOfEvent(Event& ev) {}
virtual void PutTrack(const evt::rec::VertexTrack& vtxTrack, Event& ev) {}
virtual void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev) {}
virtual void Init() {}
bool EventTest(Event& ev);
void SetEventNumber(int nEvent); /// Does it exist?
bool GetSim() {return bSim;}
void AddEventCut(EventCut* cut);
void AddTrackCut(TrackCut* cut);
void AddT2Cut();
void AddS1_1Cut();
void AddWFACut();
void AddWFACut(double wfa_Time1, double wfa_Time2, double wfa_TimeCut);
void AddChargeCut();
void AddBPDCut();
void AddDirectBPDCut(double minX, double maxX, double minY, double maxY, eMyBPD bpd);
void AddMainVtxCut();
void AddFittedVtxCut();
void AddFitQualityCut();
void AddFitQualityCut(Int_t qual);
void AddNVtxTracksCut();
void AddNVtxTracksCut(unsigned int nVtxTracks);
void AddZVtxCut();
void AddZVtxCut(double_t minZ, double_t maxZ);
void AddCentrality(double_t minE, double_t maxE);
void AddPSDEnergyCut(double maxE, ePSDModulCombinations psdSet);
void AddPSDEnergyCut(double minE, double maxE, ePSDModulCombinations psdSet);
void AddPSDCloudsCut();
void AddPSDCloudsCut(ePSDNClouds eCloudType);
void AddS5Cut(double upLimit);
void AddRunNumberCut(int lowLimit, int upLimit);
void AddVtxTrackStatusCut();
void AddImpactPointCut();
void AddImpactPointCut(double_t max_dX, double_t max_dY);
void AddVTPCAndGTPCCut();
void AddVTPCAndGTPCCut(unsigned int minVTPC, unsigned int minGTPC);
void AddTotalTPCCut();
void AddTotalTPCCut(unsigned int minN);
void AddTOFCut();
void AddPtCut();
void AddPtCut(double_t minPt, double_t maxPt);
void AddPCut();
void AddPCut(double_t minP, double_t maxP);
void AddAcceptCut();
void AddAcceptRapidityCut();
void AddEECut();
void AddEtaCut(double_t minEta, double_t maxEta);
void AddPhiCut(double_t minPhi, double_t maxPhi);
void AddChargeTrkCut(int charge);
void AddDiluteCut(double remove_track_percent);
void AddStrangeCut();
void AddStandardCutsRaw(); //declarations in the main file
void AddStandardCutsRec();
void AddStandardCutsSim();
CutList* GetTrackCutList(){ return myTrackCutList; }
protected:
BaseHandler();
int mynEvent;
TString nameOutFile;
TString myNameHist;
bool init; //???
bool bSim;
bool bRaw;
int myHistInSparseCounter;
CutList* myTrackCutList;
CutList* myEventCutList;
unsigned int nTracks0, nTracks1;
private:
};
//bool PhiGeneralization(double_t& minPhi, double_t& maxPhi);
class OneWindHandler:public BaseHandler
{
public:
OneWindHandler(const char* nameOutFile);
OneWindHandler(const char* nameOutFile, bool simE);
~OneWindHandler();
void PutTrack(const VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
static StatEventInfo myEventInfo;
static bool bEventInfoFull;
private:
OneWindHandler();
// --- list of hists
TH1D* psdEnergyHist;
TH1D *chargeHist, *multHist,
// all charges neg pos
*pHist, *pHist0, *pHist1,
*pxHist, *pxHist0, *pxHist1,
*pyHist, *pyHist0, *pyHist1,
*pzHist, *pzHist0, *pzHist1,
*ptHist, *ptHist0, *ptHist1,
*etaHist, *etaHist0, *etaHist1,
*rapHist, *rapHist0, *rapHist1,
*phiHist, *phiHist0, *phiHist1;
TH2D /*plusminusHist,*/ *etaptHist, *etaptHist0, *etaptHist1;
TH2D *rapPtHist, *rapPtHist0, *rapPtHist1;
TH2D *ptPhiHist, *ptPhiHist0, *ptPhiHist1;
TH2D *BPD1Hist, *BPD2Hist, *BPD3Hist, *ImpParHist;
TH1D *WFAHist, *fitVtxHist;
TH2D *dEdxPHist0, *dEdxPHist1, *fitVtxNHist; //Ya pomenyal
TH2D *psdEnergyNHist;
TH2D *psdEnergyS5Hist;
TH2D *multS5Hist;
TH1D *totClusterHist, *verClusterHist, *gapClusterHist; //Ya pomenyal
TH1D *nBeamHist; //Ya pomenyal
// TH3D *acceptHist;
// --- counters
int nTracks;
// int nTracks1, nTracks0;
};
class LRCHandler:public BaseHandler
{
public:
LRCHandler(const char* nameOutFile);
LRCHandler(const char* nameOutFile, bool simE);
~LRCHandler();
void PutTrack(const VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
void AddForwardCut(TrackCut* cut);
void AddBackwardCut(TrackCut* cut);
void AddPhiForward(double_t minPhi, double_t maxPhi);
void AddPhiBackward(double_t minPhi, double_t maxPhi);
void AddEtaForward(double_t minEta, double_t maxEta);
void AddEtaBackward(double_t minEta, double_t maxEta);
void AddPtForward(double_t minPt, double_t maxPt);
void AddPtBackward(double_t minPt, double_t maxPt);
private:
LRCHandler();
// --- list of hists
TH2D *NetChHist;
TH2D *TestPtPtHist;
/* // all neg pos neg-pos pos-neg
*NNHist, *NNHist0, *NNHist1, *NNHist01, *NNHist10,
*PtNHist, *PtNHist0, *PtNHist1, *PtNHist01, *PtNHist10,
*PtPtHist, *PtPtHist0, *PtPtHist1, *PtPtHist01, *PtPtHist10; */
THnSparseD *myAllChargeTHSparse;
THnSparseD *myPositiveTHSparse;
THnSparseD *myNegativeTHSparse;
THnSparseD *myPosBackNegForTHSparse;
THnSparseD *myNegBackPosForTHSparse;
// --- counters
unsigned int nTracksB, nTracksB0, nTracksB1, nTracksF, nTracksF0, nTracksF1, shalala;
int chargeB, chargeF;
double_t sumPtB, sumPtB0, sumPtB1, sumPtF, sumPtF0, sumPtF1;
// --- windows
double_t myMinEtaB, myMaxEtaB, myMinEtaF, myMaxEtaF,
myMinPhiB, myMaxPhiB, myMinPhiF, myMaxPhiF;
bool phiWindow;
CutList* myForwardTrackCutList;
CutList* myBackwardTrackCutList;
};
class PtNFluctuationHandler :public BaseHandler
{
public:
PtNFluctuationHandler(const char* nameOutFile);
PtNFluctuationHandler(const char* nameOutFile, bool simE);
~PtNFluctuationHandler();
void PutTrack(const VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
private:
PtNFluctuationHandler();
// unsigned int nTracks0, nTracks1;
double sumPt0, sumPtsqr0, sumPt1, sumPtsqr1;
THnSparseD *myAllChargeTHSparse;
THnSparseD *myPositiveTHSparse;
THnSparseD *myNegativeTHSparse;
THnSparseD *myPosPtNegNTHSparse;
THnSparseD *myNegPtPosNTHSparse;
};
class PSDFluctuationHandler :public BaseHandler
{
public:
PSDFluctuationHandler(const char* nameOutFile);
PSDFluctuationHandler(const char* nameOutFile, bool simE);
~PSDFluctuationHandler();
void PutTrack(const VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev) {}
void PutPSDEnergy(Event& ev);
void EndOfEvent(Event& ev);
void Init();
void SetBeamEnergy(double E) { beamEnergy = E; }
void Simulation();
// void SetNModules(unsigned int nMod);
private:
PSDFluctuationHandler();
THnSparseD *myAllChargeTHSparse;
THnSparseD *myPositiveTHSparse;
THnSparseD *myNegativeTHSparse;
TH1D* mySpectEnergyHist;
unsigned int nEvents;
double sumPt0, sumPt1;
double sumEnergyPSD;
double beamEnergy;
bool bEnergyIsWriten;
};
/*class AcceptanceHandler :public BaseHandler
{
public:
AcceptanceHandler(const char* nameOutFile);
~AcceptanceHandler();
BaseHandler* GetRecHandlerForCuts();
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
private:
TH3D *mySimHist;
TH3D *myRecHist;
BaseHandler *myRecHandlerForCuts;
};
*/
class TimeHandler :public BaseHandler
{
public:
TimeHandler(const char* nameOutFile);
TimeHandler(const char* nameOutFile, bool simE);
~TimeHandler();
void PutTrack(const VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
static StatEventInfo myEventInfo;
static bool bEventInfoFull;
private:
TimeHandler();
// --- list of hists
TH2D* psdEnergyHist;
TH2D *chargeHist, *multHist,
*pHist, *ptHist, *phiHist;
TH2D *fitVtxHistX, *fitVtxHistY, *fitVtxHistZ;
};
// --- search of correlations between different PSD modules
class PSDHandler : public BaseHandler
{
public:
PSDHandler(const char* nameOut);
PSDHandler(const char* nameOut, bool sim);
~PSDHandler();
void PutTrack(const evt::rec::VertexTrack& vtxTrack, Event& ev);
void PutTrack(const evt::sim::VertexTrack& vtxTrack, Event& ev);
void EndOfEvent(Event& ev);
void Init();
private:
PSDHandler();
THnSparseD* myModuleSparse;
};