|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | +/// |
| 12 | +/// \file alice3TrackingPerformance.cxx |
| 13 | +/// |
| 14 | +/// \brief This task produces the tracking performance |
| 15 | +/// |
| 16 | +/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT) |
| 17 | +/// \since May 27, 2025 |
| 18 | +/// |
| 19 | + |
| 20 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 21 | + |
| 22 | +#include "Framework/AnalysisTask.h" |
| 23 | +#include "Framework/ConfigParamRegistry.h" |
| 24 | +#include "Framework/HistogramRegistry.h" |
| 25 | +#include "Framework/runDataProcessing.h" |
| 26 | + |
| 27 | +#include <map> |
| 28 | +#include <vector> |
| 29 | + |
| 30 | +using namespace o2; |
| 31 | +using namespace o2::framework; |
| 32 | +std::map<int, std::shared_ptr<TH2>> ptResolutionVsPt; |
| 33 | +std::map<int, std::shared_ptr<TH2>> invPtResolutionVsPt; |
| 34 | +std::map<int, std::shared_ptr<TH2>> dcaXyResolutionVsPt; |
| 35 | +std::map<int, std::shared_ptr<TH2>> dcaZResolutionVsPt; |
| 36 | + |
| 37 | +struct alice3TrackingPerformance { |
| 38 | + Configurable<std::vector<int>> pdgCodes{"pdgCodes", {211}, "List of PDG codes to consider for efficiency calculation"}; |
| 39 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 40 | + Configurable<std::pair<float, float>> etaRange{"etaRange", {-5.f, 5.f}, "Eta range for efficiency calculation"}; |
| 41 | + |
| 42 | + void init(o2::framework::InitContext&) |
| 43 | + { |
| 44 | + const AxisSpec axisPt{100, 0, 10, "p_{T} (GeV/c)"}; |
| 45 | + const AxisSpec axisPtDelta{100, -1, 1, "p_{T}^{gen} - p_{T}^{reco} (GeV/c)"}; |
| 46 | + const AxisSpec axisInvPtDelta{100, -1, 1, "1./p_{T}^{gen} - 1./p_{T}^{reco} (GeV/c)^{-1}"}; |
| 47 | + const AxisSpec axisDcaXy{100, -1, 1, "DCA_{xy} (cm)"}; |
| 48 | + const AxisSpec axisDcaZ{100, -1, 1, "DCA_{z} (cm)"}; |
| 49 | + for (auto pdg : pdgCodes.value) { |
| 50 | + ptResolutionVsPt[pdg] = histos.add<TH2>(Form("ptResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisPtDelta}); |
| 51 | + invPtResolutionVsPt[pdg] = histos.add<TH2>(Form("invPtResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisInvPtDelta}); |
| 52 | + dcaXyResolutionVsPt[pdg] = histos.add<TH2>(Form("dcaXyResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisDcaXy}); |
| 53 | + dcaZResolutionVsPt[pdg] = histos.add<TH2>(Form("dcaZResolutionVsPt_%d", pdg), "", kTH2D, {axisPt, axisDcaZ}); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + void process(soa::Join<aod::Tracks, o2::aod::McTrackLabels, o2::aod::TracksDCA> const& tracks, |
| 58 | + aod::McParticles const&) |
| 59 | + { |
| 60 | + auto isParticleSelected = [&](const o2::aod::McParticle& p) { |
| 61 | + if (!p.isPhysicalPrimary()) { |
| 62 | + return false; |
| 63 | + } |
| 64 | + if (p.eta() < etaRange.value.first) { |
| 65 | + return false; |
| 66 | + } |
| 67 | + if (p.eta() > etaRange.value.second) { |
| 68 | + return false; |
| 69 | + } |
| 70 | + return true; |
| 71 | + }; |
| 72 | + for (const auto& track : tracks) { |
| 73 | + if (!track.has_mcParticle()) { |
| 74 | + continue; |
| 75 | + } |
| 76 | + const auto& mcParticle = track.mcParticle(); |
| 77 | + if (!isParticleSelected(mcParticle)) { |
| 78 | + continue; |
| 79 | + } |
| 80 | + if (ptResolutionVsPt.find(mcParticle.pdgCode()) == ptResolutionVsPt.end()) { |
| 81 | + continue; |
| 82 | + } |
| 83 | + ptResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), mcParticle.pt() - track.pt()); |
| 84 | + invPtResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), 1.f / mcParticle.pt() - 1.f / track.pt()); |
| 85 | + dcaXyResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), track.dcaXY()); |
| 86 | + dcaZResolutionVsPt[mcParticle.pdgCode()]->Fill(mcParticle.pt(), track.dcaZ()); |
| 87 | + } |
| 88 | + } |
| 89 | +}; |
| 90 | + |
| 91 | +WorkflowSpec defineDataProcessing(ConfigContext const& ctx) |
| 92 | +{ |
| 93 | + return WorkflowSpec{adaptAnalysisTask<alice3TrackingPerformance>(ctx)}; |
| 94 | +} |
0 commit comments