|
| 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 alice3SeparationPower.cxx |
| 13 | +/// |
| 14 | +/// \brief This task produces the separation power of the ALICE3 detector |
| 15 | +/// |
| 16 | +/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT) |
| 17 | +/// \since May 13, 2025 |
| 18 | +/// |
| 19 | + |
| 20 | +#include <utility> |
| 21 | +#include <map> |
| 22 | +#include <string> |
| 23 | +#include <vector> |
| 24 | + |
| 25 | +#include "Framework/AnalysisDataModel.h" |
| 26 | +#include "Framework/AnalysisTask.h" |
| 27 | +#include "Framework/runDataProcessing.h" |
| 28 | +#include "Framework/RunningWorkflowInfo.h" |
| 29 | +#include "Framework/HistogramRegistry.h" |
| 30 | +#include "TProfile2D.h" |
| 31 | +#include "THashList.h" |
| 32 | +#include "ALICE3/DataModel/OTFTOF.h" |
| 33 | +#include "ALICE3/DataModel/OTFRICH.h" |
| 34 | + |
| 35 | +using namespace o2; |
| 36 | +using namespace o2::framework; |
| 37 | + |
| 38 | +std::array<TProfile2D*, 5> separationInnerTOF; |
| 39 | +std::array<TProfile2D*, 5> separationOuterTOF; |
| 40 | +std::array<TProfile2D*, 5> separationRICH; |
| 41 | +struct alice3SeparationPower { |
| 42 | + |
| 43 | + ConfigurableAxis etaAxis{"etaAxis", {100, -1.f, 1.f}, "Binning in eta"}; |
| 44 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 45 | + OutputObj<THashList> listSeparation{"separationPower"}; |
| 46 | + void init(o2::framework::InitContext&) |
| 47 | + { |
| 48 | + listSeparation.setObject(new THashList); |
| 49 | + for (int i = 0; i < 5; i++) { |
| 50 | + auto createEfficiency = [&](const char* name, const char* title) { |
| 51 | + TProfile2D* eff = new TProfile2D(Form("%s_%d", name, i), |
| 52 | + Form("%s_%d;%s", title, i, "#it{p}_{T} (GeV/#it{c});#it{#eta}"), |
| 53 | + 100, 0.f, 10.f, |
| 54 | + 100, 0.f, 10.f); |
| 55 | + listSeparation->Add(eff); |
| 56 | + return eff; |
| 57 | + }; |
| 58 | + separationInnerTOF[i] = createEfficiency("separationInnerTOF", "separationInnerTOF"); |
| 59 | + separationOuterTOF[i] = createEfficiency("separationOuterTOF", "separationOuterTOF"); |
| 60 | + separationRICH[i] = createEfficiency("separationRICH", "separationRICH"); |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + void process(soa::Join<aod::Collisions, aod::McCollisionLabels>::iterator const& /*collision*/, |
| 65 | + soa::Join<aod::Tracks, aod::TracksCov, aod::McTrackLabels, aod::UpgradeTofMC, aod::UpgradeTof> const& tracks, |
| 66 | + aod::McParticles const&, |
| 67 | + aod::McCollisions const&) |
| 68 | + { |
| 69 | + for (const auto& track : tracks) { |
| 70 | + if (!track.has_mcParticle()) { |
| 71 | + continue; |
| 72 | + } |
| 73 | + // Check that all the nsigmas are numbers (sanity check) |
| 74 | + for (int i = 0; i < 5; i++) { |
| 75 | + if (std::isnan(track.nSigmaInnerTOF(i)) || std::isnan(track.nSigmaOuterTOF(i))) { |
| 76 | + LOG(fatal) << "Unrecognized nsigma for " << i << " " << track.nSigmaInnerTOF(i) << " " << track.nSigmaOuterTOF(i); |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + const auto& mcParticle = track.mcParticle(); |
| 81 | + // Separation electron pion |
| 82 | + switch (std::abs(mcParticle.pdgCode())) { |
| 83 | + { |
| 84 | + case 211: // electron-pion separation |
| 85 | + separationInnerTOF[0]->Fill(track.pt(), track.eta(), track.nSigmaInnerTOF(0)); |
| 86 | + separationOuterTOF[0]->Fill(track.pt(), track.eta(), track.nSigmaOuterTOF(0)); |
| 87 | + // separationRICH[0]->Fill(track.pt(), track.eta(), track.nSigmaElectronRich() ); |
| 88 | + break; |
| 89 | + case 321: // pion-kaon separation |
| 90 | + separationInnerTOF[1]->Fill(track.pt(), track.eta(), track.nSigmaInnerTOF(1)); |
| 91 | + separationOuterTOF[1]->Fill(track.pt(), track.eta(), track.nSigmaInnerTOF(1)); |
| 92 | + // separationRICH[1]->Fill(track.pt(), track.eta(), track.nSigmaPionRich() ); |
| 93 | + break; |
| 94 | + case 2212: // kaon-proton separation |
| 95 | + separationInnerTOF[2]->Fill(track.pt(), track.eta(), track.nSigmaInnerTOF(2)); |
| 96 | + separationOuterTOF[2]->Fill(track.pt(), track.eta(), track.nSigmaInnerTOF(2)); |
| 97 | + // separationRICH[2]->Fill((track.nSigmaKaonRich() > 3.f), track.pt(), track.eta()); |
| 98 | + default: |
| 99 | + break; |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | +}; |
| 105 | + |
| 106 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<alice3SeparationPower>(cfgc)}; } |
0 commit comments