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: 31 additions & 24 deletions PWGLF/TableProducer/Strangeness/sigma0builder.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 PWGLF/TableProducer/Strangeness/sigma0builder.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 @@ -45,17 +45,16 @@

#include "Math/Vector3D.h"
#include <Math/Vector4D.h>
#include <TDatabasePDG.h>
#include <TFile.h>
#include <TH2F.h>
#include <TLorentzVector.h>
#include <TPDGCode.h>
#include <TProfile.h>

#include <array>
#include <cmath>
#include <cstdlib>
#include <string>
#include <unordered_set>
#include <vector>

using namespace o2;
Expand Down Expand Up @@ -183,8 +182,8 @@
// Lambda criteria:
struct : ConfigurableGroup {
std::string prefix = "lambdaSelections"; // JSON group name
Configurable<float> Lambda_MLThreshold{"Lambda_MLThreshold", 0.1, "Decision Threshold value to select lambdas"};

Check failure on line 185 in PWGLF/TableProducer/Strangeness/sigma0builder.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> AntiLambda_MLThreshold{"AntiLambda_MLThreshold", 0.1, "Decision Threshold value to select antilambdas"};

Check failure on line 186 in PWGLF/TableProducer/Strangeness/sigma0builder.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<bool> doMCAssociation{"doMCAssociation", false, "if MC, select true lambda/alambdas only"};
Configurable<float> LambdaMinDCANegToPv{"LambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"};
Configurable<float> LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"};
Expand Down Expand Up @@ -471,15 +470,17 @@
histos.get<TH1>(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(12, "TPCCR");
histos.get<TH1>(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(13, "TPC NSigma");

histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
if (doprocessPCMVsEMCalQA) {
histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
}

} else {
for (const auto& histodir : DirList2) {
Expand All @@ -491,6 +492,16 @@
histos.add(histodir + "/hExotic", "hExotic", kTH1D, {{2, -0.5f, 1.5f}});
histos.add(histodir + "/h2dShape", "h2dShape", kTH2D, {axisPt, axisClrShape});
}

histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
}

histos.add("LambdaSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
Expand Down Expand Up @@ -863,7 +874,8 @@
info.DCADau = (cross.Mag2() > 0) ? std::abs(posdiff.Dot(cross)) / cross.R() : 999.f;
info.CosPA = v01momentumNorm.Dot(v02momentumNorm);

if (d < 1e-5f) { // Parallel or nearly parallel lines
float Min_threshold = 1e-5f; // Threshold to consider lines as parallel, can be tuned
if (d < Min_threshold) { // Parallel or nearly parallel lines
info.X = info.Y = info.Z = 0.f; // should we use another dummy value? Perhaps 999.f?
return info;
}
Expand Down Expand Up @@ -1273,7 +1285,7 @@
}
if (fillHists)
histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */);
if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) {

Check failure on line 1288 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
return false;
}
if (fillHists)
Expand Down Expand Up @@ -1386,7 +1398,7 @@
continue;
}

if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) {

Check failure on line 1401 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
continue;
}
}
Expand Down Expand Up @@ -1463,7 +1475,7 @@
continue;
}

if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) {

Check failure on line 1478 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
continue;
}
}
Expand Down Expand Up @@ -1527,7 +1539,7 @@

auto v0MC = v0.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();

float V0MCpT = RecoDecay::pt(array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});
float V0MCpT = RecoDecay::pt(std::array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});
float V0PA = TMath::ACos(v0.v0cosPA());
bool fIsV0CorrectlyAssigned = (v0MC.straMCCollisionId() == v0MCCollision.globalIndex());
bool isPrimary = v0MC.isPhysicalPrimary();
Expand Down Expand Up @@ -1591,10 +1603,10 @@
histos.fill(HIST("GenQA/h2dSigma0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);

// Checking decay modes and getting daughter pTs
for (auto& daughter : daughters) {
for (auto const& daughter : daughters) {
histos.fill(HIST("GenQA/h2dSigma0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode());

if (GenInfo.NDaughters == 2) {

Check failure on line 1609 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
if (daughter.pdgCode() == PDG_t::kGamma)
GenInfo.MCDau1Pt = daughter.pt();

Expand All @@ -1606,13 +1618,13 @@

if ((GenInfo.IsKStar) && genSelections.doQA) {
histos.fill(HIST("GenQA/h2dKStarMCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);
for (auto& daughter : daughters) // checking decay modes
for (auto const& daughter : daughters) // checking decay modes
histos.fill(HIST("GenQA/h2dKStarNDaughtersVsPDG"), daughters.size(), daughter.pdgCode());
}

if (GenInfo.IsPi0 && genSelections.doQA) {
histos.fill(HIST("GenQA/h2dPi0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);
for (auto& daughter : daughters) // checking decay modes
for (auto const& daughter : daughters) // checking decay modes
histos.fill(HIST("GenQA/h2dPi0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode());
}
}
Expand Down Expand Up @@ -1722,7 +1734,7 @@
template <typename TMCParticles>
void genProcess(TMCParticles const& mcParticles)
{
for (auto& mcParticle : mcParticles) {
for (auto const& mcParticle : mcParticles) {
// Rapidity selection
if ((mcParticle.y() < genSelections.mc_rapidityMin) || (mcParticle.y() > genSelections.mc_rapidityMax))
continue;
Expand Down Expand Up @@ -1778,7 +1790,7 @@
static constexpr std::string_view MainDir2[] = {"EMCalPhotonBeforeSel", "EMCalPhotonSel"};

// calculate pT for cluster assuming they are photons (so no mass)
float gammapT = sqrt(cluster.energy() * cluster.energy()) / std::cosh(cluster.eta());
float gammapT = std::sqrt(cluster.energy() * cluster.energy()) / std::cosh(cluster.eta());

histos.fill(HIST(MainDir2[mode]) + HIST("/hDefinition"), cluster.definition());
histos.fill(HIST(MainDir2[mode]) + HIST("/h2dNCells"), gammapT, cluster.nCells());
Expand Down Expand Up @@ -2388,7 +2400,7 @@
bool buildEMCalSigma0(TV0Object const& lambda, TEMCalClsObject const& gamma, TCollision const& collision, TMCParticles const& mcparticles, std::vector<bool> const& emcaltracksmatched)
{
// calculate pT for cluster assuming they are photons (so no mass)
float gammapT = sqrt(gamma.energy() * gamma.energy()) / std::cosh(gamma.eta());
float gammapT = std::sqrt(gamma.energy() * gamma.energy()) / std::cosh(gamma.eta());

// Momentum components
float gammapx = gammapT * std::cos(gamma.phi());
Expand Down Expand Up @@ -2720,7 +2732,6 @@

//_______________________________________________
// Photon-V0 nested loop
int nSigma0Candidates = 0;
for (size_t i = 0; i < bestGammasArray.size(); ++i) {

//_______________________________________________
Expand All @@ -2739,8 +2750,6 @@
if (!buildPCMSigma0(lambda, gamma1, coll, mcparticles))
continue;
}

nSigma0Candidates++;
}
}

Expand Down Expand Up @@ -2774,8 +2783,6 @@
}
}
}

LOGF(info, "N. photons: %i, N. lambdas: %i, expected pairs: %i, got: %i", bestGammasArray.size(), bestLambdasArray.size(), bestGammasArray.size() * bestLambdasArray.size(), nSigma0Candidates);
}
}

Expand Down Expand Up @@ -2950,7 +2957,7 @@
auto v0MC = v0.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();
auto mcv0Photon = mcparticles.rawIteratorAt(v0MC.particleIdMC());

if (mcv0Photon.pdgCode() != PDG_t::kGamma || !mcv0Photon.isPhysicalPrimary() || TMath::Abs(mcv0Photon.y()) > 0.5)

Check failure on line 2960 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
continue;

// MC pT histo
Expand Down Expand Up @@ -3040,7 +3047,7 @@
// Select TRUE + PRIMARY photons
// ============================================================

if (mcPhoton.pdgCode() != PDG_t::kGamma || !mcPhoton.isPhysicalPrimary() || TMath::Abs(mcPhoton.y()) > 0.5)

Check failure on line 3050 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
continue;

// ============================================================
Expand Down Expand Up @@ -3097,7 +3104,7 @@

// Process MC generated photons
for (const auto& mcpart : mcparticles) {
if (mcpart.pdgCode() != PDG_t::kGamma || !mcpart.isPhysicalPrimary() || TMath::Abs(mcpart.y()) > 0.5)

Check failure on line 3107 in PWGLF/TableProducer/Strangeness/sigma0builder.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.
continue;

histos.fill(HIST("PhotonMCQA/hGenPhoton"), mcpart.pt());
Expand Down
Loading