forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowSP.cxx
More file actions
1740 lines (1506 loc) · 84.7 KB
/
flowSP.cxx
File metadata and controls
1740 lines (1506 loc) · 84.7 KB
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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file flowSP.cxx
/// \author Noor Koster
/// \since 01/12/2024
/// \brief task to evaluate flow with respect to spectator plane.
#include "GFWWeights.h"
#include "PWGCF/DataModel/SPTableZDC.h"
#include "Common/Core/EventPlaneHelper.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TrackSelection.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
#include "Common/DataModel/PIDResponseTOF.h"
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/Qvectors.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "CCDB/BasicCCDBManager.h"
#include "DataFormatsParameters/GRPLHCIFData.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/runDataProcessing.h"
#include "TF1.h"
#include "TPDGCode.h"
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::aod::rctsel;
// using namespace o2::analysis;
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
struct FlowSP {
RCTFlagsChecker rctChecker;
struct : ConfigurableGroup {
O2_DEFINE_CONFIGURABLE(cfgEvtUseRCTFlagChecker, bool, false, "Evt sel: use RCT flag checker");
O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerLabel, std::string, "CBT_hadronPID", "Evt sel: RCT flag checker label (CBT, CBT_hadronPID)"); // all Labels can be found in Common/CCDB/RCTSelectionFlags.h
O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerZDCCheck, bool, false, "Evt sel: RCT flag checker ZDC check");
O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerLimitAcceptAsBad, bool, false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad");
} rctFlags;
// struct : ConfigurableGroup { // <-- change all to evsels.Selection
// event selection configurable group
O2_DEFINE_CONFIGURABLE(cfgEvSelsUseAdditionalEventCut, bool, true, "Bool to enable Additional Event Cut");
O2_DEFINE_CONFIGURABLE(cfgEvSelsMaxOccupancy, int, 10000, "Maximum occupancy of selected events");
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut");
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV");
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard");
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoCollInTimeRangeNarrow, bool, true, "kNoCollInTimeRangeNarrow");
O2_DEFINE_CONFIGURABLE(cfgEvSelsDoOccupancySel, bool, true, "Bool for event selection on detector occupancy");
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track");
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayersAll, bool, true, "Cut time intervals with dead ITS staves");
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayer0123, bool, true, "Cut time intervals with dead ITS staves");
// } evSels;
// QA Plots
O2_DEFINE_CONFIGURABLE(cfgFillEventQA, bool, false, "Fill histograms for event QA");
O2_DEFINE_CONFIGURABLE(cfgFillTrackQA, bool, false, "Fill histograms for track QA");
O2_DEFINE_CONFIGURABLE(cfgFillPIDQA, bool, false, "Fill histograms for PID QA");
O2_DEFINE_CONFIGURABLE(cfgFillEventPlaneQA, bool, false, "Fill histograms for Event Plane QA");
O2_DEFINE_CONFIGURABLE(cfgFillQABefore, bool, false, "Fill QA histograms before cuts, only for processData");
O2_DEFINE_CONFIGURABLE(cfgFillMeanPT, bool, false, "Fill histograms for mean PX/PT");
// Flags to make and fill histograms
O2_DEFINE_CONFIGURABLE(cfgFillGeneralV1Histos, bool, true, "Fill histograms for vn analysis");
O2_DEFINE_CONFIGURABLE(cfgFillMixedHarmonics, bool, true, "Flag to make and fill histos for mixed harmonics");
O2_DEFINE_CONFIGURABLE(cfgFillEventPlane, bool, false, "Flag to make and fill histos with Event Plane");
O2_DEFINE_CONFIGURABLE(cfgFillXandYterms, bool, false, "Flag to make and fill histos for with separate x and y terms for SPM");
O2_DEFINE_CONFIGURABLE(cfgFillChargeDependence, bool, true, "Flag to make and fill histos for charge dependent flow");
O2_DEFINE_CONFIGURABLE(cfgFillChargeDependenceQA, bool, true, "Flag to make and fill QA histos for charge dependent flow");
O2_DEFINE_CONFIGURABLE(cfgFillPID, bool, false, "Flag to make and fill histos for PID flow");
// Centrality Estimators -> standard is FT0C
O2_DEFINE_CONFIGURABLE(cfgCentFT0Cvariant1, bool, false, "Set centrality estimator to cfgCentFT0Cvariant1");
O2_DEFINE_CONFIGURABLE(cfgCentFT0M, bool, false, "Set centrality estimator to cfgCentFT0M");
O2_DEFINE_CONFIGURABLE(cfgCentFV0A, bool, false, "Set centrality estimator to cfgCentFV0A");
O2_DEFINE_CONFIGURABLE(cfgCentNGlobal, bool, false, "Set centrality estimator to cfgCentNGlobal");
// Standard selections
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCAxy, float, 0.2, "Cut on DCA in the transverse direction (cm)");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCAz, float, 2, "Cut on DCA in the longitudinal direction (cm)");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsNcls, float, 70, "Cut on number of TPC clusters found");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsFshcls, float, 0.4, "Cut on fraction of shared TPC clusters found");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPtmin, float, 0.2, "minimum pt (GeV/c)");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPtmax, float, 10, "maximum pt (GeV/c)");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsEta, float, 0.8, "eta cut");
O2_DEFINE_CONFIGURABLE(cfgEvSelsVtxZ, float, 10, "vertex cut (cm)");
O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field;default CCDB will be queried");
O2_DEFINE_CONFIGURABLE(cfgCentMin, float, 0, "Minimum cenrality for selected events");
O2_DEFINE_CONFIGURABLE(cfgCentMax, float, 90, "Maximum cenrality for selected events");
O2_DEFINE_CONFIGURABLE(cfgFilterLeptons, bool, true, "Filter out leptons from MCGenerated by requiring |pdgCode| > 100");
// NUA and NUE weights
O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, true, "Fill NUA weights");
O2_DEFINE_CONFIGURABLE(cfgFillWeightsPOS, bool, true, "Fill NUA weights only for positive charges");
O2_DEFINE_CONFIGURABLE(cfgFillWeightsNEG, bool, true, "Fill NUA weights only for negative charges");
O2_DEFINE_CONFIGURABLE(cfgUseNUA1D, bool, false, "Use 1D NUA weights (only phi)");
O2_DEFINE_CONFIGURABLE(cfgUseNUA2D, bool, true, "Use 2D NUA weights (phi and eta)");
O2_DEFINE_CONFIGURABLE(cfgUseNUE2D, bool, true, "Use 2D NUE weights");
O2_DEFINE_CONFIGURABLE(cfgUseNUE2Deta, bool, true, "Use 2D NUE weights TRUE: (pt and eta) FALSE: (pt and centrality)");
// Additional track Selections
O2_DEFINE_CONFIGURABLE(cfgTrackSelsUseAdditionalTrackCut, bool, false, "Bool to enable Additional Track Cut");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDoDCApt, bool, false, "Apply Pt dependent DCAz cut");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt1, float, 0.1, "DcaZ < a * b / pt^1.1 -> this sets a");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt2, float, 0.035, "DcaZ < a * b / pt^1.1 -> this sets b");
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPIDNsigma, float, 2.0, "nSigma cut for PID");
O2_DEFINE_CONFIGURABLE(cfgTrackSelDoTrackQAvsCent, bool, true, "Do track selection QA plots as function of centrality");
// harmonics for v coefficients
O2_DEFINE_CONFIGURABLE(cfgHarm, int, 1, "Flow harmonic n for ux and uy: (Cos(n*phi), Sin(n*phi))");
O2_DEFINE_CONFIGURABLE(cfgHarmMixed, int, 2, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))");
// settings for CCDB data
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_QQ, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/meanQQ/Default", "ccdb dir for average QQ values in 1% centrality bins");
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_SP, std::string, "", "ccdb dir for average event plane resolution in 1% centrality bins");
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUA, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/Default", "ccdb dir for NUA corrections");
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/Default", "ccdb dir for NUE corrections (pt)");
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE2D, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/2D", "ccdb dir for NUE 2D corrections (eta, pt)");
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_centrality, std::string, "", "ccdb dir for Centrality corrections");
// Confogirable axis
ConfigurableAxis axisCentrality{"axisCentrality", {20, 0, 100}, "Centrality bins for vn "};
ConfigurableAxis axisNch = {"axisNch", {400, 0, 4000}, "Global N_{ch}"};
ConfigurableAxis axisMultpv = {"axisMultpv", {400, 0, 4000}, "N_{ch} (PV)"};
// Configurables containing vector
Configurable<std::vector<double>> cfgEvSelsMultPv{"cfgEvSelsMultPv", std::vector<double>{2223.49, -75.1444, 0.963572, -0.00570399, 1.34877e-05, 3790.99, -137.064, 2.13044, -0.017122, 5.82834e-05}, "Multiplicity cuts (PV) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "};
Configurable<std::vector<double>> cfgEvSelsMult{"cfgEvSelsMult", std::vector<double>{1301.56, -41.4615, 0.478224, -0.00239449, 4.46966e-06, 2967.6, -102.927, 1.47488, -0.0106534, 3.28622e-05}, "Multiplicity cuts (Global) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "};
Filter collisionFilter = nabs(aod::collision::posZ) < cfgEvSelsVtxZ;
Filter trackFilter = nabs(aod::track::eta) < cfgTrackSelsEta && aod::track::pt > cfgTrackSelsPtmin&& aod::track::pt < cfgTrackSelsPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgTrackSelsDCAxy&& nabs(aod::track::dcaZ) < cfgTrackSelsDCAz;
Filter trackFilterMC = nabs(aod::mcparticle::eta) < cfgTrackSelsEta && aod::mcparticle::pt > cfgTrackSelsPtmin&& aod::mcparticle::pt < cfgTrackSelsPtmax;
using GeneralCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNGlobals>;
using UnfilteredTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFbeta, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>;
using UsedTracks = soa::Filtered<UnfilteredTracks>;
using ZDCCollisions = soa::Filtered<soa::Join<GeneralCollisions, aod::SPTableZDC>>;
// For MC Reco and Gen
using CCs = soa::Filtered<soa::Join<GeneralCollisions, aod::McCollisionLabels>>;
using CC = CCs::iterator;
using TCs = soa::Join<UnfilteredTracks, aod::McTrackLabels>;
using FilteredTCs = soa::Filtered<TCs>;
using TC = TCs::iterator;
using MCs = soa::Filtered<aod::McParticles>;
Preslice<aod::McParticles> partPerMcCollision = aod::mcparticle::mcCollisionId;
PresliceUnsorted<CCs> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<TCs> trackPerMcParticle = aod::mctracklabel::mcParticleId;
Preslice<TCs> trackPerCollision = aod::track::collisionId;
// Connect to ccdb
Service<ccdb::BasicCCDBManager> ccdb;
Service<o2::framework::O2DatabasePDG> pdg;
// struct to hold the correction histos/
struct Config {
std::vector<TH1D*> mEfficiency = {};
std::vector<TH2D*> mEfficiency2D = {};
std::vector<GFWWeights*> mAcceptance = {};
std::vector<TH3D*> mAcceptance2D = {};
bool correctionsLoaded = false;
int lastRunNumber = 0;
TProfile* hcorrQQ = nullptr;
TProfile* hcorrQQx = nullptr;
TProfile* hcorrQQy = nullptr;
TProfile* hEvPlaneRes = nullptr;
TH1D* hCentrality = nullptr;
TProfile2D* hRelPt = nullptr;
bool clQQ = false;
bool clEvPlaneRes = false;
bool clCentrality = false;
bool clRelPt = false;
} cfg;
struct SPMvars {
std::vector<std::map<int, float>> wacc = {{{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}}; // int for part species, float for weight vector for kIncl, kPos, kNeg
std::vector<std::map<int, float>> weff = {{{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}}; // int for part species, float for weight vector for kIncl, kPos, kNeg
double centWeight = 1.0;
double ux = 0;
double uy = 0;
double uxMH = 0;
double uyMH = 0;
double qxA = 0;
double qyA = 0;
double qxC = 0;
double qyC = 0;
double corrQQx = 1;
double corrQQy = 1;
double corrQQ = 1;
double vnA = 0;
double vnC = 0;
double vnFull = 0;
float centrality = 0;
float vtxz = 0;
double vx = 0;
double vy = 0;
double vz = 0;
int charge = 0;
double relPt = 1.;
double psiA = 0;
double psiC = 0;
double psiFull = 0;
double trackPxA = 0;
double trackPxC = 0;
} spm;
OutputObj<GFWWeights> fWeights{GFWWeights("weights")};
OutputObj<GFWWeights> fWeightsPOS{GFWWeights("weights_positive")};
OutputObj<GFWWeights> fWeightsNEG{GFWWeights("weights_negative")};
HistogramRegistry registry{"registry"};
HistogramRegistry histos{"QAhistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
// Event selection cuts
TF1* fPhiCutLow = nullptr;
TF1* fPhiCutHigh = nullptr;
TF1* fMultPVCutLow = nullptr;
TF1* fMultPVCutHigh = nullptr;
TF1* fMultCutLow = nullptr;
TF1* fMultCutHigh = nullptr;
TF1* fMultMultPVCut = nullptr;
enum SelectionCriteria {
evSel_FilteredEvent,
evSel_sel8,
evSel_RCTFlagsZDC,
evSel_occupancy,
evSel_kNoSameBunchPileup,
evSel_kIsGoodZvtxFT0vsPV,
evSel_kNoCollInTimeRangeStandard,
evSel_kNoCollInTimeRangeNarrow,
evSel_kIsVertexITSTPC,
evSel_kIsGoodITSLayersAll,
evSel_kIsGoodITSLayer0123,
evSel_MultCuts,
evSel_isSelectedZDC,
evSel_CentCuts,
nEventSelections
};
enum TrackSelections {
trackSel_ZeroCharge,
trackSel_Eta,
trackSel_Pt,
trackSel_DCAxy,
trackSel_DCAz,
trackSel_GlobalTracks,
trackSel_NCls,
trackSel_FshCls,
trackSel_TPCBoundary,
trackSel_ParticleWeights,
nTrackSelections
};
enum ChargeType {
kInclusive,
kPositive,
kNegative,
nChargeTypes
};
enum FillType {
kBefore,
kAfter,
nFillTypes
};
enum ModeType {
kGen,
kReco,
nModeTypes
};
enum ParticleType {
kUnidentified,
kPions,
kKaons,
kProtons,
nParticleTypes
};
static constexpr std::string_view Charge[] = {"incl/", "pos/", "neg/"};
static constexpr std::string_view Species[] = {"", "pion/", "kaon/", "proton/"};
static constexpr std::string_view Time[] = {"before/", "after/"};
void init(InitContext const&)
{
ccdb->setURL("http://alice-ccdb.cern.ch");
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
ccdb->setCreatedNotAfter(now);
AxisSpec axisDCAz = {100, -.5, .5, "DCA_{z} (cm)"};
AxisSpec axisDCAxy = {100, -.5, .5, "DCA_{xy} (cm)"};
AxisSpec axisPhiMod = {100, 0, constants::math::PI / 9, "fmod(#varphi,#pi/9)"};
AxisSpec axisPhi = {60, 0, constants::math::TwoPI, "#varphi"};
AxisSpec axisEta = {64, -1.6, 1.6, "#eta"};
AxisSpec axisEtaVn = {8, -.8, .8, "#eta"};
AxisSpec axisVx = {40, -0.01, 0.01, "v_{x}"};
AxisSpec axisVy = {40, -0.01, 0.01, "v_{y}"};
AxisSpec axisVz = {40, -10, 10, "v_{z}"};
AxisSpec axisCent = {90, 0, 90, "Centrality(%)"};
AxisSpec axisPhiPlane = {100, -constants::math::PI, constants::math::PI, "#Psi"};
AxisSpec axisT0c = {70, 0, 100000, "N_{ch} (T0C)"};
AxisSpec axisT0a = {70, 0, 200000, "N_{ch} (T0A)"};
AxisSpec axisV0a = {70, 0, 200000, "N_{ch} (V0A)"};
AxisSpec axisShCl = {40, 0, 1, "Fraction shared cl. TPC"};
AxisSpec axisCl = {80, 0, 160, "Number of cl. TPC"};
AxisSpec axisNsigma = {100, -10, 10, "Nsigma for TPC and TOF"};
AxisSpec axisdEdx = {300, 0, 300, "dEdx for PID"};
AxisSpec axisBeta = {150, 0, 1.5, "Beta for PID"};
AxisSpec axisCharge = {3, 0, 3, "Charge: 0 = inclusive, 1 = positive, 2 = negative"};
std::vector<double> ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10};
AxisSpec axisPt = {ptbinning, "#it{p}_{T} GeV/#it{c}"};
int ptbins = ptbinning.size() - 1;
rctChecker.init(rctFlags.cfgEvtRCTFlagCheckerLabel, rctFlags.cfgEvtRCTFlagCheckerZDCCheck, rctFlags.cfgEvtRCTFlagCheckerLimitAcceptAsBad);
histos.add("hCentrality", "Centrality; Centrality (%); ", {HistType::kTH1D, {axisCent}});
histos.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered events");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCT Flags ZDC");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeNarrow + 1, "kNoCollInTimeRangeNarrow");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayer0123 + 1, "kkIsGoodITSLayer0123");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity Cuts Pilup");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected");
histos.add("hTrackCount", "Number of Tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrackSelections, 0, nTrackSelections}}});
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Eta + 1, "Eta");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Pt + 1, "Pt");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAxy + 1, "DCAxy");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAz + 1, "DCAz");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_GlobalTracks + 1, "GlobalTracks");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_NCls + 1, "nClusters TPC");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_FshCls + 1, "Frac. sh. Cls TPC");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_TPCBoundary + 1, "TPC Boundary");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ZeroCharge + 1, "Only charged");
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ParticleWeights + 1, "Apply weights");
if (cfgFillWeights) {
registry.add<TH3>("weights2D/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz});
registry.add<TH3>("weights2D/hPhi_Eta_vz_positive", "", kTH3D, {axisPhi, axisEta, axisVz});
registry.add<TH3>("weights2D/hPhi_Eta_vz_negative", "", kTH3D, {axisPhi, axisEta, axisVz});
// define output objects
fWeights->setPtBins(ptbins, &ptbinning[0]);
fWeights->init(true, false);
fWeightsPOS->setPtBins(ptbins, &ptbinning[0]);
fWeightsPOS->init(true, false);
fWeightsNEG->setPtBins(ptbins, &ptbinning[0]);
fWeightsNEG->init(true, false);
}
if (cfgFillEventQA) {
histos.add("QA/after/hCentFT0C", " ; Cent FT0C (%); ", {HistType::kTH1D, {axisCent}});
histos.add("QA/after/hCentFT0M", "; Cent FT0M (%); ", {HistType::kTH1D, {axisCent}});
histos.add("QA/after/hCentFV0A", "; Cent FV0A (%); ", {HistType::kTH1D, {axisCent}});
histos.add("QA/after/hCentNGlobal", "; Cent NGlobal (%); ", {HistType::kTH1D, {axisCent}});
histos.add("QA/after/globalTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisNch}});
histos.add("QA/after/PVTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisMultpv}});
histos.add("QA/after/globalTracks_PVTracks", "", {HistType::kTH2D, {axisMultpv, axisNch}});
histos.add("QA/after/globalTracks_multT0A", "", {HistType::kTH2D, {axisT0a, axisNch}});
histos.add("QA/after/globalTracks_multV0A", "", {HistType::kTH2D, {axisV0a, axisNch}});
histos.add("QA/after/multV0A_multT0A", "", {HistType::kTH2D, {axisT0a, axisV0a}});
histos.add("QA/after/multT0C_centT0C", "", {HistType::kTH2D, {axisCent, axisT0c}});
histos.add("QA/after/CentFT0C_vs_CentFT0Cvariant1", " ; Cent FT0C (%); Cent FT0Cvariant1 (%) ", {HistType::kTH2D, {axisCent, axisCent}});
histos.add("QA/after/CentFT0C_vs_CentFT0M", " ; Cent FT0C (%); Cent FT0M (%) ", {HistType::kTH2D, {axisCent, axisCent}});
histos.add("QA/after/CentFT0C_vs_CentFV0A", " ; Cent FT0C (%); Cent FV0A (%) ", {HistType::kTH2D, {axisCent, axisCent}});
histos.add("QA/after/CentFT0C_vs_CentNGlobal", " ; Cent FT0C (%); Cent NGlobal (%) ", {HistType::kTH2D, {axisCent, axisCent}});
if (cfgFillEventPlaneQA && doprocessData) {
histos.add("QA/after/PsiA_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}});
histos.add("QA/after/PsiC_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}});
histos.add("QA/after/PsiFull_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}});
histos.add("QA/after/PsiA_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}});
histos.add("QA/after/PsiC_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}});
histos.add("QA/after/PsiFull_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}});
histos.add("QA/after/PsiA_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}});
histos.add("QA/after/PsiC_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}});
histos.add("QA/after/PsiFull_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}});
histos.add("QA/after/PsiA_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}});
histos.add("QA/after/PsiC_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}});
histos.add("QA/after/PsiFull_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}});
}
if (cfgFillQABefore) {
histos.addClone("QA/after/", "QA/before/");
}
}
if (doprocessData || doprocessMCReco) {
if (cfgFillTrackQA) {
histos.add("incl/QA/after/pt_phi", "", {HistType::kTH2D, {axisPt, axisPhiMod}});
histos.add<TH3>("incl/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz});
histos.add<TH3>("incl/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz});
histos.add<TH2>("incl/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy});
histos.add<TH2>("incl/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz});
histos.add("incl/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}});
histos.add("incl/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}});
histos.add("incl/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}});
histos.add("incl/QA/after/hMeanPtEta", "", {HistType::kTProfile2D, {axisEta, axisCent}});
if (cfgTrackSelDoTrackQAvsCent) {
histos.add<TH3>("incl/QA/after/hPt_Eta", "", kTH3D, {axisPt, axisEta, axisCent});
histos.add<TH3>("incl/QA/after/hPt_Eta_uncorrected", "", kTH3D, {axisPt, axisEta, axisCent});
histos.add<TH3>("incl/QA/after/hPhi_Eta", "", kTH3D, {axisPhi, axisEta, axisCent});
histos.add<TH3>("incl/QA/after/hPhi_Eta_uncorrected", "", kTH3D, {axisPhi, axisEta, axisCent});
} else {
histos.add<TH3>("incl/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt});
histos.add<TH3>("incl/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt});
}
if (cfgFillQABefore)
histos.addClone("incl/QA/after/", "incl/QA/before/");
}
if (cfgFillPIDQA) {
histos.add<TH2>("hPIDcounts", "", kTH2D, {{{4, 0, 4}, axisPt}});
histos.get<TH2>(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(1, "UFO");
histos.get<TH2>(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(2, "Pion");
histos.get<TH2>(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(3, "Kaon");
histos.get<TH2>(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(4, "Proton");
histos.add("incl/QA/after/hdEdxTPC_pt", "", {HistType::kTH2D, {axisPt, axisdEdx}});
histos.add("incl/QA/after/hBetaTOF_pt", "", {HistType::kTH2D, {axisPt, axisBeta}});
histos.add("incl/QA/before/hdEdxTPC_pt", "", {HistType::kTH2D, {axisPt, axisdEdx}});
histos.add("incl/QA/before/hBetaTOF_pt", "", {HistType::kTH2D, {axisPt, axisBeta}});
histos.add("incl/pion/QA/after/hNsigmaTPC_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}});
histos.add("incl/pion/QA/after/hNsigmaTOF_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}});
if (cfgTrackSelDoTrackQAvsCent) {
histos.add<TH3>("incl/pion/QA/after/hPt_Eta", "", kTH3D, {axisPt, axisEta, axisCent});
histos.add<TH3>("incl/pion/QA/after/hPt_Eta_uncorrected", "", kTH3D, {axisPt, axisEta, axisCent});
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta", "", kTH3D, {axisPhi, axisEta, axisCent});
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta_uncorrected", "", kTH3D, {axisPhi, axisEta, axisCent});
} else {
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt});
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt});
}
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz});
histos.add<TH3>("incl/pion/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz});
histos.add<TH2>("incl/pion/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy});
histos.add<TH2>("incl/pion/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz});
histos.add("incl/pion/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}});
histos.add("incl/pion/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}});
histos.add("incl/pion/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}});
if (cfgFillQABefore) {
histos.addClone("incl/pion/QA/after/", "incl/pion/QA/before/");
}
histos.addClone("incl/pion/", "incl/kaon/");
histos.addClone("incl/pion/", "incl/proton/");
}
if (doprocessMCReco) {
registry.add("trackMCReco/after/hIsPhysicalPrimary", "", {HistType::kTH2D, {{2, 0, 2}, axisCentrality}});
registry.add("trackMCReco/hTrackSize_unFiltered", "", {HistType::kTH2D, {{100, 0, 200000}, axisCentrality}});
registry.add("trackMCReco/hTrackSize_Filtered", "", {HistType::kTH2D, {{100, 0, 20000}, axisCentrality}});
registry.get<TH2>(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(1, "Secondary");
registry.get<TH2>(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(2, "Primary");
registry.add("trackMCReco/after/incl/hPt_hadron", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCReco/after/incl/hPt_proton", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCReco/after/incl/hPt_pion", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCReco/after/incl/hPt_kaon", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
// Clone into particles and before/after
registry.addClone("trackMCReco/after/incl/", "trackMCReco/after/pos/");
registry.addClone("trackMCReco/after/incl/", "trackMCReco/after/neg/");
registry.addClone("trackMCReco/after/", "trackMCReco/before/");
}
if (doprocessData) {
registry.add<TProfile>("QQCorrelations/qAqCX", "", kTProfile, {axisCent});
registry.add<TProfile>("QQCorrelations/qAqCY", "", kTProfile, {axisCent});
registry.add<TProfile>("QQCorrelations/qAqCXY", "", kTProfile, {axisCent});
registry.add<TProfile>("QQCorrelations/qAXqCY", "", kTProfile, {axisCent});
registry.add<TProfile>("QQCorrelations/qAYqCX", "", kTProfile, {axisCent});
registry.add<TProfile>("QQCorrelations/qAXYqCXY", "", kTProfile, {axisCent});
if (cfgFillGeneralV1Histos) {
// track properties per centrality and per eta, pt bin
registry.add<TProfile3D>("incl/vnC", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnA", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
}
if (cfgFillMeanPT) {
registry.add<TProfile2D>("incl/meanPT/meanRelPtA", "", kTProfile2D, {axisEtaVn, axisCentrality});
registry.add<TProfile2D>("incl/meanPT/meanRelPtC", "", kTProfile2D, {axisEtaVn, axisCentrality});
}
if (cfgFillPID) {
registry.add<TProfile3D>("incl/pion/vnC", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnA", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
if (cfgFillEventPlane) {
registry.add<TProfile3D>("incl/pion/vnA_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnC_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnFull_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
}
}
if (cfgFillXandYterms) {
registry.add<TProfile3D>("incl/vnAx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnAy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnCx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnCy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
if (cfgFillPID) {
registry.add<TProfile3D>("incl/pion/vnAx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnAy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnCx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/vnCy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
}
}
if (cfgFillMixedHarmonics) {
registry.add<TProfile3D>("incl/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/MH/vnAyCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
if (cfgFillPID) {
registry.add<TProfile3D>("incl/pion/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/MH/vnAyCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/pion/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
}
}
if (cfgFillEventPlane) {
registry.add<TProfile3D>("incl/vnA_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnC_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
registry.add<TProfile3D>("incl/vnFull_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality});
}
if (cfgFillEventPlaneQA) {
histos.add<TH1>("QA/hSPplaneA", "hSPplaneA", kTH1D, {axisPhiPlane});
histos.add<TH1>("QA/hSPplaneC", "hSPplaneC", kTH1D, {axisPhiPlane});
histos.add<TH1>("QA/hSPplaneFull", "hSPplaneFull", kTH1D, {axisPhiPlane});
histos.add<TProfile>("QA/hCosPhiACosPhiC", "hCosPhiACosPhiC; Centrality(%); #LT Cos(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent});
histos.add<TProfile>("QA/hSinPhiASinPhiC", "hSinPhiASinPhiC; Centrality(%); #LT Sin(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent});
histos.add<TProfile>("QA/hSinPhiACosPhiC", "hSinPhiACosPhiC; Centrality(%); #LT Sin(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent});
histos.add<TProfile>("QA/hCosPhiASinsPhiC", "hCosPhiASinsPhiC; Centrality(%); #LT Cos(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent});
histos.add<TProfile>("QA/hFullEvPlaneRes", "hFullEvPlaneRes; Centrality(%); -#LT Cos(#Psi^{A} - #Psi^{C})#GT ", kTProfile, {axisCent});
}
if (cfgFillEventQA) {
histos.add("QA/hCentFull", " ; Centrality (%); ", {HistType::kTH1D, {axisCent}});
}
} // end of doprocessData
if (cfgFillChargeDependence || cfgFillPID) {
registry.addClone("incl/pion/", "incl/proton/");
registry.addClone("incl/pion/", "incl/kaon/");
registry.addClone("incl/", "pos/");
registry.addClone("incl/", "neg/");
}
if (cfgFillPIDQA || cfgFillChargeDependenceQA) {
histos.addClone("incl/", "pos/");
histos.addClone("incl/", "neg/");
}
} else if (doprocessMCGen) {
registry.add("trackMCGen/nCollReconstructedPerMcCollision", "", {HistType::kTH1D, {{10, -5, 5}}});
registry.add("trackMCGen/after/incl/hPt_hadron", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCGen/after/incl/hPt_proton", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCGen/after/incl/hPt_pion", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCGen/after/incl/hPt_kaon", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}});
registry.add("trackMCGen/after/incl/phi_eta_vtxZ_gen", "", {HistType::kTH3D, {axisPhi, axisEta, axisVz}});
registry.addClone("trackMCGen/after/incl/", "trackMCGen/after/pos/");
registry.addClone("trackMCGen/after/incl/", "trackMCGen/after/neg/");
registry.addClone("trackMCGen/after/", "trackMCGen/before/");
}
if (cfgEvSelsUseAdditionalEventCut) {
fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
std::vector<double> paramsMultPVCut = cfgEvSelsMultPv;
std::vector<double> paramsMultCut = cfgEvSelsMult;
// number of parameters required in cfgEvSelsMultPv and cfgEvSelsMult. (5 Low + 5 High)
uint64_t nParams = 10;
if (paramsMultPVCut.size() < nParams) {
LOGF(fatal, "cfgEvSelsMultPv not set properly.. size = %d (should be 10) --> Check your config files!", paramsMultPVCut.size());
} else if (paramsMultCut.size() < nParams) {
LOGF(fatal, "cfgEvSelsMult not set properly.. size = %d (should be 10) --> Check your config files!", paramsMultCut.size());
} else {
fMultPVCutLow->SetParameters(paramsMultPVCut[0], paramsMultPVCut[1], paramsMultPVCut[2], paramsMultPVCut[3], paramsMultPVCut[4]);
fMultPVCutHigh->SetParameters(paramsMultPVCut[5], paramsMultPVCut[6], paramsMultPVCut[7], paramsMultPVCut[8], paramsMultPVCut[9]);
fMultCutLow->SetParameters(paramsMultCut[0], paramsMultCut[1], paramsMultCut[2], paramsMultCut[3], paramsMultCut[4]);
fMultCutHigh->SetParameters(paramsMultCut[5], paramsMultCut[6], paramsMultCut[7], paramsMultCut[8], paramsMultCut[9]);
}
}
if (cfgTrackSelsUseAdditionalTrackCut) {
fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100);
fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100);
}
} // end of init
float getNUA2D(TH3D* hNUA, float eta, float phi, float vtxz)
{
int xind = hNUA->GetXaxis()->FindBin(phi);
int etaind = hNUA->GetYaxis()->FindBin(eta);
int vzind = hNUA->GetZaxis()->FindBin(vtxz);
float weight = hNUA->GetBinContent(xind, etaind, vzind);
if (weight != 0)
return 1. / weight;
return 1;
}
template <typename TrackObject>
ParticleType getTrackPID(TrackObject track)
{
float usedNSigmaPi = -1;
float usedNSigmaKa = -1;
float usedNSigmaPr = -1;
if (track.hasTOF() && track.hasTPC()) {
usedNSigmaPi = std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi());
usedNSigmaKa = std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa());
usedNSigmaPr = std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr());
} else if (track.hasTOF()) {
usedNSigmaPi = track.tofNSigmaPi();
usedNSigmaKa = track.tofNSigmaKa();
usedNSigmaPr = track.tofNSigmaPr();
} else if (track.hasTPC()) {
usedNSigmaPi = track.tpcNSigmaPi();
usedNSigmaKa = track.tpcNSigmaKa();
usedNSigmaPr = track.tpcNSigmaPr();
} else {
return kUnidentified; // No PID information available
}
std::unordered_map<float, ParticleType> usedNSigma = {{usedNSigmaPi, kPions}, {usedNSigmaKa, kKaons}, {usedNSigmaPr, kProtons}};
int nIdentified = 0;
ParticleType valPID = kUnidentified;
for (const auto& nsigma : usedNSigma) {
if (std::abs(nsigma.first) < cfgTrackSelsPIDNsigma) {
valPID = nsigma.second;
nIdentified++;
}
}
if (nIdentified == 0) {
return kUnidentified; // No PID match found
} else if (nIdentified == 1) {
return valPID;
} else {
return kUnidentified; // Multiple PID matches found
}
}
int getMagneticField(uint64_t timestamp)
{
// TODO done only once (and not per run). Will be replaced by CCDBConfigurable
static o2::parameters::GRPMagField* grpo = nullptr;
if (grpo == nullptr) {
grpo = ccdb->getForTimeStamp<o2::parameters::GRPMagField>("GLO/Config/GRPMagField", timestamp);
if (grpo == nullptr) {
LOGF(fatal, "GRP object not found for timestamp %llu", timestamp);
return 0;
}
LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field());
}
return grpo->getNominalL3Field();
}
std::pair<float, uint16_t> getCrossingAngleCCDB(uint64_t timestamp)
{
// TODO done only once (and not per run). Will be replaced by CCDBConfigurable
auto grpo = ccdb->getForTimeStamp<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", timestamp);
if (grpo == nullptr) {
LOGF(fatal, "GRP object for Crossing Angle not found for timestamp %llu", timestamp);
return {0, 0};
}
float crossingAngle = grpo->getCrossingAngle();
uint16_t crossingAngleTime = grpo->getCrossingAngleTime();
return {crossingAngle, crossingAngleTime};
}
// From Generic Framework
void loadCorrections(uint64_t timestamp)
{
// corrections saved on CCDB as TList {incl, pos, neg} of GFWWeights (acc) TH1D (eff) objects!
if (cfg.correctionsLoaded)
return;
int nWeights = 3;
if (cfgUseNUA1D) {
if (cfgCCDB_NUA.value.empty() == false) {
TList* listCorrections = ccdb->getForTimeStamp<TList>(cfgCCDB_NUA, timestamp);
cfg.mAcceptance.push_back(reinterpret_cast<GFWWeights*>(listCorrections->FindObject("weights")));
cfg.mAcceptance.push_back(reinterpret_cast<GFWWeights*>(listCorrections->FindObject("weights_positive")));
cfg.mAcceptance.push_back(reinterpret_cast<GFWWeights*>(listCorrections->FindObject("weights_negative")));
int sizeAcc = cfg.mAcceptance.size();
if (sizeAcc < nWeights)
LOGF(fatal, "Could not load acceptance weights from %s", cfgCCDB_NUA.value.c_str());
else
LOGF(info, "Loaded acceptance weights from %s", cfgCCDB_NUA.value.c_str());
} else {
LOGF(info, "cfgCCDB_NUA empty! No corrections loaded");
}
} else if (cfgUseNUA2D) {
if (cfgCCDB_NUA.value.empty() == false) {
TH3D* hNUA2D = ccdb->getForTimeStamp<TH3D>(cfgCCDB_NUA, timestamp);
if (!hNUA2D) {
LOGF(fatal, "Could not load acceptance weights from %s", cfgCCDB_NUA.value.c_str());
} else {
LOGF(info, "Loaded acceptance weights from %s", cfgCCDB_NUA.value.c_str());
cfg.mAcceptance2D.push_back(hNUA2D);
}
} else {
LOGF(info, "cfgCCDB_NUA empty! No corrections loaded");
}
}
// Get Efficiency correction
if (cfgCCDB_NUE.value.empty() == false) {
TList* listCorrections = ccdb->getForTimeStamp<TList>(cfgCCDB_NUE, timestamp);
cfg.mEfficiency.push_back(reinterpret_cast<TH1D*>(listCorrections->FindObject("Efficiency")));
cfg.mEfficiency.push_back(reinterpret_cast<TH1D*>(listCorrections->FindObject("Efficiency_pos")));
cfg.mEfficiency.push_back(reinterpret_cast<TH1D*>(listCorrections->FindObject("Efficiency_neg")));
int sizeEff = cfg.mEfficiency.size();
if (sizeEff < nWeights)
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgCCDB_NUE.value.c_str());
else
LOGF(info, "Loaded efficiency histogram from %s", cfgCCDB_NUE.value.c_str());
} else {
LOGF(info, "cfgCCDB_NUE empty! No corrections loaded");
}
// Get Efficiency correction
if (cfgCCDB_NUE2D.value.empty() == false) {
TList* listCorrections = ccdb->getForTimeStamp<TList>(cfgCCDB_NUE2D, timestamp);
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency")));
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency_pos")));
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency_neg")));
int sizeEff = cfg.mEfficiency2D.size();
if (sizeEff < nWeights)
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgCCDB_NUE.value.c_str());
else
LOGF(info, "Loaded efficiency histogram from %s", cfgCCDB_NUE.value.c_str());
} else {
LOGF(info, "cfgCCDB_NUE2 empty! No corrections loaded");
}
cfg.correctionsLoaded = true;
}
// From Generic Framework
bool setCurrentParticleWeights(int pID, int spec, const float& phi, const float& eta, const float& pt, const float& vtxz, const float& centrality)
{
float eff = 1.;
int sizeEff = cfg.mEfficiency.size();
if (sizeEff > pID) {
if (cfgUseNUE2D) {
int binx;
int biny;
if (cfgUseNUE2Deta) {
biny = cfg.mEfficiency2D[pID]->GetYaxis()->FindBin(pt);
binx = cfg.mEfficiency2D[pID]->GetXaxis()->FindBin(eta);
} else {
binx = cfg.mEfficiency2D[pID]->GetXaxis()->FindBin(pt);
biny = cfg.mEfficiency2D[pID]->GetYaxis()->FindBin(centrality);
}
eff = cfg.mEfficiency2D[pID]->GetBinContent(binx, biny);
} else {
eff = cfg.mEfficiency[pID]->GetBinContent(cfg.mEfficiency[pID]->FindBin(pt));
}
} else {
eff = 1.0;
}
if (eff == 0)
return false;
spm.weff[pID][spec] = 1. / eff;
if (cfgUseNUA1D) {
int sizeAcc = cfg.mAcceptance.size();
if (sizeAcc > pID) {
spm.wacc[pID][spec] = cfg.mAcceptance[pID]->getNUA(phi, eta, vtxz);
} else {
spm.wacc[pID][spec] = 1;
}
} else if (cfgUseNUA2D) {
if (cfg.mAcceptance2D.size() > 0) {
spm.wacc[pID][spec] = getNUA2D(cfg.mAcceptance2D[0], eta, phi, vtxz);
} else {
spm.wacc[pID][spec] = 1;
}
}
return true;
}
template <typename TCollision>
bool eventSelected(TCollision collision, const int& multTrk)
{
if (!collision.sel8())
return 0;
histos.fill(HIST("hEventCount"), evSel_sel8);
if (rctFlags.cfgEvtUseRCTFlagChecker && !rctChecker(collision))
return 0;
histos.fill(HIST("hEventCount"), evSel_RCTFlagsZDC);
// Occupancy
if (cfgEvSelsDoOccupancySel) {
auto occupancy = collision.trackOccupancyInTimeRange();
if (occupancy > cfgEvSelsMaxOccupancy) {
return 0;
}
histos.fill(HIST("hEventCount"), evSel_occupancy);
}
if (cfgEvSelsNoSameBunchPileupCut) {
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
// rejects collisions which are associated with the same "found-by-T0" bunch crossing
// https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup);
}
if (cfgEvSelsIsGoodZvtxFT0vsPV) {
if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
// removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
// use this cut at low multiplicities with caution
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV);
}
if (cfgEvSelsNoCollInTimeRangeStandard) {
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
// Rejection of the collisions which have other events nearby
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard);
}
if (cfgEvSelsNoCollInTimeRangeNarrow) {
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) {
// Rejection of the collisions which have other events nearby
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeNarrow);
}
if (cfgEvSelsIsVertexITSTPC) {
if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) {
// selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC);
}
if (cfgEvSelsIsGoodITSLayersAll) {
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
// New event selection bits to cut time intervals with dead ITS staves
// https://indico.cern.ch/event/1493023/ (09-01-2025)
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll);
}
if (cfgEvSelsIsGoodITSLayer0123) {
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayer0123)) {
return 0;
}
histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayer0123);
}
if (cfgEvSelsUseAdditionalEventCut) {
float vtxz = -999;
if (collision.numContrib() > 1) {
vtxz = collision.posZ();
float zRes = std::sqrt(collision.covZZ());
float minzRes = 0.25;
int maxNumContrib = 20;
if (zRes > minzRes && collision.numContrib() < maxNumContrib)
vtxz = -999;
}
auto multNTracksPV = collision.multNTracksPV();
if (vtxz > cfgEvSelsVtxZ || vtxz < -cfgEvSelsVtxZ)
return 0;
if (multNTracksPV < fMultPVCutLow->Eval(collision.centFT0C()))
return 0;
if (multNTracksPV > fMultPVCutHigh->Eval(collision.centFT0C()))
return 0;
if (multTrk < fMultCutLow->Eval(collision.centFT0C()))
return 0;
if (multTrk > fMultCutHigh->Eval(collision.centFT0C()))
return 0;
histos.fill(HIST("hEventCount"), evSel_MultCuts);
}
return 1;
}
template <typename TrackObject>
bool trackSelected(TrackObject track, const int& field)
{
if (std::fabs(track.eta()) > cfgTrackSelsEta)
return false;
histos.fill(HIST("hTrackCount"), trackSel_Eta);
if (track.pt() < cfgTrackSelsPtmin || track.pt() > cfgTrackSelsPtmax)
return false;
histos.fill(HIST("hTrackCount"), trackSel_Pt);
if (track.dcaXY() > cfgTrackSelsDCAxy)
return false;
histos.fill(HIST("hTrackCount"), trackSel_DCAxy);
if (track.dcaZ() > cfgTrackSelsDCAz)
return false;
if (cfgTrackSelsDoDCApt && std::fabs(track.dcaZ()) > (cfgTrackSelsDCApt1 * cfgTrackSelsDCApt2) / (std::pow(track.pt(), 1.1)))
return false;
histos.fill(HIST("hTrackCount"), trackSel_DCAz);
if (track.tpcNClsFound() < cfgTrackSelsNcls)
return false;
histos.fill(HIST("hTrackCount"), trackSel_NCls);
if (track.tpcFractionSharedCls() > cfgTrackSelsFshcls)
return false;
histos.fill(HIST("hTrackCount"), trackSel_FshCls);
double phimodn = track.phi();
if (field < 0) // for negative polarity field
phimodn = o2::constants::math::TwoPI - phimodn;
if (track.sign() < 0) // for negative charge
phimodn = o2::constants::math::TwoPI - phimodn;
if (phimodn < 0)
LOGF(warning, "phi < 0: %g", phimodn);
phimodn += o2::constants::math::PI / 18.0; // to center gap in the middle
phimodn = fmod(phimodn, o2::constants::math::PI / 9.0);
if (cfgFillTrackQA && cfgFillQABefore)
histos.fill(HIST("incl/QA/before/pt_phi"), track.pt(), phimodn);
if (cfgTrackSelsUseAdditionalTrackCut) {
if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt()))
return false; // reject track
}
if (cfgFillTrackQA)
histos.fill(HIST("incl/QA/after/pt_phi"), track.pt(), phimodn);
histos.fill(HIST("hTrackCount"), trackSel_TPCBoundary);
return true;
}
template <FillType ft, typename CollisionObject, typename TracksObject>
inline void fillEventQA(CollisionObject collision, TracksObject tracks)
{
if (!cfgFillEventQA)
return;
static constexpr std::string_view Time[] = {"before", "after"};