Skip to content

Commit 25d3b56

Browse files
authored
Refactor includes and simplify vertex histogram addition
Reordered includes and removed conditional for adding vertex histograms.
1 parent 0bb965f commit 25d3b56

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

ALICE3/Tasks/alice3-qa-singleparticle.cxx

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
/// \brief Task to monitor the single particle QA, at the particle and track level, showing the tracked and the origin of particles
1616
///
1717

18-
// O2 includes
19-
#include "Framework/AnalysisTask.h"
20-
#include "Framework/runDataProcessing.h"
21-
#include "Framework/HistogramRegistry.h"
22-
#include "Framework/O2DatabasePDGPlugin.h"
23-
#include "TDatabasePDG.h"
24-
#include "TMCProcess.h"
18+
#include <Framework/AnalysisTask.h>
19+
#include <Framework/HistogramRegistry.h>
20+
#include <Framework/O2DatabasePDGPlugin.h>
21+
#include <Framework/runDataProcessing.h>
22+
23+
#include <TDatabasePDG.h>
24+
#include <TMCProcess.h>
2525

2626
using namespace o2;
2727
using namespace o2::framework;
@@ -97,11 +97,9 @@ struct Alice3SingleParticle {
9797
const AxisSpec axisProdz{prodBinsZ, prodMinZ, prodMaxZ, "Prod. Vertex Z (cm)"};
9898
const AxisSpec axisProdRadius{prodBins, 0., 2. * prodMax, "Prod. Vertex Radius (cm)"};
9999

100-
if (!doprocessParticleOnly) {
101-
histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx});
102-
histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy});
103-
histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz});
104-
}
100+
histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx});
101+
histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy});
102+
histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz});
105103

106104
histos.add("particle/PDGs", "Particle PDGs", kTH2D, {axisPDGs, axisCharge});
107105
histos.add("particle/PDGsPrimaries", "Particle PDGs of Primaries", kTH2D, {axisPDGs, axisCharge});
@@ -145,6 +143,7 @@ struct Alice3SingleParticle {
145143
histos.add("particle/Py", "Particle Py " + tit, kTH1D, {axisPy});
146144
histos.add("particle/Pz", "Particle Pz " + tit, kTH1D, {axisPz});
147145

146+
histos.add("particle/daughters/Number", "Number of Daughters " + tit, kTH1D, {{20, -0.5, 19.5}});
148147
histos.add("particle/daughters/PDGs", "Daughters PDGs " + tit, kTH2D, {axisPDGs, axisCharge});
149148
histos.add("particle/daughters/PDGsPrimaries", "Daughters PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge});
150149
histos.add("particle/daughters/PDGsSecondaries", "Daughters PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge});
@@ -158,6 +157,7 @@ struct Alice3SingleParticle {
158157
histos.add("particle/daughters/prodRadiusVsPt", "Daughters Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius});
159158
histos.add("particle/daughters/prodRadius3DVsPt", "Daughters Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius});
160159

160+
histos.add("particle/mothers/Number", "Number of Mothers " + tit, kTH1D, {{20, -0.5, 19.5}});
161161
histos.add("particle/mothers/PDGs", "Mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge});
162162
histos.add("particle/mothers/PDGsPrimaries", "Mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge});
163163
histos.add("particle/mothers/PDGsSecondaries", "Mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge});
@@ -167,6 +167,8 @@ struct Alice3SingleParticle {
167167
histos.add("particle/mothers/prodRadiusVsPt", "Mothers Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius});
168168
histos.add("particle/mothers/prodRadius3DVsPt", "Mothers Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius});
169169

170+
// Go up one generation
171+
histos.add("particle/mothers/mothers/Number", "Number of Mothers mothers " + tit, kTH1D, {{20, -0.5, 19.5}});
170172
histos.add("particle/mothers/mothers/PDGs", "Mothers mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge});
171173
histos.add("particle/mothers/mothers/PDGsPrimaries", "Mothers mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge});
172174
histos.add("particle/mothers/mothers/PDGsSecondaries", "Mothers mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge});
@@ -272,6 +274,7 @@ struct Alice3SingleParticle {
272274
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
273275
if (mcParticle.has_daughters()) {
274276
auto daughters = mcParticle.daughters_as<aod::McParticles>();
277+
histos.fill(HIST("particle/daughters/Number"), daughters.size());
275278
for (const auto& daughter : daughters) {
276279
const auto& pdgStringDau = getPdgCodeString(daughter);
277280
const auto& pdgChargeDau = getCharge(daughter);
@@ -293,6 +296,8 @@ struct Alice3SingleParticle {
293296
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy()));
294297
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy() + daughter.vz() * daughter.vz()));
295298
}
299+
} else {
300+
histos.fill(HIST("particle/daughters/Number"), 0.f);
296301
}
297302
if (mcParticle.has_mothers()) {
298303
const auto& mothers = mcParticle.mothers_as<aod::McParticles>();
@@ -415,8 +420,14 @@ struct Alice3SingleParticle {
415420
}
416421
PROCESS_SWITCH(Alice3SingleParticle, processStandard, "Process IU tracks", true);
417422

418-
void processParticleOnly(const aod::McParticles& mcParticles)
423+
void processParticleOnly(const o2::aod::McCollisions& colls,
424+
const aod::McParticles& mcParticles)
419425
{
426+
for (const auto& col : colls) {
427+
histos.fill(HIST("event/VtxX"), col.posX());
428+
histos.fill(HIST("event/VtxY"), col.posY());
429+
histos.fill(HIST("event/VtxZ"), col.posZ());
430+
}
420431
for (const auto& mcParticle : mcParticles) {
421432
const auto& pdgString = getPdgCodeString(mcParticle);
422433
const auto& pdgCharge = getCharge(mcParticle);
@@ -467,6 +478,7 @@ struct Alice3SingleParticle {
467478
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
468479
if (mcParticle.has_daughters()) {
469480
auto daughters = mcParticle.daughters_as<aod::McParticles>();
481+
histos.fill(HIST("particle/daughters/Number"), daughters.size());
470482
for (const auto& daughter : daughters) {
471483
const auto& pdgStringDau = getPdgCodeString(daughter);
472484
const auto& pdgChargeDau = getCharge(daughter);
@@ -484,6 +496,8 @@ struct Alice3SingleParticle {
484496
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
485497
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz()));
486498
}
499+
} else {
500+
histos.fill(HIST("particle/daughters/Number"), 0.f);
487501
}
488502
if (mcParticle.has_mothers()) {
489503
auto mothers = mcParticle.mothers_as<aod::McParticles>();
@@ -586,6 +600,7 @@ struct Alice3SingleParticle {
586600
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
587601
if (mcParticle.has_daughters()) {
588602
auto daughters = mcParticle.daughters_as<aod::McParticles>();
603+
histos.fill(HIST("particle/daughters/Number"), daughters.size());
589604
for (const auto& daughter : daughters) {
590605
const auto& pdgStringDau = getPdgCodeString(daughter);
591606
const auto& pdgChargeDau = getCharge(daughter);
@@ -603,6 +618,8 @@ struct Alice3SingleParticle {
603618
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
604619
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz()));
605620
}
621+
} else {
622+
histos.fill(HIST("particle/daughters/Number"), 0.f);
606623
}
607624
if (mcParticle.has_mothers()) {
608625
auto mothers = mcParticle.mothers_as<aod::McParticles>();

0 commit comments

Comments
 (0)