|
| 1 | +// Copyright 2019-2024 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 mcGeneratorStudies.cxx |
| 13 | +/// |
| 14 | +/// \brief Task that produces the generated pT spectrum of a given particle for MC studies based on on the fly MC simulations |
| 15 | +/// |
| 16 | +/// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt |
| 17 | +/// |
| 18 | + |
| 19 | +#include "Framework/runDataProcessing.h" |
| 20 | +#include "Framework/AnalysisTask.h" |
| 21 | +#include "Framework/AnalysisDataModel.h" |
| 22 | +#include "Framework/ASoA.h" |
| 23 | +#include "Framework/HistogramRegistry.h" |
| 24 | + |
| 25 | +#include "TDatabasePDG.h" |
| 26 | + |
| 27 | +using namespace o2; |
| 28 | +using namespace o2::framework; |
| 29 | + |
| 30 | +struct MCGeneratorStudies { |
| 31 | + HistogramRegistry mHistManager{"MCGeneratorStudyHistograms"}; |
| 32 | + Configurable<int> cfgSelectedParticleCode{"cfgSelectedParticleCode", 111, "PDG code of the particle to be investigated"}; |
| 33 | + Configurable<float> cfgMaxZVertex{"cfgMaxZVertex", 10, "Maximum absolute z-vertex distance (cm)"}; |
| 34 | + expressions::Filter zVertexFilter = aod::mccollision::posZ < cfgMaxZVertex && aod::mccollision::posZ > -cfgMaxZVertex; |
| 35 | + |
| 36 | + void init(InitContext const&) { mHistManager.add("YieldVsNParticles", "pT of selected particles in all MC collisions vs number of all generated particles in event;#bf{#it{p}_{T} (GeV/#it{c})};#bf{#it{N} (Multiplicity)};#bf{#it{N}}", HistType::kTH2F, {{200, 0, 20}, {1000, 0, 10000}}); } |
| 37 | + |
| 38 | + void process(soa::Filtered<aod::McCollisions>::iterator const&, aod::McParticles const& mcParticles) |
| 39 | + { |
| 40 | + int nParticles = mcParticles.size(); |
| 41 | + for (auto& mcParticle : mcParticles) { |
| 42 | + if (mcParticle.pdgCode() == cfgSelectedParticleCode && std::abs(mcParticle.y()) < 0.8f) |
| 43 | + mHistManager.fill(HIST("YieldVsNParticles"), mcParticle.pt(), nParticles); |
| 44 | + } |
| 45 | + } |
| 46 | +}; |
| 47 | + |
| 48 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<MCGeneratorStudies>(cfgc, TaskName{"mc-generator-studies"})}; } |
0 commit comments