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
68 changes: 34 additions & 34 deletions PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// ==============================================================================
#include "PWGLF/DataModel/LFLnnTables.h"

#include "PID/PIDTOF.h"
#include "PID/TPCPIDResponse.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/trackUtilities.h"
#include "Common/DataModel/Centrality.h"
Expand All @@ -30,13 +28,15 @@
#include "DCAFitter/DCAFitterN.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "MathUtils/BetheBlochAleph.h"
#include "DetectorsBase/GeometryManager.h"
#include "DetectorsBase/Propagator.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "MathUtils/BetheBlochAleph.h"
#include "PID/PIDTOF.h"
#include "PID/TPCPIDResponse.h"
#include "ReconstructionDataFormats/Track.h"

#include <algorithm>
Expand All @@ -59,7 +59,7 @@
constexpr double BetheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}};
static const std::vector<std::string> betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"};
static const std::vector<std::string> nucleiName{"3H"};
// Histograms for QA lnn-task
// Histograms for QA lnn-task
std::shared_ptr<TH1> hEvents;
std::shared_ptr<TH1> hZvtx;
std::shared_ptr<TH1> hCentFT0A;
Expand Down Expand Up @@ -136,7 +136,6 @@
float genPhiPi() const { return std::atan2(gMomPi[1], gMomPi[0]); }
float genEtaPi() const { return std::asinh(gMomPi[2] / genPtPi()); }


int posTrackID;
int negTrackID;
float dcaV0dau = -10;
Expand Down Expand Up @@ -220,10 +219,10 @@

// PDG codes
Configurable<int> h3DauPdg{"h3DauPdg", 1000010030, "PDG Triton"}; // PDG Triton
Configurable<int> piDauPdg{"piDauPdg", 211, "PDG Pi"}; // PDG Pi
Configurable<int> lnnPdg{"lnnPdg", 1010000030, "PDG Lnn"}; // PDG Lnn
Configurable<int> piDauPdg{"piDauPdg", 211, "PDG Pi"}; // PDG Pi
Configurable<int> lnnPdg{"lnnPdg", 1010000030, "PDG Lnn"}; // PDG Lnn

// Histogram configuration QA lnn-task
// Histogram configuration QA lnn-task
ConfigurableAxis rigidityBins{"rigidityBins", {200, -10.f, 10.f}, "Binning for rigidity"};
ConfigurableAxis dEdxBins{"dEdxBins", {5000, 0.f, 1000.f}, "Binning for dE/dx"};
ConfigurableAxis nSigmaBins{"nSigmaBins", {200, -5.f, 5.f}, "Binning for n#sigma_{TPC}"};
Expand Down Expand Up @@ -312,7 +311,7 @@
h2FT0CnClusTPCtoPiBfSel = qaRegistry.add<TH2>("QATracks/h2FT0CnClusTPCtoPiBfSel", ";FT0C (%);N_{clus}^{TPC}", HistType::kTH2F, {centAxis, tpcNClusAxis});
h2FT0Cchi2NClTPCtoTrBfSel = qaRegistry.add<TH2>("QATracks/h2FT0Cchi2NClTPCtoTrBfSel", ";FT0C (%);{#Chi}^{2}/N_{clus}^{TPC} ", HistType::kTH2F, {centAxis, tpcChi2NClusAxis});
h2FT0Cchi2NClITStoTrBfSel = qaRegistry.add<TH2>("QATracks/h2FT0Cchi2NClITStoTrBfSel", ";FT0C (%);{#Chi}^{2}/N_{clus}^{ITS}", HistType::kTH2F, {centAxis, itsChi2NClusAxis});
// QA its-tpc and its-tpc-tof studies
// QA its-tpc and its-tpc-tof studies
h2FT0CptTrBfSelItsTpc = qaRegistry.add<TH2>("QATracks/itstpc/h2FT0CptTrBfSelItsTpc", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, tPtAxis});
h2FT0CptTrBfSelItsTpcTof = qaRegistry.add<TH2>("QATracks/itstpctof/h2FT0CptTrBfSelItsTpcTof", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, tPtAxis});
h2FT0CptPiBfSelItsTpc = qaRegistry.add<TH2>("QATracks/itstpc/h2FT0CptPiBfSelItsTpc", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, tPtAxis});
Expand All @@ -337,20 +336,20 @@
hIsMatterGen = qaRegistry.add<TH1>("MC/hIsMatterGen", ";; ", HistType::kTH1D, {{2, -0.5, 1.5}});
hIsMatterGen->GetXaxis()->SetBinLabel(1, "Matter");
hIsMatterGen->GetXaxis()->SetBinLabel(2, "Antimatter");
// QA for generated mother candidate and daughter particles
h2FT0CptGenCandMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CptGenCandMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenCandMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenCandMC",";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtGenTrStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CPtGenTrStrMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenTrStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenTrStrMC",";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtGenPiStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CPtGenPiStrMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenPiStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenPiStrMC",";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
// QA for generated mother candidate and daughter particles which were reconstructed
h2FT0CptRecCandMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CptRecCandMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})",HistType::kTH2F,{centAxis,candPtAxis});
h2FT0CetaRecCandMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecCandMC",";FT0C (%);#eta",HistType::kTH2F,{centAxis,candEtaAxis});
h2FT0CPtRecTrStrMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CPtRecTrStrMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})",HistType::kTH2F,{centAxis,candPtAxis});
h2FT0CetaRecTrStrMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecTrStrMC",";FT0C (%);#eta",HistType::kTH2F,{centAxis,candEtaAxis});
h2FT0CPtRecPiStrMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CPtRecPiStrMC",";FT0C (%);#it{p}_{T} (GeV/#it{c})",HistType::kTH2F,{centAxis,candPtAxis});
h2FT0CetaRecPiStrMC=qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecPiStrMC",";FT0C (%);#eta",HistType::kTH2F,{centAxis,candEtaAxis});
// QA for generated mother candidate and daughter particles
h2FT0CptGenCandMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CptGenCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenCandMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenCandMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtGenTrStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CPtGenTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenTrStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenTrStrMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtGenPiStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CPtGenPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaGenPiStrMC = qaRegistry.add<TH2>("MC/QAGenSV/h2FT0CetaGenPiStrMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
// QA for generated mother candidate and daughter particles which were reconstructed
h2FT0CptRecCandMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CptRecCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaRecCandMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecCandMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtRecTrStrMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CPtRecTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaRecTrStrMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecTrStrMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
h2FT0CPtRecPiStrMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CPtRecPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis});
h2FT0CetaRecPiStrMC = qaRegistry.add<TH2>("MC/QARecSV/h2FT0CetaRecPiStrMC", ";FT0C (%);#eta", HistType::kTH2F, {centAxis, candEtaAxis});
}
hZvtx = qaRegistry.add<TH1>("hZvtx", ";z_{vtx} (cm); ", HistType::kTH1D, {{100, -20, 20}});
hCentFT0A = qaRegistry.add<TH1>("hCentFT0A", ";Centrality; ", HistType::kTH1D, {{100, 0, 100}});
Expand Down Expand Up @@ -398,7 +397,7 @@
auto h3pid = ccdb->getForTimeStamp<std::array<float, 6>>(pidPath.value + "_3H", run3grp_timestamp);
std::copy(h3pid->begin(), h3pid->end(), mBBparams3H.begin());
} else {
for (int i = 0; i < 5; i++) {

Check failure on line 400 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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.
mBBparams3H[i] = cfgBetheBlochParams->get("3H", Form("p%i", i));
}
mBBparams3H[5] = cfgBetheBlochParams->get("3H", "resolution");
Expand Down Expand Up @@ -466,7 +465,7 @@
auto& pitrack = lnnCand.isMatter ? negTrack : posTrack;
auto& h3Rigidity = lnnCand.isMatter ? posRigidity : negRigidity;

//fill QA track histogram studies before selection
// fill QA track histogram studies before selection
h2FT0CnClusTPCtoTrBfSel->Fill(collision.centFT0C(), h3track.tpcNClsFound());
h2FT0CnClusTPCtoPiBfSel->Fill(collision.centFT0C(), pitrack.tpcNClsFound());
h2FT0Cchi2NClTPCtoTrBfSel->Fill(collision.centFT0C(), h3track.tpcChi2NCl());
Expand All @@ -477,13 +476,13 @@
bool passedTrTrackTOF = h3track.hasTOF();
bool passedPiTrackITS = pitrack.hasITS();

if (passedTrTrackITS) {
if (passedTrTrackITS) {
h2FT0CptTrBfSelItsTpc->Fill(collision.centFT0C(), h3track.pt());
}
if (passedTrTrackITS && passedTrTrackTOF) {
h2FT0CptTrBfSelItsTpcTof->Fill(collision.centFT0C(), h3track.pt());
}
if (passedPiTrackITS) {
if (passedPiTrackITS) {
h2FT0CptPiBfSelItsTpc->Fill(collision.centFT0C(), pitrack.pt());
}
}
Expand Down Expand Up @@ -556,7 +555,7 @@
std::array<float, kMomDim> lnnMom;

const auto& vtx = fitter.getPCACandidate();
for (int i = 0; i < 3; i++) {

Check failure on line 558 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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.
lnnCand.decVtx[i] = vtx[i];
lnnMom[i] = lnnCand.mom3H[i] + lnnCand.momPi[i];
}
Expand Down Expand Up @@ -594,7 +593,7 @@
continue;
}

for (int i = 0; i < 3; i++) {

Check failure on line 596 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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.
lnnCand.decVtx[i] = lnnCand.decVtx[i] - primVtx[i];
}

Expand Down Expand Up @@ -623,18 +622,18 @@
hNsigma3HSelTOF->Fill(chargeFactor * h3track.p(), h3track.tofNSigmaTr());
h3HMassPtTOF->Fill(chargeFactor * h3track.pt(), lnnCand.mass2TrTOF);
}
if (doTrackQA && lnnCand.isReco) {
if (doTrackQA && lnnCand.isReco) {
bool passedTrTrackITS = h3track.hasITS();
bool passedTrTrackTOF = h3track.hasTOF();
bool passedPiTrackITS = pitrack.hasITS();

if (passedTrTrackITS) {
if (passedTrTrackITS) {
h2FT0CptTrSelItsTpc->Fill(collision.centFT0C(), h3track.pt());
}
if (passedTrTrackITS && passedTrTrackTOF) {
h2FT0CptTrSelItsTpcTof->Fill(collision.centFT0C(), h3track.pt());
}
if (passedPiTrackITS) {
if (passedPiTrackITS) {
h2FT0CptPiSelItsTpc->Fill(collision.centFT0C(), pitrack.pt());
}
}
Expand All @@ -644,7 +643,7 @@
// Monte Carlo information
void fillMCinfo(aod::McTrackLabels const& trackLabels, aod::McParticles const&)
{
for (auto& lnnCand : lnnCandidates) {

Check failure on line 646 in PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto mcLabPos = trackLabels.rawIteratorAt(lnnCand.posTrackID);
auto mcLabNeg = trackLabels.rawIteratorAt(lnnCand.negTrackID);

Expand All @@ -654,8 +653,8 @@
auto mcTrackNeg = mcLabNeg.mcParticle_as<aod::McParticles>();

if (mcTrackPos.has_mothers() && mcTrackNeg.has_mothers()) {
for (auto& negMother : mcTrackNeg.mothers_as<aod::McParticles>()) {

Check failure on line 656 in PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
for (auto& posMother : mcTrackPos.mothers_as<aod::McParticles>()) {

Check failure on line 657 in PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (posMother.globalIndex() != negMother.globalIndex())
continue;
if (!((mcTrackPos.pdgCode() == h3DauPdg && mcTrackNeg.pdgCode() == -1 * piDauPdg) || (mcTrackPos.pdgCode() == piDauPdg && mcTrackNeg.pdgCode() == -1 * h3DauPdg)))
Expand All @@ -664,7 +663,7 @@
continue;

// Checking primary and second vertex with MC simulations

constexpr std::size_t kposVtxDim = 3;
std::array<float, kposVtxDim> posPrimVtx = {posMother.vx(), posMother.vy(), posMother.vz()};
constexpr std::size_t ksecVtxDim = 3;
Expand All @@ -674,11 +673,11 @@

bool isTrTrack = (mcTrackPos.pdgCode() == h3DauPdg);

lnnCand.gMom3H = isTrTrack? mcTrackPos.pVector() : mcTrackNeg.pVector();
lnnCand.gMom3H = isTrTrack ? mcTrackPos.pVector() : mcTrackNeg.pVector();

lnnCand.gMomPi = isTrTrack? mcTrackNeg.pVector() : mcTrackPos.pVector();
lnnCand.gMomPi = isTrTrack ? mcTrackNeg.pVector() : mcTrackPos.pVector();

for (int i = 0; i < 3; i++) {

Check failure on line 680 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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.
lnnCand.gDecVtx[i] = secVtx[i] - posPrimVtx[i];
}
lnnCand.isSignal = true;
Expand All @@ -701,7 +700,7 @@
initCCDB(bc);

hEvents->Fill(0.);
if ((!collision.sel8()) || std::abs(collision.posZ()) > 10) {

Check failure on line 703 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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;
}
hEvents->Fill(1.);
Expand Down Expand Up @@ -751,7 +750,7 @@

hEvents->Fill(0.);

if ((!collision.sel8()) || std::abs(collision.posZ()) > 10) {

Check failure on line 753 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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;
}
hEvents->Fill(1.);
Expand Down Expand Up @@ -826,7 +825,7 @@

for (const auto& mcDaught : mcPart.daughters_as<aod::McParticles>()) {
bool motherIsAccepted = true;
if (mcDaught.getProcess() == 4) {

Check failure on line 828 in PWGLF/TableProducer/Nuspex/lnnRecoTask.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 (mcPart.has_mothers()) {
motherIsAccepted = false;
for (const auto& mother : mcPart.mothers_as<aod::McParticles>()) {
Expand Down Expand Up @@ -886,7 +885,7 @@
lnnCand.posTrackID = -1;
lnnCand.negTrackID = -1;
lnnCand.isSignal = true;
// // Fill 2D map for generated daughter particles which the mother candidate has only signal
// // Fill 2D map for generated daughter particles which the mother candidate has only signal
h2FT0CptGenCandMC->Fill(cent, lnnCand.genPt());
h2FT0CetaGenCandMC->Fill(cent, lnnCand.genEta());
outputMCTable(-1, collisionFT0Ccent[mcPart.mcCollisionId()], -1,
Expand All @@ -912,4 +911,5 @@
{
return WorkflowSpec{
adaptAnalysisTask<lnnRecoTask>(cfgc)};
}
}

Check failure on line 915 in PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
Loading