Skip to content

Commit ecbb752

Browse files
axti98alibuild
andauthored
[ALICE3] Added Multiplicity estimator task for ALICE3 (#17540)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent ab09806 commit ecbb752

6 files changed

Lines changed: 249 additions & 26 deletions

File tree

ALICE3/DataModel/collisionAlice3.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ DECLARE_SOA_TABLE(CollisionsAlice3, "AOD", "COLLALICE3",
3232

3333
using CollisionAlice3 = CollisionsAlice3::iterator;
3434

35+
namespace mcmult_alice3
36+
{
37+
DECLARE_SOA_COLUMN(MultMC, multMC, int); //! Total MCTruth multiplicity
38+
DECLARE_SOA_COLUMN(MultMC25, multMC25, int); //! MCTruth multiplicity in |eta| < 2.5
39+
DECLARE_SOA_COLUMN(MultMC125, multMC125, int); //! MCTruth multiplicity in |eta| < 1.25
40+
DECLARE_SOA_COLUMN(MultMC09, multMC09, int); //! MCTruth multiplicity in |eta| < 0.9
41+
} // namespace mcmult_alice3
42+
DECLARE_SOA_TABLE(MultsMCAlice3, "AOD", "MULTMCALICE3",
43+
mcmult_alice3::MultMC,
44+
mcmult_alice3::MultMC25,
45+
mcmult_alice3::MultMC125,
46+
mcmult_alice3::MultMC09);
47+
48+
using MultMCAlice3 = MultsMCAlice3::iterator;
3549
} // namespace o2::aod
3650

3751
#endif // ALICE3_DATAMODEL_COLLISIONALICE3_H_

ALICE3/DataModel/tracksAlice3.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ DECLARE_SOA_COLUMN(NSiliconHits, nSiliconHits, int); //! number of silico
3131
DECLARE_SOA_COLUMN(NTPCHits, nTPCHits, int); //! number of tpc hits
3232
DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); //! PDG code of the linked truth MC particle
3333
DECLARE_SOA_COLUMN(TrackType, trackType, int); //! Type of the track
34+
DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Has track contributed to the PV fit?
3435
} // namespace track_alice3
3536
DECLARE_SOA_TABLE(TracksAlice3, "AOD", "TRACKSALICE3",
3637
track_alice3::IsReconstructed);
@@ -43,7 +44,8 @@ using TrackAlice3Pdg = TracksAlice3Pdg::iterator;
4344
DECLARE_SOA_TABLE(TracksExtraA3, "AOD", "TracksExtraA3",
4445
track_alice3::NSiliconHits,
4546
track_alice3::NTPCHits,
46-
track_alice3::TrackType);
47+
track_alice3::TrackType,
48+
track_alice3::IsPVContributor);
4749
using TrackExtraA3 = TracksExtraA3::iterator;
4850

4951
namespace mcparticle_alice3

ALICE3/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ o2physics_add_dpl_workflow(alice3-centrality
2626
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
2727
COMPONENT_NAME Analysis)
2828

29+
o2physics_add_dpl_workflow(alice3-multiplicity
30+
SOURCES alice3Multiplicity.cxx
31+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
32+
COMPONENT_NAME Analysis)
33+
2934
o2physics_add_dpl_workflow(alice3-decaypreselector
3035
SOURCES alice3-decaypreselector.cxx
3136
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ struct OnTheFlyTracker {
275275
const float time = 0,
276276
const float timeError = 1,
277277
bool decayDauInput = false,
278+
bool isPVContributorInput = false,
278279
bool weakDecayDauInput = false,
279280
int isUsedInCascadingInput = 0,
280281
int nSiliconHitsInput = 0,
@@ -283,19 +284,21 @@ struct OnTheFlyTracker {
283284
mcLabel{label},
284285
timeEst{time, timeError},
285286
isDecayDau(decayDauInput),
287+
isPVContributor(isPVContributorInput),
286288
isWeakDecayDau(weakDecayDauInput),
287289
isUsedInCascading(isUsedInCascadingInput),
288290
nSiliconHits(nSiliconHitsInput),
289291
nTPCHits(nTPCHitsInput),
290292
trackType(trackTypeInput) {}
291293
const TimeEst& getTimeMUS() const { return timeEst; }
292-
int64_t mcLabel = -1; ///< MC label of the track
293-
TimeEst timeEst{}; ///< time estimate in ns
294-
bool isDecayDau = false; ///< is a decay daughter
295-
bool isWeakDecayDau = false; ///< is a weak decay daughter
296-
int isUsedInCascading = 0; ///< 0: not at all, 1: is a cascade, 2: is a bachelor, 3: is a pion, 4: is a proton
297-
int nSiliconHits = 0; ///< number of silicon hits
298-
int nTPCHits = 0; ///< number of TPC hits
294+
int64_t mcLabel = -1; ///< MC label of the track
295+
TimeEst timeEst{}; ///< time estimate in ns
296+
bool isDecayDau = false; ///< is a decay daughter
297+
bool isPVContributor = false; ///< track is PV contributor
298+
bool isWeakDecayDau = false; ///< is a weak decay daughter
299+
int isUsedInCascading = 0; ///< 0: not at all, 1: is a cascade, 2: is a bachelor, 3: is a pion, 4: is a proton
300+
int nSiliconHits = 0; ///< number of silicon hits
301+
int nTPCHits = 0; ///< number of TPC hits
299302
TrackType trackType;
300303
};
301304

@@ -1004,13 +1007,13 @@ struct OnTheFlyTracker {
10041007
thisCascade.cascadeTrackId = trackTableOffset + 4;
10051008

10061009
float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1007-
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, 1, -1, -1, TrackType::kGenCascDaug});
1010+
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, 1, -1, -1, TrackType::kGenCascDaug});
10081011
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1009-
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, 2, -1, -1, TrackType::kGenCascDaug});
1012+
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, 2, -1, -1, TrackType::kGenCascDaug});
10101013
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1011-
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[2], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, 3, -1, -1, TrackType::kGenCascDaug});
1014+
tracksCascadeProngs.push_back(TrackAlice3{xiDaughterTrackParCovsPerfect[2], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, 3, -1, -1, TrackType::kGenCascDaug});
10121015
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1013-
tracksCascadeProngs.push_back(TrackAlice3{perfectCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, 3, -1, -1, TrackType::kGenCascDaug});
1016+
tracksCascadeProngs.push_back(TrackAlice3{perfectCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, 3, -1, -1, TrackType::kGenCascDaug});
10141017

10151018
for (int i = 0; i < kCascProngs; i++) {
10161019
isReco[i] = false;
@@ -1061,7 +1064,7 @@ struct OnTheFlyTracker {
10611064
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
10621065
// TODO: add flag for whether it's a ghost track or not, currently assuming all are reconstructed tracks if they pass the fast tracker requirements
10631066
TrackType trackType = isReco[i] ? TrackType::kRecoCascDaug : TrackType::kGenCascDaug;
1064-
tracksCascadeProngs[i] = TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, i + 2, nSiliconHitsCascadeProngs[i], nTPCHitsCascadeProngs[i], trackType};
1067+
tracksCascadeProngs[i] = TrackAlice3{xiDaughterTrackParCovsTracked[i], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, i + 2, nSiliconHitsCascadeProngs[i], nTPCHitsCascadeProngs[i], trackType};
10651068
}
10661069

10671070
bool tryKinkReco = false;
@@ -1272,7 +1275,7 @@ struct OnTheFlyTracker {
12721275
return; // We didn't find enough hits for strangeness tracking
12731276
}
12741277
}
1275-
tracksCascadeProngs[kCascProngs] = TrackAlice3{cascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, 1, thisCascade.foundClusters, TrackType::kGenCascDaug};
1278+
tracksCascadeProngs[kCascProngs] = TrackAlice3{cascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, false, 1, thisCascade.foundClusters, TrackType::kGenCascDaug};
12761279
fillCascadeTable = true;
12771280
}
12781281
}
@@ -1342,7 +1345,10 @@ struct OnTheFlyTracker {
13421345
std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassLambda});
13431346
newCascadeTrack.setPID(pdgCodeToPID(PDG_t::kXiMinus)); // FIXME: not OK for omegas
13441347
float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1345-
tracksCascadeProngs[kCascProngs + 1] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, 1, thisCascade.foundClusters, 0, TrackType::kRecoCascDaug};
1348+
if (reconstructedCascade) {
1349+
tracksCascadeProngs[kCascProngs + 1] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, false, 1, thisCascade.foundClusters, TrackType::kRecoCascDaug};
1350+
}
1351+
tracksCascadeProngs[kCascProngs + 1] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, false, 1, thisCascade.foundClusters, 0, TrackType::kRecoCascDaug};
13461352
fillCascadeTable = true;
13471353
} // end fitter OK
13481354
} // end cascade found
@@ -1490,9 +1496,12 @@ struct OnTheFlyTracker {
14901496

14911497
// Store not reconstructed daughters, will update them in case reconstruction is successful
14921498
float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1493-
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, 0, 0, TrackType::kGhostV0Daug});
1499+
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, false, true, 1, TrackType::kGhostV0Daug});
1500+
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1501+
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, false, true, 1, TrackType::kGhostV0Daug});
1502+
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, false, true, 1, 0, 0, TrackType::kGhostV0Daug});
14941503
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
1495-
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, 0, 0, TrackType::kGhostV0Daug});
1504+
tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, false, true, 1, 0, 0, TrackType::kGhostV0Daug});
14961505

14971506
bool fillV0Table{false};
14981507
for (int i = 0; i < kv0Prongs; i++) {
@@ -1529,7 +1538,7 @@ struct OnTheFlyTracker {
15291538
trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
15301539
// TODO: flag to separate ghost and reco tracks
15311540
TrackType trackType = isV0Reco[i] ? TrackType::kRecoV0Daug : TrackType::kGhostV0Daug;
1532-
tracksV0Daugs[i] = TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, true, i + 2, trackType};
1541+
tracksV0Daugs[i] = TrackAlice3{v0DaughterTrackParCovsTracked[i], mcParticle.globalIndex(), trackTime, timeResolutionUs, true, false, true, i + 2, trackType};
15331542
}
15341543
if (v0DecaySettings.doV0QA) {
15351544
if (isV0Reco[0] && isV0Reco[1]) {
@@ -1680,8 +1689,8 @@ struct OnTheFlyTracker {
16801689
/// \param prmTrks the vector of tracks to be used for vertex reconstruction
16811690
/// \param primaryVertex the output variable where the computed primary vertex will be stored
16821691
/// \param icfg index of the current configuration, used for histogram filling
1683-
template <typename McCollisionType, typename TrackType>
1684-
void computeVertex(McCollisionType& mcCollision, const std::vector<TrackType>& prmTrks, o2::vertexing::PVertex& primaryVertex, const int icfg)
1692+
template <typename McCollisionType, typename TrackT>
1693+
void computeVertex(McCollisionType& mcCollision, std::vector<TrackT>& prmTrks, o2::vertexing::PVertex& primaryVertex, const int icfg)
16851694
{
16861695

16871696
if (!enablePrimaryVertexing) {
@@ -1733,7 +1742,18 @@ struct OnTheFlyTracker {
17331742
largestVertex = iv;
17341743
}
17351744
}
1745+
17361746
primaryVertex = vertices[largestVertex];
1747+
1748+
const auto& contributorRef = v2tRefs[largestVertex];
1749+
const int first = contributorRef.getFirstEntry();
1750+
const int end = first + contributorRef.getEntries();
1751+
1752+
for (int i = first; i < end; ++i) {
1753+
const auto trackIndex = vertexTrackIDs[i].getIndex();
1754+
prmTrks[trackIndex].isPVContributor = true;
1755+
}
1756+
17371757
if (doExtraQA) {
17381758
histos.fill(HIST("h2dVerticesVsContributors"), primaryVertex.getNContributors(), n_vertices);
17391759
}
@@ -1784,7 +1804,7 @@ struct OnTheFlyTracker {
17841804
trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(),
17851805
trackParCov.getSigma1Pt2());
17861806
tableMcTrackLabels(trackParCov.mcLabel, 0);
1787-
tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType);
1807+
tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType, trackParCov.isPVContributor);
17881808

17891809
// populate extra tables if required to do so
17901810
if (populateTracksExtra) {
@@ -1977,10 +1997,11 @@ struct OnTheFlyTracker {
19771997
// Time associated to the mcParticle: collision time + smearing
19781998
float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus;
19791999
TrackType trackType = reconstructed ? TrackType::kRecoPrimary : TrackType::kGhostPrimary;
2000+
bool isPVContributor = trackType == TrackType::kRecoPrimary;
19802001
if (reconstructed) {
1981-
recoPrimaries.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), trackTime, timeResolutionUs, isDecayDaughter, false, 0, nTrkHits, trackType});
2002+
recoPrimaries.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), trackTime, timeResolutionUs, isDecayDaughter, isPVContributor, false, 0, nTrkHits, trackType});
19822003
} else {
1983-
ghostPrimaries.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), trackTime, timeResolutionUs, isDecayDaughter, false, 0, nTrkHits, trackType});
2004+
ghostPrimaries.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), trackTime, timeResolutionUs, isDecayDaughter, isPVContributor, false, 0, nTrkHits, trackType});
19842005
}
19852006
}
19862007

@@ -2202,10 +2223,10 @@ struct OnTheFlyTracker {
22022223
}
22032224

22042225
if (reconstructed) {
2205-
tracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kRecoPrimary});
2226+
tracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, true, false, 0, nTrkHits, kRecoPrimary});
22062227
getHist<TH1>(histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt());
22072228
} else {
2208-
ghostTracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kGhostPrimary});
2229+
ghostTracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, false, false, 0, nTrkHits, kGhostPrimary});
22092230
}
22102231
}
22112232

0 commit comments

Comments
 (0)