forked from LUHEP/NA61_Analysis_2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NA61_LRC_2_Cut.cpp
1813 lines (1613 loc) · 46 KB
/
NA61_LRC_2_Cut.cpp
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef CUTS
#define CUTS
#include "NA61_LRC_2_Cut.h"
#endif
#ifndef CONST
#define CONST
#include "NA61_LRC_2_Const.h" //FIXME
#endif
EventCut::EventCut(){}
T2Cut::T2Cut()
{
my_Name = "T2";
my_Short_Name = "T2";
}
bool T2Cut::CheckEvent(Event& event, bool bSim)
{
// cout<<"T2"<<endl;
const raw::Trigger& trigger = event.GetRawEvent().GetBeam().GetTrigger();
// cout<<"_"<<trigger.IsTrigger(det::TriggerConst::eT2, det::TriggerConst::ePrescaled)<<"\t";
if (!trigger.IsTrigger(det::TriggerConst::eT2, det::TriggerConst::ePrescaled))
return 0;
myNEntries++;
return 1;
}
S1_1Cut::S1_1Cut()
{
my_Name = "S1_1";
my_Short_Name = "S1_1";
}
bool S1_1Cut::CheckEvent(Event& event, bool bSim)
{
// cout<<"S1_1"<<endl;
const int nbeam1 = event.GetRawEvent().GetBeam().GetTrigger().GetNumberOfSignalHits
(det::TimeStructureConst::eWFA,det::TriggerConst::eS1_1);
if (nbeam1 != 1) return 0;
myNEntries++;
return 1;
}
WFACut::WFACut():
myWfaTime1(wfaTime1),
myWfaTime2(wfaTime2),
myWfaTimeCut(wfaTimeCut)
{
my_Name = "WFA";
my_Short_Name = "WFA";
}
WFACut::WFACut(double wfa_Time1, double wfa_Time2, double wfa_TimeCut):
myWfaTime1(wfa_Time1),
myWfaTime2(wfa_Time2),
myWfaTimeCut(wfa_TimeCut)
{
my_Name = "WFA";
my_Short_Name = "WFA";
}
TString WFACut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f_%f",myWfaTime1,myWfaTime2,myWfaTimeCut);
name = my_Short_Name + name2;
return name;
}
bool WFACut::CheckEvent(Event& event, bool bSim)
{
// cout<<"WFA"<<endl;
const raw::Trigger& trigger = event.GetRawEvent().GetBeam().GetTrigger();
vector<double> timeStructureWFA;
if (!trigger.HasTimeStructure(det::TimeStructureConst::eWFA, det::TriggerConst::eS1_1))
return 0;
timeStructureWFA = trigger.GetTimeStructure(det::TimeStructureConst::eWFA, det::TriggerConst::eS1_1);
bool beamExist = false;
for (unsigned int i = 0; i < timeStructureWFA.size(); ++i)
{
if (!beamExist && (timeStructureWFA.at(i) == myWfaTime1 || timeStructureWFA.at(i) == myWfaTime2))
beamExist = true;
else if (fabs(timeStructureWFA.at(i) - (myWfaTime1 + myWfaTime2) / 2.) < 1000. * myWfaTimeCut)
{
beamExist = false;
break;
}
}
if (!beamExist) return 0;
myNEntries++;
return 1;
}
ChargeCut::ChargeCut():
myConfigPath(configPath)
{
my_Name = "Ion_Charge";
my_Short_Name = "ICh";
}
ChargeCut::ChargeCut(string yourConfigPath):
myConfigPath(yourConfigPath)
{
my_Name = "Ion_Charge";
my_Short_Name = "ICh";
}
TFile ChargeCut::zFile(string(configPath + "/cutFiles/zCut.root").c_str());
TCutG* ChargeCut::zCut = (TCutG*) zFile.Get("ZvsDelayedZCut");
bool ChargeCut::CheckEvent(Event& event, bool bSim)
//by Emil Kaptur 08.2013
{
// cout<<"ChargeCut"<<endl;
const raw::Trigger& trigger = event.GetRawEvent().GetBeam().GetTrigger();
const double_t detZADC1 = trigger.GetADC(det::TriggerConst::eZdet_1);
const double_t detZADC2 = trigger.GetADC(det::TriggerConst::eZdet_2);
const double_t detZADCAnalog = trigger.GetADC(det::TriggerConst::eZdet_sum);
const double_t detZADCAnalogDelayed = trigger.GetADC(det::TriggerConst::eZdet_sum_del);
const EventHeader& eventHeader = event.GetEventHeader();
int runNumber = 0;
runNumber = eventHeader.GetRunNumber();
// sanity check
if (runNumber == 0) return 0;
map<int, double_t*> zCalibrationMap;
ifstream calibrationFile;
calibrationFile.open(string(myConfigPath + "/calibration/calibrationZtest.txt").c_str());
double_t* pArrayCalib[114];
int iRun = 0;
while (calibrationFile.good())
{
int runNo;
pArrayCalib[iRun] = new double_t[4];
for (int l = 0; l<4; l++)
(pArrayCalib[iRun])[l] = 0;
calibrationFile >> runNo;
calibrationFile >> (pArrayCalib[iRun])[0];
calibrationFile >> (pArrayCalib[iRun])[1];
calibrationFile >> (pArrayCalib[iRun])[2];
calibrationFile >> (pArrayCalib[iRun])[3];
if ((pArrayCalib[iRun])[0] > (pArrayCalib[iRun])[1])
{
double_t temp = (pArrayCalib[iRun])[0];
(pArrayCalib[iRun])[0] = (pArrayCalib[iRun])[1];
(pArrayCalib[iRun])[1] = temp;
}
if ((pArrayCalib[iRun])[2] > (pArrayCalib[iRun])[3])
{
double_t temp = (pArrayCalib[iRun])[2];
(pArrayCalib[iRun])[2] = (pArrayCalib[iRun])[3];
(pArrayCalib[iRun])[3] = temp;
}
zCalibrationMap.insert(make_pair(runNo, pArrayCalib[iRun]));
iRun++;
}
calibrationFile.close();
if (iRun!=114) cout<<"EMIIIIIIILL!!!!!!!!!!!!!!"<<iRun<<endl;
// file with Z outliers cut defined (for 150A GeV only)
// TFile zFile(string(myConfigPath + "/cutFiles/zCut.root").c_str());
// TCutG* zCut = (TCutG*) zFile.Get("ZvsDelayedZCut");
// applying temprorary calibration (for Z-cuts)
double_t calibratedZDet = 0;
double_t calibratedZDetDelayed = 0;
if (zCalibrationMap.find(runNumber) != zCalibrationMap.end())
{
double_t c0 = zCalibrationMap.find(runNumber)->second[0];
double_t c1 = zCalibrationMap.find(runNumber)->second[1];
double_t c2 = zCalibrationMap.find(runNumber)->second[2];
double_t c3 = zCalibrationMap.find(runNumber)->second[3];
calibratedZDet = detZADCAnalog * 3/(c1-c0) + 1-(3*c0)/(c1-c0);
if (detZADCAnalog < 31)
calibratedZDet = (detZADC1 + detZADC2) * 3/(c1-c0) + 1-(3*c0)/(c1-c0);
calibratedZDetDelayed = detZADCAnalogDelayed * 3/(c3-c2) + 1-(3*c2)/(c3-c2);
}
for (int i=0; i<114; i++)
delete [](pArrayCalib[i]);
//Z Detector Cut
if (calibratedZDet < 12 || calibratedZDet > 21)
return 0;
//Z Detector Outliers Cut
if(!zCut->IsInside(calibratedZDet, calibratedZDetDelayed))
return 0;
myNEntries++;
return 1;
}
BPDCut::BPDCut()
{
my_Name = "BPD";
my_Short_Name = "BPD";
}
bool BPDCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"BPD"<<endl;
if (bSim == false){
// RecEvent* pRecEvent= event.GetRecEvent();
const int beamStatus = event.GetRecEvent().GetBeam().GetStatus();
if (beamStatus && (BeamConst::eNotFitted||BeamConst::eBadBPD3)){
// cout<<"beamStatus: "<<beamStatus<<endl;
return 0;
}
} else {
// SimEvent* pSimEvent=&event.GetSimEvent();
// const int beamStatus = pSimEvent->GetBeam().GetStatus();
// if (beamStatus & (BeamConst::eNotFitted|BeamConst::eBadBPD3))
// return 0;
}
myNEntries++;
return 1;
}
DirectBPDCut::DirectBPDCut(double minX, double maxX, double minY, double maxY, eMyBPD bpd)
{
if (minX > maxX){
cout << "Error: MinX>MaxX! myMinX=maxX, myMaxX=minX" << endl;
double a;
a = minX;
minX = maxX;
maxX = a;
}
if (minY > maxY){
cout << "Error: MinY>MaxY! myMinY=maxY, myMaxY=minY" << endl;
double a;
a = minY;
minY = maxY;
maxY = a;
}
myMinX = minX;
myMaxX = maxX;
myMinY = minY;
myMaxY = maxY;
myBPD = bpd;
my_Name = "Direct_BPD";
my_Short_Name = "DirBPD";
}
bool DirectBPDCut::CheckEvent(Event& event, bool bSim)
{
if (bSim == false){
evt::rec::Beam beam = event.GetRecEvent().GetBeam();
double BPDcoord[6] = { 0 };
for (int i = 0; i<6; i++)
BPDcoord[i] = beam.GetBPDPlane((det::BPDConst::EPlaneId)i).GetPosition();
double X, Y;
switch (myBPD)
{
case BPD1:
X = BPDcoord[0]; Y = BPDcoord[1]; break;
case BPD2:
X = BPDcoord[2]; Y = BPDcoord[3]; break;
case BPD3:
X = BPDcoord[4]; Y = BPDcoord[5]; break;
default:
break;
}
if (X>myMaxX || X<myMinX || Y>myMaxY || Y<myMinY )
return 0;
}
myNEntries++;
return 1;
}
TString DirectBPDCut::GetShortNameWithPar()
{
TString name;
char name2[50];
int i = myBPD;
sprintf(name2, "_%i_%f_%f_%f_%f",i, myMinX, myMaxX, myMinY, myMaxY);
name = my_Short_Name + name2;
return name;
}
MainVertexCut::MainVertexCut()
{
my_Name = "Main_Vtx";
my_Short_Name = "MV";
}
bool MainVertexCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"MVtx"<<endl;
RecEvent* pRecEvent=&event.GetRecEvent();
if (pRecEvent->HasMainVertex()==1)
{
myNEntries++;
return 1;
}
else return 0;
}
FittedVertexCut::FittedVertexCut()
{
my_Name = "Fitted_Vtx";
my_Short_Name = "FV";
}
bool FittedVertexCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"FVtxCut"<<endl;
if (bSim == false){
RecEvent* pRecEvent=&event.GetRecEvent();
if (pRecEvent->HasPrimaryVertex(VertexConst::ePrimaryFitZ)){
myNEntries++;
return 1;
}
else return 0;
}else{
// SimEvent* pSimEvent=&event.GetSimEvent();
// if (pSimEvent->HasPrimaryVertex(VertexConst::ePrimaryFitZ)){
// myNEntries++;
// return 1;
// }
// else return 0;
myNEntries++;
return 1;
}
}
FitQualityCut::FitQualityCut():
my_Quality(track_Quality)
{
my_Name = "Fit_Quality";
my_Short_Name = "FQu";
}
FitQualityCut::FitQualityCut(Int_t qual):
my_Quality(qual)
{
my_Name = "Fit_Quality";
my_Short_Name = "FQu";
}
bool FitQualityCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"FitQua"<<endl;
if (bSim==false){
RecEvent* pRecEvent=&event.GetRecEvent();
Vertex* pMainVertex=&pRecEvent->GetMainVertex();
rec::Vertex& primaryVertex = pRecEvent->GetPrimaryVertex(rec::VertexConst::ePrimaryFitZ);
if (/*pMainVertex->*/primaryVertex.GetFitQuality() != rec::FitQuality::ePerfect)//my_Quality)
return 0;
} else{
// SimEvent* pSimEvent=&event.GetSimEvent();
// evt::sim::Vertex* pMainVertex=&pSimEvent->GetMainVertex();
//
// if (pMainVertex->GetFitQuality()!=my_Quality) return 0;
}
myNEntries++;
return 1;
}
TString FitQualityCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%i",my_Quality);
name = my_Short_Name + name2;
return name;
}
NVertexTracksCut::NVertexTracksCut():
myMinNVtxTrack(nMinVertexTracks)
{
my_Name = "N_Vtx_Track";
my_Short_Name = "NVTr";
}
NVertexTracksCut::NVertexTracksCut(unsigned int nVtxTrack):
myMinNVtxTrack(nVtxTrack)
{
my_Name = "N_Vtx_Track";
my_Short_Name = "NVTr";
}
bool NVertexTracksCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"NVtx"<<endl;
unsigned int nGoodVertexTracks = 0;
if (bSim == false){
RecEvent& recEvent = event.GetRecEvent();
for (list<evt::rec::VertexTrack>::const_iterator iTrack = recEvent.Begin<evt::rec::VertexTrack>();
iTrack != recEvent.End<evt::rec::VertexTrack>(); ++iTrack) {
nGoodVertexTracks++;
//const evt::rec::VertexTrack& vtxTrack = *iTrack;
}
// RecEvent* pRecEvent=&event.GetRecEvent();
// Vertex* pMainVertex=&event.GetRecEvent().GetMainVertex();
// for (VertexTrackIndexIterator vtxTrackIter = pMainVertex->DaughterTracksBegin();
// vtxTrackIter != pMainVertex->DaughterTracksEnd(); ++vtxTrackIter){
// VertexTrack& vtxTrack = (*pRecEvent).Get(*vtxTrackIter);
// if ((vtxTrack.GetStatus() == 0) && (vtxTrack.HasTrack()))
// nGoodVertexTracks++;
// if (nGoodVertexTracks >= myMinNVtxTrack) {myNEntries++; return 1;}
// }
} else {
evt::SimEvent& simEvent = event.GetSimEvent();
RecEvent& recEvent = event.GetRecEvent();
for (list<evt::sim::VertexTrack>::const_iterator iTrack = simEvent.Begin<evt::sim::VertexTrack>();
iTrack != simEvent.End<evt::sim::VertexTrack>(); ++iTrack) {
if (iTrack->GetType() == sim::VertexTrackConst::eGeneratorFinal) {
//const evt::sim::VertexTrack& vtxTrack = *iTrack;
nGoodVertexTracks++;
}
}
// SimEvent* pSimEvent=&event.GetSimEvent();
// Vertex* pMainVertex=&event.GetSimEvent().GetMainVertex();
// for (VertexTrackIndexIterator vtxTrackIter = pMainVertex->DaughterTracksBegin();
// vtxTrackIter != pMainVertex->DaughterTracksEnd(); ++vtxTrackIter){
// VertexTrack& vtxTrack = (*pSimEvent).Get(*vtxTrackIter);
// if ((vtxTrack.GetStatus() == 0) && (vtxTrack.HasTrack()))
// nGoodVertexTracks++;
// if (nGoodVertexTracks >= myMinNVtxTrack) {myNEntries++; return 1;}
// }
}
if (nGoodVertexTracks < myMinNVtxTrack)
return 0;
//myNEntries++;
//cout << "nvertex cut " << myNEntries << endl;
myNEntries++;
return 1;
}
TString NVertexTracksCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%i",myMinNVtxTrack);
name = my_Short_Name + name2;
return name;
}
ZVertexCut::ZVertexCut():
myMinVtxZ(minZVertex),
myMaxVtxZ(maxZVertex)
{
my_Name = "Z_Coord";
my_Short_Name = "Z";
}
ZVertexCut::ZVertexCut(double minZ, double maxZ):
myMinVtxZ(minZ),
myMaxVtxZ(maxZ)
{
my_Name = "Z_Coord";
my_Short_Name = "Z";
}
bool ZVertexCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"ZVtx"<<endl;
if (bSim == false){
// RecEvent* pRecEvent=&event.GetRecEvent();
Vertex* pPrimaryVertex = &event.GetRecEvent().GetPrimaryVertex(rec::VertexConst::ePrimaryFitZ);
const utl::Point& Vertex = pPrimaryVertex->GetPosition();
// Vertex* pMainVertex=&event.GetRecEvent().GetMainVertex();
// const utl::Point& Vertex = pMainVertex->GetPosition();
double_t ZVertex = Vertex.GetZ();
if (ZVertex > myMaxVtxZ || ZVertex < myMinVtxZ) return 0;
} else {
// SimEvent* pSimEvent=&event.GetSimEvent();
// Vertex* pMainVertex=&event.GetSimEvent().GetMainVertex();
//
// const utl::Point& Vertex = pMainVertex->GetPosition();
// double_t ZVertex = Vertex.GetZ();
//
// if (ZVertex > myMaxVtxZ || ZVertex < myMinVtxZ) return 0;
myNEntries++;
return 1;
}
myNEntries++;
return 1;
}
TString ZVertexCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f",myMinVtxZ,myMaxVtxZ);
name = my_Short_Name + name2;
return name;
}
CentralityCut::CentralityCut(double minPer, double maxPer, bool bRaw):
myLowPer(minPer),
myUpPer(maxPer)
{
my_Name = "Centrality";
my_Short_Name = "PSD";
myMaxEPSD=0;
myMinEPSD=0;
double per;
double E = 0;
if (bRaw==true){
//cout << "centrality_raw" << endl;
ifstream in(configPath+"/psdByEmil/150BeBeCentrality28Mod.txt");
while(in>>per){
if(per>myLowPer){
myMinEPSD = E;
in>>E;
break;
}
in>>E;
}
while(in>>per){
if(per>myUpPer){
myMaxEPSD = E;
in>>E;
break;
}
in>>E;
}
if(myMaxEPSD == 0){
cout<<"WARNING: max percentile can't be so large (problem with simulation of T2 trigger)"<<endl;
cout<<"it has reduced to the largest value: "<<per<<endl;
myMaxEPSD=E;
}
in.close();
cout<<myLowPer*100<<"% "<<myMinEPSD<<endl;
cout<<myUpPer*100<<"% "<<myMaxEPSD<<endl;
}else{
//cout << "Centrality_sim" << endl;
this->InitLegacyCentrality();//FIXME bad realization!
}
}
void CentralityCut::InitLegacyCentrality()
{
pDetermineCentrality = new LegacyCentrality();
// pDetermineCentrality->SetDataPath(configPath); //change it to your path
double centralityEdges[4] = {myLowPer, myUpPer, myUpPer+0.1, myUpPer+0.2}; // Can be changed if statistics too low
pDetermineCentrality->SetCentralityEdges(centralityEdges);
bInit=true;
}
//fwk::CentralConfig::GetInstance("bootstrap.xml.in");
CentralConfig& cc = CentralConfig::GetInstance(str_configPath + "/bootstrap.xml");
bool CentralityCut::CheckEvent(Event& event, bool bSim)
{
// cout<<"Centr"<<endl;
if (bInit==false){ //RAW data
double_t eventPSDEnergy = 0;
if (bSim == false)
{//DON'T FORGET TO CHANGE the Handler
RecEvent* pRecEvent=&event.GetRecEvent();
PSD& psd = pRecEvent->GetPSD();
for (int i=0; i<nPSDMods; i++)
eventPSDEnergy = eventPSDEnergy + psd.GetModule(i+1).GetEnergy();
} else{
// SimEvent* pSimEvent=&event.GetSimEvent();
// PSD& psd = pSimEvent->GetPSD();
// for (int i=0; i<nPSDMods; i++)
// eventPSDEnergy = eventPSDEnergy + psd.GetModule(i+1).GetEnergy();
myNEntries++;
return 1;
}
if ((eventPSDEnergy > myMinEPSD)&&(eventPSDEnergy < myMaxEPSD)) {
myNEntries++;
return 1;
}
else return 0;
}else{
// cout<<"CheckEvent\t";
const EventHeader& eventHeader = event.GetEventHeader();
unsigned int runNumber = eventHeader.GetRunNumber();
det::Detector::GetInstance().Update(eventHeader.GetTime(), runNumber);
vector<int> centralityClasses;
int centralityClass = pDetermineCentrality->GetCentralityClass(event, ¢ralityClasses);
// cout<<"centrality:"<<centralityClass<<endl;
if (centralityClass == 2){
myNEntries++;
return 1;
}
return 0;
}
}
TString CentralityCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f",myLowPer,myUpPer);
name = my_Short_Name + name2;
return name;
}
VtxTrackStatusCut::VtxTrackStatusCut()
{
my_Name = "Vtx_Tr_Status";
my_Short_Name = "VTrSt";
}
bool VtxTrackStatusCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"VtxStatus"<<endl;
if (vtxTrack.GetStatus() != 0 || !vtxTrack.HasTrack()) return 0;
myNEntries++;
return 1;
}
bool VtxTrackStatusCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"VtxStatus"<<endl;
// if (vtxTrack.GetStatus() != 0 || !vtxTrack.HasTrack()) return 0;
myNEntries++;
return 1;
}
ImpactPointCut::ImpactPointCut():
myMaxImpX(maxImpactX),
myMaxImpY(maxImpactY)
{
my_Name = "Impact_Point";
my_Short_Name = "ImP";
}
ImpactPointCut::ImpactPointCut(double maxX, double maxY):
myMaxImpX(maxX),
myMaxImpY(maxY)
{
my_Name = "Impact_Point";
my_Short_Name = "ImP";
}
bool ImpactPointCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"Impact Point Cut"<<endl;
const Vertex& mainVertex = recEvent.GetMainVertex();
const Point& impactPoint = vtxTrack.GetImpactPoint();
const Vector vertexToImpact = mainVertex.GetPosition() - impactPoint;
const double_t bx = vertexToImpact.GetX();
const double_t by = vertexToImpact.GetY();
if (fabs(bx) >= myMaxImpX || fabs(by) >= myMaxImpY)
return 0;
myNEntries++;
return 1;
}
bool ImpactPointCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"Impact Point Cut"<<endl;
/* const Vertex& mainVertex = simEvent.GetMainVertex();
const Point& impactPoint = vtxTrack.GetImpactPoint();
const Vector vertexToImpact = mainVertex.GetPosition() - impactPoint;
const double_t bx = vertexToImpact.GetX();
const double_t by = vertexToImpact.GetY();
if (fabs(bx) >= myMaxImpX || fabs(by) >= myMaxImpY)
return 0;*/
myNEntries++;
return 1;
}
TString ImpactPointCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f",myMaxImpX,myMaxImpY);
name = my_Short_Name + name2;
return name;
}
TotalTPCClustersCut::TotalTPCClustersCut():
myMinTotalClusters(nMinTotalClusters)
{
my_Name = "Total_TPC_Clusters";
my_Short_Name = "TPC";
}
TotalTPCClustersCut::TotalTPCClustersCut(unsigned int minTotal):
myMinTotalClusters(minTotal)
{
my_Name = "Total_TPC_Clusters";
my_Short_Name = "TPC";
}
bool TotalTPCClustersCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"Total TPC Cut"<<endl;
const Track& track = recEvent.Get(vtxTrack.GetTrackIndex());
int nClusters = 0;
if (systemType == ArSc)
nClusters = track.GetNumberOfClusters(TrackConst::eAll) - track.GetNumberOfClusters(TrackConst::eGTPC);
else
nClusters = track.GetNumberOfClusters(TrackConst::eAll);
if (nClusters < myMinTotalClusters)
return 0;
myNEntries++;
return 1;
}
bool TotalTPCClustersCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"Total TPC Cut"<<endl;
// const Track& track = simEvent.Get(vtxTrack.GetTrackIndex());
// if (track.GetNumberOfClusters(TrackConst::eAll) < myMinTotalClusters)
// return 0;
myNEntries++;
return 1;
}
TString TotalTPCClustersCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%i",myMinTotalClusters);
name = my_Short_Name + name2;
return name;
}
VTPCAndGTPCClustersCut::VTPCAndGTPCClustersCut():
myMinVTPCClusters(nMinVTPCClusters),
myMinGTPCClusters(nMinGTPCClusters)
{
my_Name = "VTPC_GTPC_Clusters";
my_Short_Name = "VGTPC";
}
VTPCAndGTPCClustersCut::VTPCAndGTPCClustersCut(unsigned int minVTPC, unsigned int minGTPC):
myMinGTPCClusters(minGTPC),
myMinVTPCClusters(minVTPC)
{
my_Name = "VTPC_GTPC_Clusters";
my_Short_Name = "VGTPC";
}
bool VTPCAndGTPCClustersCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"VTPC>PC Cut"<<endl;
const Track& track = recEvent.Get(vtxTrack.GetTrackIndex());
if ((track.GetNumberOfClusters(TrackConst::eVTPC1) + track.GetNumberOfClusters(TrackConst::eVTPC2) < myMinVTPCClusters)
&& (track.GetNumberOfClusters(TrackConst::eGTPC) < myMinGTPCClusters))
return 0;
myNEntries++;
return 1;
}
bool VTPCAndGTPCClustersCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"VTPC>PC Cut"<<endl;
// const Track& track = simEvent.Get(vtxTrack.GetTrackIndex());
// if ((track.GetNumberOfClusters(TrackConst::eVTPC1) + track.GetNumberOfClusters(TrackConst::eVTPC2) < myMinVTPCClusters)
// && (track.GetNumberOfClusters(TrackConst::eGTPC) < myMinGTPCClusters))
// return 0;
myNEntries++;
return 1;
}
TString VTPCAndGTPCClustersCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%i_%i",myMinVTPCClusters,myMinGTPCClusters);
name = my_Short_Name + name2;
return name;
}
TOFCut::TOFCut()
{
my_Name = "TOF";
my_Short_Name = "TOF";
}
bool TOFCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
if (vtxTrack.GetNumberOfTOFMasses())
return 0;
myNEntries++;
return 1;
}
bool TOFCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// if (vtxTrack.GetNumberOfTOFMasses())
// return 0;
myNEntries++;
return 1;
}
PCut::PCut():
myMaxP(maxP),
myMinP(minP)
{
my_Name = "Momentum";
my_Short_Name = "P";
}
PCut::PCut(double min_P, double max_P):
myMaxP(max_P),
myMinP(min_P)
{
my_Name = "Momentum";
my_Short_Name = "P";
}
bool PCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"P"<<endl;
double_t P;
Vector vtxMomentum = vtxTrack.GetMomentum();
P=vtxMomentum.GetMag();
if (P > myMaxP || P < myMinP) return 0;
myNEntries++;
return 1;
}
bool PCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"P"<<endl;
double_t P;
Vector vtxMomentum = vtxTrack.GetMomentum();
P=vtxMomentum.GetMag();
if (P > myMaxP || P < myMinP) return 0;
myNEntries++;
return 1;
}
TString PCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f",myMinP,myMaxP);
name = my_Short_Name + name2;
return name;
}
PtCut::PtCut():
myMaxPt(maxPt),
myMinPt(minPt)
{
my_Name = "Transvers_Momentum";
my_Short_Name = "Pt";
}
PtCut::PtCut(double min_Pt, double max_Pt):
myMaxPt(max_Pt),
myMinPt(min_Pt)
{
my_Name = "Transvers_Momentum";
my_Short_Name = "Pt";
}
bool PtCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"Pt"<<endl;
double_t Px, Py, Pt;
Vector vtxMomentum = vtxTrack.GetMomentum();
Px=vtxMomentum.GetX();
Py=vtxMomentum.GetY();
Pt=sqrt(Px*Px+Py*Py);
if (Pt > myMaxPt || Pt < myMinPt) return 0;
myNEntries++;
return 1;
}
bool PtCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{
// cout<<"Pt"<<endl;
double_t Px, Py, Pt;
Vector vtxMomentum = vtxTrack.GetMomentum();
Px=vtxMomentum.GetX();
Py=vtxMomentum.GetY();
Pt=sqrt(Px*Px+Py*Py);
if (Pt > myMaxPt || Pt < myMinPt) return 0;
myNEntries++;
return 1;
}
TString PtCut::GetShortNameWithPar()
{
TString name;
char name2[50];
sprintf(name2,"_%f_%f",myMinPt,myMaxPt);
name = my_Short_Name + name2;
return name;
}
AcceptCut::AcceptCut():
myConfigPath(configPath)
{
TFile* in_file = TFile::Open(string(myConfigPath + "/acceptance.root").c_str());
//TH3D* acceptHist = (TH3D*)in_file->GetObjectChecked("newAcc", "TH3D");
TH3D* acceptHist = (TH3D*)in_file->GetObjectChecked("recAcceptance", "TH3D");
itsAcceptHist = (TH3D*) acceptHist->Clone("myAccCopy");
myXAxLowEdge = itsAcceptHist->GetXaxis()->GetBinLowEdge(1);
myYAxLowEdge = itsAcceptHist->GetYaxis()->GetBinLowEdge(1);
myZAxLowEdge = itsAcceptHist->GetZaxis()->GetBinLowEdge(1);
myXAxBinWidth = itsAcceptHist->GetXaxis()->GetBinWidth(1);
myYAxBinWidth = itsAcceptHist->GetYaxis()->GetBinWidth(1);
myZAxBinWidth = itsAcceptHist->GetZaxis()->GetBinWidth(1);
myNXBins = itsAcceptHist->GetXaxis()->GetNbins() + 1;
myNYBins = itsAcceptHist->GetYaxis()->GetNbins() + 1;
myNZBins = itsAcceptHist->GetZaxis()->GetNbins() + 1;
my_Name = "Acceptance_map";
my_Short_Name = "Ac";
}
AcceptCut::AcceptCut(TString yourConfigPath):
myConfigPath(yourConfigPath)
{
TFile* in_file = TFile::Open(string(myConfigPath + "/acceptance.root").c_str());
//TH3D* acceptHist = (TH3D*)in_file->GetObjectChecked("newAcc", "TH3D");
TH3D* acceptHist = (TH3D*)in_file->GetObjectChecked("recAcceptance", "TH3D");
itsAcceptHist = (TH3D*) acceptHist->Clone("myAccCopy");
myXAxLowEdge = itsAcceptHist->GetXaxis()->GetBinLowEdge(1);
myYAxLowEdge = itsAcceptHist->GetYaxis()->GetBinLowEdge(1);
myZAxLowEdge = itsAcceptHist->GetZaxis()->GetBinLowEdge(1);
myXAxBinWidth = itsAcceptHist->GetXaxis()->GetBinWidth(1);
myYAxBinWidth = itsAcceptHist->GetYaxis()->GetBinWidth(1);
myZAxBinWidth = itsAcceptHist->GetZaxis()->GetBinWidth(1);
myNXBins = itsAcceptHist->GetXaxis()->GetNbins() + 1;
myNYBins = itsAcceptHist->GetYaxis()->GetNbins() + 1;
myNZBins = itsAcceptHist->GetZaxis()->GetNbins() + 1;
my_Name = "Acceptance_map";
my_Short_Name = "Ac";
}
AcceptCut::~AcceptCut()
{
delete itsAcceptHist;
}
bool AcceptCut::CheckTrack(RecEvent& recEvent, const VertexTrack& vtxTrack)
{
// cout<<"Accept"<<endl;
double_t Px, Py, Pz, P, Pt, eta, phi;
Vector vtxMomentum = vtxTrack.GetMomentum();
Px=vtxMomentum.GetX();
Py=vtxMomentum.GetY();
Pz=vtxMomentum.GetZ();
P=vtxMomentum.GetMag();
phi = TMath::ATan2(Py,Px);
Pt=sqrt(Px*Px+Py*Py);
eta=-0.5*TMath::Log((P-Pz)/(P+Pz));
double_t a,b,c;
a = 1 + floor((phi - myXAxLowEdge) / myXAxBinWidth);
b = 1 + floor((Pt - myYAxLowEdge) / myYAxBinWidth);
c = 1 + floor((eta - myZAxLowEdge) / myZAxBinWidth);
if (a < 1 || b < 1 || c < 1) return 0;
if ((a<myNXBins) && (b<myNYBins) && (c<myNZBins)) {
double_t N_acc;
N_acc=itsAcceptHist->GetBinContent(a,b,c);
if (N_acc==0)
return 0;
else {
myNEntries++;
return 1;
}
} else
return 0;
}
bool AcceptCut::CheckTrack(SimEvent& simEvent, const evt::sim::VertexTrack& vtxTrack)
{