Skip to content

Commit c96cd41

Browse files
committed
PWGHF: add selection on generated PV z position in creators
1 parent 1c9c017 commit c96cd41

5 files changed

Lines changed: 105 additions & 4 deletions

File tree

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "Framework/AnalysisTask.h"
3434
#include "Framework/HistogramRegistry.h"
3535
#include "Framework/runDataProcessing.h"
36+
#include "Framework/RunningWorkflowInfo.h"
3637
#include "ReconstructionDataFormats/DCA.h"
3738

3839
#include "Common/Core/trackUtilities.h"
@@ -665,7 +666,21 @@ struct HfCandidateCreator2ProngExpressions {
665666
Produces<aod::HfCand2ProngMcRec> rowMcMatchRec;
666667
Produces<aod::HfCand2ProngMcGen> rowMcMatchGen;
667668

668-
void init(InitContext const&) {}
669+
float zPvPosMax{1000.f};
670+
671+
// inspect for which zPvPosMax cut was set for reconstructed
672+
void init(InitContext& initContext) {
673+
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
674+
for (const DeviceSpec& device : workflows.devices) {
675+
if (device.name.compare("hf-candidate-creator-2prong") == 0) {
676+
for (const auto& option : device.options) {
677+
if (option.name.compare("zPvPosMax") == 0) {
678+
zPvPosMax = option.defaultValue.get<float>();
679+
}
680+
}
681+
}
682+
}
683+
}
669684

670685
/// Performs MC matching.
671686
void processMc(aod::TracksWMc const& tracks,
@@ -721,6 +736,13 @@ struct HfCandidateCreator2ProngExpressions {
721736
flag = 0;
722737
origin = 0;
723738

739+
auto mcCollision = particle.mcCollision();
740+
float zPv = mcCollision.posZ();
741+
if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them
742+
rowMcMatchGen(flag, origin);
743+
continue;
744+
}
745+
724746
// D0(bar) → π± K∓
725747
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) {
726748
flag = sign * (1 << DecayType::D0ToPiK);

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,12 @@ struct HfCandidateCreator3ProngExpressions {
470470
bool createDs{false};
471471
bool createLc{false};
472472
bool createXic{false};
473+
float zPvPosMax{1000.f};
473474

474475
void init(InitContext& initContext)
475476
{
476477

477-
// inspect for which particle species the candidates were created
478+
// inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed
478479
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
479480
for (const DeviceSpec& device : workflows.devices) {
480481
if (device.name.compare("hf-candidate-creator-3prong") == 0) {
@@ -487,6 +488,8 @@ struct HfCandidateCreator3ProngExpressions {
487488
createLc = option.defaultValue.get<bool>();
488489
} else if (option.name.compare("createXic") == 0) {
489490
createXic = option.defaultValue.get<bool>();
491+
} else if (option.name.compare("zPvPosMax") == 0) {
492+
zPvPosMax = option.defaultValue.get<float>();
490493
}
491494
}
492495
}
@@ -618,6 +621,13 @@ struct HfCandidateCreator3ProngExpressions {
618621
channel = 0;
619622
arrDaughIndex.clear();
620623

624+
auto mcCollision = particle.mcCollision();
625+
float zPv = mcCollision.posZ();
626+
if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them
627+
rowMcMatchGen(flag, origin, channel);
628+
continue;
629+
}
630+
621631
// D± → π± K∓ π±
622632
if (createDplus) {
623633
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 2)) {

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "Framework/AnalysisTask.h"
2323
#include "Framework/HistogramRegistry.h"
2424
#include "Framework/runDataProcessing.h"
25+
#include "Framework/RunningWorkflowInfo.h"
2526
#include "ReconstructionDataFormats/DCA.h"
2627
#include "ReconstructionDataFormats/V0.h"
2728

@@ -445,6 +446,22 @@ struct HfCandidateCreatorCascadeMc {
445446

446447
using MyTracksWMc = soa::Join<aod::TracksWCov, aod::McTrackLabels>;
447448

449+
float zPvPosMax{1000.f};
450+
451+
// inspect for which zPvPosMax cut was set for reconstructed
452+
void init(InitContext& initContext) {
453+
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
454+
for (const DeviceSpec& device : workflows.devices) {
455+
if (device.name.compare("hf-candidate-creator-cascade") == 0) {
456+
for (const auto& option : device.options) {
457+
if (option.name.compare("zPvPosMax") == 0) {
458+
zPvPosMax = option.defaultValue.get<float>();
459+
}
460+
}
461+
}
462+
}
463+
}
464+
448465
void processMc(MyTracksWMc const& tracks,
449466
aod::McParticles const& mcParticles)
450467
{
@@ -493,6 +510,14 @@ struct HfCandidateCreatorCascadeMc {
493510
// Match generated particles.
494511
for (const auto& particle : mcParticles) {
495512
origin = 0;
513+
514+
auto mcCollision = particle.mcCollision();
515+
float zPv = mcCollision.posZ();
516+
if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them
517+
rowMcMatchGen(sign, origin);
518+
continue;
519+
}
520+
496521
// checking if I have a Lc --> K0S + p
497522
RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, +kK0Short}, false, &sign, 2);
498523
if (sign == 0) { // now check for anti-Lc

PWGHF/TableProducer/candidateCreatorDstar.cxx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "Framework/AnalysisDataModel.h"
2525
#include "Framework/AnalysisTask.h"
2626
#include "Framework/runDataProcessing.h"
27+
#include "Framework/RunningWorkflowInfo.h"
2728
// O2Physics
2829
#include "Common/Core/trackUtilities.h"
2930
// PWGHF
@@ -516,7 +517,21 @@ struct HfCandidateCreatorDstarExpressions {
516517
Produces<aod::HfCandDstarMcRec> rowsMcMatchRecDstar;
517518
Produces<aod::HfCandDstarMcGen> rowsMcMatchGenDstar;
518519

519-
void init(InitContext const&) {}
520+
float zPvPosMax{1000.f};
521+
522+
// inspect for which zPvPosMax cut was set for reconstructed
523+
void init(InitContext& initContext) {
524+
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
525+
for (const DeviceSpec& device : workflows.devices) {
526+
if (device.name.compare("hf-candidate-creator-dstar") == 0) {
527+
for (const auto& option : device.options) {
528+
if (option.name.compare("zPvPosMax") == 0) {
529+
zPvPosMax = option.defaultValue.get<float>();
530+
}
531+
}
532+
}
533+
}
534+
}
520535

521536
/// Perform MC Matching.
522537
void processMc(aod::TracksWMc const& tracks,
@@ -576,6 +591,14 @@ struct HfCandidateCreatorDstarExpressions {
576591
originDstar = 0;
577592
originD0 = 0;
578593

594+
auto mcCollision = particle.mcCollision();
595+
float zPv = mcCollision.posZ();
596+
if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them
597+
rowsMcMatchGenDstar(flagDstar, originDstar);
598+
rowsMcMatchGenD0(flagD0, originD0);
599+
continue;
600+
}
601+
579602
// D*± → D0(bar) π±
580603
if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDStar, std::array{+kPiPlus, +kPiPlus, -kKPlus}, true, &signDstar, 2)) {
581604
flagDstar = signDstar * (BIT(aod::hf_cand_dstar::DecayType::DstarToD0Pi));

PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "DetectorsVertexing/PVertexer.h" // for dca recalculation
2525
#include "Framework/AnalysisTask.h"
2626
#include "Framework/runDataProcessing.h"
27+
#include "Framework/RunningWorkflowInfo.h"
2728

2829
#include "Common/Core/TrackSelection.h"
2930
#include "Common/Core/trackUtilities.h"
@@ -385,8 +386,21 @@ struct HfCandidateSigmac0plusplusMc {
385386
using LambdacMc = soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfCand3ProngMcRec>;
386387
// using LambdacMcGen = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>;
387388

389+
float zPvPosMax{1000.f};
390+
388391
/// @brief init function
389-
void init(InitContext const&) {}
392+
void init(InitContext& initContext) {
393+
auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
394+
for (const DeviceSpec& device : workflows.devices) {
395+
if (device.name.compare("hf-candidate-creator-3prong") == 0) { // here we assume that the hf-candidate-creator-3prong is in the workflow
396+
for (const auto& option : device.options) {
397+
if (option.name.compare("zPvPosMax") == 0) {
398+
zPvPosMax = option.defaultValue.get<float>();
399+
}
400+
}
401+
}
402+
}
403+
}
390404

391405
/// @brief dummy process function, to be run on data
392406
/// @param
@@ -469,6 +483,13 @@ struct HfCandidateSigmac0plusplusMc {
469483
flag = 0;
470484
origin = 0;
471485

486+
auto mcCollision = particle.mcCollision();
487+
float zPv = mcCollision.posZ();
488+
if (zPv < -zPvPosMax || zPv > zPvPosMax) { // to avoid counting particles in collisions with Zvtx larger than the maximum, we do not match them
489+
rowMCMatchScGen(flag, origin);
490+
continue;
491+
}
492+
472493
/// 3 levels:
473494
/// 1. Σc0 → Λc+ π-,+
474495
/// 2. Λc+ → pK-π+ direct (i) or Λc+ → resonant channel Λc± → p± K*, Λc± → Δ(1232)±± K∓ or Λc± → Λ(1520) π± (ii)

0 commit comments

Comments
 (0)