Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 50 additions & 26 deletions ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct OnTheFlyTracker {
Configurable<bool> enableSecondarySmearing{"enableSecondarySmearing", false, "Enable smearing of weak decay daughters"};
Configurable<bool> enableNucleiSmearing{"enableNucleiSmearing", false, "Enable smearing of nuclei"};
Configurable<bool> enablePrimaryVertexing{"enablePrimaryVertexing", true, "Enable primary vertexing"};
Configurable<std::string> primaryVertexOption{"primaryVertexOption", "pvertexer.maxChi2TZDebris=10;pvertexer.acceptableScale2=9;pvertexer.minScale2=2;pvertexer.timeMarginVertexTime=1.3;;pvertexer.maxChi2TZDebris=40;pvertexer.maxChi2Mean=12;pvertexer.maxMultRatDebris=1.;pvertexer.addTimeSigma2Debris=1e-2;pvertexer.meanVertexExtraErrSelection=0.03;", "Option for the primary vertexer"};
Configurable<bool> interpolateLutEfficiencyVsNch{"interpolateLutEfficiencyVsNch", true, "interpolate LUT efficiency as f(Nch)"};

Configurable<bool> populateTracksDCA{"populateTracksDCA", true, "populate TracksDCA table"};
Expand All @@ -118,11 +119,13 @@ struct OnTheFlyTracker {
Configurable<bool> doExtraQA{"doExtraQA", false, "do extra 2D QA plots"};
Configurable<bool> extraQAwithoutDecayDaughters{"extraQAwithoutDecayDaughters", false, "remove decay daughters from qa plots (yes/no)"};
Configurable<bool> cleanLutWhenLoaded{"cleanLutWhenLoaded", true, "clean LUTs after being loaded to save disk space"};
Configurable<std::string> primaryVertexOption{"primaryVertexOption", "pvertexer.maxChi2TZDebris=10;pvertexer.acceptableScale2=9;pvertexer.minScale2=2;pvertexer.timeMarginVertexTime=1.3;;pvertexer.maxChi2TZDebris=40;pvertexer.maxChi2Mean=12;pvertexer.maxMultRatDebris=1.;pvertexer.addTimeSigma2Debris=1e-2;pvertexer.meanVertexExtraErrSelection=0.03;", "Option for the primary vertexer"};

struct : ConfigurableGroup {
ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p} (GeV/#it{c})"};
ConfigurableAxis axisNVertices{"axisNVertices", {20, -0.5, 19.5}, "N_{vertices}"};
ConfigurableAxis axisDeltaVtxCoord{"axisDeltaVtxCoord", {100, -5., 5}, "Delta Vtx coord (cm)"};
ConfigurableAxis axisDeltaMultPVRecoGen{"axisDeltaMultPVRecoGen", {51, -25, 25}, "Delta Multiplicity_{PV} (cm)"};
ConfigurableAxis axisVtxMult{"axisVtxMult", {101, 0, 100}, "Vertex Multiplicity"};
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {100, -0.5, 99.5}, "N_{contributors}"};
ConfigurableAxis axisVertexZ{"axisVertexZ", {40, -20, 20}, "vertex Z (cm)"};
ConfigurableAxis axisDCA{"axisDCA", {400, -200, 200}, "DCA (#mum)"};
Expand Down Expand Up @@ -373,24 +376,37 @@ struct OnTheFlyTracker {
// smear un-reco'ed tracks if asked to do so
mSmearer[icfg]->skipUnreconstructed(!processUnreconstructedTracks.value);

insertHist(histPath + "hPtGenerated", "hPtGenerated", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPhiGenerated", "hPhiGenerated", {kTH1D, {{100, 0.0f, 2 * M_PI, "#phi (rad)"}}});

insertHist(histPath + "hPtGeneratedEl", "hPtGeneratedEl", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedPi", "hPtGeneratedPi", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedKa", "hPtGeneratedKa", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedPr", "hPtGeneratedPr", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructed", "hPtReconstructed", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedEl", "hPtReconstructedEl", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedPi", "hPtReconstructedPi", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedKa", "hPtReconstructedKa", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedPr", "hPtReconstructedPr", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGenerated", "hPtGenerated;#it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPhiGenerated", "hPhiGenerated;#phi (rad);Counts", {kTH1D, {{100, 0.0f, 2 * M_PI, "#phi (rad)"}}});

insertHist(histPath + "hPtGeneratedEl", "hPtGeneratedEl;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedPi", "hPtGeneratedPi;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedKa", "hPtGeneratedKa;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtGeneratedPr", "hPtGeneratedPr;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructed", "hPtReconstructed;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedEl", "hPtReconstructedEl;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedPi", "hPtReconstructedPi;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedKa", "hPtReconstructedKa;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
insertHist(histPath + "hPtReconstructedPr", "hPtReconstructedPr;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}});
}
// Collision QA
insertHist(histPath + "hPVz", "hPVz", {kTH1D, {{axes.axisVertexZ}}});
insertHist(histPath + "hLUTMultiplicity", "hLUTMultiplicity", {kTH1D, {{axes.axisMultiplicity}}});
insertHist(histPath + "hSimMultiplicity", "hSimMultiplicity", {kTH1D, {{axes.axisMultiplicity}}});
insertHist(histPath + "hRecoMultiplicity", "hRecoMultiplicity", {kTH1D, {{axes.axisMultiplicity}}});
insertHist(histPath + "hPVz", "hPVz;Primary Vertex Z (cm);Counts", {kTH1D, {{axes.axisVertexZ}}});
insertHist(histPath + "hLUTMultiplicity", "hLUTMultiplicity;dN/d#eta;Counts", {kTH1D, {{axes.axisMultiplicity}}});
insertHist(histPath + "hSimMultiplicity", "hSimMultiplicity;Gen. multiplicity;Counts", {kTH1D, {{axes.axisMultiplicity}}});
insertHist(histPath + "hRecoMultiplicity", "hRecoMultiplicity;Reco Multiplicity;Counts", {kTH1D, {{axes.axisMultiplicity}}});

if (enablePrimaryVertexing) {
insertHist(histPath + "hDeltaXPVRecoGen", "hDeltaXPVRecoGen;Delta X (reco - gen), cm", {kTH1D, {{axes.axisDeltaVtxCoord}}});
insertHist(histPath + "hDeltaYPVRecoGen", "hDeltaYPVRecoGen;Delta Y (reco - gen), cm", {kTH1D, {{axes.axisDeltaVtxCoord}}});
insertHist(histPath + "hDeltaZPVRecoGen", "hDeltaZPVRecoGen;Delta Z (reco - gen), cm", {kTH1D, {{axes.axisDeltaVtxCoord}}});
insertHist(histPath + "hDeltaMultPVRecoGen", "hDeltaMultPVRecoGen;Delta Multiplicity (reco - gen)", {kTH1D, {{axes.axisDeltaMultPVRecoGen}}});
insertHist(histPath + "hVtxMultGen", "hVtxMultGen;Generated Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}});
insertHist(histPath + "hVtxMultReco", "hVtxMultReco;Reconstructed Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}});
insertHist(histPath + "hVtxTrials", "hVtxTrials;Vertex Reconstruction Trials", {kTH1D, {{2, -0.5, 1.5}}});
// Set the bin labels
getHist(TH1, histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried");
getHist(TH1, histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded");
}

if (enableSecondarySmearing) {
fastTracker.emplace_back(std::make_unique<o2::fastsim::FastTracker>());
Expand Down Expand Up @@ -431,8 +447,8 @@ struct OnTheFlyTracker {
insertHist(histPath + "h2dDCAzCascadeNegative", "h2dDCAzCascadeNegative", {kTH2F, {axes.axisMomentum, axes.axisDCA}});
insertHist(histPath + "h2dDCAzCascadePositive", "h2dDCAzCascadePositive", {kTH2F, {axes.axisMomentum, axes.axisDCA}});

insertHist(histPath + "h2dDeltaPtVsPt", "h2dDeltaPtVsPt", {kTH2F, {axes.axisMomentum, axes.axisDeltaPt}});
insertHist(histPath + "h2dDeltaEtaVsPt", "h2dDeltaEtaVsPt", {kTH2F, {axes.axisMomentum, axes.axisDeltaEta}});
insertHist(histPath + "h2dDeltaPtVsPt", "h2dDeltaPtVsPt;Gen p_{T};#Delta p_{T}", {kTH2F, {axes.axisMomentum, axes.axisDeltaPt}});
insertHist(histPath + "h2dDeltaEtaVsPt", "h2dDeltaEtaVsPt;Gen p_{T};#Delta #eta", {kTH2F, {axes.axisMomentum, axes.axisDeltaEta}});

insertHist(histPath + "hFastTrackerHits", "hFastTrackerHits", {kTH2F, {axes.axisZ, axes.axisRadius}});
insertHist(histPath + "hFastTrackerQA", "hFastTrackerQA", {kTH1F, {{8, -0.5f, 7.5f}}});
Expand All @@ -448,9 +464,9 @@ struct OnTheFlyTracker {
}

if (doExtraQA) {
insertHist(histPath + "h2dPtRes", "h2dPtRes", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}});
insertHist(histPath + "h2dDCAxy", "h2dDCAxy", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}});
insertHist(histPath + "h2dDCAz", "h2dDCAz", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}});
insertHist(histPath + "h2dPtRes", "h2dPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}});
insertHist(histPath + "h2dDCAxy", "h2dDCAxy;p_{T};DCA_{xy}", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}});
insertHist(histPath + "h2dDCAz", "h2dDCAz;p_{T};DCA_{z}", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}});
}

} // end config loop
Expand All @@ -471,9 +487,9 @@ struct OnTheFlyTracker {
hCovMatOK->GetXaxis()->SetBinLabel(2, "OK");

if (doExtraQA) {
histos.add("h2dVerticesVsContributors", "h2dVerticesVsContributors", kTH2F, {axes.axisMultiplicity, axes.axisNVertices});
histos.add("h1dVerticesNotReco", "h1dVerticesNotReco", kTH1F, {axes.axisMultiplicity});
histos.add("hRecoVsSimMultiplicity", "hRecoVsSimMultiplicity", kTH2F, {axes.axisMultiplicity, axes.axisMultiplicity});
histos.add("h2dVerticesVsContributors", "h2dVerticesVsContributors;Multiplicity;N vertices", kTH2F, {axes.axisMultiplicity, axes.axisNVertices});
histos.add("h1dVerticesNotReco", "h1dVerticesNotReco;Multiplicity;Vertices Not Reco", kTH1F, {axes.axisMultiplicity});
histos.add("hRecoVsSimMultiplicity", "hRecoVsSimMultiplicity;Reco Mult.;Sim Mult.", kTH2F, {axes.axisMultiplicity, axes.axisMultiplicity});

histos.add("hSimTrackX", "hSimTrackX", kTH1F, {axes.axisX});
histos.add("hRecoTrackX", "hRecoTrackX", kTH1F, {axes.axisX});
Expand Down Expand Up @@ -688,7 +704,6 @@ struct OnTheFlyTracker {
std::pair<float, float> vertexReconstructionEfficiencyCounters = {0, 0}; // {nVerticesWithMoreThan2Contributors, nVerticesReconstructed}
void processWithLUTs(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, int const& icfg)
{
LOG(debug) << "Processing event " << mcCollision.globalIndex() << " with LUTs for configuration " << icfg;
vertexReconstructionEfficiencyCounters.first += 1;
const int lastTrackIndex = tableStoredTracksCov.lastIndex() + 1; // bookkeep the last added track
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
Expand Down Expand Up @@ -1368,6 +1383,7 @@ struct OnTheFlyTracker {
o2::vertexing::PVertex primaryVertex;
if (enablePrimaryVertexing) {
LOG(debug) << "Starting primary vertexing with " << tracksAlice3.size() << " tracks.";
fillHist(TH1, histPath + "hVtxMultGen", tracksAlice3.size());
std::vector<o2::MCCompLabel> lblTracks;
std::vector<o2::vertexing::PVertex> vertices;
std::vector<o2::vertexing::GIndex> vertexTrackIDs;
Expand All @@ -1382,6 +1398,8 @@ struct OnTheFlyTracker {
idxVec.emplace_back(i, o2::dataformats::GlobalTrackID::ITS); // let's say ITS
}

getHist(TH1, histPath + "hVtxTrials")->Fill(0); // Tried vertexing

// Calculate vertices
const int n_vertices = vertexer.process(tracksAlice3, // track array
idxVec,
Expand All @@ -1401,6 +1419,7 @@ struct OnTheFlyTracker {
return; // primary vertex not reconstructed
}
vertexReconstructionEfficiencyCounters.second += 1;
getHist(TH1, histPath + "hVtxTrials")->Fill(1); // Succeeded vertexing
LOG(debug) << "Vertexing completed with " << n_vertices << " vertices found.";

// Find largest vertex
Expand All @@ -1414,6 +1433,11 @@ struct OnTheFlyTracker {
if (doExtraQA) {
histos.fill(HIST("h2dVerticesVsContributors"), primaryVertex.getNContributors(), n_vertices);
}
fillHist(TH1, histPath + "hVtxMultReco", primaryVertex.getNContributors());
fillHist(TH1, histPath + "hDeltaMultPVRecoGen", static_cast<int>(primaryVertex.getNContributors()) - static_cast<int>(tracksAlice3.size()));
fillHist(TH1, histPath + "hDeltaXPVRecoGen", primaryVertex.getX() - mcCollision.posX());
fillHist(TH1, histPath + "hDeltaYPVRecoGen", primaryVertex.getY() - mcCollision.posY());
fillHist(TH1, histPath + "hDeltaZPVRecoGen", primaryVertex.getZ() - mcCollision.posZ());
} else {
primaryVertex.setXYZ(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ());
}
Expand Down
7 changes: 5 additions & 2 deletions ALICE3/TableProducer/alice3HfTreeCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ struct Alice3HfTreeCreator3Prong {
Configurable<bool> fillPid{"fillPid", false, "fill PID info"};
} fillTables;
// parameters for production of training samples
Configurable<bool> fillSwapMassHypo{"fillSwapMassHypo", false, "Flag to fill derived tables with swapped mass hypothesis"};
Configurable<bool> fillOnlySignal{"fillOnlySignal", true, "Flag to fill derived tables with signal"};
Configurable<bool> fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background"};
Configurable<float> downSampleFactor{"downSampleFactor", 1., "Fraction of cands to keep"};
Expand Down Expand Up @@ -475,8 +476,10 @@ struct Alice3HfTreeCreator3Prong {
if (cand.isSelMassHypo0()) {
fillRecoTables<CharmHad, false>(cand);
}
if (cand.isSelMassHypo1()) {
fillRecoTables<CharmHad, true>(cand);
if (fillSwapMassHypo) {
if (cand.isSelMassHypo1()) {
fillRecoTables<CharmHad, true>(cand);
}
}
}
fillGenTables<CharmHad>(candsGen);
Expand Down
49 changes: 27 additions & 22 deletions ALICE3/Tasks/alice3HfTask3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct Alice3HfTask3Prong {
Configurable<double> yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"};
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_3prongs_alice3::vecBinsPt}, "pT bin limits"};
Configurable<bool> fillThn{"fillThn", false, "fill Thn"};
Configurable<bool> fillSwapMassHypo{"fillSwapMassHypo", false, "Flag to fill derived tables with swapped mass hypothesis"};
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"};
Configurable<std::string> ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"};
Expand Down Expand Up @@ -335,36 +336,40 @@ struct Alice3HfTask3Prong {
registry.get<THnSparse>(HIST("hSparseRec"))->Fill(valuesToFill.data());
}
}
if (candidate.isSelMassHypo1()) {
registry.fill(HIST("hSelectionStatus"), 1., pt);
double mass = hfHelper.getCandMass<CharmHad, true>(candidate);
/// Fill histograms
fillHistogramsRecSig<CharmHad, SignalClasses::Signal>(candidate, mass, true);
if (originType == RecoDecay::OriginType::Prompt) {
fillHistogramsRecSig<CharmHad, SignalClasses::Prompt>(candidate, mass, true);
} else if (originType == RecoDecay::OriginType::NonPrompt) {
fillHistogramsRecSig<CharmHad, SignalClasses::NonPrompt>(candidate, mass, true);
}
if (fillThn) {
std::vector<double> valuesToFill{mass, pt};
if constexpr (SaveMl) {
LOGP(fatal, "Trying to access ML scores, but SaveMl is false!");
valuesToFill.push_back(candidate.mlScore0());
valuesToFill.push_back(candidate.mlScore1());
valuesToFill.push_back(candidate.mlScore2());
if (fillSwapMassHypo) {
if (candidate.isSelMassHypo1()) {
registry.fill(HIST("hSelectionStatus"), 1., pt);
double mass = hfHelper.getCandMass<CharmHad, true>(candidate);
/// Fill histograms
fillHistogramsRecSig<CharmHad, SignalClasses::Signal>(candidate, mass, true);
if (originType == RecoDecay::OriginType::Prompt) {
fillHistogramsRecSig<CharmHad, SignalClasses::Prompt>(candidate, mass, true);
} else if (originType == RecoDecay::OriginType::NonPrompt) {
fillHistogramsRecSig<CharmHad, SignalClasses::NonPrompt>(candidate, mass, true);
}
if (fillThn) {
std::vector<double> valuesToFill{mass, pt};
if constexpr (SaveMl) {
LOGP(fatal, "Trying to access ML scores, but SaveMl is false!");
valuesToFill.push_back(candidate.mlScore0());
valuesToFill.push_back(candidate.mlScore1());
valuesToFill.push_back(candidate.mlScore2());
}
valuesToFill.push_back(static_cast<double>(originType));
registry.get<THnSparse>(HIST("hSparseRec"))->Fill(valuesToFill.data());
}
valuesToFill.push_back(static_cast<double>(originType));
registry.get<THnSparse>(HIST("hSparseRec"))->Fill(valuesToFill.data());
}
}
} else { // Background
if (candidate.isSelMassHypo0()) {
double mass = hfHelper.getCandMass<CharmHad, false>(candidate);
fillHistogramsRecSig<CharmHad, SignalClasses::Bkg>(candidate, mass, false);
}
if (candidate.isSelMassHypo1()) {
double mass = hfHelper.getCandMass<CharmHad, true>(candidate);
fillHistogramsRecSig<CharmHad, SignalClasses::Bkg>(candidate, mass, true);
if (fillSwapMassHypo) {
if (candidate.isSelMassHypo1()) {
double mass = hfHelper.getCandMass<CharmHad, true>(candidate);
fillHistogramsRecSig<CharmHad, SignalClasses::Bkg>(candidate, mass, true);
}
}
}
}
Expand Down
Loading