Skip to content

Commit 4b8e335

Browse files
committed
Add option to apply BC selection to collisions
1 parent a7bddd7 commit 4b8e335

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Common/Tasks/centralityStudy.cxx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ struct centralityStudy {
136136
Configurable<bool> rejectUpc{"rejectUpc", false, "Reject upc events based on forward signals. Configurable group: upcRejection"};
137137
Configurable<bool> rejectCollInTimeRangeNarrow{"rejectCollInTimeRangeNarrow", false, "reject if extra colls in time range (narrow)"};
138138
Configurable<float> maxVtxZ{"maxVtxZ", 10.0f, "max vertex z distance from ip"};
139+
Configurable<bool> applyBcSel{"applyBcSel", false, "For each collision; de-reference the bc and apply the bc selections"};
140+
Configurable<bool> rejectNoFoundBC{"rejectNoFoundBC", true, "if applyBcSel; reject if no BC found when de-referencing"};
141+
139142
} evsel;
140143

141144
// _______________________________________
@@ -248,6 +251,7 @@ struct centralityStudy {
248251
histos.get<TH1>(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(15, "rejectCollInTimeRangeNarrow");
249252
histos.get<TH1>(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(16, "em/upc rejection");
250253
histos.get<TH1>(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(17, "isFlangeEvent");
254+
histos.get<TH1>(HIST("hCollisionSelection"))->GetXaxis()->SetBinLabel(18, "bcsel");
251255

252256
histos.add("hFT0A_Collisions", "hFT0A_Collisions", kTH1D, {axisMultUltraFineFT0A});
253257
histos.add("hFT0C_Collisions", "hFT0C_Collisions", kTH1D, {axisMultUltraFineFT0C});
@@ -267,6 +271,13 @@ struct centralityStudy {
267271
histos.add("hNGlobalTracksvsPVz_Collisions", "hNGlobalTracksvsPVz_Collisions", kTProfile, {axisPVz});
268272
histos.add("hNMFTTracksvsPVz_Collisions", "hNMFTTracksvsPVz_Collisions", kTProfile, {axisPVz});
269273

274+
if (evsel.applyBcSel) {
275+
histos.add("hCollToBcQa", "hCollToBcQa", kTH1D, {{3, -0.5, 2.5}});
276+
histos.get<TH1>(HIST("hCollToBcQa"))->GetXaxis()->SetBinLabel(1, "Found");
277+
histos.get<TH1>(HIST("hCollToBcQa"))->GetXaxis()->SetBinLabel(2, "Not found");
278+
histos.get<TH1>(HIST("hCollToBcQa"))->GetXaxis()->SetBinLabel(3, "Rejected");
279+
}
280+
270281
if (studies.do2DPlots) {
271282
histos.add("hNContribsVsFT0C", "hNContribsVsFT0C", kTH2F, {axisMultFT0C, axisMultPVContributors});
272283
histos.add("hNContribsVsFV0A", "hNContribsVsFV0A", kTH2F, {axisMultFV0A, axisMultPVContributors});
@@ -477,6 +488,7 @@ struct centralityStudy {
477488
getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(15, "rejectCollInTimeRangeNarrow");
478489
getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(16, "em/upc rejection");
479490
getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(17, "isFlangeEvent");
491+
getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(18, "bcsel");
480492

481493
histPointers.insert({histPath + "hFT0C_Collisions", histos.add((histPath + "hFT0C_Collisions").c_str(), "hFT0C_Collisions", {kTH1D, {{axisMultUltraFineFT0C}}})});
482494
histPointers.insert({histPath + "hFT0A_Collisions", histos.add((histPath + "hFT0A_Collisions").c_str(), "hFT0A_Collisions", {kTH1D, {{axisMultUltraFineFT0A}}})});
@@ -829,6 +841,31 @@ struct centralityStudy {
829841
if (studies.doRunByRunHistograms) {
830842
getHist(TH1, histPath + "hCollisionSelection")->Fill(16);
831843
}
844+
845+
if (evsel.applyBcSel) {
846+
if constexpr (requires { collision.has_multBC(); }) {
847+
if (collision.has_multBC()) {
848+
auto multbc = collision.template multBC_as<soa::Join<aod::MultBCs, aod::MultBcSel>>();
849+
histos.fill(HIST("hCollToBcQa"), 0 /* found */);
850+
if (!selectedBC(multbc)) {
851+
return;
852+
}
853+
} else {
854+
histos.fill(HIST("hCollToBcQa"), 1 /* not found */);
855+
if (evsel.rejectNoFoundBC) {
856+
histos.fill(HIST("hCollToBcQa"), 2 /* rejected */);
857+
858+
return;
859+
}
860+
}
861+
}
862+
}
863+
864+
histos.fill(HIST("hCollisionSelection"), 17 /* bc selections */);
865+
if (studies.doRunByRunHistograms) {
866+
getHist(TH1, histPath + "hCollisionSelection")->Fill(17);
867+
}
868+
832869
// if we got here, we also finally fill the FT0C histogram, please
833870
histos.fill(HIST("hNPVContributors"), collision.multNTracksPV());
834871
histos.fill(HIST("hFT0A_Collisions"), collision.multFT0A() * scale.factorFT0C);

0 commit comments

Comments
 (0)