Skip to content

Commit 16d3f7b

Browse files
committed
Creating a task, which test MC production of standard tables by ploting some standard variables against generatorID
1 parent f70417a commit 16d3f7b

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-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: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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 <[email protected]>, 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+
51+
struct : ConfigurableGroup {
52+
ConfigurableAxis zzAxisNtracks{"zzAxisNtracks", {30, -0.5, 29.5}, "Number of tracks in collision"};
53+
ConfigurableAxis zzAxisNparticles{"zzAxisNparticles", {60, -0.5, 59.5}, "Number of particles in collision"};
54+
ConfigurableAxis zzAxisNprocesses{"zzAxisNprocesses", {50, -0.5, 49.5}, "Number of processes"};
55+
ConfigurableAxis zzAxisInvMassWide{"zzAxisInvMassWide", {1000, 0., 10.}, "Invariant mass (GeV/c^{2}), wider range"};
56+
ConfigurableAxis zzAxisPt{"zzAxisPt", {400, 0., 2.}, "Transversal momentum (GeV/c)"};
57+
ConfigurableAxis zzAxisRap{"zzAxisRap", {50, -1.2, 1.2}, "Rapidity (a.u.)"};
58+
} confAxis;
59+
60+
// init
61+
void init(InitContext&)
62+
{
63+
histos.add("Events/Truth/hGenIDvsCountCollisions", ";Process ID", HistType::kTH2D, {confAxis.zzAxisNprocesses, {1, 0.5, 1.5}});
64+
histos.add("Events/Truth/hGenIDvsPDGcodesAll", ";Process ID ;PDG codes of all particles (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
65+
histos.add("Events/Truth/hGenIDvsPDGcodesNoMother", ";Process ID ;PDG codes of particles without mother (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
66+
histos.add("Events/Truth/hGenIDvsPDGcodesDaughters", ";Process ID ;PDG codes of daughters of particles without mother (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, {2001, -1000, 1000}});
67+
histos.add("Events/Truth/hGenIDvsNparticles", ";Process ID ;Number of particles in a collision (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisNparticles});
68+
histos.add("Events/Truth/hGenIDvsNdaughters", ";Process ID ;Number of daughters of no-mother particle in a collision (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisNparticles});
69+
histos.add("Events/Truth/hGenIDvsMotherMass", ";Process ID ;Mother invariant mass (GeV/c^{2})", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisInvMassWide});
70+
histos.add("Events/Truth/hGenIDvsMotherPt", ";Process ID ;Mother p_{T} (GeV/c)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisPt});
71+
histos.add("Events/Truth/hGenIDvsMotherRap", ";Process ID ;Mother rapidity (-)", HistType::kTH2D, {confAxis.zzAxisNprocesses, confAxis.zzAxisRap});
72+
73+
74+
} // end init
75+
76+
void processMCgen(aod::McCollision const& collision, aod::McParticles const& particles)
77+
{
78+
79+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsCountCollisions"))->Fill(collision.generatorsID(),1);
80+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsNparticles"))->Fill(collision.generatorsID(),particles.size());
81+
82+
TLorentzVector mother;
83+
for (const auto& particle : particles) {
84+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesAll"))->Fill(collision.generatorsID(),particle.pdgCode());
85+
// if (!particle.isPhysicalPrimary()) continue;
86+
if (particle.has_mothers())
87+
continue;
88+
mother.SetPxPyPzE(particle.px(), particle.py(), particle.pz(), energy(pdg->Mass(particle.pdgCode()), particle.px(), particle.py(), particle.pz()));
89+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesNoMother"))->Fill(collision.generatorsID(),particle.pdgCode());
90+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherMass"))->Fill(collision.generatorsID(),mother.M());
91+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherPt"))->Fill(collision.generatorsID(),particle.pt());
92+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsMotherRap"))->Fill(collision.generatorsID(),particle.y());
93+
const auto& daughters = particle.daughters_as<aod::McParticles>();
94+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsNdaughters"))->Fill(collision.generatorsID(),daughters.size());
95+
for (const auto& daughter : daughters) {
96+
histos.get<TH2>(HIST("Events/Truth/hGenIDvsPDGcodesDaughters"))->Fill(collision.generatorsID(),daughter.pdgCode());
97+
}
98+
}
99+
100+
} // end processMCgenDG
101+
102+
PROCESS_SWITCH(TestMCstdTabsRL, processMCgen, "Iterate Monte Carlo UD tables with truth data.", true);
103+
};
104+
105+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
106+
{
107+
return WorkflowSpec{
108+
adaptAnalysisTask<TestMCstdTabsRL>(cfgc)};
109+
}

0 commit comments

Comments
 (0)