Skip to content

Commit da115a5

Browse files
rolavickalibuild
andauthored
[PWGUD] Task to test generatorID of UD MC production on hyperloop (#9937)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 4bbee2b commit da115a5

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

PWGUD/Tasks/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ o2physics_add_dpl_workflow(tautau13topo
123123
SOURCES upcTauTau13topo.cxx
124124
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector
125125
COMPONENT_NAME Analysis)
126+
126127
o2physics_add_dpl_workflow(upc-tau-rl
127128
SOURCES upcTauCentralBarrelRL.cxx
128129
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsBase O2::DetectorsCommonDataFormats
@@ -226,4 +227,9 @@ o2physics_add_dpl_workflow(exclusive-rho-to-four-pi
226227
o2physics_add_dpl_workflow(upc-quarkonia-central-barrel
227228
SOURCES upcQuarkoniaCentralBarrel.cxx
228229
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase
230+
COMPONENT_NAME Analysis)
231+
232+
o2physics_add_dpl_workflow(test-mc-std-tabs-rl
233+
SOURCES testMCstdTabsRL.cxx
234+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsBase O2::DetectorsCommonDataFormats
229235
COMPONENT_NAME Analysis)

PWGUD/Tasks/testMCstdTabsRL.cxx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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 testMCstdTabsRL.cxx
13+
/// \brief task to test the Monte Carlo UD production generatorIDs on hyperloop
14+
///
15+
/// \author Roman Lavicka <roman.lavicka@cern.ch>, Austrian Academy of Sciences & SMI
16+
/// \since 12.02.2025
17+
//
18+
19+
// C++ headers
20+
#include <set>
21+
#include <utility>
22+
#include <algorithm>
23+
#include <vector>
24+
25+
// O2 headers
26+
#include "Framework/AnalysisTask.h"
27+
#include "Framework/AnalysisDataModel.h"
28+
#include "Framework/HistogramRegistry.h"
29+
#include "Framework/O2DatabasePDGPlugin.h"
30+
#include "Framework/runDataProcessing.h"
31+
32+
// O2Physics headers
33+
#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h"
34+
35+
// ROOT headers
36+
#include "TLorentzVector.h"
37+
38+
using namespace o2;
39+
using namespace o2::framework;
40+
using namespace o2::framework::expressions;
41+
using namespace o2::constants::physics;
42+
43+
struct TestMCstdTabsRL {
44+
45+
// Global varialbes
46+
Service<o2::framework::O2DatabasePDG> pdg;
47+
48+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
49+
50+
struct : ConfigurableGroup {
51+
ConfigurableAxis zzAxisNtracks{"zzAxisNtracks", {30, -0.5, 29.5}, "Number of tracks in collision"};
52+
ConfigurableAxis zzAxisNparticles{"zzAxisNparticles", {60, -0.5, 59.5}, "Number of particles in collision"};
53+
ConfigurableAxis zzAxisNprocesses{"zzAxisNprocesses", {50, -0.5, 49.5}, "Number of processes"};
54+
ConfigurableAxis zzAxisInvMassWide{"zzAxisInvMassWide", {1000, 0., 10.}, "Invariant mass (GeV/c^{2}), wider range"};
55+
ConfigurableAxis zzAxisPt{"zzAxisPt", {400, 0., 2.}, "Transversal momentum (GeV/c)"};
56+
ConfigurableAxis zzAxisRap{"zzAxisRap", {50, -1.2, 1.2}, "Rapidity (a.u.)"};
57+
} confAxis;
58+
59+
// init
60+
void init(InitContext&)
61+
{
62+
histos.add("Events/Truth/hGenIDvsCountCollisions", ";Process ID", HistType::kTH2D, {confAxis.zzAxisNprocesses, {1, 0.5, 1.5}});
63+
histos.add("Events/Truth/hGenIDvsPDGcodesAll", ";Process ID ;PDG codes of all particles (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
64+
histos.add("Events/Truth/hGenIDvsPDGcodesNoMother", ";Process ID ;PDG codes of particles without mother (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
65+
histos.add("Events/Truth/hGenIDvsPDGcodesDaughters", ";Process ID ;PDG codes of daughters of particles without mother (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
66+
histos.add("Events/Truth/hGenIDvsNparticles", ";Process ID ;Number of particles in a collision (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisNparticles});
67+
histos.add("Events/Truth/hGenIDvsNdaughters", ";Process ID ;Number of daughters of no-mother particle in a collision (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisNparticles});
68+
histos.add("Events/Truth/hGenIDvsMotherMass", ";Process ID ;Mother invariant mass (GeV/c^{2})", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisInvMassWide});
69+
histos.add("Events/Truth/hGenIDvsMotherPt", ";Process ID ;Mother p_{T} (GeV/c)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisPt});
70+
histos.add("Events/Truth/hGenIDvsMotherRap", ";Process ID ;Mother rapidity (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisRap});
71+
72+
} // end init
73+
74+
void processMCgen(aod::McCollision const& collision, aod::McParticles const& particles)
75+
{
76+
77+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsCountCollisions"))->Fill(collision.generatorsID(), 1);
78+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsNparticles"))->Fill(collision.generatorsID(), particles.size());
79+
80+
TLorentzVector mother;
81+
for (const auto& particle : particles) {
82+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesAll"))->Fill(collision.generatorsID(), particle.pdgCode());
83+
// if (!particle.isPhysicalPrimary()) continue;
84+
if (particle.has_mothers())
85+
continue;
86+
mother.SetPxPyPzE(particle.px(), particle.py(), particle.pz(), energy(pdg->Mass(particle.pdgCode()), particle.px(), particle.py(), particle.pz()));
87+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesNoMother"))->Fill(collision.generatorsID(), particle.pdgCode());
88+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherMass"))->Fill(collision.generatorsID(), mother.M());
89+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherPt"))->Fill(collision.generatorsID(), particle.pt());
90+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherRap"))->Fill(collision.generatorsID(), particle.y());
91+
const auto& daughters = particle.daughters_as<aod::McParticles>();
92+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsNdaughters"))->Fill(collision.generatorsID(), daughters.size());
93+
for (const auto& daughter : daughters) {
94+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesDaughters"))->Fill(collision.generatorsID(), daughter.pdgCode());
95+
}
96+
}
97+
98+
} // end processMCgenDG
99+
100+
PROCESS_SWITCH(TestMCstdTabsRL, processMCgen, "Iterate Monte Carlo UD tables with truth data.", true);
101+
};
102+
103+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
104+
{
105+
return WorkflowSpec{
106+
adaptAnalysisTask<TestMCstdTabsRL>(cfgc)};
107+
}

0 commit comments

Comments
 (0)