Skip to content

Commit 4f3f132

Browse files
Jinhyun ParkJinhyun Park
authored andcommitted
Merge branch 'master' of https://github.com/AliceO2Group/O2Physics into dev
2 parents 7420f65 + fc680f6 commit 4f3f132

74 files changed

Lines changed: 9346 additions & 4368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ALICE3/DataModel/ReducedTablesAlice3.h

Lines changed: 335 additions & 0 deletions
Large diffs are not rendered by default.

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct OnTheFlyTracker {
211211

212212
struct : ConfigurableGroup {
213213
std::string prefix = "fastPrimaryTrackerSettings";
214+
Configurable<bool> fastTrackShortLivedParticles{"fastTrackShortLivedParticles", false, "Use fasttracker for short lived tracks"};
214215
Configurable<bool> fastTrackPrimaries{"fastTrackPrimaries", false, "Use fasttracker for primary tracks. Enable with care"};
215216
Configurable<int> minSiliconHits{"minSiliconHits", 4, "minimum number of silicon hits to accept track"};
216217
Configurable<bool> applyZacceptance{"applyZacceptance", false, "apply z limits to detector layers or not"};
@@ -348,15 +349,20 @@ struct OnTheFlyTracker {
348349
v0candidate thisV0;
349350
// Constants
350351
static constexpr int kv0Prongs = 2;
351-
static constexpr std::array<int, 3> v0PDGs = {kK0Short,
352-
kLambda0,
353-
kLambda0Bar};
352+
static constexpr std::array<int, 3> v0PDGs = {PDG_t::kK0Short,
353+
PDG_t::kLambda0,
354+
PDG_t::kLambda0Bar};
354355

355-
static constexpr std::array<int, 5> longLivedHandledPDGs = {kElectron,
356-
kMuonMinus,
357-
kPiPlus,
358-
kKPlus,
359-
kProton};
356+
static constexpr std::array<int, 5> longLivedHandledPDGs = {PDG_t::kElectron,
357+
PDG_t::kMuonMinus,
358+
PDG_t::kPiPlus,
359+
PDG_t::kKPlus,
360+
PDG_t::kProton};
361+
362+
static constexpr std::array<int, 5> shortLivedHandledPDGs = {PDG_t::kSigmaPlus,
363+
PDG_t::kSigmaMinus,
364+
PDG_t::kXiMinus,
365+
PDG_t::kOmegaMinus};
360366

361367
static constexpr std::array<int, 4> nucleiPDGs = {o2::constants::physics::kDeuteron,
362368
o2::constants::physics::kTriton,
@@ -760,6 +766,10 @@ struct OnTheFlyTracker {
760766
return o2::track::PID::Proton;
761767
} else if (std::abs(pdgCode) == PDG_t::kLambda0) {
762768
return o2::track::PID::Lambda;
769+
} else if (std::abs(pdgCode) == PDG_t::kSigmaPlus) {
770+
return o2::track::PID::XiMinus; // Close enough
771+
} else if (std::abs(pdgCode) == PDG_t::kSigmaMinus) {
772+
return o2::track::PID::XiMinus; // Close enough
763773
} else if (std::abs(pdgCode) == PDG_t::kXiMinus) {
764774
return o2::track::PID::XiMinus;
765775
} else if (std::abs(pdgCode) == PDG_t::kOmegaMinus) {
@@ -1875,12 +1885,14 @@ struct OnTheFlyTracker {
18751885

18761886
const bool isCascadeToDecay = (mcParticle.pdgCode() == kXiMinus) && cascadeDecaySettings.decayXi;
18771887
const bool isV0ToDecay = std::find(v0PDGs.begin(), v0PDGs.end(), mcParticle.pdgCode()) != v0PDGs.end() && v0DecaySettings.decayV0;
1878-
18791888
const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), std::abs(mcParticle.pdgCode())) != longLivedHandledPDGs.end();
1889+
const bool shortLivedToBeHandled = std::find(shortLivedHandledPDGs.begin(), shortLivedHandledPDGs.end(), std::abs(mcParticle.pdgCode())) != shortLivedHandledPDGs.end();
18801890
const bool nucleiToBeHandled = std::find(nucleiPDGs.begin(), nucleiPDGs.end(), std::abs(mcParticle.pdgCode())) != nucleiPDGs.end();
18811891
const bool pdgsToBeHandled = longLivedToBeHandled ||
18821892
(enableNucleiSmearing && nucleiToBeHandled) ||
1883-
(isCascadeToDecay) || (isV0ToDecay);
1893+
(isCascadeToDecay) || (isV0ToDecay) ||
1894+
(shortLivedToBeHandled && fastPrimaryTrackerSettings.fastTrackShortLivedParticles);
1895+
18841896
if (!pdgsToBeHandled) {
18851897
continue;
18861898
}
@@ -1902,7 +1914,7 @@ struct OnTheFlyTracker {
19021914
bool reconstructed = true;
19031915
int nTrkHits = 0;
19041916
if (enablePrimarySmearing) {
1905-
if (fastPrimaryTrackerSettings.fastTrackPrimaries) {
1917+
if (fastPrimaryTrackerSettings.fastTrackPrimaries || fastPrimaryTrackerSettings.fastTrackShortLivedParticles) {
19061918
o2::track::TrackParCov perfectTrackParCov;
19071919
o2::upgrade::convertMCParticleToO2Track(mcParticle, perfectTrackParCov, pdgDB);
19081920
perfectTrackParCov.setPID(pdgCodeToPID(mcParticle.pdgCode()));
@@ -2052,8 +2064,10 @@ struct OnTheFlyTracker {
20522064
// Now that the multiplicity is known, we can process the particles to smear them
20532065
for (const auto& mcParticle : mcParticles) {
20542066
const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), std::abs(mcParticle.pdgCode())) != longLivedHandledPDGs.end();
2067+
const bool shortLivedToBeHandled = std::find(shortLivedHandledPDGs.begin(), shortLivedHandledPDGs.end(), std::abs(mcParticle.pdgCode())) != shortLivedHandledPDGs.end();
20552068
const bool nucleiToBeHandled = std::find(nucleiPDGs.begin(), nucleiPDGs.end(), std::abs(mcParticle.pdgCode())) != nucleiPDGs.end();
2056-
const bool pdgsToBeHandled = longLivedToBeHandled || (enableNucleiSmearing && nucleiToBeHandled);
2069+
const bool pdgsToBeHandled = longLivedToBeHandled || (enableNucleiSmearing && nucleiToBeHandled) ||
2070+
(shortLivedToBeHandled && fastPrimaryTrackerSettings.fastTrackShortLivedParticles);
20572071

20582072
o2::upgrade::OTFParticle otfParticle(mcParticle);
20592073
otfParticle.setBits(mcParticle.decayerBits_raw());
@@ -2099,10 +2113,21 @@ struct OnTheFlyTracker {
20992113
bool reconstructed = false;
21002114
int nTrkHits = 0;
21012115
const bool isSecondary = !otfParticle.isPrimary() && otfParticle.checkBit(o2::upgrade::DecayerBits::ProducedByDecayer) && otfParticle.isAlive();
2102-
if (enablePrimarySmearing && otfParticle.isPrimary()) {
2116+
if (enablePrimarySmearing && longLivedToBeHandled && otfParticle.isPrimary()) {
21032117
o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB);
21042118
computeBremsstrahlungLoss(icfg, mcParticle, trackParCov);
21052119
reconstructed = mSmearer[icfg]->smearTrack(trackParCov, mcParticle.pdgCode(), dNdEta);
2120+
} else if (shortLivedToBeHandled && fastPrimaryTrackerSettings.fastTrackShortLivedParticles) {
2121+
o2::track::TrackParCov perfectTrackParCov;
2122+
o2::upgrade::convertMCParticleToO2Track(mcParticle, perfectTrackParCov, pdgDB);
2123+
perfectTrackParCov.setPID(pdgCodeToPID(mcParticle.pdgCode()));
2124+
computeBremsstrahlungLoss(icfg, mcParticle, perfectTrackParCov);
2125+
nTrkHits = fastTracker[icfg]->FastTrack(perfectTrackParCov, trackParCov, dNdEta);
2126+
if (nTrkHits < fastPrimaryTrackerSettings.minSiliconHits) {
2127+
reconstructed = false;
2128+
} else {
2129+
reconstructed = true;
2130+
}
21062131
} else if (enableSecondarySmearing && isSecondary) {
21072132
o2::track::TrackParCov perfectTrackParCov;
21082133
o2::upgrade::convertMCParticleToO2Track(mcParticle, perfectTrackParCov, pdgDB);

ALICE3/TableProducer/alice3-dq-table-maker.cxx

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#include "PWGDQ/Core/MCSignal.h"
2323
#include "PWGDQ/Core/MCSignalLibrary.h"
2424
#include "PWGDQ/Core/VarManager.h"
25-
#include "PWGDQ/DataModel/ReducedTablesAlice3.h"
2625

2726
#include "ALICE3/DataModel/OTFRICH.h"
2827
#include "ALICE3/DataModel/OTFTOF.h"
28+
#include "ALICE3/DataModel/ReducedTablesAlice3.h"
2929
#include "ALICE3/DataModel/collisionAlice3.h"
3030
#include "ALICE3/DataModel/tracksAlice3.h"
3131
#include "Common/CCDB/EventSelectionParams.h"
@@ -74,16 +74,14 @@ constexpr static uint32_t gkTrackFillMapWithCov = VarManager::ObjTypes::Track |
7474

7575
struct Alice3DQTableMaker {
7676

77-
Produces<ReducedA3MCEvents> eventMC;
78-
Produces<ReducedA3MCTracks> trackMC;
77+
Produces<ReA3MCEvents> eventMC;
78+
Produces<ReA3MCTracks> trackMC;
7979

80-
Produces<ReducedA3Events> event;
80+
Produces<ReA3Events> event;
8181
Produces<ReducedA3EventsVtxCov> eventVtxCov;
82-
Produces<ReducedA3EventsInfo> eventInfo;
8382
Produces<ReducedA3MCEventLabels> eventMClabels;
8483

85-
Produces<ReducedA3TracksBarrelInfo> trackBarrelInfo;
86-
Produces<ReducedA3Tracks> trackBasic;
84+
Produces<ReA3Tracks> trackBasic;
8785
Produces<ReducedA3TracksBarrel> trackBarrel;
8886
Produces<ReducedA3TracksBarrelCov> trackBarrelCov;
8987
Produces<ReducedA3TracksAssoc> trackBarrelAssoc;
@@ -96,7 +94,7 @@ struct Alice3DQTableMaker {
9694
OutputObj<THashList> fOutputList{"output"};
9795
OutputObj<TList> fStatsList{"Statistics"}; //! skimming statistics
9896

99-
HistogramManager* fHistMan;
97+
HistogramManager* fHistMan = nullptr;
10098

10199
// Event and track AnalysisCut configurables
102100
struct : ConfigurableGroup {
@@ -120,9 +118,8 @@ struct Alice3DQTableMaker {
120118
Configurable<std::string> fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"};
121119
} fConfigHistOutput;
122120

123-
AnalysisCompositeCut* fEventCut; //! Event selection cut
121+
AnalysisCompositeCut* fEventCut = nullptr; //! Event selection cut
124122
std::vector<AnalysisCompositeCut*> fTrackCuts; //! Barrel track cuts
125-
std::vector<AnalysisCompositeCut*> fMuonCuts; //! Muon track cuts
126123

127124
bool fDoDetailedQA = false;
128125

@@ -290,38 +287,38 @@ struct Alice3DQTableMaker {
290287
}
291288
}
292289

293-
// create statistics histograms (event, tracks, muons, MCsignals)
290+
// create statistics histograms (event, tracks, MCsignals)
294291
fStatsList.setObject(new TList());
295292
fStatsList->SetOwner(true);
296293
std::vector<TString> eventLabels{"Collisions before filtering", "Before cuts", "After cuts"};
297294
TH2I* histEvents = new TH2I("EventStats", "Event statistics", eventLabels.size(), -0.5, eventLabels.size() - 0.5, o2::aod::evsel::kNsel + 1, -0.5, (float)o2::aod::evsel::kNsel + 0.5);
298-
int ib = 1;
299-
for (auto label = eventLabels.begin(); label != eventLabels.end(); label++, ib++) {
300-
histEvents->GetXaxis()->SetBinLabel(ib, (*label).Data());
295+
int ibX = 1;
296+
for (auto label = eventLabels.begin(); label != eventLabels.end(); label++, ibX++) {
297+
histEvents->GetXaxis()->SetBinLabel(ibX, (*label).Data());
301298
}
302-
for (int ib = 1; ib <= o2::aod::evsel::kNsel; ib++) {
303-
histEvents->GetYaxis()->SetBinLabel(ib, o2::aod::evsel::selectionLabels[ib - 1]);
299+
for (int ibY = 1; ibY <= o2::aod::evsel::kNsel; ibY++) {
300+
histEvents->GetYaxis()->SetBinLabel(ibY, o2::aod::evsel::selectionLabels[ibY - 1]);
304301
}
305302
histEvents->GetYaxis()->SetBinLabel(o2::aod::evsel::kNsel + 1, "Total");
306303
fStatsList->Add(histEvents);
307304

308305
// Track statistics: one bin for each track selection and 5 bins for V0 tags (gamma, K0s, Lambda, anti-Lambda, Omega)
309306
TH1I* histTracks = new TH1I("TrackStats", "Track statistics", fTrackCuts.size() + 5.0, -0.5, fTrackCuts.size() - 0.5 + 5.0);
310-
ib = 1;
311-
for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, ib++) {
312-
histTracks->GetXaxis()->SetBinLabel(ib, (*cut)->GetName());
307+
ibX = 1;
308+
for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, ibX++) {
309+
histTracks->GetXaxis()->SetBinLabel(ibX, (*cut)->GetName());
313310
}
314311
constexpr int nV0Tags = 5;
315312
const char* v0TagNames[nV0Tags] = {"Photon conversion", "K^{0}_{s}", "#Lambda", "#bar{#Lambda}", "#Omega"};
316-
for (int ib = 0; ib < nV0Tags; ib++) {
317-
histTracks->GetXaxis()->SetBinLabel(fTrackCuts.size() + 1 + ib, v0TagNames[ib]);
313+
for (int ibY = 0; ibY < nV0Tags; ibY++) {
314+
histTracks->GetXaxis()->SetBinLabel(fTrackCuts.size() + 1 + ibY, v0TagNames[ibY]);
318315
}
319316
fStatsList->Add(histTracks);
320317

321318
TH1I* histMCsignals = new TH1I("MCsignals", "MC signals", fMCSignals.size() + 1, -0.5, fMCSignals.size() - 0.5 + 1.0);
322-
ib = 1;
323-
for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, ib++) {
324-
histMCsignals->GetXaxis()->SetBinLabel(ib, (*signal)->GetName());
319+
ibX = 1;
320+
for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, ibX++) {
321+
histMCsignals->GetXaxis()->SetBinLabel(ibX, (*signal)->GetName());
325322
}
326323
histMCsignals->GetXaxis()->SetBinLabel(fMCSignals.size() + 1, "Others (matched to reco tracks)");
327324
fStatsList->Add(histMCsignals);
@@ -384,19 +381,22 @@ struct Alice3DQTableMaker {
384381
}
385382

386383
// If this MC track was not already added to the map, add it now
387-
if (fLabelsMap.find(mctrack.globalIndex()) == fLabelsMap.end()) {
388-
fLabelsMap[mctrack.globalIndex()] = trackCounter;
389-
fLabelsMapReversed[trackCounter] = mctrack.globalIndex();
390-
fMCFlags[mctrack.globalIndex()] = mcflags;
391-
trackCounter++;
384+
const auto mcTrackIndex = mctrack.globalIndex();
385+
const bool inserted = fLabelsMap.try_emplace(mcTrackIndex, trackCounter).second;
386+
387+
if (inserted) {
388+
fLabelsMapReversed.try_emplace(trackCounter, mcTrackIndex);
389+
fMCFlags.try_emplace(mcTrackIndex, mcflags);
390+
++trackCounter;
392391

393392
// fill histograms for each of the signals, if found
394393
if (fConfigHistOutput.fConfigQA) {
395394
VarManager::FillTrackMC(mcTracks, mctrack);
396395
auto mcCollision = mctrack.template mcCollision_as<MyEventsMC>();
397396
VarManager::FillEvent<gkEventMcFillMap>(mcCollision);
397+
398398
int j = 0;
399-
for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) {
399+
for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); ++signal, ++j) {
400400
if (mcflags & (static_cast<uint16_t>(1) << j)) {
401401
fHistMan->FillHistClass(Form("MCTruth_%s", (*signal)->GetName()), VarManager::fgValues);
402402
}
@@ -444,7 +444,6 @@ struct Alice3DQTableMaker {
444444

445445
eventVtxCov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2());
446446
eventMClabels(collision.mcCollisionId(), collision.mcMask());
447-
eventInfo(collision.globalIndex());
448447

449448
// add an element for this collision into the map
450449
fCollIndexMap[collision.globalIndex()] = event.lastIndex();
@@ -484,14 +483,14 @@ struct Alice3DQTableMaker {
484483
fHistMan->FillHistClass("TrackBarrel_BeforeCuts", VarManager::fgValues);
485484
}
486485

487-
int i = 0;
488-
for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) {
486+
int n = 0;
487+
for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, n++) {
489488
if ((*cut)->IsSelected(VarManager::fgValues)) {
490-
trackTempFilterMap |= (static_cast<uint32_t>(1) << i);
489+
trackTempFilterMap |= (static_cast<uint32_t>(1) << n);
491490
if (fConfigHistOutput.fConfigQA) {
492491
fHistMan->FillHistClass(Form("TrackBarrel_%s", (*cut)->GetName()), VarManager::fgValues);
493492
}
494-
(reinterpret_cast<TH1I*>(fStatsList->At(1)))->Fill(static_cast<float>(i));
493+
(reinterpret_cast<TH1I*>(fStatsList->At(1)))->Fill(static_cast<float>(n));
495494
}
496495
}
497496
if (!trackTempFilterMap) {
@@ -512,9 +511,6 @@ struct Alice3DQTableMaker {
512511
// In the case of Run2-like analysis, there will be no associations, so this ID will be the one originally assigned in the AO2Ds (updated for the skims)
513512
uint32_t reducedEventIdx = fCollIndexMap[track.collisionId()];
514513

515-
// NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done
516-
// in workflows where the original AO2Ds are also present)
517-
// trackBarrelInfo(track.collisionId(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex());
518514
trackBasic(reducedEventIdx, trackFilteringTag, track.pt(), track.eta(), track.phi(), track.sign(), 0);
519515

520516
trackBarrel(track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt(),
@@ -612,7 +608,6 @@ struct Alice3DQTableMaker {
612608
event.reserve(collisions.size());
613609
eventVtxCov.reserve(collisions.size());
614610
eventMClabels.reserve(collisions.size());
615-
eventInfo.reserve(collisions.size());
616611

617612
skimCollisions(collisions);
618613

0 commit comments

Comments
 (0)