Skip to content

Commit ae7b60d

Browse files
fgrosaalibuild
authored andcommitted
PWGHF: Implement the possibility to apply proton PID for baryons in skimming (AliceO2Group#3939)
* PWGHF: Implent the possibility to apply proton PID for baryons in HF finding * Please consider the following formatting changes * Restore author removed by mistake * Remove all MY_DEBUG instances * Restore line wrongly deleted * Fallback to fill PVrefit table for all tracks at once to avoid crash due to tracks with no collision * Move initialisation of whichHypo * Add check on hasTPC and hasTOF in case of single detector PID * Remove extra slash --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent a4b986f commit ae7b60d

File tree

6 files changed

+394
-335
lines changed

6 files changed

+394
-335
lines changed

PWGHF/Core/SelectorCuts.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ static const std::vector<std::string> labelsPtTrack{};
6363
static const std::vector<std::string> labelsCutVarTrack = {"min_dcaxytoprimary", "max_dcaxytoprimary"};
6464
} // namespace hf_cuts_single_track
6565

66+
namespace hf_presel_proton_pid
67+
{
68+
// default values for the PID cuts for protons in the track-index-skim-creator
69+
constexpr float cutsProtonPid[3][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
70+
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
71+
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}};
72+
static const std::vector<std::string> labelsCutsProtonPid = {"minPtTpc", "maxPtTpc", "nSigmaMaxTpc", "minPtTof", "maxPtTof", "nSigmaMaxTof"};
73+
static const std::vector<std::string> labelsRowsProtonPid = {"LcToPKPi", "XicToPKPi", "LcToPK0S"};
74+
} // namespace hf_presel_proton_pid
75+
6676
namespace hf_cuts_bdt_multiclass
6777
{
6878
static constexpr int nBinsPt = 1;

PWGHF/DataModel/CandidateReconstructionTables.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //!
153153
namespace hf_sel_track
154154
{
155155
DECLARE_SOA_COLUMN(IsSelProng, isSelProng, int); //!
156+
DECLARE_SOA_COLUMN(IsProton, isProton, int8_t); //!
156157
} // namespace hf_sel_track
157158

158159
DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //!
159-
hf_sel_track::IsSelProng);
160+
hf_sel_track::IsSelProng,
161+
hf_sel_track::IsProton);
160162

161163
namespace hf_pv_refit_track
162164
{

PWGHF/TableProducer/candidateCreatorCascade.cxx

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,11 @@
2727

2828
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
2929
#include "PWGHF/Utils/utilsBfieldCCDB.h"
30-
#include "PWGHF/Utils/utilsDebugLcToK0sP.h"
3130

3231
using namespace o2;
3332
using namespace o2::analysis;
3433
using namespace o2::framework;
3534

36-
// #define MY_DEBUG
37-
38-
#ifdef MY_DEBUG
39-
using MyBigTracks = soa::Join<aod::TracksWCov, aod::McTrackLabels>;
40-
#define MY_DEBUG_MSG(condition, cmd) \
41-
if (condition) { \
42-
cmd; \
43-
}
44-
#else
45-
using MyBigTracks = aod::TracksWCov;
46-
#define MY_DEBUG_MSG(condition, cmd)
47-
#endif
48-
4935
/// Reconstruction of heavy-flavour cascade decay candidates
5036
struct HfCandidateCreatorCascade {
5137
Produces<aod::HfCandCascBase> rowCandidateBase;
@@ -72,13 +58,6 @@ struct HfCandidateCreatorCascade {
7258
o2::base::MatLayerCylSet* lut;
7359
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
7460

75-
// for debugging
76-
#ifdef MY_DEBUG
77-
Configurable<std::vector<int>> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"};
78-
Configurable<std::vector<int>> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"};
79-
Configurable<std::vector<int>> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"};
80-
#endif
81-
8261
int runNumber{0};
8362
double massP{0.};
8463
double massK0s{0.};
@@ -106,15 +85,10 @@ struct HfCandidateCreatorCascade {
10685

10786
void process(aod::Collisions const&,
10887
aod::HfCascades const& rowsTrackIndexCasc,
109-
MyBigTracks const&,
88+
aod::TracksWCov const&,
11089
aod::V0sLinked const&,
11190
aod::V0Datas const&,
112-
aod::BCsWithTimestamps const&
113-
#ifdef MY_DEBUG
114-
,
115-
aod::McParticles const& mcParticles
116-
#endif
117-
)
91+
aod::BCsWithTimestamps const&)
11892
{
11993
// 2-prong vertex fitter
12094
o2::vertexing::DCAFitterN<2> df;
@@ -130,7 +104,7 @@ struct HfCandidateCreatorCascade {
130104
// loop over pairs of track indeces
131105
for (const auto& casc : rowsTrackIndexCasc) {
132106

133-
const auto& bach = casc.prong0_as<MyBigTracks>();
107+
const auto& bach = casc.prong0_as<aod::TracksWCov>();
134108
LOGF(debug, "V0 %d in HF cascade %d.", casc.v0Id(), casc.globalIndex());
135109
if (!casc.has_v0()) {
136110
LOGF(error, "V0 not there for HF cascade %d. Skipping candidate.", casc.globalIndex());
@@ -144,8 +118,8 @@ struct HfCandidateCreatorCascade {
144118
}
145119
LOGF(debug, "V0Data ID: %d", casc.v0_as<aod::V0sLinked>().v0DataId());
146120
const auto& v0 = casc.v0_as<aod::V0sLinked>().v0Data();
147-
const auto& trackV0DaughPos = v0.posTrack_as<MyBigTracks>();
148-
const auto& trackV0DaughNeg = v0.negTrack_as<MyBigTracks>();
121+
const auto& trackV0DaughPos = v0.posTrack_as<aod::TracksWCov>();
122+
const auto& trackV0DaughNeg = v0.negTrack_as<aod::TracksWCov>();
149123

150124
auto collision = casc.collision();
151125

@@ -160,18 +134,9 @@ struct HfCandidateCreatorCascade {
160134
}
161135
df.setBz(bz);
162136

163-
#ifdef MY_DEBUG
164-
auto indexBach = bach.mcParticleId();
165-
auto indexV0DaughPos = trackV0DaughPos.mcParticleId();
166-
auto indexV0DaughNeg = trackV0DaughNeg.mcParticleId();
167-
bool isLc = isLcK0SpFunc(indexBach, indexV0DaughPos, indexV0DaughNeg, indexProton, indexK0Spos, indexK0Sneg);
168-
#endif
169-
170-
MY_DEBUG_MSG(isLc, LOG(info) << "Processing the Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg);
171-
172137
auto trackParCovBach = getTrackParCov(bach);
173-
auto trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that MyBigTracks does not need TracksDCA!
174-
auto trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that MyBigTracks does not need TracksDCA!
138+
auto trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that aod::TracksWCov does not need TracksDCA!
139+
auto trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that aod::TracksWCov does not need TracksDCA!
175140
trackParCovV0DaughPos.propagateTo(v0.posX(), bz); // propagate the track to the X closest to the V0 vertex
176141
trackParCovV0DaughNeg.propagateTo(v0.negX(), bz); // propagate the track to the X closest to the V0 vertex
177142
const std::array<float, 3> vertexV0 = {v0.x(), v0.y(), v0.z()};
@@ -181,10 +146,6 @@ struct HfCandidateCreatorCascade {
181146

182147
// reconstruct the cascade secondary vertex
183148
if (df.process(trackV0, trackParCovBach) == 0) {
184-
MY_DEBUG_MSG(isLc, LOG(info) << "Vertexing failed for Lc candidate");
185-
// if (isLc) {
186-
// LOG(info) << "Vertexing failed for Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg;
187-
//}
188149
continue;
189150
} else {
190151
// LOG(info) << "Vertexing succeeded for Lc candidate";
@@ -221,7 +182,6 @@ struct HfCandidateCreatorCascade {
221182
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.));
222183

223184
// fill candidate table rows
224-
MY_DEBUG_MSG(isLc, LOG(info) << "IT IS A Lc! Filling for Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg);
225185
rowCandidateBase(collision.globalIndex(),
226186
collision.posX(), collision.posY(), collision.posZ(),
227187
secondaryVertex[0], secondaryVertex[1], secondaryVertex[2],
@@ -258,12 +218,6 @@ struct HfCandidateCreatorCascadeMc {
258218
Produces<aod::HfCandCascadeMcRec> rowMcMatchRec;
259219
Produces<aod::HfCandCascadeMcGen> rowMcMatchGen;
260220

261-
#ifdef MY_DEBUG
262-
Configurable<std::vector<int>> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"};
263-
Configurable<std::vector<int>> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"};
264-
Configurable<std::vector<int>> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"};
265-
#endif
266-
267221
using MyTracksWMc = soa::Join<aod::TracksWCov, aod::McTrackLabels>;
268222

269223
void processMc(MyTracksWMc const& tracks,
@@ -293,24 +247,12 @@ struct HfCandidateCreatorCascadeMc {
293247
LOG(debug) << "\n";
294248
LOG(debug) << "Checking MC for candidate!";
295249
LOG(debug) << "Looking for K0s";
296-
#ifdef MY_DEBUG
297-
auto indexV0DaughPos = trackV0DaughPos.mcParticleId();
298-
auto indexV0DaughNeg = trackV0DaughNeg.mcParticleId();
299-
auto indexBach = bach.mcParticleId();
300-
bool isLc = isLcK0SpFunc(indexBach, indexV0DaughPos, indexV0DaughNeg, indexProton, indexK0Spos, indexK0Sneg);
301-
bool isK0SfromLc = isK0SfromLcFunc(indexV0DaughPos, indexV0DaughNeg, indexK0Spos, indexK0Sneg);
302-
#endif
303-
MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "correct K0S in the Lc daughters: posTrack --> " << indexV0DaughPos << ", negTrack --> " << indexV0DaughNeg);
304250

305251
// if (isLc) {
306252
RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1);
307-
308253
if (sign != 0) { // we have already positively checked the K0s
309254
// then we check the Lc
310-
MY_DEBUG_MSG(sign, LOG(info) << "K0S was correct! now we check the Lc");
311-
MY_DEBUG_MSG(sign, LOG(info) << "index proton = " << indexBach);
312255
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, pdg::Code::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi-
313-
MY_DEBUG_MSG(sign, LOG(info) << "Lc found with sign " << sign; printf("\n"));
314256
}
315257

316258
// Check whether the particle is non-prompt (from a b quark).
@@ -333,7 +275,6 @@ struct HfCandidateCreatorCascadeMc {
333275
sign = -sign;
334276
}
335277
if (sign != 0) {
336-
MY_DEBUG_MSG(sign, LOG(info) << "Lc in K0S p");
337278
arrDaughLcIndex.clear();
338279
// checking that the final daughters (decay depth = 3) are p, pi+, pi-
339280
RecoDecay::getDaughters(particle, &arrDaughLcIndex, arrDaughLcPDGRef, 3); // best would be to check the K0S daughters
@@ -347,7 +288,6 @@ struct HfCandidateCreatorCascadeMc {
347288
} else {
348289
LOG(debug) << "Lc --> K0S+p found in MC table";
349290
}
350-
MY_DEBUG_MSG(sign == 0, LOG(info) << "Pity, the three final daughters are not p, pi+, pi-, but " << arrDaughLcPDG[0] << ", " << arrDaughLcPDG[1] << ", " << arrDaughLcPDG[2]);
351291
}
352292
}
353293
// Check whether the particle is non-prompt (from a b quark).

PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "PWGHF/Core/HfMlResponse.h"
2626
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
2727
#include "PWGHF/DataModel/CandidateSelectionTables.h"
28-
#include "PWGHF/Utils/utilsDebugLcToK0sP.h"
2928

3029
using namespace o2;
3130
using namespace o2::analysis;

0 commit comments

Comments
 (0)