Skip to content

Commit 7589d6f

Browse files
authored
Refactor hFastTrackerQA histogram creation and logging
1 parent 8982531 commit 7589d6f

File tree

1 file changed

+56
-37
lines changed

1 file changed

+56
-37
lines changed

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -460,32 +460,32 @@ struct OnTheFlyTracker {
460460
histos.add("h2dDeltaEtaVsPt", "h2dDeltaEtaVsPt", kTH2F, {axes.axisMomentum, axes.axisDeltaEta});
461461

462462
histos.add("hFastTrackerHits", "hFastTrackerHits", kTH2F, {axes.axisZ, axes.axisRadius});
463-
auto hFastTrackerQA = histos.add<TH1>("hFastTrackerQA", "hFastTrackerQA", kTH1D, {{8, -0.5f, 7.5f}});
464-
hFastTrackerQA->GetXaxis()->SetBinLabel(1, "Negative eigenvalue");
465-
hFastTrackerQA->GetXaxis()->SetBinLabel(2, "Failed sanity check");
466-
hFastTrackerQA->GetXaxis()->SetBinLabel(3, "intercept original radius");
467-
hFastTrackerQA->GetXaxis()->SetBinLabel(4, "propagate to original radius");
468-
hFastTrackerQA->GetXaxis()->SetBinLabel(5, "problematic layer");
469-
hFastTrackerQA->GetXaxis()->SetBinLabel(6, "multiple scattering");
470-
hFastTrackerQA->GetXaxis()->SetBinLabel(7, "energy loss");
471-
hFastTrackerQA->GetXaxis()->SetBinLabel(8, "efficiency");
463+
auto h = histos.add<TH1>("hFastTrackerQA", "hFastTrackerQA", kTH1D, {{8, -0.5f, 7.5f}});
464+
h->GetXaxis()->SetBinLabel(1, "Negative eigenvalue");
465+
h->GetXaxis()->SetBinLabel(2, "Failed sanity check");
466+
h->GetXaxis()->SetBinLabel(3, "intercept original radius");
467+
h->GetXaxis()->SetBinLabel(4, "propagate to original radius");
468+
h->GetXaxis()->SetBinLabel(5, "problematic layer");
469+
h->GetXaxis()->SetBinLabel(6, "multiple scattering");
470+
h->GetXaxis()->SetBinLabel(7, "energy loss");
471+
h->GetXaxis()->SetBinLabel(8, "efficiency");
472472
}
473-
if (v0DecaySettings.doV0QA) {
474473

474+
if (v0DecaySettings.doV0QA) {
475475
for (int icfg = 0; icfg < nGeometries; icfg++) {
476476
std::string v0histPath = "V0Building_Configuration_" + std::to_string(icfg) + "/";
477477
insertHist(v0histPath + "hV0Building", "hV0Building", kTH1F, {{10, -0.5f, 9.5f}});
478478
insertHist(v0histPath + "hFastTrackerHits", "hV0Building", kTH2F, {{axes.axisZ, axes.axisRadius}});
479-
auto hFastTrackerQA = histos.add<TH1>(v0histPath + "hFastTrackerQA", "hFastTrackerQA", kTH1D, {{8, -0.5f, 7.5f}});
480-
hFastTrackerQA->GetXaxis()->SetBinLabel(1, "Negative eigenvalue");
481-
hFastTrackerQA->GetXaxis()->SetBinLabel(2, "Failed sanity check");
482-
hFastTrackerQA->GetXaxis()->SetBinLabel(3, "intercept original radius");
483-
hFastTrackerQA->GetXaxis()->SetBinLabel(4, "propagate to original radius");
484-
hFastTrackerQA->GetXaxis()->SetBinLabel(5, "problematic layer");
485-
hFastTrackerQA->GetXaxis()->SetBinLabel(6, "multiple scattering");
486-
hFastTrackerQA->GetXaxis()->SetBinLabel(7, "energy loss");
487-
hFastTrackerQA->GetXaxis()->SetBinLabel(8, "efficiency");
488-
histPointers.insert({v0histPath + "hFastTrackerQA", hFastTrackerQA});
479+
auto h = histos.add<TH1>(v0histPath + "hFastTrackerQA", "hFastTrackerQA", kTH1D, {{8, -0.5f, 7.5f}});
480+
h->GetXaxis()->SetBinLabel(1, "Negative eigenvalue");
481+
h->GetXaxis()->SetBinLabel(2, "Failed sanity check");
482+
h->GetXaxis()->SetBinLabel(3, "intercept original radius");
483+
h->GetXaxis()->SetBinLabel(4, "propagate to original radius");
484+
h->GetXaxis()->SetBinLabel(5, "problematic layer");
485+
h->GetXaxis()->SetBinLabel(6, "multiple scattering");
486+
h->GetXaxis()->SetBinLabel(7, "energy loss");
487+
h->GetXaxis()->SetBinLabel(8, "efficiency");
488+
histPointers.insert({v0histPath + "hFastTrackerQA", h});
489489
// K0s
490490
insertHist(v0histPath + "K0/hGen", "hGen", kTH2F, {axes.axisDecayRadius, axes.axisMomentum});
491491
insertHist(v0histPath + "K0/hReco", "hReco", kTH2F, {axes.axisDecayRadius, axes.axisMomentum});
@@ -630,21 +630,28 @@ struct OnTheFlyTracker {
630630
double posDauMass = -1.;
631631
double ctau = -1.;
632632

633-
if (std::abs(pdgCode) == kK0Short) {
634-
v0Mass = o2::constants::physics::MassK0Short;
635-
negDauMass = o2::constants::physics::MassPionCharged;
636-
posDauMass = o2::constants::physics::MassPionCharged;
637-
ctau = 2.68;
638-
} else if (pdgCode == kLambda0) {
639-
v0Mass = o2::constants::physics::MassLambda;
640-
negDauMass = o2::constants::physics::MassPionCharged;
641-
posDauMass = o2::constants::physics::MassProton;
642-
ctau = 7.845;
643-
} else if (pdgCode == kLambda0Bar) {
644-
v0Mass = o2::constants::physics::MassLambda;
645-
negDauMass = o2::constants::physics::MassProton;
646-
posDauMass = o2::constants::physics::MassPionCharged;
647-
ctau = 7.845;
633+
switch (pdgCode) {
634+
case kK0Short:
635+
case -kK0Short:
636+
v0Mass = o2::constants::physics::MassK0Short;
637+
negDauMass = o2::constants::physics::MassPionCharged;
638+
posDauMass = o2::constants::physics::MassPionCharged;
639+
ctau = 2.68;
640+
break;
641+
case kLambda0:
642+
v0Mass = o2::constants::physics::MassLambda;
643+
negDauMass = o2::constants::physics::MassPionCharged;
644+
posDauMass = o2::constants::physics::MassProton;
645+
ctau = 7.845;
646+
break;
647+
case kLambda0Bar:
648+
v0Mass = o2::constants::physics::MassLambda;
649+
negDauMass = o2::constants::physics::MassProton;
650+
posDauMass = o2::constants::physics::MassPionCharged;
651+
ctau = 7.845;
652+
break;
653+
default:
654+
LOG(fatal) << "Trying to decay unsupported V0 with PDG " << pdgCode;
648655
}
649656

650657
const double v0BetaGamma = particle.p() / v0Mass;
@@ -666,6 +673,7 @@ struct OnTheFlyTracker {
666673
float dNdEta = 0.f; // Charged particle multiplicity to use in the efficiency evaluation
667674
void processWithLUTs(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, int const& icfg)
668675
{
676+
LOG(debug) << "Processing event " << mcCollision.globalIndex() << " with LUTs for configuration " << icfg;
669677
int lastTrackIndex = tableStoredTracksCov.lastIndex() + 1; // bookkeep the last added track
670678
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
671679

@@ -695,6 +703,7 @@ struct OnTheFlyTracker {
695703

696704
// First we compute the number of charged particles in the event
697705
dNdEta = 0.f;
706+
LOG(debug) << "Processing " << mcParticles.size() << " MC particles to compute dNch/deta";
698707
for (const auto& mcParticle : mcParticles) {
699708
if (std::abs(mcParticle.eta()) > multEtaRange) {
700709
continue;
@@ -722,6 +731,7 @@ struct OnTheFlyTracker {
722731
}
723732
dNdEta += 1.f;
724733
}
734+
LOG(debug) << "Computed dNch/deta before normalization: " << dNdEta;
725735

726736
dNdEta /= (multEtaRange * 2.0f);
727737
uint32_t multiplicityCounter = 0;
@@ -742,6 +752,9 @@ struct OnTheFlyTracker {
742752
laDecayVertex.clear();
743753
v0DecayVertex.clear();
744754

755+
decayProducts.clear();
756+
v0DecayProducts.clear();
757+
745758
if (cascadeDecaySettings.decayXi) {
746759
if (mcParticle.pdgCode() == kXiMinus) {
747760
o2::track::TrackParCov xiTrackParCov;
@@ -849,7 +862,7 @@ struct OnTheFlyTracker {
849862
nSiliconHits[i] = fastTracker[icfg]->GetNSiliconPoints();
850863
nTPCHits[i] = fastTracker[icfg]->GetNGasPoints();
851864

852-
if (nHits[i] < 0) { // QA
865+
if (nHits[i] < 0 && cascadeDecaySettings.doXiQA) { // QA
853866
histos.fill(HIST("hFastTrackerQA"), o2::math_utils::abs(nHits[i]));
854867
}
855868

@@ -858,7 +871,7 @@ struct OnTheFlyTracker {
858871
} else {
859872
continue; // extra sure
860873
}
861-
for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits(); ih++) {
874+
for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits() && cascadeDecaySettings.doXiQA; ih++) {
862875
histos.fill(HIST("hFastTrackerHits"), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih)));
863876
}
864877
} else {
@@ -1409,6 +1422,7 @@ struct OnTheFlyTracker {
14091422

14101423
// *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*
14111424
// populate tracks
1425+
LOG(debug) << "Populating " << tracksAlice3.size() << " tracks.";
14121426
for (const auto& trackParCov : tracksAlice3) {
14131427
// Fixme: collision index could be changeable
14141428
aod::track::TrackTypeEnum trackType = aod::track::Track;
@@ -1476,6 +1490,7 @@ struct OnTheFlyTracker {
14761490
}
14771491

14781492
// populate ghost tracks
1493+
LOG(debug) << "Populating " << ghostTracksAlice3.size() << " ghost tracks.";
14791494
for (const auto& trackParCov : ghostTracksAlice3) {
14801495
// Fixme: collision index could be changeable
14811496
aod::track::TrackTypeEnum trackType = aod::track::Track;
@@ -1526,6 +1541,7 @@ struct OnTheFlyTracker {
15261541
}
15271542

15281543
// populate Cascades
1544+
LOG(debug) << "Populating " << cascadesAlice3.size() << " cascades.";
15291545
for (const auto& cascade : cascadesAlice3) {
15301546
tableUpgradeCascades(tableCollisions.lastIndex(), // now we know the collision index -> populate table
15311547
cascade.cascadeTrackId,
@@ -1544,6 +1560,7 @@ struct OnTheFlyTracker {
15441560
}
15451561

15461562
// populate V0s
1563+
LOG(debug) << "Populating " << v0sAlice3.size() << " V0s.";
15471564
for (const auto& v0 : v0sAlice3) {
15481565
tableUpgradeV0s(tableCollisions.lastIndex(), // now we know the collision index -> populate table
15491566
v0.mcParticleId,
@@ -1562,11 +1579,13 @@ struct OnTheFlyTracker {
15621579
histos.fill(HIST("hCovMatOK"), 0.0f, fastTracker[icfg]->GetCovMatNotOK());
15631580
histos.fill(HIST("hCovMatOK"), 1.0f, fastTracker[icfg]->GetCovMatOK());
15641581
}
1582+
LOG(debug) << " <- Finished processing OTF tracking with LUT configuration ID " << icfg;
15651583
} // end process
15661584

15671585
void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles)
15681586
{
15691587
for (size_t icfg = 0; icfg < mSmearer.size(); ++icfg) {
1588+
LOG(debug) << " -> Processing OTF tracking with LUT configuration ID " << icfg;
15701589
processWithLUTs(mcCollision, mcParticles, static_cast<int>(icfg));
15711590
}
15721591
}

0 commit comments

Comments
 (0)