Skip to content

Commit 4cdcd58

Browse files
[PWGMM] New MM task computing MFT tracks histograms (#363)
1 parent e8f9a73 commit 4cdcd58

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

PWGMM/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(dndeta
1919
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
2020
COMPONENT_NAME Analysis)
2121

22+
o2physics_add_dpl_workflow(analyse-mft-tracks
23+
SOURCES analyse-mft-tracks.cxx
24+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
25+
COMPONENT_NAME Analysis)
26+
2227
o2physics_add_dpl_workflow(ue-charged
2328
SOURCES uecharged.cxx
2429
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore

PWGMM/Tasks/analyse-mft-tracks.cxx

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
#include "Framework/runDataProcessing.h"
13+
#include "Framework/AnalysisTask.h"
14+
15+
#include "TDatabasePDG.h"
16+
#include "Common/Core/MC.h"
17+
18+
using namespace o2;
19+
using namespace o2::framework;
20+
21+
using Particles = aod::McParticles;
22+
23+
//the task analyseMFTTracks loops over MFT tracks and generated particles and fills basic histograms
24+
25+
struct analyseMFTTracks {
26+
int icoll = 0;
27+
Service<TDatabasePDG> pdg;
28+
HistogramRegistry registry{
29+
"registry",
30+
{
31+
{"TracksPhiEta_in_coll", "; #varphi; #eta; tracks", {HistType::kTH2F, {{600, -M_PI, M_PI}, {35, -4.5, -1.}}}}, //
32+
{"TracksEtaZvtx", "; #eta; Z_{vtx}; tracks", {HistType::kTH2F, {{35, -4.5, -1.}, {201, -20.1, 20.1}}}}, //
33+
{"NtrkZvtx", "; N_{trk}; Z_{vtx}; events", {HistType::kTH2F, {{301, -0.5, 300.5}, {201, -20.1, 20.1}}}}, //
34+
{"NtrkEta", "#eta; N_{trk}; events", {HistType::kTH1F, {{35, -4.5, -1.}}}}, //
35+
{"TracksPhiEtaGen", "; #varphi; #eta; tracks", {HistType::kTH2F, {{600, 0, 2 * M_PI}, {35, -4.5, -1.}}}}, //
36+
{"TracksEtaZvtxGen", "; #eta; Z_{vtx}; tracks", {HistType::kTH2F, {{35, -4.5, -1.}, {201, -20.1, 20.1}}}}, //
37+
//{"NtrkZvtxGen", "; N_{trk}; Z_{vtx}; events", {HistType::kTH2F, {{301, -0.5, 300.5}, {201, -20.1, 20.1}}}}, //
38+
{"NtrkEtaGen", "#eta; N_{trk}; events", {HistType::kTH1F, {{35, -4.5, -1.}}}}, //
39+
} //
40+
};
41+
42+
void processRec(o2::aod::Collision const& collision, o2::aod::MFTTracks const& tracks)
43+
{
44+
45+
auto z = collision.posZ();
46+
registry.fill(HIST("NtrkZvtx"), tracks.size(), z);
47+
48+
for (auto& track : tracks) {
49+
registry.fill(HIST("TracksPhiEta_in_coll"), track.phi(), track.eta());
50+
registry.fill(HIST("TracksEtaZvtx"), track.eta(), z);
51+
registry.fill(HIST("NtrkEta"), track.eta());
52+
}
53+
icoll++;
54+
}
55+
//end of processRec
56+
PROCESS_SWITCH(analyseMFTTracks, processRec, "Process rec level", true);
57+
58+
void processGen(aod::McCollisions::iterator const& mcCollision, Particles const& particles)
59+
{
60+
61+
int nChargedPrimaryParticles = 0;
62+
auto z = mcCollision.posZ();
63+
64+
for (auto& particle : particles) {
65+
auto p = pdg->GetParticle(particle.pdgCode());
66+
int charge = 0;
67+
if (p == nullptr) {
68+
// unknown particles will be skipped
69+
if (particle.pdgCode() > 1000000000) {
70+
// auto x = (std::trunc(particle.pdgCode() / 10000) - 100000);
71+
// charge = x - std::trunc(x / 1000) * 1000;
72+
LOGF(debug, "[{}] Nucleus with PDG code {}", particle.globalIndex(), particle.pdgCode() /*, charge*/); // (charge %d)
73+
} else {
74+
LOGF(debug, "[{}] Unknown particle with PDG code {}", particle.globalIndex(), particle.pdgCode());
75+
}
76+
} else {
77+
charge = p->Charge();
78+
}
79+
if (charge != 0 && particle.isPhysicalPrimary()) {
80+
registry.fill(HIST("TracksEtaZvtxGen"), particle.eta(), z);
81+
registry.fill(HIST("TracksPhiEtaGen"), particle.phi(), particle.eta());
82+
83+
registry.fill(HIST("TracksPhiEtaGen"), particle.phi(), particle.eta());
84+
registry.fill(HIST("NtrkEtaGen"), particle.eta());
85+
nChargedPrimaryParticles++;
86+
}
87+
}
88+
89+
registry.fill(HIST("NtrkZvtxGen"), nChargedPrimaryParticles, mcCollision.posZ());
90+
}
91+
92+
PROCESS_SWITCH(analyseMFTTracks, processGen, "Process gen level", true);
93+
};
94+
//end of the task analyseMFTTracks
95+
96+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
97+
{
98+
return WorkflowSpec{
99+
adaptAnalysisTask<analyseMFTTracks>(cfgc),
100+
};
101+
}

0 commit comments

Comments
 (0)