Skip to content

Commit ae55c21

Browse files
[PWGLF] Sigma0 analysis: small fixes (#15592)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 3f1700f commit ae55c21

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@
4545

4646
#include "Math/Vector3D.h"
4747
#include <Math/Vector4D.h>
48-
#include <TDatabasePDG.h>
4948
#include <TFile.h>
5049
#include <TH2F.h>
51-
#include <TLorentzVector.h>
5250
#include <TPDGCode.h>
5351
#include <TProfile.h>
5452

5553
#include <array>
5654
#include <cmath>
5755
#include <cstdlib>
5856
#include <string>
57+
#include <unordered_set>
5958
#include <vector>
6059

6160
using namespace o2;
@@ -471,15 +470,17 @@ struct sigma0builder {
471470
histos.get<TH1>(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(12, "TPCCR");
472471
histos.get<TH1>(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(13, "TPC NSigma");
473472

474-
histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
475-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
476-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
477-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
478-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
479-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
480-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
481-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
482-
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
473+
if (doprocessPCMVsEMCalQA) {
474+
histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
475+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
476+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
477+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
478+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
479+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
480+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
481+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
482+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
483+
}
483484

484485
} else {
485486
for (const auto& histodir : DirList2) {
@@ -491,6 +492,16 @@ struct sigma0builder {
491492
histos.add(histodir + "/hExotic", "hExotic", kTH1D, {{2, -0.5f, 1.5f}});
492493
histos.add(histodir + "/h2dShape", "h2dShape", kTH2D, {axisPt, axisClrShape});
493494
}
495+
496+
histos.add("EMCalPhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel});
497+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel");
498+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Definition");
499+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "MinCell");
500+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(4, "Energy");
501+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(5, "Eta");
502+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(6, "Time");
503+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(7, "Exotic");
504+
histos.get<TH1>(HIST("EMCalPhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(8, "Shape");
494505
}
495506

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

866-
if (d < 1e-5f) { // Parallel or nearly parallel lines
877+
float Min_threshold = 1e-5f; // Threshold to consider lines as parallel, can be tuned
878+
if (d < Min_threshold) { // Parallel or nearly parallel lines
867879
info.X = info.Y = info.Z = 0.f; // should we use another dummy value? Perhaps 999.f?
868880
return info;
869881
}
@@ -1527,7 +1539,7 @@ struct sigma0builder {
15271539

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

1530-
float V0MCpT = RecoDecay::pt(array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});
1542+
float V0MCpT = RecoDecay::pt(std::array<float, 2>{v0MC.pxMC(), v0MC.pyMC()});
15311543
float V0PA = TMath::ACos(v0.v0cosPA());
15321544
bool fIsV0CorrectlyAssigned = (v0MC.straMCCollisionId() == v0MCCollision.globalIndex());
15331545
bool isPrimary = v0MC.isPhysicalPrimary();
@@ -1591,7 +1603,7 @@ struct sigma0builder {
15911603
histos.fill(HIST("GenQA/h2dSigma0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);
15921604

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

15971609
if (GenInfo.NDaughters == 2) {
@@ -1606,13 +1618,13 @@ struct sigma0builder {
16061618

16071619
if ((GenInfo.IsKStar) && genSelections.doQA) {
16081620
histos.fill(HIST("GenQA/h2dKStarMCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);
1609-
for (auto& daughter : daughters) // checking decay modes
1621+
for (auto const& daughter : daughters) // checking decay modes
16101622
histos.fill(HIST("GenQA/h2dKStarNDaughtersVsPDG"), daughters.size(), daughter.pdgCode());
16111623
}
16121624

16131625
if (GenInfo.IsPi0 && genSelections.doQA) {
16141626
histos.fill(HIST("GenQA/h2dPi0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother);
1615-
for (auto& daughter : daughters) // checking decay modes
1627+
for (auto const& daughter : daughters) // checking decay modes
16161628
histos.fill(HIST("GenQA/h2dPi0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode());
16171629
}
16181630
}
@@ -1722,7 +1734,7 @@ struct sigma0builder {
17221734
template <typename TMCParticles>
17231735
void genProcess(TMCParticles const& mcParticles)
17241736
{
1725-
for (auto& mcParticle : mcParticles) {
1737+
for (auto const& mcParticle : mcParticles) {
17261738
// Rapidity selection
17271739
if ((mcParticle.y() < genSelections.mc_rapidityMin) || (mcParticle.y() > genSelections.mc_rapidityMax))
17281740
continue;
@@ -1778,7 +1790,7 @@ struct sigma0builder {
17781790
static constexpr std::string_view MainDir2[] = {"EMCalPhotonBeforeSel", "EMCalPhotonSel"};
17791791

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

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

23932405
// Momentum components
23942406
float gammapx = gammapT * std::cos(gamma.phi());
@@ -2720,7 +2732,6 @@ struct sigma0builder {
27202732

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

27262737
//_______________________________________________
@@ -2739,8 +2750,6 @@ struct sigma0builder {
27392750
if (!buildPCMSigma0(lambda, gamma1, coll, mcparticles))
27402751
continue;
27412752
}
2742-
2743-
nSigma0Candidates++;
27442753
}
27452754
}
27462755

@@ -2774,8 +2783,6 @@ struct sigma0builder {
27742783
}
27752784
}
27762785
}
2777-
2778-
LOGF(info, "N. photons: %i, N. lambdas: %i, expected pairs: %i, got: %i", bestGammasArray.size(), bestLambdasArray.size(), bestGammasArray.size() * bestLambdasArray.size(), nSigma0Candidates);
27792786
}
27802787
}
27812788

0 commit comments

Comments
 (0)