Skip to content

Commit fd04b9c

Browse files
authored
[ALICE3] Add causality checks for secondary tracks in cascade finding (#17156)
1 parent 8592215 commit fd04b9c

1 file changed

Lines changed: 75 additions & 13 deletions

File tree

ALICE3/TableProducer/alice3strangenessFinder.cxx

Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "PWGLF/DataModel/LFStrangenessTables.h"
2323

24+
#include "ALICE3/Core/GeometryContainer.h"
2425
#include "ALICE3/Core/TrackUtilities.h"
2526
#include "ALICE3/DataModel/OTFPIDTrk.h"
2627
#include "ALICE3/DataModel/OTFRICH.h"
@@ -31,6 +32,7 @@
3132
#include "Common/Core/trackUtilities.h"
3233
#include "Common/DataModel/TrackSelectionTables.h"
3334

35+
#include <CCDB/BasicCCDBManager.h>
3436
#include <CommonConstants/PhysicsConstants.h>
3537
#include <DCAFitter/DCAFitterN.h>
3638
#include <DetectorsBase/Propagator.h>
@@ -60,7 +62,6 @@
6062
#include <vector>
6163

6264
using namespace o2;
63-
// using namespace o2::analysis;
6465
using namespace o2::framework;
6566
using namespace o2::constants::physics;
6667

@@ -73,6 +74,9 @@ struct Alice3strangenessFinder {
7374
SliceCache cache;
7475

7576
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
77+
Service<o2::ccdb::BasicCCDBManager> ccdb{};
78+
o2::fastsim::GeometryContainer geoContainer;
79+
std::vector<std::vector<float>> trackingLayers;
7680

7781
Produces<aod::V0CandidateIndices> v0CandidateIndices; // contains V0 candidate indices
7882
Produces<aod::V0CandidateCores> v0CandidateCores; // contains V0 candidate core information
@@ -145,8 +149,9 @@ struct Alice3strangenessFinder {
145149
Configurable<bool> useOriginalTrackParams{"useOriginalTrackParams", false, "use original track parameters instead of the ones propagated to PCA (effective only if skipFitter is false) and for MC truth info"};
146150

147151
o2::vertexing::DCAFitterN<2> fitter;
148-
Service<o2::framework::O2DatabasePDG> pdgDB;
152+
Service<o2::framework::O2DatabasePDG> pdgDB{};
149153
static constexpr float ToMicrons = 1e+4;
154+
static constexpr int LutConfig = 0; // todo
150155

151156
// partitions for v0/casc dau tracks
152157
Partition<Alice3TracksACTS> positiveSecondaryTracksACTS =
@@ -194,7 +199,7 @@ struct Alice3strangenessFinder {
194199
float dcaToPV{};
195200
};
196201

197-
void init(InitContext&)
202+
void init(InitContext& initContext)
198203
{
199204
// Initialization code here
200205
fitter.setBz(magneticField);
@@ -275,6 +280,30 @@ struct Alice3strangenessFinder {
275280
histos.add("Generated/hGeneratedAntiOmega", "hGeneratedAntiOmega", kTH2D, {{axisPt}, {axisEta}});
276281
}
277282

283+
if (doprocessFindV0CandidateOTF) {
284+
ccdb->setURL("http://alice-ccdb.cern.ch");
285+
ccdb->setTimestamp(-1);
286+
geoContainer.setCcdbManager(ccdb.operator->());
287+
geoContainer.init(initContext);
288+
const int nGeometries = geoContainer.getNumberOfConfigurations();
289+
trackingLayers.resize(nGeometries);
290+
291+
for (int icfg = 0; icfg < nGeometries; ++icfg) {
292+
auto globalConfiguration = geoContainer.getConfigurations(icfg);
293+
294+
for (const auto& [outerKey, innerMap] : globalConfiguration) {
295+
if (outerKey.empty() || outerKey[0] != 'B') {
296+
continue;
297+
}
298+
299+
auto it = innerMap.find("r");
300+
if (it != innerMap.end()) {
301+
trackingLayers[icfg].push_back(std::stof(it->second));
302+
}
303+
}
304+
}
305+
}
306+
278307
if (buildCascade) {
279308
histos.add("CascadeBuilding/hDcaBetweenDaus", "hDcaBetweenDaus", kTH1D, {{axisDCA}});
280309
histos.add("CascadeBuilding/hXiMass", "", kTH1D, {axisXiMass});
@@ -333,6 +362,20 @@ struct Alice3strangenessFinder {
333362
} // end association check
334363
return returnValue;
335364
}
365+
366+
template <typename TTrackType>
367+
[[nodiscard]] float getFirstLayerHitRadius(const TTrackType& track, const std::vector<float>& layers)
368+
{
369+
const float trueRadius = std::hypot(track.x(), track.y());
370+
for (const float layerRadius : layers) {
371+
if (layerRadius >= trueRadius) {
372+
return layerRadius;
373+
}
374+
}
375+
static constexpr float OutsideALICE3 = 100.f;
376+
return OutsideALICE3;
377+
}
378+
336379
template <typename TTrackType>
337380
bool buildDecayCandidateTwoBody(TTrackType const& t0, TTrackType const& t1, std::array<float, 3> vtx, Candidate& thisCandidate)
338381
{
@@ -373,8 +416,8 @@ struct Alice3strangenessFinder {
373416
t0.getPxPyPzGlo(thisCandidate.pDau0);
374417
t1.getPxPyPzGlo(thisCandidate.pDau1);
375418
}
376-
histos.fill(HIST("hPtNegDauAfterV0Finding"), std::sqrt(thisCandidate.pDau1[0] * thisCandidate.pDau1[0] + thisCandidate.pDau1[1] + thisCandidate.pDau1[1]), t1.getPt());
377-
histos.fill(HIST("hPtPosDauAfterV0Finding"), std::sqrt(thisCandidate.pDau0[0] * thisCandidate.pDau0[0] + thisCandidate.pDau0[1] + thisCandidate.pDau0[1]), t0.getPt());
419+
histos.fill(HIST("hPtNegDauAfterV0Finding"), std::hypot(thisCandidate.pDau1[0], thisCandidate.pDau1[1]), t1.getPt());
420+
histos.fill(HIST("hPtPosDauAfterV0Finding"), std::hypot(thisCandidate.pDau0[0], thisCandidate.pDau0[1]), t0.getPt());
378421

379422
thisCandidate.dcaDau = std::sqrt(fitter.getChi2AtPCACandidate());
380423
thisCandidate.p[0] = thisCandidate.pDau0[0] + thisCandidate.pDau1[0];
@@ -416,8 +459,6 @@ struct Alice3strangenessFinder {
416459
thisCandidate.dcaToPV = calculateDCAStraightToPV(thisCandidate.posSV[0], thisCandidate.posSV[1], thisCandidate.posSV[2],
417460
thisCandidate.p[0], thisCandidate.p[1], thisCandidate.p[2],
418461
vtx[0], vtx[1], vtx[2]);
419-
420-
return true;
421462
} else {
422463
t0.getPxPyPzGlo(thisCandidate.pDau0);
423464
t1.getPxPyPzGlo(thisCandidate.pDau1);
@@ -434,8 +475,8 @@ struct Alice3strangenessFinder {
434475
thisCandidate.dcaToPV = calculateDCAStraightToPV(thisCandidate.posSV[0], thisCandidate.posSV[1], thisCandidate.posSV[2],
435476
thisCandidate.p[0], thisCandidate.p[1], thisCandidate.p[2],
436477
vtx[0], vtx[1], vtx[2]);
437-
return true;
438478
}
479+
return true;
439480
}
440481

441482
void processGenerated(aod::McParticles const&)
@@ -603,8 +644,26 @@ struct Alice3strangenessFinder {
603644
continue; // candidate outside of acceptance
604645
}
605646

606-
if (std::hypot(v0Cand.posSV[0], v0Cand.posSV[1]) < std::hypot(cascCand.posSV[0], cascCand.posSV[1])) {
607-
continue; // causality
647+
const float radiusV0 = std::hypot(v0Cand.posSV[0], v0Cand.posSV[1]);
648+
const float radiusCasc = std::hypot(cascCand.posSV[0], cascCand.posSV[1]);
649+
const float posCausalityRadius = getFirstLayerHitRadius(posTrack, trackingLayers[LutConfig]);
650+
const float negCausalityRadius = getFirstLayerHitRadius(negTrack, trackingLayers[LutConfig]);
651+
const float bachCausalityRadius = getFirstLayerHitRadius(bachTrack, trackingLayers[LutConfig]);
652+
653+
if (posCausalityRadius < radiusV0) {
654+
continue; // positive track hit a layer before v0 decayed
655+
}
656+
657+
if (negCausalityRadius < radiusV0) {
658+
continue; // negative track hit a layer before v0 decayed
659+
}
660+
661+
if (radiusV0 < radiusCasc) {
662+
continue; // v0 decayed before cascade
663+
}
664+
665+
if (bachCausalityRadius < radiusCasc) {
666+
continue; // bachelor track hit a layer before v0 decayed
608667
}
609668

610669
const float massXi = RecoDecay::m(std::array{std::array{cascCand.pDau0[0], cascCand.pDau0[1], cascCand.pDau0[2]},
@@ -685,10 +744,12 @@ struct Alice3strangenessFinder {
685744
isLambda = (posParticle.pdgCode() == kProton && negParticle.pdgCode() == kPiMinus);
686745
isAntiLambda = (posParticle.pdgCode() == kPiPlus && negParticle.pdgCode() == kProtonBar);
687746
if (isK0s || isLambda || isAntiLambda) {
688-
if (!isK0s && isK0Gun)
747+
if (!isK0s && isK0Gun) {
689748
continue;
690-
if (!isLambda && isLambdaGun)
749+
}
750+
if (!isLambda && isLambdaGun) {
691751
continue;
752+
}
692753
Candidate v0cand;
693754
std::vector<double> v0DecayVertex;
694755
v0DecayVertex.push_back(negParticle.vx());
@@ -700,8 +761,9 @@ struct Alice3strangenessFinder {
700761
o2::track::TrackParCov negParCov;
701762
o2::upgrade::convertTLorentzVectorToO2Track(1, posLorVector, v0DecayVertex, posParCov);
702763
o2::upgrade::convertTLorentzVectorToO2Track(-1, negLorVector, v0DecayVertex, negParCov);
703-
if (!buildDecayCandidateTwoBody(posParCov, negParCov, vtx, v0cand))
764+
if (!buildDecayCandidateTwoBody(posParCov, negParCov, vtx, v0cand)) {
704765
continue;
766+
}
705767
v0CandidateIndices(collision.globalIndex(),
706768
posParticle.globalIndex(),
707769
negParticle.globalIndex(),

0 commit comments

Comments
 (0)