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
55 changes: 43 additions & 12 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 Down Expand Up @@ -27,7 +27,7 @@
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TDatabasePDG.h>

Check failure on line 30 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 <TH1.h>
#include <TH2.h>
#include <TMCProcess.h>
Expand All @@ -46,12 +46,12 @@

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

Check failure on line 49 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 50 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 52 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 53 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 54 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 @@ -159,6 +159,11 @@
histos.add("particle/Px", "Particle Px " + tit, kTH1D, {axisPx});
histos.add("particle/Py", "Particle Py " + tit, kTH1D, {axisPy});
histos.add("particle/Pz", "Particle Pz " + tit, kTH1D, {axisPz});
histos.add("particle/decayDistanceX", "Particle decay distance " + tit, kTH1D, {axisProdx});
histos.add("particle/decayDistanceY", "Particle decay distance " + tit, kTH1D, {axisPrody});
histos.add("particle/decayDistanceZ", "Particle decay distance " + tit, kTH1D, {axisProdz});
histos.add("particle/decayDistanceVsPt", "Particle decay distance " + tit, kTH2D, {axisPt, axisProdRadius});
histos.add("particle/decayCtau", "Particle decay distance " + tit, kTH1D, {{1000, 0, 10000, "c#tau (#mum)"}});

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});
Expand All @@ -167,10 +172,6 @@
histos.add("particle/daughters/prodVx", "Daughters Prod. Vertex X " + tit, kTH1D, {axisProdx});
histos.add("particle/daughters/prodVy", "Daughters Prod. Vertex Y " + tit, kTH1D, {axisPrody});
histos.add("particle/daughters/prodVz", "Daughters Prod. Vertex Z " + tit, kTH1D, {axisProdz});
histos.add("particle/daughters/prodDistanceX", "Daughters Prod. distance " + tit, kTH1D, {axisProdx});
histos.add("particle/daughters/prodDistanceY", "Daughters Prod. distance " + tit, kTH1D, {axisPrody});
histos.add("particle/daughters/prodDistanceZ", "Daughters Prod. distance " + tit, kTH1D, {axisProdz});
histos.add("particle/daughters/prodDistanceVsPt", "Daughters Prod. distance " + tit, kTH2D, {axisPt, axisProdRadius});
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});

Expand Down Expand Up @@ -290,8 +291,9 @@
histos.fill(HIST("particle/prodVy"), mcParticle.vy());
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
if (mcParticle.has_daughters()) {
auto daughters = mcParticle.daughters_as<aod::McParticles>();
const auto& daughters = mcParticle.daughters_as<aod::McParticles>();
histos.fill(HIST("particle/daughters/Number"), daughters.size());
bool filledDistance = false;
for (const auto& daughter : daughters) {
const auto& pdgStringDau = getPdgCodeString(daughter);
const auto& pdgChargeDau = getCharge(daughter);
Expand All @@ -306,12 +308,24 @@
histos.fill(HIST("particle/daughters/prodVx"), daughter.vx());
histos.fill(HIST("particle/daughters/prodVy"), daughter.vy());
histos.fill(HIST("particle/daughters/prodVz"), daughter.vz());
histos.fill(HIST("particle/daughters/prodDistanceX"), daughter.vx() - mcParticle.vx());
histos.fill(HIST("particle/daughters/prodDistanceY"), daughter.vy() - mcParticle.vy());
histos.fill(HIST("particle/daughters/prodDistanceZ"), daughter.vz() - mcParticle.vz());
histos.fill(HIST("particle/daughters/prodDistanceVsPt"), mcParticle.pt(), std::sqrt((daughter.vx() - mcParticle.vx()) * (daughter.vx() - mcParticle.vx()) + (daughter.vy() - mcParticle.vy()) * (daughter.vy() - mcParticle.vy()) + (daughter.vz() - mcParticle.vz()) * (daughter.vz() - mcParticle.vz())));
if (filledDistance) {
continue;
}
filledDistance = true;
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()));

const float dx = daughter.vx() - mcParticle.vx();
const float dy = daughter.vy() - mcParticle.vy();
const float dz = daughter.vz() - mcParticle.vz();
histos.fill(HIST("particle/decayDistanceX"), dx);
histos.fill(HIST("particle/decayDistanceY"), dy);
histos.fill(HIST("particle/decayDistanceZ"), dz);
histos.fill(HIST("particle/decayDistanceVsPt"), mcParticle.pt(), std::sqrt((dx) * (dx) + (dy) * (dy) + (dz) * (dz)));
if (pdg->GetParticle(mcParticle.pdgCode())) {
const float mass = pdg->GetParticle(mcParticle.pdgCode())->Mass();
histos.fill(HIST("particle/decayCtau"), std::sqrt((dx) * (dx) + (dy) * (dy) + (dz) * (dz)) / mcParticle.pt() * mass * 10 * 1000);
}
}
} else {
histos.fill(HIST("particle/daughters/Number"), 0.f);
Expand Down Expand Up @@ -360,7 +374,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 377 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 @@ -494,8 +508,9 @@
histos.fill(HIST("particle/prodVy"), mcParticle.vy());
histos.fill(HIST("particle/prodVz"), mcParticle.vz());
if (mcParticle.has_daughters()) {
auto daughters = mcParticle.daughters_as<aod::McParticles>();
const auto& daughters = mcParticle.daughters_as<aod::McParticles>();
histos.fill(HIST("particle/daughters/Number"), daughters.size());
bool filledDistance = false;
for (const auto& daughter : daughters) {
const auto& pdgStringDau = getPdgCodeString(daughter);
const auto& pdgChargeDau = getCharge(daughter);
Expand All @@ -510,8 +525,24 @@
histos.fill(HIST("particle/daughters/prodVx"), daughter.vx());
histos.fill(HIST("particle/daughters/prodVy"), daughter.vy());
histos.fill(HIST("particle/daughters/prodVz"), daughter.vz());
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()));
if (filledDistance) {
continue;
}
filledDistance = true;
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()));

const float dx = daughter.vx() - mcParticle.vx();
const float dy = daughter.vy() - mcParticle.vy();
const float dz = daughter.vz() - mcParticle.vz();
histos.fill(HIST("particle/decayDistanceX"), dx);
histos.fill(HIST("particle/decayDistanceY"), dy);
histos.fill(HIST("particle/decayDistanceZ"), dz);
histos.fill(HIST("particle/decayDistanceVsPt"), mcParticle.pt(), std::sqrt((dx) * (dx) + (dy) * (dy) + (dz) * (dz)));
if (pdg->GetParticle(mcParticle.pdgCode())) {
const float mass = pdg->GetParticle(mcParticle.pdgCode())->Mass();
histos.fill(HIST("particle/decayCtau"), std::sqrt((dx) * (dx) + (dy) * (dy) + (dz) * (dz)) / mcParticle.pt() * mass * 10 * 1000);
}
}
} else {
histos.fill(HIST("particle/daughters/Number"), 0.f);
Expand Down Expand Up @@ -540,7 +571,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 574 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 @@ -662,7 +693,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 696 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