Skip to content

Commit 734b722

Browse files
committed
Add task for model predictions for meson spectra
1 parent c77a889 commit 734b722

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

PWGEM/Dilepton/Tasks/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ o2physics_add_dpl_workflow(dimuon-hadron-mpc
161161
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore
162162
COMPONENT_NAME Analysis)
163163

164+
o2physics_add_dpl_workflow(mc-particle-predictions-otf
165+
SOURCES mcParticlePredictionsOTF.cxx
166+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
167+
COMPONENT_NAME Analysis)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
// init function
33+
void init()
34+
{
35+
36+
const AxisSpec axisEta{binsEta, "#eta"};
37+
const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"};
38+
39+
histos.add<TH1>("collisions/generated", "collisions", kTH1D, {{1, -0.5, 0.5}});
40+
histos.add<TH2>("particles/generated/phi", "phi", kTH2D, {axisPt, axisEta});
41+
}
42+
43+
void process(aod::McCollisions const& mcCollisions,
44+
aod::McParticles const& mcParticles)
45+
{
46+
for (const auto& collission : mcCollisions) {
47+
histos.fill(HIST("collisions/generated"), 0);
48+
}
49+
50+
for (const auto& particle : mcParticles) {
51+
if (std::abs(particle.pdgCode()) == 333) // phi
52+
{
53+
histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta());
54+
}
55+
}
56+
}
57+
};
58+
59+
WorkflowSpec
60+
defineDataProcessing(ConfigContext const& cfgc)
61+
{
62+
return WorkflowSpec{adaptAnalysisTask<otfParticlePrediction>(cfgc)};
63+
}

0 commit comments

Comments
 (0)