Skip to content

Commit bd9a98a

Browse files
fgrosaalibuild
andauthored
PWGHF: add configurables to turn off/on creation of different 3-prong species (#4988)
* PWGHF: add configurables to turn off/on creation of different 3-prong species * Please consider the following formatting changes * Implement Mattia's and Vit's comments * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 87623d3 commit bd9a98a

1 file changed

Lines changed: 72 additions & 18 deletions

File tree

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 72 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "DCAFitter/DCAFitterN.h"
2222
#include "Framework/AnalysisTask.h"
2323
#include "Framework/runDataProcessing.h"
24+
#include "Framework/RunningWorkflowInfo.h"
2425
#include "ReconstructionDataFormats/DCA.h"
2526

2627
#include "Common/Core/trackUtilities.h"
@@ -34,6 +35,7 @@ using namespace o2::aod::hf_cand_3prong;
3435
using namespace o2::aod::hf_collision_centrality;
3536
using namespace o2::constants::physics;
3637
using namespace o2::framework;
38+
using namespace o2::framework::expressions;
3739

3840
/// Reconstruction of heavy-flavour 3-prong decay candidates
3941
struct HfCandidateCreator3Prong {
@@ -57,6 +59,11 @@ struct HfCandidateCreator3Prong {
5759
Configurable<std::string> ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"};
5860
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"};
5961
Configurable<std::string> ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"};
62+
// flags to enable creation for different particle species separately
63+
Configurable<bool> createDplus{"createDplus", false, "enable D+/- candidate creation"};
64+
Configurable<bool> createDs{"createDs", false, "enable Ds+/- candidate creation"};
65+
Configurable<bool> createLc{"createLc", false, "enable Lc+/- candidate creation"};
66+
Configurable<bool> createXic{"createXic", false, "enable Xic+/- candidate creation"};
6067

6168
o2::vertexing::DCAFitterN<3> df; // 3-prong vertex fitter
6269
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -70,6 +77,12 @@ struct HfCandidateCreator3Prong {
7077
double massPiKPi{0.};
7178
double bz{0.};
7279

80+
using FilteredHf3Prongs = soa::Filtered<aod::Hf3Prongs>;
81+
using FilteredPvRefitHf3Prongs = soa::Filtered<soa::Join<aod::Hf3Prongs, aod::HfPvRefit3Prong>>;
82+
83+
// filter candidates
84+
Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast<uint8_t>(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast<uint8_t>(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast<uint8_t>(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast<uint8_t>(0));
85+
7386
OutputObj<TH1F> hMass3{TH1F("hMass3", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", 500, 1.6, 2.1)};
7487
OutputObj<TH1F> hCovPVXX{TH1F("hCovPVXX", "3-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", 100, 0., 1.e-4)};
7588
OutputObj<TH1F> hCovSVXX{TH1F("hCovSVXX", "3-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", 100, 0., 0.2)};
@@ -90,6 +103,12 @@ struct HfCandidateCreator3Prong {
90103
if (std::accumulate(processes.begin(), processes.end(), 0) != 1) {
91104
LOGP(fatal, "One and only one process function must be enabled at a time.");
92105
}
106+
107+
std::array<bool, 4> creationFlags = {createDplus, createDs, createLc, createXic};
108+
if (std::accumulate(creationFlags.begin(), creationFlags.end(), 0) == 0) {
109+
LOGP(fatal, "At least one particle specie should be enabled for the creation.");
110+
}
111+
93112
massPi = MassPiPlus;
94113
massK = MassKPlus;
95114

@@ -266,7 +285,7 @@ struct HfCandidateCreator3Prong {
266285

267286
/// @brief process function w/ PV refit and w/o centrality selections
268287
void processPvRefit(aod::Collisions const& collisions,
269-
soa::Join<aod::Hf3Prongs, aod::HfPvRefit3Prong> const& rowsTrackIndexProng3,
288+
FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3,
270289
aod::TracksWCovExtra const& tracks,
271290
aod::BCsWithTimestamps const& bcWithTimeStamps)
272291
{
@@ -276,7 +295,7 @@ struct HfCandidateCreator3Prong {
276295

277296
/// @brief process function w/o PV refit and w/o centrality selections
278297
void processNoPvRefit(aod::Collisions const& collisions,
279-
aod::Hf3Prongs const& rowsTrackIndexProng3,
298+
FilteredHf3Prongs const& rowsTrackIndexProng3,
280299
aod::TracksWCovExtra const& tracks,
281300
aod::BCsWithTimestamps const& bcWithTimeStamps)
282301
{
@@ -292,7 +311,7 @@ struct HfCandidateCreator3Prong {
292311

293312
/// @brief process function w/ PV refit and w/ centrality selection on FT0C
294313
void processPvRefitCentFT0C(soa::Join<aod::Collisions, aod::CentFT0Cs> const& collisions,
295-
soa::Join<aod::Hf3Prongs, aod::HfPvRefit3Prong> const& rowsTrackIndexProng3,
314+
FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3,
296315
aod::TracksWCovExtra const& tracks,
297316
aod::BCsWithTimestamps const& bcWithTimeStamps)
298317
{
@@ -302,7 +321,7 @@ struct HfCandidateCreator3Prong {
302321

303322
/// @brief process function w/o PV refit and w/ centrality selection on FT0C
304323
void processNoPvRefitCentFT0C(soa::Join<aod::Collisions, aod::CentFT0Cs> const& collisions,
305-
aod::Hf3Prongs const& rowsTrackIndexProng3,
324+
FilteredHf3Prongs const& rowsTrackIndexProng3,
306325
aod::TracksWCovExtra const& tracks,
307326
aod::BCsWithTimestamps const& bcWithTimeStamps)
308327
{
@@ -318,7 +337,7 @@ struct HfCandidateCreator3Prong {
318337

319338
/// @brief process function w/ PV refit and w/ centrality selection on FT0M
320339
void processPvRefitCentFT0M(soa::Join<aod::Collisions, aod::CentFT0Ms> const& collisions,
321-
soa::Join<aod::Hf3Prongs, aod::HfPvRefit3Prong> const& rowsTrackIndexProng3,
340+
FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3,
322341
aod::TracksWCovExtra const& tracks,
323342
aod::BCsWithTimestamps const& bcWithTimeStamps)
324343
{
@@ -328,7 +347,7 @@ struct HfCandidateCreator3Prong {
328347

329348
/// @brief process function w/o PV refit and w/ centrality selection on FT0M
330349
void processNoPvRefitCentFT0M(soa::Join<aod::Collisions, aod::CentFT0Ms> const& collisions,
331-
aod::Hf3Prongs const& rowsTrackIndexProng3,
350+
FilteredHf3Prongs const& rowsTrackIndexProng3,
332351
aod::TracksWCovExtra const& tracks,
333352
aod::BCsWithTimestamps const& bcWithTimeStamps)
334353
{
@@ -343,7 +362,38 @@ struct HfCandidateCreator3ProngExpressions {
343362
Produces<aod::HfCand3ProngMcRec> rowMcMatchRec;
344363
Produces<aod::HfCand3ProngMcGen> rowMcMatchGen;
345364

346-
void init(InitContext const&) {}
365+
bool createDplus{false};
366+
bool createDs{false};
367+
bool createLc{false};
368+
bool createXic{false};
369+
370+
void init(InitContext& initContext)
371+
{
372+
373+
// inspect for which particle species the candidates were created
374+
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
375+
for (const DeviceSpec& device : workflows.devices) {
376+
if (device.name.compare("hf-candidate-creator-3prong") == 0) {
377+
for (const auto& option : device.options) {
378+
if (option.name.compare("createDplus") == 0) {
379+
createDplus = option.defaultValue.get<bool>();
380+
} else if (option.name.compare("createDs") == 0) {
381+
createDs = option.defaultValue.get<bool>();
382+
} else if (option.name.compare("createLc") == 0) {
383+
createLc = option.defaultValue.get<bool>();
384+
} else if (option.name.compare("createXic") == 0) {
385+
createXic = option.defaultValue.get<bool>();
386+
}
387+
}
388+
}
389+
}
390+
391+
LOGP(info, "Flags for candidate creation from the reco workflow:");
392+
LOGP(info, " --> createDplus = {}", createDplus);
393+
LOGP(info, " --> createDs = {}", createDs);
394+
LOGP(info, " --> createLc = {}", createLc);
395+
LOGP(info, " --> createXic = {}", createXic);
396+
}
347397

348398
/// Performs MC matching.
349399
void processMc(aod::TracksWMc const& tracks,
@@ -376,13 +426,15 @@ struct HfCandidateCreator3ProngExpressions {
376426
auto arrayDaughters = std::array{candidate.prong0_as<aod::TracksWMc>(), candidate.prong1_as<aod::TracksWMc>(), candidate.prong2_as<aod::TracksWMc>()};
377427

378428
// D± → π± K∓ π±
379-
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
380-
if (indexRec > -1) {
381-
flag = sign * (1 << DecayType::DplusToPiKPi);
429+
if (createDplus) {
430+
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
431+
if (indexRec > -1) {
432+
flag = sign * (1 << DecayType::DplusToPiKPi);
433+
}
382434
}
383435

384436
// Ds± → K± K∓ π± and D± → K± K∓ π±
385-
if (flag == 0) {
437+
if (flag == 0 && createDs) {
386438
bool isDplus = false;
387439
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2);
388440
if (indexRec == -1) {
@@ -412,7 +464,7 @@ struct HfCandidateCreator3ProngExpressions {
412464
}
413465

414466
// Λc± → p± K∓ π±
415-
if (flag == 0) {
467+
if (flag == 0 && createLc) {
416468
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
417469
if (indexRec > -1) {
418470
flag = sign * (1 << DecayType::LcToPKPi);
@@ -439,7 +491,7 @@ struct HfCandidateCreator3ProngExpressions {
439491
}
440492

441493
// Ξc± → p± K∓ π±
442-
if (flag == 0) {
494+
if (flag == 0 && createXic) {
443495
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2);
444496
if (indexRec > -1) {
445497
flag = sign * (1 << DecayType::XicToPKPi);
@@ -463,12 +515,14 @@ struct HfCandidateCreator3ProngExpressions {
463515
arrDaughIndex.clear();
464516

465517
// D± → π± K∓ π±
466-
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) {
467-
flag = sign * (1 << DecayType::DplusToPiKPi);
518+
if (createDplus) {
519+
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) {
520+
flag = sign * (1 << DecayType::DplusToPiKPi);
521+
}
468522
}
469523

470524
// Ds± → K± K∓ π± and D± → K± K∓ π±
471-
if (flag == 0) {
525+
if (flag == 0 && createDs) {
472526
bool isDplus = false;
473527
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDS, std::array{+kKPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) {
474528
// DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π±
@@ -497,7 +551,7 @@ struct HfCandidateCreator3ProngExpressions {
497551
}
498552

499553
// Λc± → p± K∓ π±
500-
if (flag == 0) {
554+
if (flag == 0 && createLc) {
501555
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) {
502556
flag = sign * (1 << DecayType::LcToPKPi);
503557

@@ -520,7 +574,7 @@ struct HfCandidateCreator3ProngExpressions {
520574
}
521575

522576
// Ξc± → p± K∓ π±
523-
if (flag == 0) {
577+
if (flag == 0 && createXic) {
524578
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) {
525579
flag = sign * (1 << DecayType::XicToPKPi);
526580
}

0 commit comments

Comments
 (0)