Skip to content

Commit 0b857e3

Browse files
author
Lucia Anna Tarasovicova
committed
fix the OTFtracker for AntiLambdas, correct setting of the V0 fitter
1 parent b72aed1 commit 0b857e3

File tree

4 files changed

+115
-41
lines changed

4 files changed

+115
-41
lines changed

ALICE3/DataModel/OTFStrangeness.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, Tracks, "_Pos"); //!
107107
DECLARE_SOA_INDEX_COLUMN_FULL(NegTrack, negTrack, int, Tracks, "_Neg"); //!
108108
DECLARE_SOA_INDEX_COLUMN(V0, v0); //!
109109

110+
// Label to MC particle
111+
DECLARE_SOA_INDEX_COLUMN_FULL(MCParticle, mcParticle, int, McParticles, ""); //! label to the MC particle corresponding to the V0
112+
110113
// General V0 properties: position, momentum
111114
DECLARE_SOA_COLUMN(PosX, posX, float); //! positive track X at min
112115
DECLARE_SOA_COLUMN(NegX, negX, float); //! negative track X at min
@@ -213,7 +216,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(PositivePhi, positivephi, //! positive daughter phi
213216
[](float PxPos, float PyPos) -> float { return RecoDecay::phi(PxPos, PyPos); });
214217
} // namespace candidatev0
215218
DECLARE_SOA_TABLE(V0CandidateIndices, "AOD", "V0CANDIDATEINDEX", //! index table
216-
o2::soa::Index<>, candidatev0::CollisionId, candidatev0::PosTrackId, candidatev0::NegTrackId);
219+
o2::soa::Index<>, candidatev0::CollisionId, candidatev0::PosTrackId, candidatev0::NegTrackId, candidatev0::MCParticleId);
217220

218221
DECLARE_SOA_TABLE(V0CandidateCores, "AOD", "V0CANDIDATECORE",
219222
o2::soa::Index<>,

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ struct OnTheFlyTracker {
246246

247247
// Helper struct to pass V0 information
248248
struct v0candidate {
249-
int positiveId; // track index in the Tracks table
250-
int negativeId; // track index in the Tracks table
249+
int positiveId; // track index in the Tracks table
250+
int negativeId; // track index in the Tracks table
251251
int mcParticleId; // mc particle index
252252

253253
float pt;
@@ -635,12 +635,12 @@ struct OnTheFlyTracker {
635635
negDauMass = o2::constants::physics::MassPionCharged;
636636
posDauMass = o2::constants::physics::MassPionCharged;
637637
ctau = 2.68;
638-
} else if (std::abs(pdgCode) == kLambda0) {
638+
} else if (pdgCode == kLambda0) {
639639
v0Mass = o2::constants::physics::MassLambda;
640640
negDauMass = o2::constants::physics::MassPionCharged;
641641
posDauMass = o2::constants::physics::MassProton;
642642
ctau = 7.845;
643-
} else if (std::abs(pdgCode) == kLambda0Bar) {
643+
} else if (pdgCode == kLambda0Bar) {
644644
v0Mass = o2::constants::physics::MassLambda;
645645
negDauMass = o2::constants::physics::MassProton;
646646
posDauMass = o2::constants::physics::MassPionCharged;
@@ -751,10 +751,10 @@ struct OnTheFlyTracker {
751751
laDecayRadius2D = std::hypot(laDecayVertex[0], laDecayVertex[1]);
752752
}
753753
}
754-
const bool isV0 = std::find(v0PDGs.begin(), v0PDGs.end(), std::abs(mcParticle.pdgCode())) != v0PDGs.end();
754+
const bool isV0 = std::find(v0PDGs.begin(), v0PDGs.end(), mcParticle.pdgCode()) != v0PDGs.end();
755755

756756
if (v0DecaySettings.decayV0 && isV0) {
757-
decayV0Particle(mcParticle, v0DecayProducts, v0DecayVertex, std::abs(mcParticle.pdgCode()));
757+
decayV0Particle(mcParticle, v0DecayProducts, v0DecayVertex, mcParticle.pdgCode());
758758
v0DecayRadius2D = std::hypot(v0DecayVertex[0], v0DecayVertex[1]);
759759
}
760760

@@ -1246,26 +1246,32 @@ struct OnTheFlyTracker {
12461246
if (mcParticle.pdgCode() == kLambda0) {
12471247
thisV0.mLambda = RecoDecay::m(std::array{std::array{posP[0], posP[1], posP[2]},
12481248
std::array{negP[0], negP[1], negP[2]}},
1249-
std::array{o2::constants::physics::MassPionCharged,
1250-
o2::constants::physics::MassProton});
1249+
std::array{o2::constants::physics::MassProton,
1250+
o2::constants::physics::MassPionCharged});
12511251
} else {
12521252
thisV0.mLambda = -1;
12531253
}
12541254

12551255
if (mcParticle.pdgCode() == kLambda0Bar) {
12561256
thisV0.mAntiLambda = RecoDecay::m(std::array{std::array{posP[0], posP[1], posP[2]},
12571257
std::array{negP[0], negP[1], negP[2]}},
1258-
std::array{o2::constants::physics::MassProton,
1259-
o2::constants::physics::MassPionCharged});
1258+
std::array{o2::constants::physics::MassPionCharged,
1259+
o2::constants::physics::MassProton});
12601260
} else {
12611261
thisV0.mAntiLambda = -1;
12621262
}
12631263

12641264
if (v0DecaySettings.doV0QA) {
12651265
fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 4.0f);
1266-
fillHist(TH2, Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt);
1267-
fillHist(TH2, Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt);
1268-
fillHist(TH2, Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt);
1266+
if (std::abs(mcParticle.pdgCode()) == kK0Short) {
1267+
fillHist(TH2, Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt);
1268+
}
1269+
if (mcParticle.pdgCode() == kLambda0) {
1270+
fillHist(TH2, Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt);
1271+
}
1272+
if (mcParticle.pdgCode() == kLambda0Bar) {
1273+
fillHist(TH2, Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt);
1274+
}
12691275
}
12701276

12711277
// add this V0 to vector (will fill cursor later with collision ID)
@@ -1277,6 +1283,9 @@ struct OnTheFlyTracker {
12771283
if (doExtraQA) {
12781284
histos.fill(HIST("hSimTrackX"), trackParCov.getX());
12791285
}
1286+
if (isV0) {
1287+
continue; // V0 handling done, should not be considered anymore
1288+
}
12801289

12811290
bool reconstructed = true;
12821291
if (enablePrimarySmearing && !fastPrimaryTrackerSettings.fastTrackPrimaries) {

ALICE3/TableProducer/alice3-strangenessFinder.cxx

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "Framework/runDataProcessing.h"
3434
#include "ReconstructionDataFormats/Track.h"
3535
#include <Framework/AnalysisHelpers.h>
36+
#include <Framework/Configurable.h>
3637

3738
#include <cstdlib>
3839

@@ -42,20 +43,42 @@ using namespace o2::framework;
4243
using namespace o2::constants::physics;
4344

4445
using Alice3TracksWPid = soa::Join<aod::Tracks, aod::TracksCov, aod::McTrackLabels, aod::TracksDCA, aod::UpgradeTrkPids, aod::UpgradeTofs, aod::UpgradeRichs>;
45-
using Alice3Tracks = soa::Join<aod::Tracks, aod::TracksCov, aod::McTrackLabels, aod::TracksDCA, aod::TracksCovExtension>;
46+
using Alice3Tracks = soa::Join<aod::StoredTracks, aod::StoredTracksCov, aod::McTrackLabels, aod::TracksDCA, aod::TracksCovExtension, aod::TracksAlice3>;
4647

4748
struct alice3strangenessFinder {
4849
SliceCache cache;
4950

51+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
52+
5053
Produces<aod::V0CandidateIndices> v0CandidateIndices; // contains V0 candidate indices
5154
Produces<aod::V0CandidateCores> v0CandidateCores; // contains V0 candidate core information
5255

53-
Configurable<bool> mcSameMotherCheck{"mcSameMotherCheck", true, "check if tracks come from the same MC mother"};
54-
5556
Configurable<float> nSigmaTOF{"nSigmaTOF", 5.0f, "Nsigma for TOF PID (if enabled)"};
5657
Configurable<float> dcaXYconstant{"dcaXYconstant", -1.0f, "[0] in |DCAxy| > [0]+[1]/pT"};
5758
Configurable<float> dcaXYpTdep{"dcaXYpTdep", 0.0, "[1] in |DCAxy| > [0]+[1]/pT"};
5859

60+
// Vertexing
61+
Configurable<bool> propagateToPCA{"propagateToPCA", false, "create tracks version propagated to PCA"};
62+
Configurable<bool> useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"};
63+
Configurable<bool> useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"};
64+
Configurable<double> maxR{"maxR", 150., "reject PCA's above this radius"};
65+
Configurable<double> maxDZIni{"maxDZIni", 5, "reject (if>0) PCA candidate if tracks DZ exceeds threshold"};
66+
Configurable<double> maxDXYIni{"maxDXYIni", 4, "reject (if>0) PCA candidate if tracks DXY exceeds threshold"};
67+
Configurable<double> maxVtxChi2{"maxVtxChi2", 2, "reject (if>0) vtx. chi2 above this value"};
68+
Configurable<double> minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"};
69+
Configurable<double> minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"};
70+
// Operation and minimisation criteria
71+
Configurable<float> magneticField{"magneticField", 20.0f, "Magnetic field (in kilogauss)"};
72+
Configurable<bool> doDCAplotsD{"doDCAplotsD", true, "do daughter prong DCA plots for D mesons"};
73+
Configurable<bool> doDCAplots3Prong{"doDCAplots3Prong", true, "do daughter prong DCA plots for Lc baryons"};
74+
Configurable<bool> doTopoPlotsForSAndB{"doTopoPlotsForSAndB", true, "do topological variable distributions for S and B separately"};
75+
Configurable<float> dcaDaughtersSelection{"dcaDaughtersSelection", 1000.0f, "DCA between daughters (cm)"};
76+
Configurable<bool> mcSameMotherCheck{"mcSameMotherCheck", true, "check if tracks come from the same MC mother"};
77+
// propagation options
78+
Configurable<bool> usePropagator{"usePropagator", false, "use external propagator"};
79+
Configurable<bool> refitWithMatCorr{"refitWithMatCorr", false, "refit V0 applying material corrections"};
80+
Configurable<bool> useCollinearV0{"useCollinearV0", true, "use collinear approximation for V0 fitting"};
81+
5982
o2::vertexing::DCAFitterN<2> fitter;
6083
o2::vertexing::DCAFitterN<3> fitter3;
6184

@@ -82,6 +105,21 @@ struct alice3strangenessFinder {
82105
void init(InitContext&)
83106
{
84107
// Initialization code here
108+
fitter.setBz(magneticField);
109+
fitter.setUseAbsDCA(useAbsDCA);
110+
fitter.setPropagateToPCA(propagateToPCA);
111+
fitter.setMaxR(maxR);
112+
fitter.setMinParamChange(minParamChange);
113+
fitter.setMinRelChi2Change(minRelChi2Change);
114+
fitter.setMaxDZIni(maxDZIni);
115+
fitter.setMaxDXYIni(maxDXYIni);
116+
fitter.setMaxChi2(maxVtxChi2);
117+
fitter.setUsePropagator(usePropagator);
118+
fitter.setRefitWithMatCorr(refitWithMatCorr);
119+
fitter.setCollinear(useCollinearV0);
120+
fitter.setMatCorrType(o2::base::Propagator::MatCorrType::USEMatCorrNONE);
121+
122+
histos.add("hV0Counter", "", kTH1D, {{4, 0, 4}}); // For QA reasons, counting found V0, 0: K0s, 1: Lambda, 2:AntiLambda, 3: wrongly identified V0
85123
}
86124
/// function to check if tracks have the same mother in MC
87125
template <typename TTrackType>
@@ -92,14 +130,8 @@ struct alice3strangenessFinder {
92130
return sameMother;
93131
auto mcParticle1 = track1.template mcParticle_as<aod::McParticles>();
94132
auto mcParticle2 = track2.template mcParticle_as<aod::McParticles>();
95-
if (!mcParticle1.has_mothers() || !mcParticle2.has_mothers())
96-
return sameMother;
97-
for (auto& mcParticleMother1 : mcParticle1.template mothers_as<aod::McParticles>()) {
98-
for (auto& mcParticleMother2 : mcParticle2.template mothers_as<aod::McParticles>()) {
99-
if (mcParticleMother1.globalIndex() == mcParticleMother2.globalIndex()) {
100-
sameMother = true;
101-
}
102-
}
133+
if (mcParticle2.globalIndex() == mcParticle1.globalIndex()) { // for the V0 daughters we store the mc label of the mother particle in the daughter tracks
134+
sameMother = true;
103135
}
104136
return sameMother;
105137
}
@@ -122,6 +154,10 @@ struct alice3strangenessFinder {
122154
return false;
123155
}
124156
//}-{}-{}-{}-{}-{}-{}-{}-{}-{}
157+
if (!fitter.isPropagateTracksToVertexDone() && !fitter.propagateTracksToVertex()) {
158+
LOG(debug) << "RejProp failed";
159+
return false;
160+
}
125161

126162
posTrackCov = fitter.getTrack(0);
127163
negTrackCov = fitter.getTrack(1);
@@ -139,7 +175,7 @@ struct alice3strangenessFinder {
139175
v0cand.P[0] = posP[0] + negP[0];
140176
v0cand.P[1] = posP[1] + negP[1];
141177
v0cand.P[2] = posP[2] + negP[2];
142-
const auto posSV = fitter.getPCACandidate();
178+
const auto posSV = fitter.getPCACandidatePos();
143179
v0cand.posSV[0] = posSV[0];
144180
v0cand.posSV[1] = posSV[1];
145181
v0cand.posSV[2] = posSV[2];
@@ -156,7 +192,14 @@ struct alice3strangenessFinder {
156192
auto positiveSecondaryTracksGrouped = positiveSecondaryTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
157193

158194
for (auto const& posTrack : positiveSecondaryTracksGrouped) {
195+
if (!posTrack.isReconstructed()) {
196+
continue; // no ghost tracks
197+
}
159198
for (auto const& negTrack : negativeSecondaryTracksGrouped) {
199+
if (!negTrack.isReconstructed()) {
200+
continue; // no ghost tracks
201+
}
202+
auto mcParticle1 = posTrack.template mcParticle_as<aod::McParticles>();
160203

161204
if (mcSameMotherCheck && !checkSameMother(posTrack, negTrack))
162205
continue;
@@ -169,13 +212,23 @@ struct alice3strangenessFinder {
169212
collision.posX(), collision.posY(), collision.posZ());
170213
v0CandidateIndices(collision.globalIndex(),
171214
posTrack.globalIndex(),
172-
negTrack.globalIndex());
215+
negTrack.globalIndex(),
216+
mcParticle1.globalIndex());
173217
v0CandidateCores(
174218
v0cand.posSV[0], v0cand.posSV[1], v0cand.posSV[2],
175219
v0cand.Pdaug[0], v0cand.Pdaug[1], v0cand.Pdaug[2],
176220
v0cand.Ndaug[0], v0cand.Ndaug[1], v0cand.Ndaug[2],
177221
v0cand.dcaDau, posTrack.dcaXY(), negTrack.dcaXY(),
178222
v0cand.cosPA, v0cand.dcaToPV);
223+
if (mcParticle1.pdgCode() == 310) {
224+
histos.fill(HIST("hV0Counter"), 0.5);
225+
} else if (mcParticle1.pdgCode() == 3122) {
226+
histos.fill(HIST("hV0Counter"), 1.5);
227+
} else if (mcParticle1.pdgCode() == -3122) {
228+
histos.fill(HIST("hV0Counter"), 2.5);
229+
} else {
230+
histos.fill(HIST("hV0Counter"), 3.5);
231+
}
179232
}
180233
}
181234
}

0 commit comments

Comments
 (0)