Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions ALICE3/Tasks/alice3-qa-singleparticle.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -15,13 +15,13 @@
/// \brief Task to monitor the single particle QA, at the particle and track level, showing the tracked and the origin of particles
///

// O2 includes
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "TDatabasePDG.h"
#include "TMCProcess.h"
#include <Framework/AnalysisTask.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/O2DatabasePDGPlugin.h>
#include <Framework/runDataProcessing.h>

#include <TDatabasePDG.h>

Check failure on line 23 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/database]

Do not use TDatabasePDG directly. Use o2::constants::physics::Mass... or Service<o2::framework::O2DatabasePDG> instead.
#include <TMCProcess.h>

using namespace o2;
using namespace o2::framework;
Expand All @@ -29,12 +29,12 @@

struct Alice3SingleParticle {
Service<o2::framework::O2DatabasePDG> pdg;
Configurable<int> PDG{"PDG", 2212, "PDG code of the particle of interest"};

Check failure on line 32 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<int> IsStable{"IsStable", 0, "Flag to check stable particles"};

Check failure on line 33 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Configurable<int> ptBins{"pt-bins", 500, "Number of pT bins"};

Check failure on line 35 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> ptMin{"pt-min", 0.f, "Lower limit in pT"};

Check failure on line 36 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<float> ptMax{"pt-max", 10.f, "Upper limit in pT"};

Check failure on line 37 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<int> etaBins{"eta-bins", 500, "Number of eta bins"};
Configurable<float> etaMin{"eta-min", -3.f, "Lower limit in eta"};
Configurable<float> etaMax{"eta-max", 3.f, "Upper limit in eta"};
Expand Down Expand Up @@ -97,11 +97,9 @@
const AxisSpec axisProdz{prodBinsZ, prodMinZ, prodMaxZ, "Prod. Vertex Z (cm)"};
const AxisSpec axisProdRadius{prodBins, 0., 2. * prodMax, "Prod. Vertex Radius (cm)"};

if (!doprocessParticleOnly) {
histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx});
histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy});
histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz});
}
histos.add("event/VtxX", "Vertex X", kTH1D, {axisVx});
histos.add("event/VtxY", "Vertex Y", kTH1D, {axisVy});
histos.add("event/VtxZ", "Vertex Z", kTH1D, {axisVz});

histos.add("particle/PDGs", "Particle PDGs", kTH2D, {axisPDGs, axisCharge});
histos.add("particle/PDGsPrimaries", "Particle PDGs of Primaries", kTH2D, {axisPDGs, axisCharge});
Expand Down Expand Up @@ -145,6 +143,7 @@
histos.add("particle/Py", "Particle Py " + tit, kTH1D, {axisPy});
histos.add("particle/Pz", "Particle Pz " + tit, kTH1D, {axisPz});

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

histos.add("particle/mothers/Number", "Number of Mothers " + tit, kTH1D, {{20, -0.5, 19.5}});
histos.add("particle/mothers/PDGs", "Mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge});
histos.add("particle/mothers/PDGsPrimaries", "Mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge});
histos.add("particle/mothers/PDGsSecondaries", "Mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge});
Expand All @@ -167,6 +167,8 @@
histos.add("particle/mothers/prodRadiusVsPt", "Mothers Prod. Vertex Radius " + tit, kTH2D, {axisPt, axisProdRadius});
histos.add("particle/mothers/prodRadius3DVsPt", "Mothers Prod. Vertex Radius XYZ " + tit, kTH2D, {axisPt, axisProdRadius});

// Go up one generation
histos.add("particle/mothers/mothers/Number", "Number of Mothers mothers " + tit, kTH1D, {{20, -0.5, 19.5}});
histos.add("particle/mothers/mothers/PDGs", "Mothers mothers PDGs " + tit, kTH2D, {axisPDGs, axisCharge});
histos.add("particle/mothers/mothers/PDGsPrimaries", "Mothers mothers PDGs Primaries of " + tit, kTH2D, {axisPDGs, axisCharge});
histos.add("particle/mothers/mothers/PDGsSecondaries", "Mothers mothers PDGs Secondaries of " + tit, kTH2D, {axisPDGs, axisCharge});
Expand Down Expand Up @@ -272,6 +274,7 @@
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
if (mcParticle.has_daughters()) {
auto daughters = mcParticle.daughters_as<aod::McParticles>();
histos.fill(HIST("particle/daughters/Number"), daughters.size());
for (const auto& daughter : daughters) {
const auto& pdgStringDau = getPdgCodeString(daughter);
const auto& pdgChargeDau = getCharge(daughter);
Expand All @@ -293,6 +296,8 @@
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy()));
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(daughter.vx() * daughter.vx() + daughter.vy() * daughter.vy() + daughter.vz() * daughter.vz()));
}
} else {
histos.fill(HIST("particle/daughters/Number"), 0.f);
}
if (mcParticle.has_mothers()) {
const auto& mothers = mcParticle.mothers_as<aod::McParticles>();
Expand Down Expand Up @@ -338,7 +343,7 @@
histos.fill(HIST("particle/prodRadius"), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/prodVxVy"), mcParticle.vx(), mcParticle.vy());
if (!mcParticle.isPhysicalPrimary()) {
if (mcParticle.getProcess() == 4) {

Check failure on line 346 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("particle/prodVxVyStr"), mcParticle.vx(), mcParticle.vy());
} else {
histos.fill(HIST("particle/prodVxVyMat"), mcParticle.vx(), mcParticle.vy());
Expand Down Expand Up @@ -415,8 +420,14 @@
}
PROCESS_SWITCH(Alice3SingleParticle, processStandard, "Process IU tracks", true);

void processParticleOnly(const aod::McParticles& mcParticles)
void processParticleOnly(const o2::aod::McCollisions& colls,
const aod::McParticles& mcParticles)
{
for (const auto& col : colls) {
histos.fill(HIST("event/VtxX"), col.posX());
histos.fill(HIST("event/VtxY"), col.posY());
histos.fill(HIST("event/VtxZ"), col.posZ());
}
for (const auto& mcParticle : mcParticles) {
const auto& pdgString = getPdgCodeString(mcParticle);
const auto& pdgCharge = getCharge(mcParticle);
Expand Down Expand Up @@ -467,6 +478,7 @@
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
if (mcParticle.has_daughters()) {
auto daughters = mcParticle.daughters_as<aod::McParticles>();
histos.fill(HIST("particle/daughters/Number"), daughters.size());
for (const auto& daughter : daughters) {
const auto& pdgStringDau = getPdgCodeString(daughter);
const auto& pdgChargeDau = getCharge(daughter);
Expand All @@ -484,6 +496,8 @@
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz()));
}
} else {
histos.fill(HIST("particle/daughters/Number"), 0.f);
}
if (mcParticle.has_mothers()) {
auto mothers = mcParticle.mothers_as<aod::McParticles>();
Expand All @@ -509,7 +523,7 @@
histos.fill(HIST("particle/prodRadius"), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/prodVxVy"), mcParticle.vx(), mcParticle.vy());
if (!mcParticle.isPhysicalPrimary()) {
if (mcParticle.getProcess() == 4) {

Check failure on line 526 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("particle/prodVxVyStr"), mcParticle.vx(), mcParticle.vy());
} else {
histos.fill(HIST("particle/prodVxVyMat"), mcParticle.vx(), mcParticle.vy());
Expand Down Expand Up @@ -586,6 +600,7 @@
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
if (mcParticle.has_daughters()) {
auto daughters = mcParticle.daughters_as<aod::McParticles>();
histos.fill(HIST("particle/daughters/Number"), daughters.size());
for (const auto& daughter : daughters) {
const auto& pdgStringDau = getPdgCodeString(daughter);
const auto& pdgChargeDau = getCharge(daughter);
Expand All @@ -603,6 +618,8 @@
histos.fill(HIST("particle/daughters/prodRadiusVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/daughters/prodRadius3DVsPt"), mcParticle.pt(), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy() + mcParticle.vz() * mcParticle.vz()));
}
} else {
histos.fill(HIST("particle/daughters/Number"), 0.f);
}
if (mcParticle.has_mothers()) {
auto mothers = mcParticle.mothers_as<aod::McParticles>();
Expand All @@ -628,7 +645,7 @@
histos.fill(HIST("particle/prodRadius"), std::sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()));
histos.fill(HIST("particle/prodVxVy"), mcParticle.vx(), mcParticle.vy());
if (!mcParticle.isPhysicalPrimary()) {
if (mcParticle.getProcess() == 4) {

Check failure on line 648 in ALICE3/Tasks/alice3-qa-singleparticle.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("particle/prodVxVyStr"), mcParticle.vx(), mcParticle.vy());
} else {
histos.fill(HIST("particle/prodVxVyMat"), mcParticle.vx(), mcParticle.vy());
Expand Down
Loading