|
| 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 | +/// |
| 13 | +/// \file mcParticlePrediction.cxx |
| 14 | +/// \author Sebastian Scheid, s.scheid@cern.ch |
| 15 | +/// \brief Task to build the predictions from the models based on the generated particles |
| 16 | +/// |
| 17 | + |
| 18 | +#include "Framework/AnalysisTask.h" |
| 19 | +#include "Framework/HistogramRegistry.h" |
| 20 | +#include "Framework/runDataProcessing.h" |
| 21 | + |
| 22 | +using namespace o2; |
| 23 | +using namespace o2::framework; |
| 24 | + |
| 25 | +struct otfParticlePrediction { |
| 26 | + // histogram registry |
| 27 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 28 | + // define configurables |
| 29 | + ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; |
| 30 | + ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; |
| 31 | + |
| 32 | + Configurable<float> maxEtaParticle{"maxEtaParticle", 5.f, "Max eta of particles considered"}; |
| 33 | + |
| 34 | + // init function |
| 35 | + void |
| 36 | + init() |
| 37 | + { |
| 38 | + |
| 39 | + const AxisSpec axisEta{binsEta, "#eta"}; |
| 40 | + const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; |
| 41 | + |
| 42 | + histos.add<TH1>("collisions/generated", "collisions", kTH1D, {{2, -0.5, 1.5}}); |
| 43 | + histos.add<TH2>("particles/generated/pi0", "pi0", kTH2D, {axisPt, axisEta}); |
| 44 | + histos.add<TH2>("particles/generated/eta", "eta", kTH2D, {axisPt, axisEta}); |
| 45 | + histos.add<TH2>("particles/generated/etaP", "etaP", kTH2D, {axisPt, axisEta}); |
| 46 | + histos.add<TH2>("particles/generated/rho", "rho", kTH2D, {axisPt, axisEta}); |
| 47 | + histos.add<TH2>("particles/generated/omega", "omega", kTH2D, {axisPt, axisEta}); |
| 48 | + histos.add<TH2>("particles/generated/phi", "phi", kTH2D, {axisPt, axisEta}); |
| 49 | + } |
| 50 | + |
| 51 | + void process(aod::McCollisions const& mcCollisions, |
| 52 | + aod::McParticles const& mcParticles) |
| 53 | + { |
| 54 | + |
| 55 | + histos.fill(HIST("collisions/generated"), 0, mcCollisions.size()); |
| 56 | + |
| 57 | + for (const auto& particle : mcParticles) { |
| 58 | + auto pdg = std::abs(particle.pdgCode()); |
| 59 | + if (particle.eta() < maxEtaParticle) { |
| 60 | + continue; |
| 61 | + } |
| 62 | + if (pdg < 100) { |
| 63 | + continue; |
| 64 | + } |
| 65 | + if (pdg > 1000) { |
| 66 | + continue; |
| 67 | + } |
| 68 | + switch (pdg) { |
| 69 | + case 111: |
| 70 | + histos.fill(HIST("particles/generated/pi0"), particle.pt(), particle.eta()); |
| 71 | + break; |
| 72 | + case 221: |
| 73 | + histos.fill(HIST("particles/generated/eta"), particle.pt(), particle.eta()); |
| 74 | + break; |
| 75 | + case 331: |
| 76 | + histos.fill(HIST("particles/generated/etaP"), particle.pt(), particle.eta()); |
| 77 | + break; |
| 78 | + case 223: |
| 79 | + histos.fill(HIST("particles/generated/omega"), particle.pt(), particle.eta()); |
| 80 | + break; |
| 81 | + case 113: |
| 82 | + histos.fill(HIST("particles/generated/rho"), particle.pt(), particle.eta()); |
| 83 | + break; |
| 84 | + case 333: |
| 85 | + histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); |
| 86 | + break; |
| 87 | + default: |
| 88 | + break; |
| 89 | + } |
| 90 | + } |
| 91 | + } |
| 92 | +}; |
| 93 | + |
| 94 | +WorkflowSpec |
| 95 | + defineDataProcessing(ConfigContext const& cfgc) |
| 96 | +{ |
| 97 | + return WorkflowSpec{adaptAnalysisTask<otfParticlePrediction>(cfgc)}; |
| 98 | +} |
0 commit comments