Skip to content

Commit 7254b69

Browse files
committed
Add 2D efficiency option and add extra event selections + adapt for updated table
1 parent bcbd286 commit 7254b69

File tree

1 file changed

+88
-49
lines changed

1 file changed

+88
-49
lines changed

PWGCF/Flow/Tasks/flowSP.cxx

Lines changed: 88 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ struct FlowSP {
6969
O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerLimitAcceptAsBad, bool, false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad");
7070
} rctFlags;
7171

72+
// struct : ConfigurableGroup { // <-- change all to evsels.Selection
73+
// event selection configurable group
74+
O2_DEFINE_CONFIGURABLE(cfgEvSelsUseAdditionalEventCut, bool, true, "Bool to enable Additional Event Cut");
75+
O2_DEFINE_CONFIGURABLE(cfgEvSelsMaxOccupancy, int, 10000, "Maximum occupancy of selected events");
76+
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut");
77+
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV");
78+
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard");
79+
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoCollInTimeRangeNarrow, bool, true, "kNoCollInTimeRangeNarrow");
80+
O2_DEFINE_CONFIGURABLE(cfgEvSelsDoOccupancySel, bool, true, "Bool for event selection on detector occupancy");
81+
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track");
82+
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayersAll, bool, true, "Cut time intervals with dead ITS staves");
83+
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayer0123, bool, true, "Cut time intervals with dead ITS staves");
84+
// } evSels;
85+
7286
// QA Plots
7387
O2_DEFINE_CONFIGURABLE(cfgFillEventQA, bool, false, "Fill histograms for event QA");
7488
O2_DEFINE_CONFIGURABLE(cfgFillTrackQA, bool, false, "Fill histograms for track QA");
@@ -107,31 +121,23 @@ struct FlowSP {
107121
O2_DEFINE_CONFIGURABLE(cfgFillWeightsNEG, bool, true, "Fill NUA weights only for negative charges");
108122
O2_DEFINE_CONFIGURABLE(cfguseNUA1D, bool, false, "Use 1D NUA weights (only phi)");
109123
O2_DEFINE_CONFIGURABLE(cfguseNUA2D, bool, true, "Use 2D NUA weights (phi and eta)");
124+
O2_DEFINE_CONFIGURABLE(cfguseNUE2D, bool, true, "Use 2D NUE weights (pt and eta)");
110125
// Additional track Selections
111126
O2_DEFINE_CONFIGURABLE(cfgTrackSelsUseAdditionalTrackCut, bool, false, "Bool to enable Additional Track Cut");
112127
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDoDCApt, bool, false, "Apply Pt dependent DCAz cut");
113128
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt1, float, 0.1, "DcaZ < a * b / pt^1.1 -> this sets a");
114129
O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt2, float, 0.035, "DcaZ < a * b / pt^1.1 -> this sets b");
115130
O2_DEFINE_CONFIGURABLE(cfgTrackSelsPIDNsigma, float, 2.0, "nSigma cut for PID");
116131
O2_DEFINE_CONFIGURABLE(cfgTrackSelDoTrackQAvsCent, bool, true, "Do track selection QA plots as function of centrality");
117-
// Additional event selections
118-
O2_DEFINE_CONFIGURABLE(cfgEvSelsUseAdditionalEventCut, bool, true, "Bool to enable Additional Event Cut");
119-
O2_DEFINE_CONFIGURABLE(cfgEvSelsMaxOccupancy, int, 10000, "Maximum occupancy of selected events");
120-
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut");
121-
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV");
122-
O2_DEFINE_CONFIGURABLE(cfgEvSelsNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard");
123-
O2_DEFINE_CONFIGURABLE(cfgEvSelsDoOccupancySel, bool, true, "Bool for event selection on detector occupancy");
124-
O2_DEFINE_CONFIGURABLE(cfgEvSelsTVXinTRD, bool, false, "Use kTVXinTRD (reject TRD triggered events)");
125-
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track");
126-
O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayersAll, bool, true, "Cut time intervals with dead ITS staves");
127132
// harmonics for v coefficients
128133
O2_DEFINE_CONFIGURABLE(cfgHarm, int, 1, "Flow harmonic n for ux and uy: (Cos(n*phi), Sin(n*phi))");
129134
O2_DEFINE_CONFIGURABLE(cfgHarmMixed, int, 2, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))");
130135
// settings for CCDB data
131136
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");
132137
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_SP, std::string, "", "ccdb dir for average event plane resolution in 1% centrality bins");
133138
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUA, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/Default", "ccdb dir for NUA corrections");
134-
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/Default", "ccdb dir for NUE corrections");
139+
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/Default", "ccdb dir for NUE corrections (pt)");
140+
O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE2D, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/2D", "ccdb dir for NUE 2D corrections (eta, pt)");
135141
O2_DEFINE_CONFIGURABLE(cfgCCDBdir_centrality, std::string, "", "ccdb dir for Centrality corrections");
136142
// Confogirable axis
137143
ConfigurableAxis axisCentrality{"axisCentrality", {20, 0, 100}, "Centrality bins for vn "};
@@ -170,6 +176,7 @@ struct FlowSP {
170176
// struct to hold the correction histos/
171177
struct Config {
172178
std::vector<TH1D*> mEfficiency = {};
179+
std::vector<TH2D*> mEfficiency2D = {};
173180
std::vector<GFWWeights*> mAcceptance = {};
174181
std::vector<TH3D*> mAcceptance2D = {};
175182
bool correctionsLoaded = false;
@@ -234,13 +241,14 @@ struct FlowSP {
234241
evSel_sel8,
235242
evSel_RCTFlagsZDC,
236243
evSel_occupancy,
237-
evSel_kTVXinTRD,
238244
evSel_kNoSameBunchPileup,
239245
evSel_kIsGoodZvtxFT0vsPV,
240246
evSel_kNoCollInTimeRangeStandard,
247+
evSel_kNoCollInTimeRangeNarrow,
241248
evSel_kIsVertexITSTPC,
242-
evSel_MultCuts,
243249
evSel_kIsGoodITSLayersAll,
250+
evSel_kIsGoodITSLayer0123,
251+
evSel_MultCuts,
244252
evSel_isSelectedZDC,
245253
evSel_CentCuts,
246254
nEventSelections
@@ -329,19 +337,20 @@ struct FlowSP {
329337
rctChecker.init(rctFlags.cfgEvtRCTFlagCheckerLabel, rctFlags.cfgEvtRCTFlagCheckerZDCCheck, rctFlags.cfgEvtRCTFlagCheckerLimitAcceptAsBad);
330338

331339
histos.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
332-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered event");
340+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered events");
341+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCT Flags ZDC");
333342
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8");
334-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCTFlags (ZDC CBT LimAcc");
335343
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy");
336-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kTVXinTRD + 1, "kTVXinTRD");
337344
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup");
338345
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
339346
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
347+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeNarrow + 1, "kNoCollInTimeRangeNarrow");
340348
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
341-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity cuts");
342-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
343-
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected ZDC");
344349
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range");
350+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
351+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayer0123 + 1, "kkIsGoodITSLayer0123");
352+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity Cuts Pilup");
353+
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected");
345354

346355
histos.add("hTrackCount", "Number of Tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrackSelections, 0, nTrackSelections}}});
347356
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Eta + 1, "Eta");
@@ -742,6 +751,20 @@ struct FlowSP {
742751
} else {
743752
LOGF(info, "cfgCCDB_NUE empty! No corrections loaded");
744753
}
754+
// Get Efficiency correction
755+
if (cfgCCDB_NUE2D.value.empty() == false) {
756+
TList* listCorrections = ccdb->getForTimeStamp<TList>(cfgCCDB_NUE2D, timestamp);
757+
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency2D")));
758+
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency2D_pos")));
759+
cfg.mEfficiency2D.push_back(reinterpret_cast<TH2D*>(listCorrections->FindObject("Efficiency2D_neg")));
760+
int sizeEff = cfg.mEfficiency2D.size();
761+
if (sizeEff < nWeights)
762+
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgCCDB_NUE.value.c_str());
763+
else
764+
LOGF(info, "Loaded efficiency histogram from %s", cfgCCDB_NUE.value.c_str());
765+
} else {
766+
LOGF(info, "cfgCCDB_NUE2 empty! No corrections loaded");
767+
}
745768
cfg.correctionsLoaded = true;
746769
}
747770

@@ -750,10 +773,17 @@ struct FlowSP {
750773
{
751774
float eff = 1.;
752775
int sizeEff = cfg.mEfficiency.size();
753-
if (sizeEff > pID)
754-
eff = cfg.mEfficiency[pID]->GetBinContent(cfg.mEfficiency[pID]->FindBin(pt));
755-
else
776+
if (sizeEff > pID) {
777+
if(cfguseNUE2D) {
778+
int binx = cfg.mEfficiency2D[pID]->GetXaxis()->FindBin(eta);
779+
int biny = cfg.mEfficiency2D[pID]->GetYaxis()->FindBin(pt);
780+
eff = cfg.mEfficiency2D[pID]->GetBinContent(binx, biny);
781+
} else {
782+
eff = cfg.mEfficiency[pID]->GetBinContent(cfg.mEfficiency[pID]->FindBin(pt));
783+
}
784+
} else {
756785
eff = 1.0;
786+
}
757787
if (eff == 0)
758788
return false;
759789

@@ -796,15 +826,6 @@ struct FlowSP {
796826
histos.fill(HIST("hEventCount"), evSel_occupancy);
797827
}
798828

799-
if (cfgEvSelsTVXinTRD) {
800-
if (collision.alias_bit(kTVXinTRD)) {
801-
// TRD triggered
802-
// "CMTVX-B-NOPF-TRD,minbias_TVX"
803-
return 0;
804-
}
805-
histos.fill(HIST("hEventCount"), evSel_kTVXinTRD);
806-
}
807-
808829
if (cfgEvSelsNoSameBunchPileupCut) {
809830
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
810831
// rejects collisions which are associated with the same "found-by-T0" bunch crossing
@@ -828,7 +849,13 @@ struct FlowSP {
828849
}
829850
histos.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard);
830851
}
831-
852+
if (cfgEvSelsNoCollInTimeRangeNarrow) {
853+
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) {
854+
// Rejection of the collisions which have other events nearby
855+
return 0;
856+
}
857+
histos.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeNarrow);
858+
}
832859
if (cfgEvSelsIsVertexITSTPC) {
833860
if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) {
834861
// selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks
@@ -837,6 +864,21 @@ struct FlowSP {
837864
histos.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC);
838865
}
839866

867+
if (cfgEvSelsIsGoodITSLayersAll) {
868+
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
869+
// New event selection bits to cut time intervals with dead ITS staves
870+
// https://indico.cern.ch/event/1493023/ (09-01-2025)
871+
return 0;
872+
}
873+
histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll);
874+
}
875+
if (cfgEvSelsIsGoodITSLayer0123) {
876+
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayer0123)) {
877+
return 0;
878+
}
879+
histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayer0123);
880+
}
881+
840882
if (cfgEvSelsUseAdditionalEventCut) {
841883
float vtxz = -999;
842884
if (collision.numContrib() > 1) {
@@ -864,15 +906,6 @@ struct FlowSP {
864906
histos.fill(HIST("hEventCount"), evSel_MultCuts);
865907
}
866908

867-
if (cfgEvSelsIsGoodITSLayersAll) {
868-
if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
869-
// New event selection bits to cut time intervals with dead ITS staves
870-
// https://indico.cern.ch/event/1493023/ (09-01-2025)
871-
return 0;
872-
}
873-
histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll);
874-
}
875-
876909
return 1;
877910
}
878911

@@ -957,20 +990,20 @@ struct FlowSP {
957990
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), spm.centWeight);
958991

959992
if (cfgFillEventPlaneQA) {
960-
if constexpr (o2::framework::has_type_v<aod::sptablezdc::Vx, typename CollisionObject::all_columns>) {
993+
if constexpr (o2::framework::has_type_v<aod::sptablezdc::Vertex, typename CollisionObject::all_columns>) {
961994
double psiA = 1.0 * std::atan2(collision.qyA(), collision.qxA());
962995
double psiC = 1.0 * std::atan2(collision.qyC(), collision.qxC());
963996
double psiFull = 1.0 * std::atan2(collision.qyA() + collision.qyC(), collision.qxA() + collision.qxC());
964997

965998
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Cent"), psiA, collision.centFT0C(), spm.centWeight);
966999
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Cent"), psiC, collision.centFT0C(), spm.centWeight);
9671000
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Cent"), psiFull, collision.centFT0C(), spm.centWeight);
968-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vx(), spm.centWeight);
969-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vx(), spm.centWeight);
970-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vx(), spm.centWeight);
971-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vy(), spm.centWeight);
972-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vy(), spm.centWeight);
973-
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vy(), spm.centWeight);
1001+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vertex()[0], spm.centWeight);
1002+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vertex()[0], spm.centWeight);
1003+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vertex()[0], spm.centWeight);
1004+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vertex()[1], spm.centWeight);
1005+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vertex()[1], spm.centWeight);
1006+
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vertex()[1], spm.centWeight);
9741007
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vz"), psiA, collision.posZ(), spm.centWeight);
9751008
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vz"), psiC, collision.posZ(), spm.centWeight);
9761009
histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vz"), psiFull, collision.posZ(), spm.centWeight);
@@ -1158,11 +1191,12 @@ struct FlowSP {
11581191

11591192
if (!eventSelected(collision, tracks.size()))
11601193
return;
1161-
1194+
11621195
if (!collision.isSelected()) // selected by ZDCQVectors task (checks signal in ZDC) --> only possible in data not MC
11631196
return;
11641197
histos.fill(HIST("hEventCount"), evSel_isSelectedZDC);
11651198

1199+
11661200
spm.qxA = collision.qxA();
11671201
spm.qyA = collision.qyA();
11681202
spm.qxC = collision.qxC();
@@ -1458,6 +1492,11 @@ struct FlowSP {
14581492

14591493
spm.charge = (track.sign() > 0) ? kPositive : kNegative;
14601494

1495+
int minVal = 100;
1496+
if (cfgFilterLeptons && std::abs(mcParticle.pdgCode()) < minVal) {
1497+
continue;
1498+
}
1499+
14611500
// This neglects PID (for now) later use getPID like in data.
14621501
if (cfgFillQABefore) {
14631502
fillAllQA<kBefore, kUnidentified>(track);

0 commit comments

Comments
 (0)