Skip to content

Commit 9f6486e

Browse files
fgrosaalibuild
andauthored
[PWGHF] Add RCT selection in HF event selection utils (AliceO2Group#10949)
Co-authored-by: ALICE Action Bot <[email protected]>
1 parent 0ca165a commit 9f6486e

9 files changed

+113
-27
lines changed

PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ struct HfDataCreatorCharmHadPiReduced {
291291
setLabelHistoCands(hCandidatesD0);
292292
setLabelHistoCands(hCandidatesDPlus);
293293
setLabelHistoCands(hCandidatesDs);
294+
295+
// init HF event selection helper
296+
hfEvSel.init(registry);
294297
}
295298

296299
/// Pion selection (D Pi <-- B0)

PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ struct HfDataCreatorCharmResoReduced {
302302
fitter.setMaxChi2(1e9);
303303
fitter.setUseAbsDCA(true);
304304
fitter.setWeightedFinalPCA(false);
305+
306+
// init HF event selection helper
307+
hfEvSel.init(registry);
305308
}
306309

307310
/// Basic track quality selections for V0 daughters

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ struct HfCandidateCreator2Prong {
147147
registry.add("hDcaZProngs", "DCAz of 2-prong candidate daughters;#it{p}_{T} (GeV/#it{c};#it{d}_{z}) (#mum);entries", {HistType::kTH2F, {{100, 0., 20.}, {200, -500., 500.}}});
148148
registry.add("hVertexerType", "Use KF or DCAFitterN;Vertexer type;entries", {HistType::kTH1D, {{2, -0.5, 1.5}}}); // See o2::aod::hf_cand::VertexerType
149149
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
150-
hfEvSel.addHistograms(registry); // collision monitoring
150+
151+
// init HF event selection helper
152+
hfEvSel.init(registry);
151153

152154
massPi = MassPiPlus;
153155
massK = MassKPlus;
@@ -713,11 +715,11 @@ struct HfCandidateCreator2ProngExpressions {
713715
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
714716
for (const DeviceSpec& device : workflows.devices) {
715717
if (device.name.compare("hf-candidate-creator-2prong") == 0) {
716-
hfEvSelMc.configureFromDevice(device);
718+
// init HF event selection helper
719+
hfEvSelMc.init(device, registry);
717720
break;
718721
}
719722
}
720-
hfEvSelMc.addHistograms(registry); // particles monitoring
721723
}
722724

723725
/// Performs MC matching.

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ struct HfCandidateCreator3Prong {
175175
registry.add("hDcaXYProngs", "DCAxy of 3-prong candidate daughters;#it{p}_{T} (GeV/#it{c};#it{d}_{xy}) (#mum);entries", {HistType::kTH2F, {{100, 0., 20.}, {200, -500., 500.}}});
176176
registry.add("hDcaZProngs", "DCAz of 3-prong candidate daughters;#it{p}_{T} (GeV/#it{c};#it{d}_{z}) (#mum);entries", {HistType::kTH2F, {{100, 0., 20.}, {200, -500., 500.}}});
177177
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
178-
hfEvSel.addHistograms(registry); // collision monitoring
178+
179+
// init HF event selection helper
180+
hfEvSel.init(registry);
179181

180182
massP = MassProton;
181183
massPi = MassPiPlus;
@@ -838,12 +840,11 @@ struct HfCandidateCreator3ProngExpressions {
838840
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
839841
for (const DeviceSpec& device : workflows.devices) {
840842
if (device.name.compare("hf-candidate-creator-3prong") == 0) {
841-
hfEvSelMc.configureFromDevice(device);
843+
// init HF event selection helper
844+
hfEvSelMc.init(device, registry);
842845
break;
843846
}
844847
}
845-
846-
hfEvSelMc.addHistograms(registry); // particles monitoring
847848
}
848849

849850
/// Performs MC matching.

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ struct HfCandidateCreatorCascade {
118118
registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}});
119119
registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}});
120120
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
121-
hfEvSel.addHistograms(registry); // collision monitoring
121+
122+
// init HF event selection helper
123+
hfEvSel.init(registry);
122124

123125
massP = MassProton;
124126
massK0s = MassK0Short;
@@ -471,11 +473,11 @@ struct HfCandidateCreatorCascadeMc {
471473
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
472474
for (const DeviceSpec& device : workflows.devices) {
473475
if (device.name.compare("hf-candidate-creator-cascade") == 0) {
474-
hfEvSelMc.configureFromDevice(device);
476+
// init HF event selection helper
477+
hfEvSelMc.init(device, registry);
475478
break;
476479
}
477480
}
478-
hfEvSelMc.addHistograms(registry); // particles monitoring
479481
}
480482

481483
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs, typename McCollisions>

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ struct HfCandidateCreatorDstar {
136136
}
137137

138138
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
139-
hfEvSel.addHistograms(registry); // collision monitoring
139+
140+
// init HF event selection helper
141+
hfEvSel.init(registry);
140142

141143
// LOG(info) << "Init Function Invoked";
142144
massPi = MassPiPlus;
@@ -534,11 +536,11 @@ struct HfCandidateCreatorDstarExpressions {
534536
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
535537
for (const DeviceSpec& device : workflows.devices) {
536538
if (device.name.compare("hf-candidate-creator-dstar") == 0) {
537-
hfEvSelMc.configureFromDevice(device);
539+
// init HF event selection helper
540+
hfEvSelMc.init(device, registry);
538541
break;
539542
}
540543
}
541-
hfEvSelMc.addHistograms(registry); // particles monitoring
542544
}
543545

544546
/// Perform MC Matching.

PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,11 @@ struct HfCandidateSigmac0plusplusMc {
408408
// here we assume that the hf-candidate-creator-3prong is in the workflow
409409
// configure the ev. sel from that workflow
410410
if (device.name.compare("hf-candidate-creator-3prong") == 0) {
411-
hfEvSelMc.configureFromDevice(device);
411+
// init HF event selection helper
412+
hfEvSelMc.init(device, registry);
412413
break;
413414
}
414415
}
415-
416-
hfEvSelMc.addHistograms(registry); // particles monitoring
417416
}
418417

419418
/// @brief dummy process function, to be run on data

PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ struct HfCandidateCreatorXic0Omegac0 {
341341
registry.add("hKFcosPaV0ToCasc", "hKFcosPaV0ToCasc", kTH1D, {{5000, 0.8f, 1.1f}});
342342
registry.add("hKFcosPaCascToOmegac", "hKFcosPaCascToOmegac", kTH1D, {{5000, 0.8f, 1.1f}});
343343
}
344-
hfEvSel.addHistograms(registry); // collision monitoring
344+
345+
// init HF event selection helper
346+
hfEvSel.init(registry);
345347

346348
df.setPropagateToPCA(propagateToPCA);
347349
df.setMaxR(maxR);
@@ -1879,11 +1881,11 @@ struct HfCandidateCreatorXic0Omegac0Mc {
18791881
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
18801882
for (const DeviceSpec& device : workflows.devices) {
18811883
if (device.name.compare("hf-candidate-creator-xic0-omegac0") == 0) {
1882-
hfEvSelMc.configureFromDevice(device);
1884+
// init HF event selection helper
1885+
hfEvSelMc.init(device, registry);
18831886
break;
18841887
}
18851888
}
1886-
hfEvSelMc.addHistograms(registry); // particles monitoring
18871889

18881890
hGenCharmBaryonPtRapidityTightXicToXiPi = registry.add<TH1>("hGenCharmBaryonPtRapidityTightXicToXiPi", "Generated charm baryon #it{p}_{T};#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{20, 0.0, 20.0}}}); // keep track of generated candidates pt when |y|<0.5
18891891
hGenCharmBaryonPtRapidityLooseXicToXiPi = registry.add<TH1>("hGenCharmBaryonPtRapidityLooseXicToXiPi", "Generated charm baryon #it{p}_{T};#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{20, 0.0, 20.0}}}); // keep track of generated candidates pt when |y|<0.8

PWGHF/Utils/utilsEvSelHf.h

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "Framework/OutputObjHeader.h"
2828

2929
#include "Common/CCDB/EventSelectionParams.h"
30+
#include "Common/CCDB/RCTSelectionFlags.h"
3031
#include "EventFiltering/Zorro.h"
3132
#include "EventFiltering/ZorroSummary.h"
3233
#include "PWGLF/DataModel/mcCentrality.h"
@@ -82,6 +83,7 @@ namespace o2::hf_evsel
8283
// event rejection types
8384
enum EventRejection {
8485
None = 0,
86+
Rct,
8587
SoftwareTrigger,
8688
Centrality,
8789
Trigger,
@@ -110,6 +112,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel
110112
{
111113
// Puts labels on the collision monitoring histogram.
112114
hRejection->GetXaxis()->SetBinLabel(EventRejection::None + 1, "All");
115+
hRejection->GetXaxis()->SetBinLabel(EventRejection::Rct + 1, "RCT");
113116
hRejection->GetXaxis()->SetBinLabel(EventRejection::SoftwareTrigger + 1, softwareTriggerLabel.data());
114117
hRejection->GetXaxis()->SetBinLabel(EventRejection::Centrality + 1, "Centrality");
115118
hRejection->GetXaxis()->SetBinLabel(EventRejection::Trigger + 1, "Trigger");
@@ -155,6 +158,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
155158
o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "ccdb path for ZORRO objects"};
156159
o2::framework::ConfigurableAxis th2ConfigAxisCent{"th2ConfigAxisCent", {100, 0., 100.}, ""};
157160
o2::framework::ConfigurableAxis th2ConfigAxisOccupancy{"th2ConfigAxisOccupancy", {14, 0, 14000}, ""};
161+
o2::framework::Configurable<bool> requireGoodRct{"requireGoodRct", false, "Flag to require good RCT"};
162+
o2::framework::Configurable<std::string> rctLabel{"rctLabel", "CBT_hadronPID", "RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CCBT_calo, CBT_muon, CBT_muon_glo)"};
163+
o2::framework::Configurable<bool> rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"};
164+
o2::framework::Configurable<bool> rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"};
158165

159166
// histogram names
160167
static constexpr char NameHistCollisions[] = "hCollisions";
@@ -169,6 +176,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
169176
std::shared_ptr<TH1> hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel;
170177
std::shared_ptr<TH2> hCollisionsCentOcc;
171178

179+
// util to retrieve the RCT info from CCDB
180+
o2::aod::rctsel::RCTFlagsChecker rctChecker;
181+
172182
// util to retrieve trigger mask in case of software triggers
173183
Zorro zorro;
174184
o2::framework::OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
@@ -190,11 +200,24 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
190200
const o2::framework::AxisSpec th2AxisCent{th2ConfigAxisCent, "Centrality"};
191201
const o2::framework::AxisSpec th2AxisOccupancy{th2ConfigAxisOccupancy, "Occupancy"};
192202
hCollisionsCentOcc = registry.add<TH2>(NameHistCollisionsCentOcc, "selected events;Centrality; Occupancy", {o2::framework::HistType::kTH2D, {th2AxisCent, th2AxisOccupancy}});
203+
}
204+
205+
/// \brief Inits the HF event selection object
206+
/// \param registry reference to the histogram registry
207+
void init(o2::framework::HistogramRegistry& registry)
208+
{
209+
// we initialise the RCT checker
210+
if (requireGoodRct) {
211+
rctChecker.init(rctLabel.value, rctCheckZDC.value, rctTreatLimitedAcceptanceAsBad.value);
212+
}
193213

194214
// we initialise the summary object
195215
if (softwareTrigger.value != "") {
196216
zorroSummary.setObject(zorro.getZorroSummary());
197217
}
218+
219+
// we initialise histograms
220+
addHistograms(registry);
198221
}
199222

200223
/// \brief Applies event selection.
@@ -218,6 +241,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
218241
}
219242

220243
if constexpr (useEvSel) {
244+
/// RCT condition
245+
if (requireGoodRct && !rctChecker.checkTable(collision)) {
246+
SETBIT(rejectionMask, EventRejection::Rct);
247+
}
221248
/// trigger condition
222249
if ((useSel8Trigger && !collision.sel8()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit(triggerClass))) {
223250
SETBIT(rejectionMask, EventRejection::Trigger);
@@ -333,14 +360,21 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
333360

334361
struct HfEventSelectionMc {
335362
// event selection parameters (in chronological order of application)
336-
bool useSel8Trigger{false}; // Apply the Sel8 selection
337-
bool useTvxTrigger{false}; // Apply the TVX trigger
338-
bool useTimeFrameBorderCut{true}; // Apply TF border cut
339-
bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut
340-
float zPvPosMin{-1000.f}; // Minimum PV posZ (cm)
341-
float zPvPosMax{1000.f}; // Maximum PV posZ (cm)
342-
float centralityMin{0.f}; // Minimum centrality
343-
float centralityMax{100.f}; // Maximum centrality
363+
bool useSel8Trigger{false}; // Apply the Sel8 selection
364+
bool useTvxTrigger{false}; // Apply the TVX trigger
365+
bool useTimeFrameBorderCut{true}; // Apply TF border cut
366+
bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut
367+
float zPvPosMin{-1000.f}; // Minimum PV posZ (cm)
368+
float zPvPosMax{1000.f}; // Maximum PV posZ (cm)
369+
float centralityMin{0.f}; // Minimum centrality
370+
float centralityMax{100.f}; // Maximum centrality
371+
bool requireGoodRct{false}; // Apply RCT selection
372+
std::string rctLabel{""}; // RCT selection flag
373+
bool rctCheckZDC; // require ZDC from RCT
374+
bool rctTreatLimitedAcceptanceAsBad; // RCT flag to reject events with limited acceptance for selected detectors
375+
376+
// util to retrieve the RCT info from CCDB
377+
o2::aod::rctsel::RCTFlagsChecker rctChecker;
344378

345379
// histogram names
346380
static constexpr char NameHistGenCollisionsCent[] = "hGenCollisionsCent";
@@ -364,6 +398,9 @@ struct HfEventSelectionMc {
364398
setEventRejectionLabels(hParticles);
365399
}
366400

401+
/// \brief Configures the object from the reco workflow
402+
/// \param registry reference to the histogram registry
403+
/// \param device device spec to get the configs from the reco workflow
367404
void configureFromDevice(const o2::framework::DeviceSpec& device)
368405
{
369406
for (const auto& option : device.options) {
@@ -383,10 +420,35 @@ struct HfEventSelectionMc {
383420
centralityMin = option.defaultValue.get<float>();
384421
} else if (option.name.compare("hfEvSel.centralityMax") == 0) {
385422
centralityMax = option.defaultValue.get<float>();
423+
} else if (option.name.compare("hfEvSel.requireGoodRct") == 0) {
424+
requireGoodRct = option.defaultValue.get<bool>();
425+
} else if (option.name.compare("hfEvSel.rctLabel") == 0) {
426+
rctLabel = option.defaultValue.get<std::string>();
427+
} else if (option.name.compare("hfEvSel.rctCheckZDC") == 0) {
428+
rctCheckZDC = option.defaultValue.get<bool>();
429+
} else if (option.name.compare("hfEvSel.rctTreatLimitedAcceptanceAsBad") == 0) {
430+
rctTreatLimitedAcceptanceAsBad = option.defaultValue.get<bool>();
386431
}
387432
}
388433
}
389434

435+
/// \brief Inits the HF event selection object
436+
/// \param device device spec to get the configs from the reco workflow
437+
/// \param registry reference to the histogram registry
438+
void init(const o2::framework::DeviceSpec& device, o2::framework::HistogramRegistry& registry)
439+
{
440+
// we get the configuration from the reco workflow
441+
configureFromDevice(device);
442+
443+
// we initialise the RCT checker
444+
if (requireGoodRct) {
445+
rctChecker.init(rctLabel, rctCheckZDC, rctTreatLimitedAcceptanceAsBad);
446+
}
447+
448+
// we initialise histograms
449+
addHistograms(registry);
450+
}
451+
390452
/// \brief Function to apply event selections to generated MC collisions
391453
/// \param mcCollision MC collision to test against the selection criteria
392454
/// \param collSlice collection of reconstructed collisions
@@ -406,6 +468,16 @@ struct HfEventSelectionMc {
406468
SETBIT(rejectionMask, EventRejection::Centrality);
407469
}
408470
}
471+
472+
/// RCT condition
473+
if (requireGoodRct) {
474+
for (auto const& collision : collSlice) {
475+
if (!rctChecker.checkTable(collision)) {
476+
SETBIT(rejectionMask, EventRejection::Rct);
477+
break;
478+
}
479+
}
480+
}
409481
/// Sel8 trigger selection
410482
if (useSel8Trigger && (!bc.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !bc.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !bc.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) {
411483
SETBIT(rejectionMask, EventRejection::Trigger);

0 commit comments

Comments
 (0)