From 2b699a63a52c55c864a9ecafa387f18c650a3528 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 10 Jul 2025 16:16:57 +0200 Subject: [PATCH 1/8] New 2D histos and vars (tracks, rct) in tau tree --- PWGUD/Tasks/upcTauTau13topo.cxx | 282 +++++++++++++++++++++++++------- 1 file changed, 222 insertions(+), 60 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index 0d18b316b8b..3051f1257e7 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -17,9 +17,9 @@ // copts="--configuration json://tautauConfig.json -b" // o2-analysis-ud-tautau13topo $copts > output.log -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" // #include "TDatabasePDG.h" // not recommended in o2 #include "Framework/O2DatabasePDGPlugin.h" @@ -28,13 +28,13 @@ // #include "Common/DataModel/EventSelection.h" // #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/DGPIDSelector.h" #include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/UDHelpers.h" +#include "PWGUD/DataModel/UDTables.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/PIDResponse.h" // #include #include "TPDGCode.h" @@ -52,7 +52,8 @@ namespace tau_tree DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); DECLARE_SOA_COLUMN(Bc, bc, int); DECLARE_SOA_COLUMN(TotalTracks, totalTracks, int); -DECLARE_SOA_COLUMN(NumContrib, numContrib, int); +DECLARE_SOA_COLUMN(NumContrib, numContrib, int8_t); +DECLARE_SOA_COLUMN(RctOk, rctOk, int); // DECLARE_SOA_COLUMN(GlobalNonPVtracks, globalNonPVtracks, int); // DECLARE_SOA_COLUMN(PosX, posX, float); // DECLARE_SOA_COLUMN(PosY, posY, float); @@ -63,14 +64,14 @@ DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); DECLARE_SOA_COLUMN(Trs, trs, bool); DECLARE_SOA_COLUMN(Trofs, trofs, bool); DECLARE_SOA_COLUMN(Hmpr, hmpr, bool); -// DECLARE_SOA_COLUMN(Tfb, tfb, int); -// DECLARE_SOA_COLUMN(ItsRofb, itsRofb, int); -// DECLARE_SOA_COLUMN(Sbp, sbp, int); -// DECLARE_SOA_COLUMN(ZvtxFT0vsPv, zvtxFT0vsPv, int); -// DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, int); +DECLARE_SOA_COLUMN(Tfb, tfb, bool); +DECLARE_SOA_COLUMN(ItsRofb, itsRofb, bool); +DECLARE_SOA_COLUMN(Sbp, sbp, bool); +DECLARE_SOA_COLUMN(ZvtxFT0vsPv, zvtxFT0vsPv, bool); +DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, bool); DECLARE_SOA_COLUMN(ZdcAenergy, zdcAenergy, float); DECLARE_SOA_COLUMN(ZdcCenergy, zdcCenergy, float); -DECLARE_SOA_COLUMN(Qtot, qtot, int16_t); +DECLARE_SOA_COLUMN(Qtot, qtot, int8_t); // FIT info DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); @@ -83,9 +84,14 @@ DECLARE_SOA_COLUMN(TrkPx, trkPx, float[4]); DECLARE_SOA_COLUMN(TrkPy, trkPy, float[4]); DECLARE_SOA_COLUMN(TrkPz, trkPz, float[4]); // DECLARE_SOA_COLUMN(TrkSign, trkSign, int[4]); -// DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); -// DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); +DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); +DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); DECLARE_SOA_COLUMN(TrkTPCcr, trkTPCcr, int[4]); +DECLARE_SOA_COLUMN(TrkTPCfind, trkTPCfind, int[4]); +DECLARE_SOA_COLUMN(TrkTPCchi2, trkTPCchi2, float[4]); +DECLARE_SOA_COLUMN(TrkITSchi2, trkITSchi2, float[4]); +DECLARE_SOA_COLUMN(TrkITScl, trkITScl, int[4]); + DECLARE_SOA_COLUMN(TrkTPCsignal, trkTPCsignal, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaEl, trkTPCnSigmaEl, float[4]); // DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); @@ -105,19 +111,21 @@ DECLARE_SOA_COLUMN(TrkTOFchi2, trkTOFchi2, float[4]); } // end of namespace tau_tree DECLARE_SOA_TABLE(TauFourTracks, "AOD", "TAUFOURTRACK", tau_tree::RunNumber, tau_tree::Bc, tau_tree::TotalTracks, tau_tree::NumContrib, + tau_tree::RctOk, // tau_tree::GlobalNonPVtracks, // tau_tree::PosX, tau_tree::PosY, tau_tree::PosZ, tau_tree::FlagUPC, tau_tree::OccupancyInTime, tau_tree::HadronicRate, tau_tree::ZdcAenergy, tau_tree::ZdcCenergy, tau_tree::Qtot, tau_tree::Trs, tau_tree::Trofs, tau_tree::Hmpr, - // tau_tree::Tfb, tau_tree::ItsRofb, tau_tree::Sbp, tau_tree::ZvtxFT0vsPv, tau_tree::VtxITSTPC, + tau_tree::Tfb, tau_tree::ItsRofb, tau_tree::Sbp, tau_tree::ZvtxFT0vsPv, tau_tree::VtxITSTPC, tau_tree::TotalFT0AmplitudeA, tau_tree::TotalFT0AmplitudeC, tau_tree::TotalFV0AmplitudeA, // tau_tree::TimeFT0A, tau_tree::TimeFT0C, tau_tree::TimeFV0A, tau_tree::TrkPx, tau_tree::TrkPy, tau_tree::TrkPz, // tau_tree::TrkSign, - // tau_tree::TrkDCAxy, tau_tree::TrkDCAz, + tau_tree::TrkDCAxy, tau_tree::TrkDCAz, tau_tree::TrkTPCcr, + tau_tree::TrkTPCfind, tau_tree::TrkTPCchi2, tau_tree::TrkITSchi2, tau_tree::TrkITScl, tau_tree::TrkTPCsignal, tau_tree::TrkTPCnSigmaEl, tau_tree::TrkTPCnSigmaPi, tau_tree::TrkTPCnSigmaKa, tau_tree::TrkTPCnSigmaPr, tau_tree::TrkTPCnSigmaMu, tau_tree::TrkTOFbeta, tau_tree::TrkTOFnSigmaEl, tau_tree::TrkTOFnSigmaPi, tau_tree::TrkTOFnSigmaKa, tau_tree::TrkTOFnSigmaPr, tau_tree::TrkTOFnSigmaMu, tau_tree::TrkTOFchi2); @@ -138,7 +146,7 @@ struct TauTau13topo { ConfigurableAxis ptAxis{"ptAxis", {120, 0., 4.}, "#it{p} (GeV/#it{c})"}; // ConfigurableAxis etaAxis{"etaAxis", {100, -2., 2.}, "#eta"}; ConfigurableAxis dedxAxis{"dedxAxis", {100, 20., 160.}, "dE/dx"}; - ConfigurableAxis minvAxis{"minvAxis", {100, 0.4, 3.5}, "M_{inv} (GeV/#it{c}^{2})"}; + ConfigurableAxis minvAxis{"minvAxis", {100, 0.5, 5.0}, "M_{inv} (GeV/#it{c}^{2})"}; ConfigurableAxis phiAxis{"phiAxis", {120, 0., 3.2}, "#phi"}; // ConfigurableAxis vectorAxis{"vectorAxis", {100, 0., 2.}, "A_{V}"}; // ConfigurableAxis scalarAxis{"scalarAxis", {100, -1., 1.}, "A_{S}"}; @@ -215,6 +223,7 @@ struct TauTau13topo { const AxisSpec scalarAxis{100, -1., 1., "A_{S}"}; const AxisSpec axisZDC{50, -1., 14., "#it{E} (TeV)"}; const AxisSpec axisInvMass4trk{160, 0.5, 8.5, "#it{M}^{4trk}_{inv} (GeV/#it{c}^{2})"}; + const AxisSpec acoAxis{100, 0., 1., "A^{1+3}"}; if (doprocessDataSG) { registry.add("global/RunNumber", "Run number; Run; Collisions", {HistType::kTH1F, {{150, 544013, 545367}}}); @@ -805,22 +814,78 @@ struct TauTau13topo { registry.add("pidTOF/h3piTOFchi2Cut23", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); // registry.add("pidTOF/h3piTOFchi2Cut36", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); // registry.add("pidTOF/h3piTOFchi2Cut37", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); + + // histograms mass3pi vs acoponarity + registry.add("control/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + } // end of data histograms // MC part // histograms filled by processSimpleMCSG // CollisionMC histograms - if (doprocessEfficiencyMCSG) { - registry1MC.add("globalMC/hGeneratorID", ";Generator ID;events", {HistType::kTH1F, {{100, 0., 1000.}}}); + if (doprocessEfficiencyMCSG || doprocessSimpleMCSG) { registryMC.add("globalMC/hMCZvertex", ";V_{Z}^{MC} (cm);events", {HistType::kTH1F, {{100, -25., 25.}}}); registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{20, 0., 20.}}}); + + // efficiency el + registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); + // efficiency pi + registryMC.add("efficiencyMCPi/effiPi", ";Efficiency #pi3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); + // efficiency mu + registryMC.add("efficiencyMCMu/effiMu", ";Efficiency #mu3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); + } + + if (doprocessSimpleMCSG) { registryMC.add("globalMC/hMCnPart", ";N_{part};Type;events", {HistType::kTH2F, {{25, 0., 25.}, {10, 0, 10}}}); + registryMC.add("globalMC/hMCetaGen", ";#eta^{gen};N^{MC particles}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMC/hMCphiGen", ";#phi^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("globalMC/hMCyGen", ";y^{gen};N^{MC particles}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMC/hMCptGen", ";p_{T}^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 4.}}}); + // tau + registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("tauMC/hMCpt", ";#it{p}_{T}^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 10.}}}); + + registryMC.add("tauMC/hMCdeltaeta", ";#Delta#eta^{#tau};events ", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCdeltaphi", ";#Delta#phi^{#tau}(deg.);events", {HistType::kTH1F, {{100, 131., 181}}}); + + // electron + registryMC.add("electronMC/hMCeta", ";#eta^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("electronMC/hMCy", ";y^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); + + // efficiency mu + registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); + + // efficiency pi + registryMC.add("efficiencyMCPi/hpTpi", ";p_{T}^{#pi, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); + + // efficiency el + registryMC.add("efficiencyMCEl/hpTelec", ";p_{T}^{e, gen} (GeV/c);events", {HistType::kTH1F, {axispt}}); + } + + if (doprocessEfficiencyMCSG) { // MC reconstructed with information from MC true + registry1MC.add("globalMC/hGeneratorID", ";Generator ID;events", {HistType::kTH1F, {{100, 0., 1000.}}}); + registryMC.add("globalMCrec/hMCetaGenCol", ";#eta^{genCol};events", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMCrec/hMCphiGenCol", ";#phi^{genCol};events", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("globalMCrec/hMCyGenCol", ";y^{genCol};events", {HistType::kTH1F, {{100, -5., 5.}}}); @@ -1461,33 +1526,6 @@ struct TauTau13topo { registryMC.add("controlMCcomb/cut35/hPtSpectrumEl", ";p_{T}^{comb} (GeV/c);entries", {HistType::kTH1F, {axispt}}); // zrobic hpTspectrumEl dla cut 0,20-35: registry.get(HIST("global/hFinalPtSpectrumEl"))->Fill(tmpPt[i]); - // tau - registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); - registryMC.add("tauMC/hMCpt", ";#it{p}_{T}^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 10.}}}); - - registryMC.add("tauMC/hMCdeltaeta", ";#Delta#eta^{#tau};events ", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCdeltaphi", ";#Delta#phi^{#tau}(deg.);events", {HistType::kTH1F, {{100, 131., 181}}}); - - // electron - registryMC.add("electronMC/hMCeta", ";#eta^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("electronMC/hMCy", ";y^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); - registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); - - // efficiency mu - registryMC.add("efficiencyMCMu/effiMu", ";Efficiency #mu3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); - registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); - - // efficiency pi - registryMC.add("efficiencyMCPi/effiPi", ";Efficiency #pi3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); - registryMC.add("efficiencyMCPi/hpTpi", ";p_{T}^{#pi, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); - - // efficiency el - registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); - registryMC.add("efficiencyMCEl/hpTelec", ";p_{T}^{e, gen} (GeV/c);events", {HistType::kTH1F, {axispt}}); - // efficiency el registryMC.add("efficiencyMCEl/hMCdeltaAlphaEpi", ";#Delta#alpha^{e-#pi(3x), gen} (rad);events", {HistType::kTH1F, {{100, -0.1, 3.2}}}); registryMC.add("efficiencyMCEl/hMCdeltaAlphaPiPi", ";#Delta#alpha^{#pi-#pi(3x), gen} (rad);events", {HistType::kTH1F, {{100, -0.1, 3.2}}}); @@ -1506,6 +1544,40 @@ struct TauTau13topo { registryMC.add("efficiencyMCEl/hMCinvmass3pi", ";M_{inv}^{3#pi true} (GeV/c^{2}) ;events", {HistType::kTH1F, {{100, 0.4, 2.4}}}); registryMC.add("efficiencyMCEl/hMCdeltaphi13", ";#Delta#phi^{1-3 true} ;events", {HistType::kTH1F, {{100, 0., 3.2}}}); + // histograms mass3pi vs acoponarity MC true + registry1MC.add("controlMCtrue/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + + // histograms mass3pi vs acoponarity MC comb + registry1MC.add("controlMCcomb/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + } // end of MC histograms processEfficiencyMCSG if (doprocessDoSkim) { @@ -1651,6 +1723,8 @@ struct TauTau13topo { registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hTPCnCrossedRows"))->Fill(nCRtpc); registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } // fill control histograms per track in MC true @@ -1671,6 +1745,8 @@ struct TauTau13topo { registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); // registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); registry1MC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry1MC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } // fill control histograms per track in MC true @@ -1691,6 +1767,8 @@ struct TauTau13topo { registryMC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); // registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); registry1MC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry1MC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } template @@ -1919,6 +1997,45 @@ struct TauTau13topo { return true; } + // check ITS clusters, how many -1,0,1,7 + 10 if 0,1,2 layers were fired + // analysis track quality check + template + int numberOfItsClustersCheck(T track) + { + if (!track.hasITS()) + return -1; + int nITSbits = 0; + int firstThreeLayers = 0; + uint32_t clusterSizes = track.itsClusterSizes(); + for (int layer = 0; layer < 7; layer++) { + if ((clusterSizes >> (layer * 4)) & 0xf) { + nITSbits++; + if (layer < 3) + firstThreeLayers++; + } + } // end of loop over ITS bits + if (firstThreeLayers == 3) + nITSbits += 10; + + return nITSbits; + } + + // RCT check + template + int isGoodRCTflag(C const& coll) + { + if (sgSelector.isCBTHadronZdcOk(coll)) + return 4; + else if (sgSelector.isCBTHadronOk(coll)) + return 3; + else if (sgSelector.isCBTZdcOk(coll)) + return 2; + else if (sgSelector.isCBTOk(coll)) + return 1; + else + return 0; + } + // using UDCollisionsFull = soa::Join; // using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; @@ -1930,9 +2047,6 @@ struct TauTau13topo { Filter pVContributorFilter = aod::udtrack::isPVContributor == true; using PVTracks = soa::Filtered; - // using LabeledTracks = soa::Join; - using LabeledTracks = soa::Join; - Preslice perCollision = aod::udtrack::udCollisionId; // PVContributors in MC handling // Filter pVContributorFilterMC = aod::udtrack::isPVContributor == true; // using PVTracksMC = soa::Filtered; @@ -3216,6 +3330,7 @@ struct TauTau13topo { // loop over MC particles for (const auto& mcParticle : mcParticles) { + // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); // primaries // if (mcParticle.isPhysicalPrimary()) { // countPrim++; @@ -3393,20 +3508,42 @@ struct TauTau13topo { } // end of processSimpleMCSG + // using LabeledTracks = soa::Join; + using LabeledTracks = soa::Join; + Preslice perCollision = aod::udtrack::udCollisionId; + // ZDC is not reproduced in MC, it is for a consistency + using FullMcUdCollisions = soa::Join; + // using FullMcUdCollisions = soa::Join; + // PresliceUnsorted colPerMcCollision = aod::udcollision::udMcCollisionId; + // PresliceUnsorted partPerMcCollision = aod::udmcparticle::udMcCollisionId; + void processEfficiencyMCSG(aod::UDMcCollision const& mcCollision, + // void processEfficiencyMCSG(aod::UDMcCollisions const& mcCollisions, // soa::SmallGroups> const& collisions, - soa::SmallGroups> const& collisions, + // soa::SmallGroups> const& collisions, + soa::SmallGroups const& collisions, + // FullMcUdCollisions const& collisionsFull, LabeledTracks const& tracks, aod::UDMcParticles const& mcParticles) + // aod::UDMcParticles const& mcParts) { + // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisionsFull.size()); + // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisions.size()); + + // loop over generated collisions + // for (const auto &mcCollision : mcCollisions) { + // LOGF(info, " Per mcCollision not sliced: UDMcParticles size %d, FullMcUdCollisions size %d", mcParts.size(), collisionsFull.size()); + if (verbose) { LOGF(info, " GeneratorIDtot %d", mcCollision.generatorsID()); // below is not implemented in UDMcCollisions // LOGF(info," GeneratorIDtot %d, GenID %d, subGenID %d, source %d", mcCollision.generatorsID(), mcCollision.getGeneratorId(), mcCollision.getSubGeneratorId(), mcCollision.getSourceId()); } + // registry1MC.get(HIST("globalMC/hGeneratorID"))->Fill(mcCollision.getGeneratorID()); registry1MC.get(HIST("globalMC/hGeneratorID"))->Fill(mcCollision.generatorsID()); registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(10., 1.); if (!(generatorIDMC < 0)) { // do not check generatorsID process if generatorIDMC < 0 + // if (mcCollision.getGeneratorID() != generatorIDMC) if (mcCollision.generatorsID() != generatorIDMC) return; } @@ -3426,11 +3563,21 @@ struct TauTau13topo { TLorentzVector tmp(0., 0., 0., 0.); + // get reconstructed collisions associated to generated collision + // auto const& collisions = collisionsFull.sliceBy(colPerMcCollision, mcCollision.globalIndex()); + // LOGF(info, " per mcCollisions sliced collisions.size %d", collisions.size()); + + // get MC particles associated to generated collision + // auto const& mcParticles = mcParts.sliceBy(partPerMcCollision, mcCollision.globalIndex()); + // LOGF(info, " per mcCollisions sliced mcParticles.size %d", mcParticles.size()); + for (const auto& mcParticle : mcParticles) { + // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); if (mcParticle.isPhysicalPrimary()) { if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); + // LOGF(info, " mcParticle has mother %d",mother.pdgCode()); tmp.SetPxPyPzE(mother.px(), mother.py(), mother.pz(), mother.e()); if (std::abs(mother.pdgCode()) == 15) { if (std::abs(rapidity(mother.e(), mother.pz())) > 0.9) @@ -3466,7 +3613,6 @@ struct TauTau13topo { } // has mothers } // charged particles } // end if isPhysicalPrimary - } // end loop over mcParticle registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(11., 1.); @@ -4816,6 +4962,8 @@ struct TauTau13topo { } // end of loop over collisions } // end of electron + 3pi + // } // end of loop over mcCollisions + } // end of processEfficiencyMCSG // skimming: only 4 tracks selection @@ -4845,7 +4993,7 @@ struct TauTau13topo { int nEtaIn15 = 0; int npT100 = 0; // int qtot = 0; - int16_t qtot = 0; + int8_t qtot = 0; TLorentzVector p; for (const auto& trk : PVContributors) { qtot += trk.sign(); @@ -4898,14 +5046,18 @@ struct TauTau13topo { return; registrySkim.get(HIST("skim/efficiency"))->Fill(7., 1.); + // RCT variable + int rct = 0; + rct = isGoodRCTflag(dgcand); + // // variables per track // int counterTmp = 0; float px[4], py[4], pz[4]; // int sign[4]; - // float dcaZ[4]; - // float dcaXY[4]; + float dcaZ[4]; + float dcaXY[4]; float tmpDedx[4]; float tmpTofNsigmaEl[4]; @@ -4922,8 +5074,12 @@ struct TauTau13topo { // float chi2TPC[4]; // float chi2ITS[4]; float chi2TOF[4] = {-1., -1., -1., -1.}; - // float nclTPCfind[4]; int nclTPCcrossedRows[4]; + int nclTPCfind[4]; + float nclTPCchi2[4]; + float trkITSchi2[4]; + int trkITScl[4]; + // double trkTime[4]; // float trkTimeRes[4]; float trkTofSignal[4]; @@ -4934,8 +5090,8 @@ struct TauTau13topo { py[counterTmp] = trk.py(); pz[counterTmp] = trk.pz(); // sign[counterTmp] = trk.sign(); - // dcaZ[counterTmp] = trk.dcaZ(); - // dcaXY[counterTmp] = trk.dcaXY(); + dcaZ[counterTmp] = trk.dcaZ(); + dcaXY[counterTmp] = trk.dcaXY(); tmpDedx[counterTmp] = trk.tpcSignal(); nSigmaEl[counterTmp] = trk.tpcNSigmaEl(); @@ -4958,6 +5114,11 @@ struct TauTau13topo { // nclTPCfind[counterTmp] = trk.tpcNClsFindable(); nclTPCcrossedRows[counterTmp] = trk.tpcNClsCrossedRows(); + nclTPCfind[counterTmp] = trk.tpcNClsFindable(); + nclTPCchi2[counterTmp] = trk.tpcChi2NCl(); + trkITSchi2[counterTmp] = trk.itsChi2NCl(); + trkITScl[counterTmp] = numberOfItsClustersCheck(trk); + // trkTime[counterTmp] = trk.trackTime(); // trkTimeRes[counterTmp] = trk.trackTimeRes(); counterTmp++; @@ -4967,6 +5128,7 @@ struct TauTau13topo { dgcand.globalBC(), // is it necessary dgtracks.size(), dgcand.numContrib(), + rct, // dgcand.posX(), dgcand.posY(), dgcand.posZ(), dgcand.flags(), @@ -4975,12 +5137,12 @@ struct TauTau13topo { energyZNA, energyZNC, qtot, dgcand.trs(), dgcand.trofs(), dgcand.hmpr(), // to test it - // dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), + dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), dgcand.totalFT0AmplitudeA(), dgcand.totalFT0AmplitudeC(), dgcand.totalFV0AmplitudeA(), // dgcand.timeFT0A(), dgcand.timeFT0C(), dgcand.timeFV0A(), px, py, pz, // sign, - // dcaXY, dcaZ, - nclTPCcrossedRows, + dcaXY, dcaZ, + nclTPCcrossedRows, nclTPCfind, nclTPCchi2, trkITSchi2, trkITScl, tmpDedx, nSigmaEl, nSigmaPi, nSigmaKa, nSigmaPr, nSigmaMu, trkTofSignal, tmpTofNsigmaEl, tmpTofNsigmaPi, tmpTofNsigmaKa, tmpTofNsigmaPr, tmpTofNsigmaMu, chi2TOF); From 8abbdafe1e664db674778913f8a10deec4fa0c86 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 31 Jul 2025 12:25:40 +0200 Subject: [PATCH 2/8] Avoid TLorentzVector and pdg magic numbers --- PWGUD/Tasks/upcTauTau13topo.cxx | 131 ++++++++++++++++++++------------ 1 file changed, 83 insertions(+), 48 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index 3051f1257e7..fde9482683f 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -24,7 +24,8 @@ // #include "TDatabasePDG.h" // not recommended in o2 #include "Framework/O2DatabasePDGPlugin.h" -#include "TLorentzVector.h" +// #include "TLorentzVector.h" +#include "Math/Vector4D.h" // #include "Common/DataModel/EventSelection.h" // #include "Common/DataModel/TrackSelectionTables.h" @@ -1635,7 +1636,14 @@ struct TauTau13topo { return std::sqrt(E * E - px * px - py * py - pz * pz); } - float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) + float energy(float px, float py, float pz, float mass) + // Just a simple function to return energy + { + return std::sqrt(px * px + py * py + pz * pz + mass * mass); + } + + // float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) + float calculateDeltaPhi(ROOT::Math::LorentzVector> p, ROOT::Math::LorentzVector> p1) { // float delta = p.Phi(); float delta = RecoDecay::constrainAngle(p.Phi()); @@ -2124,7 +2132,8 @@ struct TauTau13topo { int nEtaIn15 = 0; int nITSbits = -1; int npT100 = 0; - TLorentzVector p; + // TLorentzVector p; + ROOT::Math::LorentzVector> p; // auto const pionMass = MassPiPlus; // auto const electronMass = MassElectron; bool flagGlobalCheck = true; @@ -2133,7 +2142,8 @@ struct TauTau13topo { // loop over PV contributors for (const auto& trk : PVContributors) { qtot += trk.sign(); - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global/hTrackPtPV"))->Fill(p.Pt()); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 1.5 is a default @@ -2207,7 +2217,8 @@ struct TauTau13topo { registry.get(HIST("global1/hNTracks"))->Fill(dgtracks.size()); registry.get(HIST("global1/hNTracksPV"))->Fill(PVContributors.size()); for (const auto& trk : PVContributors) { - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global1/hTrackPtPV"))->Fill(p.Pt()); registry.get(HIST("global1/hTrackEtaPhiPV"))->Fill(p.Eta(), p.Phi()); } @@ -2367,23 +2378,27 @@ struct TauTau13topo { // 12 34 | 01 23 |//1 //6 | 0 5 |counter<3?counter:5-counter counter<3?0:1 // 13 24 | 02 13 |//2 //5 | 1 4 | // 14 23 | 03 12 |//3 //4 | 2 3 | - TLorentzVector p1, p2; - TLorentzVector gammaPair[3][2]; - float invMass2El[3][2]; + // TLorentzVector p1, p2; + ROOT::Math::LorentzVector> p1, p2; + // TLorentzVector gammaPair[3][2]; + ROOT::Math::LorentzVector> gammaPair[3][2]; + float invMass2El[3][2]; // inv. mass squared int counterTmp = 0; bool flagIMGam2ePV[4] = {true, true, true, true}; for (const auto& trk : PVContributors) { - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassElectron)); for (const auto& trk1 : PVContributors) { if (trk.index() >= trk1.index()) continue; if (trk1.hasTPC()) nPiHasTPC[trk.index()]++; - p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); - invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).Mag2(); + // p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); + p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), energy(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); + invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).mag2(); gammaPair[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1); - registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).Mag2()); + registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).mag2()); counterTmp++; if ((p + p1).M() < 0.015) { flagIMGam2ePV[trk.index()] = false; @@ -2393,15 +2408,17 @@ struct TauTau13topo { } // end of loop over PVContributors // first loop to add all the tracks together - p = TLorentzVector(0., 0., 0., 0.); + // p = TLorentzVector(0., 0., 0., 0.); + p.SetXYZT(0., 0., 0., 0.); for (const auto& trk : PVContributors) { - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); p += p1; scalarPtsum += trk.pt(); } // end of loop over PVContributors float pttot = p.Pt(); - float mass4pi = p.Mag(); + float mass4pi = p.mag(); TVector3 v1(0, 0, 0); TVector3 vtmp(0, 0, 0); @@ -2423,9 +2440,11 @@ struct TauTau13topo { registry.get(HIST("global/hTrkCheck"))->Fill(tmpTrkCheck); // inv mass of 3pi + 1e - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p2.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); - mass3pi1e[counterTmp] = (p - p1 + p2).Mag(); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + // p2.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + p2.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassElectron)); + mass3pi1e[counterTmp] = (p - p1 + p2).mag(); v1.SetXYZ(trk.px(), trk.py(), trk.pz()); for (const auto& trk1 : PVContributors) { @@ -2472,14 +2491,15 @@ struct TauTau13topo { trkTime[counterTmp] = trk.trackTime(); trkTimeRes[counterTmp] = trk.trackTimeRes(); - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(),MassPiPlus)); tmpMomentum[counterTmp] = p1.P(); tmpPt[counterTmp] = p1.Pt(); tmpDedx[counterTmp] = trk.tpcSignal(); tmpTofNsigmaEl[counterTmp] = trk.tofNSigmaEl(); deltaPhiTmp = calculateDeltaPhi(p - p1, p1); - pi3invMass[counterTmp] = (p - p1).Mag(); + pi3invMass[counterTmp] = (p - p1).mag(); pi3pt[counterTmp] = (p - p1).Pt(); pi3deltaPhi[counterTmp] = deltaPhiTmp; pi3assymav[counterTmp] = (p1.Pt() - (scalarPtsum - p1.Pt()) / 3.) / (p1.Pt() + (scalarPtsum - p1.Pt()) / 3.); @@ -3342,7 +3362,8 @@ struct TauTau13topo { countGen++; if (mcParticle.isPhysicalPrimary()) { countBoth++; - if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { countCharged++; registryMC.get(HIST("globalMC/hMCetaGen"))->Fill(mcParticle.eta()); @@ -3352,7 +3373,8 @@ struct TauTau13topo { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); - if (std::abs(mother.pdgCode()) == 15) { + // if (std::abs(mother.pdgCode()) == 15) { + if (std::abs(mother.pdgCode()) == kTauMinus) { countChargedFromTau++; } // mother is tau } // mc particle has mother @@ -3363,7 +3385,8 @@ struct TauTau13topo { // // tau+/- // - if (std::abs(mcParticle.pdgCode()) == 15) { // tau+/- + // if (std::abs(mcParticle.pdgCode()) == 15) { // tau+/- + if (std::abs(mcParticle.pdgCode()) == kTauMinus) { // 15 = tau+/- countTau++; if (countTau <= 2) { etaTau[countTau - 1] = mcParticle.eta(); @@ -3380,15 +3403,15 @@ struct TauTau13topo { if (mcParticle.has_daughters()) { for (const auto& daughter : mcParticle.daughters_as()) { // pions from tau - if (std::abs(daughter.pdgCode()) == 211) { // 211 = pi+ + if (std::abs(daughter.pdgCode()) == kPiPlus) { // 211 = pi+ pionCounter++; tmpPionIndex = daughter.index(); // returns index of daughter of tau, not in the event, not in the MC particles if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of pion check // electron from tau - if (std::abs(daughter.pdgCode()) == 11) { // 11 = electron - if (daughter.pdgCode() == 11) + if (std::abs(daughter.pdgCode()) == kElectron) { // 11 = electron + if (daughter.pdgCode() == kElectron) flagElPlusElMinus = true; registryMC.get(HIST("electronMC/hMCeta"))->Fill(daughter.eta()); registryMC.get(HIST("electronMC/hMCphi"))->Fill(daughter.phi()); @@ -3403,8 +3426,8 @@ struct TauTau13topo { partFromTauInEta = false; } // end of electron check // muon from tau - if (std::abs(daughter.pdgCode()) == 13) { - if (daughter.pdgCode() == 13) + if (std::abs(daughter.pdgCode()) == kMuonMinus) { // 13 + if (daughter.pdgCode() == kMuonMinus) // 13 flagMuPlusMuMinus = true; muonFound = !muonFound; partPt = static_cast(daughter.pt()); @@ -3420,7 +3443,7 @@ struct TauTau13topo { singlePionFound = true; singlePionIndex = tmpPionIndex; auto mcPartTmp = mcParticle.daughters_as().begin() + singlePionIndex; - if (mcPartTmp.pdgCode() == -211) + if (mcPartTmp.pdgCode() == kPiMinus) // -211 flagPiPlusPiMinus = true; partPt = static_cast(mcPartTmp.pt()); // motherOfSinglePionIndex = mcParticle.index(); @@ -3561,7 +3584,8 @@ struct TauTau13topo { bool tauInRapidity = true; bool partFromTauInEta = true; - TLorentzVector tmp(0., 0., 0., 0.); + // TLorentzVector tmp(0., 0., 0., 0.); + ROOT::Math::LorentzVector> tmp(0., 0., 0., 0.); // get reconstructed collisions associated to generated collision // auto const& collisions = collisionsFull.sliceBy(colPerMcCollision, mcCollision.globalIndex()); @@ -3574,12 +3598,13 @@ struct TauTau13topo { for (const auto& mcParticle : mcParticles) { // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); if (mcParticle.isPhysicalPrimary()) { - if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); // LOGF(info, " mcParticle has mother %d",mother.pdgCode()); tmp.SetPxPyPzE(mother.px(), mother.py(), mother.pz(), mother.e()); - if (std::abs(mother.pdgCode()) == 15) { + if (std::abs(mother.pdgCode()) == kTauMinus) { // 15 if (std::abs(rapidity(mother.e(), mother.pz())) > 0.9) // if (std::abs(tmp.Rapidity()) > 0.9) tauInRapidity = false; @@ -3587,10 +3612,10 @@ struct TauTau13topo { // if (std::abs(tmp.Eta()) > 0.9) partFromTauInEta = false; - if (std::abs(mcParticle.pdgCode()) == 11) { + if (std::abs(mcParticle.pdgCode()) == kElectron) { // 11 index1ProngMC = mcParticle.index(); is1ProngElectronMC = true; - } else if (std::abs(mcParticle.pdgCode()) == 13) { + } else if (std::abs(mcParticle.pdgCode()) == kMuonMinus) { // 13 index1ProngMC = mcParticle.index(); // is1ProngMuonMC = true; } @@ -3638,10 +3663,10 @@ struct TauTau13topo { // // motherIndex[i] = (tmpMC.mothers_first_as()).globalIndex(); // } int motherIndex1Pi = motherIndex[0]; - int motherIndexNew = -1; + int motherIndexNew = 3; // was -1 int nDifferences = 0; for (int i = 1; i < 4; i++) { - if (motherIndex1Pi != motherIndex[i]) { // the same mother index + if (motherIndex1Pi != motherIndex[i]) { // the same mother (tau) index nDifferences++; motherIndexNew = i; } @@ -3654,7 +3679,7 @@ struct TauTau13topo { // if (!onlyPi) LOGF(info, "ERROR: should be 4 pions, but they are not!"); } // end of special check for pi + 3pi - int index3ProngMC[3]; + int index3ProngMC[3] = {0, 0, 0}; // initialised of request if (index1ProngMC > 0) { // electron or muon case + 3pi int index3pi = 0; for (int i = 0; i < 4; i++) { @@ -3673,7 +3698,8 @@ struct TauTau13topo { auto const& tmpPion2MC = mcParticles.begin() + index3ProngMC[1]; auto const& tmpPion3MC = mcParticles.begin() + index3ProngMC[2]; - if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) + //if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) + if (std::abs(tmpPion1MC.pdgCode()) == kPiPlus && std::abs(tmpPion2MC.pdgCode()) == kPiPlus && std::abs(tmpPion3MC.pdgCode()) == kPiPlus) // 211 211 211 is3prong3PiMC = true; // @@ -4003,8 +4029,10 @@ struct TauTau13topo { registryMC.get(HIST("global1MCrec/hNTracks"))->Fill(groupedTracks.size()); registryMC.get(HIST("global1MCrec/hNTracksPV"))->Fill(nPVTracks); - TLorentzVector p, p1; - p.SetXYZM(0., 0., 0., 0.); + // TLorentzVector p, p1; + ROOT::Math::LorentzVector> p, p1; + // p.SetXYZM(0., 0., 0., 0.); + p.SetXYZT(0., 0., 0., 0.); TVector3 v1(0, 0, 0); TVector3 v2(0, 0, 0); float scalarPtsum = 0; @@ -4038,10 +4066,13 @@ struct TauTau13topo { float tmpPhiData = phi(tmptrack.px(), tmptrack.py()); registryMC.get(HIST("global1MCrec/hTrackEtaPhiPV"))->Fill(tmpEtaData, tmpPhiData); registryMC.get(HIST("global1MCrec/hTrackPtPV"))->Fill(tmptrack.pt()); - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); + // p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron))); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 float tmpPt = pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); float tmpEta = eta(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()); float tmpPhi = phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); @@ -4156,7 +4187,7 @@ struct TauTau13topo { // // temporary control variables per event with combinatorics float pttot = p.Pt(); - float mass4pi = p.Mag(); + float mass4pi = p.mag(); int counterTmp = 0; float nSigmaEl[4]; @@ -4199,9 +4230,11 @@ struct TauTau13topo { auto const tmptrack = groupedTracks.begin() + trackId[i]; // if (tmptrack.hasTOF()) trkHasTof[i] = true; v1.SetXYZ(tmptrack.px(), tmptrack.py(), tmptrack.pz()); - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); } nSigmaEl[counterTmp] = tmptrack.tpcNSigmaEl(); @@ -4243,7 +4276,7 @@ struct TauTau13topo { tmpTofNsigmaEl[counterTmp] = tmptrack.tofNSigmaEl(); deltaPhiTmp = calculateDeltaPhi(p - p1, p1); - pi3invMass[counterTmp] = (p - p1).Mag(); + pi3invMass[counterTmp] = (p - p1).mag(); pi3pt[counterTmp] = (p - p1).Pt(); pi3deltaPhi[counterTmp] = deltaPhiTmp; pi3assymav[counterTmp] = (p1.Pt() - (scalarPtsum - p1.Pt()) / 3.) / (p1.Pt() + (scalarPtsum - p1.Pt()) / 3.); @@ -4994,10 +5027,12 @@ struct TauTau13topo { int npT100 = 0; // int qtot = 0; int8_t qtot = 0; - TLorentzVector p; + // TLorentzVector p; + ROOT::Math::LorentzVector> p; for (const auto& trk : PVContributors) { qtot += trk.sign(); - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 0.9 is a default if (trk.pt() > 0.1) From 3761d617068c4a341644a657c7e82a84dcbab567 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 31 Jul 2025 12:29:21 +0200 Subject: [PATCH 3/8] Correct whitespaces --- PWGUD/Tasks/upcTauTau13topo.cxx | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index fde9482683f..43f0b0a9c75 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -1641,7 +1641,7 @@ struct TauTau13topo { { return std::sqrt(px * px + py * py + pz * pz + mass * mass); } - + // float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) float calculateDeltaPhi(ROOT::Math::LorentzVector> p, ROOT::Math::LorentzVector> p1) { @@ -2395,7 +2395,7 @@ struct TauTau13topo { if (trk1.hasTPC()) nPiHasTPC[trk.index()]++; // p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); - p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), energy(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); + p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), energy(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).mag2(); gammaPair[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1); registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).mag2()); @@ -2492,7 +2492,7 @@ struct TauTau13topo { trkTimeRes[counterTmp] = trk.trackTimeRes(); // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(),MassPiPlus)); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); tmpMomentum[counterTmp] = p1.P(); tmpPt[counterTmp] = p1.Pt(); tmpDedx[counterTmp] = trk.tpcSignal(); @@ -3363,7 +3363,7 @@ struct TauTau13topo { if (mcParticle.isPhysicalPrimary()) { countBoth++; // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { - if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { countCharged++; registryMC.get(HIST("globalMC/hMCetaGen"))->Fill(mcParticle.eta()); @@ -3374,7 +3374,7 @@ struct TauTau13topo { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); // if (std::abs(mother.pdgCode()) == 15) { - if (std::abs(mother.pdgCode()) == kTauMinus) { + if (std::abs(mother.pdgCode()) == kTauMinus) { countChargedFromTau++; } // mother is tau } // mc particle has mother @@ -3427,7 +3427,7 @@ struct TauTau13topo { } // end of electron check // muon from tau if (std::abs(daughter.pdgCode()) == kMuonMinus) { // 13 - if (daughter.pdgCode() == kMuonMinus) // 13 + if (daughter.pdgCode() == kMuonMinus) // 13 flagMuPlusMuMinus = true; muonFound = !muonFound; partPt = static_cast(daughter.pt()); @@ -3599,7 +3599,7 @@ struct TauTau13topo { // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); if (mcParticle.isPhysicalPrimary()) { // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { - if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); // LOGF(info, " mcParticle has mother %d",mother.pdgCode()); @@ -3679,8 +3679,8 @@ struct TauTau13topo { // if (!onlyPi) LOGF(info, "ERROR: should be 4 pions, but they are not!"); } // end of special check for pi + 3pi - int index3ProngMC[3] = {0, 0, 0}; // initialised of request - if (index1ProngMC > 0) { // electron or muon case + 3pi + int index3ProngMC[3] = {0, 0, 0}; // initialised of request + if (index1ProngMC > 0) { // electron or muon case + 3pi int index3pi = 0; for (int i = 0; i < 4; i++) { if (index1ProngMC == indexProngMC[i]) @@ -3698,7 +3698,7 @@ struct TauTau13topo { auto const& tmpPion2MC = mcParticles.begin() + index3ProngMC[1]; auto const& tmpPion3MC = mcParticles.begin() + index3ProngMC[2]; - //if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) + // if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) if (std::abs(tmpPion1MC.pdgCode()) == kPiPlus && std::abs(tmpPion2MC.pdgCode()) == kPiPlus && std::abs(tmpPion3MC.pdgCode()) == kPiPlus) // 211 211 211 is3prong3PiMC = true; @@ -4030,9 +4030,9 @@ struct TauTau13topo { registryMC.get(HIST("global1MCrec/hNTracksPV"))->Fill(nPVTracks); // TLorentzVector p, p1; - ROOT::Math::LorentzVector> p, p1; + ROOT::Math::LorentzVector> p, p1; // p.SetXYZM(0., 0., 0., 0.); - p.SetXYZT(0., 0., 0., 0.); + p.SetXYZT(0., 0., 0., 0.); TVector3 v1(0, 0, 0); TVector3 v2(0, 0, 0); float scalarPtsum = 0; @@ -4067,12 +4067,12 @@ struct TauTau13topo { registryMC.get(HIST("global1MCrec/hTrackEtaPhiPV"))->Fill(tmpEtaData, tmpPhiData); registryMC.get(HIST("global1MCrec/hTrackPtPV"))->Fill(tmptrack.pt()); // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); - // p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron))); - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 + // p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron))); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 float tmpPt = pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); float tmpEta = eta(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()); float tmpPhi = phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); @@ -4231,10 +4231,10 @@ struct TauTau13topo { // if (tmptrack.hasTOF()) trkHasTof[i] = true; v1.SetXYZ(tmptrack.px(), tmptrack.py(), tmptrack.pz()); // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); } nSigmaEl[counterTmp] = tmptrack.tpcNSigmaEl(); From fdfcb0dda4d4734d54983bd7ec1c938a66d2f860 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 31 Jul 2025 16:29:13 +0200 Subject: [PATCH 4/8] Moved to RecoDecoy methods --- PWGUD/Tasks/upcTauTau13topo.cxx | 147 ++++++++++++++++---------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index 43f0b0a9c75..b3ff71675cc 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -1587,31 +1587,31 @@ struct TauTau13topo { } // end of init method - float eta(float px, float py, float pz) - // Just a simple function to return pseudorapidity - { - float arg = -2.; // outside valid range for std::atanh - float mom = std::sqrt(px * px + py * py + pz * pz); - if (mom != 0) - arg = pz / mom; - if (-1. < arg && arg < 1.) - return std::atanh(arg); // definition of eta - return -999.; - } + // float eta(float px, float py, float pz) + // // Just a simple function to return pseudorapidity + // { + // float arg = -2.; // outside valid range for std::atanh + // float mom = std::sqrt(px * px + py * py + pz * pz); + // if (mom != 0) + // arg = pz / mom; + // if (-1. < arg && arg < 1.) + // return std::atanh(arg); // definition of eta + // return -999.; + // } - float phi(float px, float py) - // Just a simple function to return azimuthal angle from 0 to 2pi - { - if (px != 0) - return (std::atan2(py, px) + o2::constants::math::PI); - return -999.; - } + // float phi(float px, float py) + // // Just a simple function to return azimuthal angle from 0 to 2pi + // { + // if (px != 0) + // return (std::atan2(py, px) + o2::constants::math::PI); + // return -999.; + // } - float pt(float px, float py) - // Just a simple function to return pt - { - return std::sqrt(px * px + py * py); - } + // float pt(float px, float py) + // // Just a simple function to return pt + // { + // return std::sqrt(px * px + py * py); + // } float rapidity(float energy, float pz) // Just a simple function to return track rapidity @@ -1630,17 +1630,11 @@ struct TauTau13topo { return angle; } - float invariantMass(float E, float px, float py, float pz) - // Just a simple function to return invariant mass - { - return std::sqrt(E * E - px * px - py * py - pz * pz); - } - - float energy(float px, float py, float pz, float mass) - // Just a simple function to return energy - { - return std::sqrt(px * px + py * py + pz * pz + mass * mass); - } + // float invariantMass(float E, float px, float py, float pz) + // // Just a simple function to return invariant mass + // { + // return std::sqrt(E * E - px * px - py * py - pz * pz); + // } // float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) float calculateDeltaPhi(ROOT::Math::LorentzVector> p, ROOT::Math::LorentzVector> p1) @@ -1696,8 +1690,10 @@ struct TauTau13topo { // helper function to calculate scalar asymmetry float scalarAsymMC(auto particle1, auto particle2) { - auto pt1 = pt(particle1.px(), particle1.py()); - auto pt2 = pt(particle2.px(), particle2.py()); + // auto pt1 = pt(particle1.px(), particle1.py()); + auto pt1 = RecoDecay::pt(particle1.px(), particle1.py()); + // auto pt2 = pt(particle2.px(), particle2.py()); + auto pt2 = RecoDecay::pt(particle2.px(), particle2.py()); auto delta = pt1 - pt2; return std::abs(delta) / (pt1 + pt2); } @@ -1864,7 +1860,7 @@ struct TauTau13topo { } else { isGlobalTrack = false; } - if (std::abs(eta(track.px(), track.py(), track.pz())) < 0.8) { + if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) < 0.8) { registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(8., 1.); } else { isGlobalTrack = false; @@ -2143,7 +2139,7 @@ struct TauTau13topo { for (const auto& trk : PVContributors) { qtot += trk.sign(); // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global/hTrackPtPV"))->Fill(p.Pt()); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 1.5 is a default @@ -2218,7 +2214,8 @@ struct TauTau13topo { registry.get(HIST("global1/hNTracksPV"))->Fill(PVContributors.size()); for (const auto& trk : PVContributors) { // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + // p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global1/hTrackPtPV"))->Fill(p.Pt()); registry.get(HIST("global1/hTrackEtaPhiPV"))->Fill(p.Eta(), p.Phi()); } @@ -2388,14 +2385,14 @@ struct TauTau13topo { for (const auto& trk : PVContributors) { // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); - p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassElectron)); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassElectron)); for (const auto& trk1 : PVContributors) { if (trk.index() >= trk1.index()) continue; if (trk1.hasTPC()) nPiHasTPC[trk.index()]++; // p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); - p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), energy(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); + p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), RecoDecay::e(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).mag2(); gammaPair[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1); registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).mag2()); @@ -2412,7 +2409,7 @@ struct TauTau13topo { p.SetXYZT(0., 0., 0., 0.); for (const auto& trk : PVContributors) { // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); p += p1; scalarPtsum += trk.pt(); } // end of loop over PVContributors @@ -2441,9 +2438,9 @@ struct TauTau13topo { // inv mass of 3pi + 1e // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); // p2.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); - p2.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassElectron)); + p2.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassElectron)); mass3pi1e[counterTmp] = (p - p1 + p2).mag(); v1.SetXYZ(trk.px(), trk.py(), trk.pz()); @@ -2492,7 +2489,7 @@ struct TauTau13topo { trkTimeRes[counterTmp] = trk.trackTimeRes(); // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p1.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); tmpMomentum[counterTmp] = p1.P(); tmpPt[counterTmp] = p1.Pt(); tmpDedx[counterTmp] = trk.tpcSignal(); @@ -3608,7 +3605,7 @@ struct TauTau13topo { if (std::abs(rapidity(mother.e(), mother.pz())) > 0.9) // if (std::abs(tmp.Rapidity()) > 0.9) tauInRapidity = false; - if (std::abs(eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())) > 0.9) + if (std::abs(RecoDecay::eta(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()})) > 0.9) // if (std::abs(tmp.Eta()) > 0.9) partFromTauInEta = false; @@ -3629,10 +3626,10 @@ struct TauTau13topo { } count++; if (collisions.size() > 0) { - registryMC.get(HIST("globalMCrec/hMCetaGenCol"))->Fill(eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); - registryMC.get(HIST("globalMCrec/hMCphiGenCol"))->Fill(phi(mcParticle.px(), mcParticle.py())); + registryMC.get(HIST("globalMCrec/hMCetaGenCol"))->Fill(RecoDecay::eta(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()})); + registryMC.get(HIST("globalMCrec/hMCphiGenCol"))->Fill(RecoDecay::phi(mcParticle.px(), mcParticle.py())); registryMC.get(HIST("globalMCrec/hMCyGenCol"))->Fill(rapidity(mcParticle.e(), mcParticle.pz())); - registryMC.get(HIST("globalMCrec/hMCptGenCol"))->Fill(pt(mcParticle.px(), mcParticle.py())); + registryMC.get(HIST("globalMCrec/hMCptGenCol"))->Fill(RecoDecay::pt(mcParticle.px(), mcParticle.py())); } } // mother is tau } // has mothers @@ -3719,13 +3716,13 @@ struct TauTau13topo { registryMC.get(HIST("efficiencyMCEl/hMCdeltaAlphaEpi"))->Fill(deltaAlpha2); registryMC.get(HIST("efficiencyMCEl/hMCdeltaAlphaEpi"))->Fill(deltaAlpha3); // - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion1MC.px(), tmpPion1MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion2MC.px(), tmpPion2MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); // - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion1MC.px(), tmpPion1MC.py()), phi(tmpPion2MC.px(), tmpPion2MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion1MC.px(), tmpPion1MC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion2MC.px(), tmpPion2MC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()), RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); // auto deltaAlphaPi1 = deltaAlpha(tmpPion1MC, tmpPion2MC); @@ -3738,13 +3735,13 @@ struct TauTau13topo { float energyInCone = 0; float angleLimit = 0.5; if (deltaAlpha1 < angleLimit) { - energyInCone += pt(tmpPion1MC.px(), tmpPion1MC.py()); + energyInCone += RecoDecay::pt(tmpPion1MC.px(), tmpPion1MC.py()); } if (deltaAlpha2 < angleLimit) { - energyInCone += pt(tmpPion2MC.px(), tmpPion2MC.py()); + energyInCone += RecoDecay::pt(tmpPion2MC.px(), tmpPion2MC.py()); } if (deltaAlpha3 < angleLimit) { - energyInCone += pt(tmpPion3MC.px(), tmpPion3MC.py()); + energyInCone += RecoDecay::pt(tmpPion3MC.px(), tmpPion3MC.py()); } registryMC.get(HIST("efficiencyMCEl/hMCvirtCal"))->Fill(energyInCone); // @@ -3757,17 +3754,19 @@ struct TauTau13topo { registryMC.get(HIST("efficiencyMCEl/hMCVector"))->Fill(vectorAsym(tmp1ProngMC, tmpPion3MC)); // add eta phi - registryMC.get(HIST("efficiencyMCEl/hMCptEl"))->Fill(pt(tmp1ProngMC.px(), tmp1ProngMC.py())); + registryMC.get(HIST("efficiencyMCEl/hMCptEl"))->Fill(RecoDecay::pt(tmp1ProngMC.px(), tmp1ProngMC.py())); float px3pi = tmpPion1MC.px() + tmpPion2MC.px() + tmpPion3MC.px(); float py3pi = tmpPion1MC.py() + tmpPion2MC.py() + tmpPion3MC.py(); float pz3pi = tmpPion1MC.pz() + tmpPion2MC.pz() + tmpPion3MC.pz(); float en3pi = tmpPion1MC.e() + tmpPion2MC.e() + tmpPion3MC.e(); - registryMC.get(HIST("efficiencyMCEl/hMCpt4trk"))->Fill(pt(tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(invariantMass(tmp1ProngMC.e() + en3pi, tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi, tmp1ProngMC.pz() + pz3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(invariantMass(en3pi, px3pi, py3pi, pz3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaphi13"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(px3pi, py3pi))); + registryMC.get(HIST("efficiencyMCEl/hMCpt4trk"))->Fill(RecoDecay::pt(tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi)); + // registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(invariantMass(tmp1ProngMC.e() + en3pi, tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi, tmp1ProngMC.pz() + pz3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(RecoDecay::m(std::array{(tmp1ProngMC.px() + px3pi), (tmp1ProngMC.py() + py3pi), (tmp1ProngMC.pz() + pz3pi)}, (tmp1ProngMC.e() + en3pi))); + // registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(invariantMass(en3pi, px3pi, py3pi, pz3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(RecoDecay::m(std::array{px3pi, py3pi, pz3pi}, en3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaphi13"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(px3pi, py3pi))); // reconstructed event if (collisions.size() < 1) @@ -3896,7 +3895,7 @@ struct TauTau13topo { nPVTracks++; trackCharge += track.sign(); // if (std::abs(eta(track.px(),track.py(),track.pz())) >= trkEtacut) allInEtaAcceptance = false; - if (std::abs(eta(track.px(), track.py(), track.pz())) < trkEtacut) + if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) < trkEtacut) nTrkInEtaRange++; if (track.pt() > 0.1) nTrkAbovePtThreshold++; @@ -4062,20 +4061,20 @@ struct TauTau13topo { flagVcalPV[i] = true; } } // end of second loop - float tmpEtaData = eta(tmptrack.px(), tmptrack.py(), tmptrack.pz()); - float tmpPhiData = phi(tmptrack.px(), tmptrack.py()); + float tmpEtaData = RecoDecay::eta(std::array{tmptrack.px(), tmptrack.py(), tmptrack.pz()}); + float tmpPhiData = RecoDecay::phi(tmptrack.px(), tmptrack.py()); registryMC.get(HIST("global1MCrec/hTrackEtaPhiPV"))->Fill(tmpEtaData, tmpPhiData); registryMC.get(HIST("global1MCrec/hTrackPtPV"))->Fill(tmptrack.pt()); // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); // p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron))); - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 - float tmpPt = pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); - float tmpEta = eta(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()); - float tmpPhi = phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 + float tmpPt = RecoDecay::pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); + float tmpEta = RecoDecay::eta(std::array{tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()}); + float tmpPhi = RecoDecay::phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); registryMC.get(HIST("global1MCrec/hpTGenRecTracksPV"))->Fill(tmptrack.pt(), tmpPt); registryMC.get(HIST("global1MCrec/hDeltapTGenRecVsRecpTTracksPV"))->Fill(tmptrack.pt() - tmpPt, tmptrack.pt()); registryMC.get(HIST("global1MCrec/hEtaGenRecTracksPV"))->Fill(tmpEtaData, tmpEta); @@ -4231,10 +4230,10 @@ struct TauTau13topo { // if (tmptrack.hasTOF()) trkHasTof[i] = true; v1.SetXYZ(tmptrack.px(), tmptrack.py(), tmptrack.pz()); // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); - p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); } nSigmaEl[counterTmp] = tmptrack.tpcNSigmaEl(); @@ -5032,7 +5031,7 @@ struct TauTau13topo { for (const auto& trk : PVContributors) { qtot += trk.sign(); // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 0.9 is a default if (trk.pt() > 0.1) From 1b51f2db904df3a101cb3be33b75818c758d8b6b Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 7 Aug 2025 10:06:59 +0200 Subject: [PATCH 5/8] Avoid magic numbers and minior changes --- PWGUD/Core/SGSelector.h | 30 ++++++++++++++--------- PWGUD/TableProducer/SGCandProducer.cxx | 34 +++++++++++++------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index b9fc3ecf2e7..91206a6bc8a 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -41,7 +41,10 @@ enum TrueGap : int { NoGap = -1, SingleGapA = 0, SingleGapC = 1, - DoubleGap = 2 + DoubleGap = 2, + NoUpc = 3, + TrkOutOfRange = 4, + BadDoubleGap = 5 }; } @@ -65,7 +68,7 @@ class SGSelector SelectionResult result; result.bc = &oldbc; if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) { - result.value = 4; + result.value = o2::aod::sgselector::TrkOutOfRange; // 4 return result; } auto newbc = oldbc; @@ -91,9 +94,9 @@ class SGSelector newbc = bc; gC = false; } - } + } // end of loop over bc range if (!gA && !gC) { - result.value = 3; + result.value = o2::aod::sgselector::NoUpc; // gap = 3 return result; } if (gA && gC) { // loop once again for so-called DG events to get the most active FT0 BC @@ -120,7 +123,8 @@ class SGSelector result.bc = &newbc; // LOGF(info, "Old BC: %i, New BC: %i",oldbc.globalBC(), newbc.globalBC()); result.bc = &newbc; - result.value = gA && gC ? 2 : (gA ? 0 : 1); + // result.value = gA && gC ? 2 : (gA ? 0 : 1); + result.value = gA && gC ? o2::aod::sgselector::DoubleGap : (gA ? o2::aod::sgselector::SingleGapA : o2::aod::sgselector::SingleGapC); return result; } template @@ -139,12 +143,12 @@ class SGSelector float fit_cut[3] = {fv0, ft0a, ft0c}; int gap = collision.gapSide(); int true_gap = gap; - float FV0A, FT0A, FT0C, ZNA, ZNC; - FV0A = collision.totalFV0AmplitudeA(); - FT0A = collision.totalFT0AmplitudeA(); - FT0C = collision.totalFT0AmplitudeC(); - ZNA = collision.energyCommonZNA(); - ZNC = collision.energyCommonZNC(); + // float FV0A, FT0A, FT0C, ZNA, ZNC; + const float FV0A = collision.totalFV0AmplitudeA(); + const float FT0A = collision.totalFT0AmplitudeA(); + const float FT0C = collision.totalFT0AmplitudeC(); + const float ZNA = collision.energyCommonZNA(); + const float ZNC = collision.energyCommonZNC(); if (gap == o2::aod::sgselector::SingleGapA) { // gap == 0 if (FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) true_gap = o2::aod::sgselector::NoGap; // -1 @@ -160,8 +164,10 @@ class SGSelector true_gap = o2::aod::sgselector::SingleGapA; // 0 else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut) true_gap = o2::aod::sgselector::DoubleGap; // 2 - else + else { LOGF(info, "Something wrong with DG"); + true_gap = o2::aod::sgselector::BadDoubleGap; // 5 + } } return true_gap; } diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index 37fba3120db..df466cb95b3 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -217,8 +217,8 @@ struct SGCandProducer { // Cross sections in ub. Using dummy -1 if lumi estimator is not reliable float csTCE = 10.36e6; - float csZEM = 415.2e6; // see AN: https://alice-notes.web.cern.ch/node/1515 - float csZNC = 214.5e6; // see AN: https://alice-notes.web.cern.ch/node/1515 + const float csZEM = 415.2e6; // see AN: https://alice-notes.web.cern.ch/node/1515 + const float csZNC = 214.5e6; // see AN: https://alice-notes.web.cern.ch/node/1515 if (runNumber > 543437 && runNumber < 543514) { csTCE = 8.3e6; } @@ -326,14 +326,14 @@ struct SGCandProducer { getHist(TH1, histdir + "/Stat")->Fill(8., 1.); // - int trs = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) ? 1 : 0; - int trofs = collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard) ? 1 : 0; - int hmpr = collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof) ? 1 : 0; - int tfb = collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) ? 1 : 0; - int itsROFb = collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) ? 1 : 0; - int sbp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup) ? 1 : 0; - int zVtxFT0vPv = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) ? 1 : 0; - int vtxITSTPC = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC) ? 1 : 0; + const int trs = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) ? 1 : 0; + const int trofs = collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard) ? 1 : 0; + const int hmpr = collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof) ? 1 : 0; + const int tfb = collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) ? 1 : 0; + const int itsROFb = collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) ? 1 : 0; + const int sbp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup) ? 1 : 0; + const int zVtxFT0vPv = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) ? 1 : 0; + const int vtxITSTPC = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC) ? 1 : 0; auto bc = collision.template foundBC_as(); double ir = 0.; const uint64_t ts = bc.timestamp(); @@ -363,14 +363,14 @@ struct SGCandProducer { return; } upchelpers::FITInfo fitInfo{}; - uint8_t chFT0A = 0; - uint8_t chFT0C = 0; - uint8_t chFDDA = 0; - uint8_t chFDDC = 0; - uint8_t chFV0A = 0; - int occ = collision.trackOccupancyInTimeRange(); + const uint8_t chFT0A = 0; + const uint8_t chFT0C = 0; + const uint8_t chFDDA = 0; + const uint8_t chFDDC = 0; + const uint8_t chFV0A = 0; + const int occ = collision.trackOccupancyInTimeRange(); udhelpers::getFITinfo(fitInfo, newbc, bcs, ft0s, fv0as, fdds); - int upc_flag = (collision.flags() & dataformats::Vertex>::Flags::UPCMode) ? 1 : 0; + const int upc_flag = (collision.flags() & dataformats::Vertex>::Flags::UPCMode) ? 1 : 0; // update SG candidates tables outputCollisions(bc.globalBC(), bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), upc_flag, From da1001b3c73a9116a703dfb03f92e2f1261ae1e7 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Thu, 7 Aug 2025 10:47:13 +0200 Subject: [PATCH 6/8] Megalinter corrections --- PWGUD/Core/SGSelector.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index 91206a6bc8a..662707b4aab 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -46,7 +46,7 @@ enum TrueGap : int { TrkOutOfRange = 4, BadDoubleGap = 5 }; -} +} // namespace o2::aod::sgselector class SGSelector { @@ -156,15 +156,15 @@ class SGSelector if (FT0C > fit_cut[2] || ZNC > zdc_cut) true_gap = o2::aod::sgselector::NoGap; // -1 } else if (gap == o2::aod::sgselector::DoubleGap) { // gap == 2 - if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) + if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) { true_gap = o2::aod::sgselector::NoGap; // -1 - else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut)) + } else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut)) { true_gap = o2::aod::sgselector::SingleGapC; // 1 - else if ((FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) + } else if ((FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) { true_gap = o2::aod::sgselector::SingleGapA; // 0 - else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut) + } else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut) { true_gap = o2::aod::sgselector::DoubleGap; // 2 - else { + } else { LOGF(info, "Something wrong with DG"); true_gap = o2::aod::sgselector::BadDoubleGap; // 5 } From 186bdb0fc49e2319085e8d8f1e8a6ff564a7064b Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Fri, 8 Aug 2025 13:52:53 +0200 Subject: [PATCH 7/8] Clear comments added --- PWGUD/Core/SGSelector.h | 14 +++++++------- PWGUD/Tasks/upcTauTau13topo.cxx | 27 ++++++++++++--------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index 662707b4aab..a80224ef82b 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -38,13 +38,13 @@ struct SelectionResult { namespace o2::aod::sgselector { enum TrueGap : int { - NoGap = -1, - SingleGapA = 0, - SingleGapC = 1, - DoubleGap = 2, - NoUpc = 3, - TrkOutOfRange = 4, - BadDoubleGap = 5 + NoGap = -1, // no gap due to change of threshold(s) in any of FV0, FT0A, ZNA, FT0C, ZNC + SingleGapA = 0, // initially single gap at A side event + SingleGapC = 1, // initially single gap at C side event + DoubleGap = 2, // initially double gap event + NoUpc = 3, // initially no UPC event with default thresholds (FT0A=150, FT0C=50) + TrkOutOfRange = 4, // to many tracks (>100 default) + BadDoubleGap = 5 // unknows status of double gap check with changed thresholds }; } // namespace o2::aod::sgselector diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index b3ff71675cc..b9825e73977 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -84,7 +84,7 @@ DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); DECLARE_SOA_COLUMN(TrkPx, trkPx, float[4]); DECLARE_SOA_COLUMN(TrkPy, trkPy, float[4]); DECLARE_SOA_COLUMN(TrkPz, trkPz, float[4]); -// DECLARE_SOA_COLUMN(TrkSign, trkSign, int[4]); +DECLARE_SOA_COLUMN(TrkSign, trkSign, int8_t[4]); DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); DECLARE_SOA_COLUMN(TrkTPCcr, trkTPCcr, int[4]); @@ -95,14 +95,12 @@ DECLARE_SOA_COLUMN(TrkITScl, trkITScl, int[4]); DECLARE_SOA_COLUMN(TrkTPCsignal, trkTPCsignal, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaEl, trkTPCnSigmaEl, float[4]); -// DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaPi, trkTPCnSigmaPi, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaKa, trkTPCnSigmaKa, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaPr, trkTPCnSigmaPr, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTOFbeta, trkTOFbeta, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaEl, trkTOFnSigmaEl, float[4]); -// DECLARE_SOA_COLUMN(TrkTOFnSigmaMu, trkTOFnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaPi, trkTOFnSigmaPi, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaKa, trkTOFnSigmaKa, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaPr, trkTOFnSigmaPr, float[4]); @@ -123,7 +121,7 @@ DECLARE_SOA_TABLE(TauFourTracks, "AOD", "TAUFOURTRACK", tau_tree::TotalFT0AmplitudeA, tau_tree::TotalFT0AmplitudeC, tau_tree::TotalFV0AmplitudeA, // tau_tree::TimeFT0A, tau_tree::TimeFT0C, tau_tree::TimeFV0A, tau_tree::TrkPx, tau_tree::TrkPy, tau_tree::TrkPz, - // tau_tree::TrkSign, + tau_tree::TrkSign, tau_tree::TrkDCAxy, tau_tree::TrkDCAz, tau_tree::TrkTPCcr, tau_tree::TrkTPCfind, tau_tree::TrkTPCchi2, tau_tree::TrkITSchi2, tau_tree::TrkITScl, @@ -3347,7 +3345,9 @@ struct TauTau13topo { // loop over MC particles for (const auto& mcParticle : mcParticles) { - // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); + if (verbose) { + LOGF(info, " mcParticle pdg %d, gen %d, prim %d", mcParticle.pdgCode(), mcParticle.producedByGenerator(), mcParticle.isPhysicalPrimary() ); + } // primaries // if (mcParticle.isPhysicalPrimary()) { // countPrim++; @@ -3358,7 +3358,7 @@ struct TauTau13topo { if (mcParticle.producedByGenerator()) { countGen++; if (mcParticle.isPhysicalPrimary()) { - countBoth++; + countBoth++; // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { countCharged++; @@ -3376,7 +3376,7 @@ struct TauTau13topo { } // mother is tau } // mc particle has mother } // veto neutral particles - } // physicsl primary + } // physics primary } // generator produced by // @@ -3549,7 +3549,8 @@ struct TauTau13topo { { // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisionsFull.size()); // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisions.size()); - + LOGF(info, " UDMcCollision size %d, SmallGroups FullMcUdCollisions size %d, UDtracks %d, UDMcParticles %d", mcCollision.size(), collisions.size(), tracks.size(), mcParticles.size()); + // loop over generated collisions // for (const auto &mcCollision : mcCollisions) { // LOGF(info, " Per mcCollision not sliced: UDMcParticles size %d, FullMcUdCollisions size %d", mcParts.size(), collisionsFull.size()); @@ -5089,7 +5090,7 @@ struct TauTau13topo { // int counterTmp = 0; float px[4], py[4], pz[4]; - // int sign[4]; + int8_t sign[4]; float dcaZ[4]; float dcaXY[4]; @@ -5105,8 +5106,6 @@ struct TauTau13topo { float nSigmaPr[4]; float nSigmaKa[4]; float nSigmaMu[4]; - // float chi2TPC[4]; - // float chi2ITS[4]; float chi2TOF[4] = {-1., -1., -1., -1.}; int nclTPCcrossedRows[4]; int nclTPCfind[4]; @@ -5123,7 +5122,7 @@ struct TauTau13topo { px[counterTmp] = trk.px(); py[counterTmp] = trk.py(); pz[counterTmp] = trk.pz(); - // sign[counterTmp] = trk.sign(); + sign[counterTmp] = trk.sign(); dcaZ[counterTmp] = trk.dcaZ(); dcaXY[counterTmp] = trk.dcaXY(); @@ -5141,8 +5140,6 @@ struct TauTau13topo { tmpTofNsigmaPr[counterTmp] = trk.tofNSigmaPr(); tmpTofNsigmaMu[counterTmp] = trk.tofNSigmaMu(); - // chi2TPC[counterTmp] = trk.tpcChi2NCl(); - // chi2ITS[counterTmp] = trk.itsChi2NCl(); if (trk.hasTOF()) chi2TOF[counterTmp] = trk.tofChi2(); // nclTPCfind[counterTmp] = trk.tpcNClsFindable(); @@ -5174,7 +5171,7 @@ struct TauTau13topo { dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), dgcand.totalFT0AmplitudeA(), dgcand.totalFT0AmplitudeC(), dgcand.totalFV0AmplitudeA(), // dgcand.timeFT0A(), dgcand.timeFT0C(), dgcand.timeFV0A(), - px, py, pz, // sign, + px, py, pz, sign, dcaXY, dcaZ, nclTPCcrossedRows, nclTPCfind, nclTPCchi2, trkITSchi2, trkITScl, tmpDedx, nSigmaEl, nSigmaPi, nSigmaKa, nSigmaPr, nSigmaMu, From 126c89b8796a0902f6e5e34cf421744562ff37e7 Mon Sep 17 00:00:00 2001 From: Adam Matyja Date: Tue, 12 Aug 2025 11:09:51 +0200 Subject: [PATCH 8/8] tautau MC checks --- PWGUD/Tasks/upcTauTau13topo.cxx | 156 ++++++++++++++++++++++++-------- 1 file changed, 120 insertions(+), 36 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index b9825e73977..676181f8de0 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -121,7 +121,7 @@ DECLARE_SOA_TABLE(TauFourTracks, "AOD", "TAUFOURTRACK", tau_tree::TotalFT0AmplitudeA, tau_tree::TotalFT0AmplitudeC, tau_tree::TotalFV0AmplitudeA, // tau_tree::TimeFT0A, tau_tree::TimeFT0C, tau_tree::TimeFV0A, tau_tree::TrkPx, tau_tree::TrkPy, tau_tree::TrkPz, - tau_tree::TrkSign, + tau_tree::TrkSign, tau_tree::TrkDCAxy, tau_tree::TrkDCAz, tau_tree::TrkTPCcr, tau_tree::TrkTPCfind, tau_tree::TrkTPCchi2, tau_tree::TrkITSchi2, tau_tree::TrkITScl, @@ -838,7 +838,7 @@ struct TauTau13topo { // CollisionMC histograms if (doprocessEfficiencyMCSG || doprocessSimpleMCSG) { registryMC.add("globalMC/hMCZvertex", ";V_{Z}^{MC} (cm);events", {HistType::kTH1F, {{100, -25., 25.}}}); - registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{20, 0., 20.}}}); + registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{28, -8., 20.}}}); // efficiency el registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); @@ -857,6 +857,8 @@ struct TauTau13topo { registryMC.add("globalMC/hMCptGen", ";p_{T}^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 4.}}}); // tau + registryMC.add("tauMC/hNtaus", ";N^{#tau};N_events ", {HistType::kTH1F, {{6, -1., 5.}}}); + registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); @@ -871,6 +873,18 @@ struct TauTau13topo { registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); + // muon + registryMC.add("muonMC/hMCeta", ";#eta^{#mu};N^{#mu}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("muonMC/hMCy", ";y^{#mu};N^{#mu}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("muonMC/hMCphi", ";#phi^{#mu};N^{#mu}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("muonMC/hMCpt", ";#it{p}_{T}^{#mu};N^{#mu}", {HistType::kTH1F, {{400, 0., 10.}}}); + + // pion + registryMC.add("pionMC/hMCeta", ";#eta^{#pi};N^{#pi}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("pionMC/hMCy", ";y^{#pi};N^{#pi}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("pionMC/hMCphi", ";#phi^{#pi};N^{#pi}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("pionMC/hMCpt", ";#it{p}_{T}^{#pi};N^{#pi}", {HistType::kTH1F, {{400, 0., 10.}}}); + // efficiency mu registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); @@ -3303,19 +3317,22 @@ struct TauTau13topo { void processSimpleMCSG(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { registryMC.get(HIST("globalMC/hMCZvertex"))->Fill(mcCollision.posZ()); - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(0., 1.); + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-8., 1.); registryMC.get(HIST("efficiencyMCEl/effiEl"))->Fill(0., 1.); registryMC.get(HIST("efficiencyMCMu/effiMu"))->Fill(0., 1.); registryMC.get(HIST("efficiencyMCPi/effiPi"))->Fill(0., 1.); // check how many physical primaries - // int countPrim = 0; - int countGen = 0; - int countBoth = 0; - int countCharged = 0; - int countChargedFromTau = 0; + int countPrim = 0; + int countGen = 0; // generator + int countBoth = 0; // generator + primary + int countCharged = 0; // generator + primary + charged + int countChargedFromTau = 0; // generator + primary + charged + from tau int countTau = 0; + int countChargedOnly = 0; // charged only + int countChargedOnlyFromTau = 0; // charged only and from tau + float etaTau[2]; float phiTau[2]; @@ -3346,19 +3363,19 @@ struct TauTau13topo { // loop over MC particles for (const auto& mcParticle : mcParticles) { if (verbose) { - LOGF(info, " mcParticle pdg %d, gen %d, prim %d", mcParticle.pdgCode(), mcParticle.producedByGenerator(), mcParticle.isPhysicalPrimary() ); + LOGF(info, " mcParticle pdg %d, gen %d, prim %d, bkg %d, process %d", mcParticle.pdgCode(), mcParticle.producedByGenerator(), mcParticle.isPhysicalPrimary(), mcParticle.fromBackgroundEvent(), mcParticle.getProcess()); } // primaries - // if (mcParticle.isPhysicalPrimary()) { - // countPrim++; - // } + if (mcParticle.isPhysicalPrimary()) { + countPrim++; + } // // MC particles produced by generator only // if (mcParticle.producedByGenerator()) { countGen++; if (mcParticle.isPhysicalPrimary()) { - countBoth++; + countBoth++; // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { countCharged++; @@ -3376,9 +3393,30 @@ struct TauTau13topo { } // mother is tau } // mc particle has mother } // veto neutral particles - } // physics primary + } // physics primary } // generator produced by + // special case only for UPCgen, charged but not taus + if (std::abs(mcParticle.pdgCode()) != kTauMinus && mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { + countChargedOnly++; + // case for UPCgen when all particles are not pimaries + if (!mcParticle.isPhysicalPrimary()) { + // all charged particles, not only from 1+3 topo + registryMC.get(HIST("globalMC/hMCetaGen"))->Fill(mcParticle.eta()); + registryMC.get(HIST("globalMC/hMCphiGen"))->Fill(mcParticle.phi()); + registryMC.get(HIST("globalMC/hMCyGen"))->Fill(mcParticle.y()); + registryMC.get(HIST("globalMC/hMCptGen"))->Fill(mcParticle.pt()); + } // end of UPCgen case + + if (mcParticle.has_mothers()) { + auto const& mother = mcParticle.mothers_first_as(); + if (std::abs(mother.pdgCode()) == kTauMinus) { // 15 + countChargedOnlyFromTau++; + } // mother is tau + } // mc particle has mother + } // veto neutral particles + // end of special case only for UPCgen + // // tau+/- // @@ -3406,10 +3444,12 @@ struct TauTau13topo { if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of pion check + // electron from tau if (std::abs(daughter.pdgCode()) == kElectron) { // 11 = electron if (daughter.pdgCode() == kElectron) flagElPlusElMinus = true; + registryMC.get(HIST("electronMC/hMCeta"))->Fill(daughter.eta()); registryMC.get(HIST("electronMC/hMCphi"))->Fill(daughter.phi()); registryMC.get(HIST("electronMC/hMCy"))->Fill(daughter.y()); @@ -3422,10 +3462,17 @@ struct TauTau13topo { if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of electron check + // muon from tau if (std::abs(daughter.pdgCode()) == kMuonMinus) { // 13 if (daughter.pdgCode() == kMuonMinus) // 13 flagMuPlusMuMinus = true; + + registryMC.get(HIST("muonMC/hMCeta"))->Fill(daughter.eta()); + registryMC.get(HIST("muonMC/hMCphi"))->Fill(daughter.phi()); + registryMC.get(HIST("muonMC/hMCy"))->Fill(daughter.y()); + registryMC.get(HIST("muonMC/hMCpt"))->Fill(daughter.pt()); + muonFound = !muonFound; partPt = static_cast(daughter.pt()); // LOGF(info,"mu pt %f",daughter.pt()); @@ -3433,6 +3480,7 @@ struct TauTau13topo { partFromTauInEta = false; } // end of muon check } // end of loop over daughters + if (pionCounter == 3) { threePionsFound = true; } // end of 3pi check @@ -3442,6 +3490,12 @@ struct TauTau13topo { auto mcPartTmp = mcParticle.daughters_as().begin() + singlePionIndex; if (mcPartTmp.pdgCode() == kPiMinus) // -211 flagPiPlusPiMinus = true; + + registryMC.get(HIST("pionMC/hMCeta"))->Fill(mcPartTmp.eta()); + registryMC.get(HIST("pionMC/hMCphi"))->Fill(mcPartTmp.phi()); + registryMC.get(HIST("pionMC/hMCy"))->Fill(mcPartTmp.y()); + registryMC.get(HIST("pionMC/hMCpt"))->Fill(mcPartTmp.pt()); + partPt = static_cast(mcPartTmp.pt()); // motherOfSinglePionIndex = mcParticle.index(); if (std::abs(mcPartTmp.eta()) > 0.9) @@ -3454,6 +3508,7 @@ struct TauTau13topo { // LOGF(info,"pt after %f",partPt); // tau related things + registryMC.get(HIST("tauMC/hNtaus"))->Fill(countTau); if (countTau == 2) { registryMC.get(HIST("tauMC/hMCdeltaeta"))->Fill(etaTau[0] - etaTau[1]); registryMC.get(HIST("tauMC/hMCdeltaphi"))->Fill(calculateDeltaPhi(phiTau[0], phiTau[1]) * 180. / o2::constants::math::PI); @@ -3503,29 +3558,58 @@ struct TauTau13topo { registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countBoth, 2); registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countCharged, 3); registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedFromTau, 4); - if (countChargedFromTau != 4) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(1., 1.); - if (electronFound && flagElPlusElMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(2., 1.); // e- - else if (electronFound && !flagElPlusElMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(3., 1.); // e+ - if (muonFound && flagMuPlusMuMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(4., 1.); // mu- - else if (muonFound && !flagMuPlusMuMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(5., 1.); // mu+ - if (singlePionFound && flagPiPlusPiMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(6., 1.); // pi- - else if (singlePionFound && !flagPiPlusPiMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(7., 1.); // pi+ + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countPrim, 5); + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedOnly, 6); + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedOnlyFromTau, 7); - if (!tauInRapidity) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(8., 1.); - if (!partFromTauInEta) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(9., 1.); + if (countChargedFromTau == 2 || countChargedOnlyFromTau == 2) { + // 2 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-7., 1.); + } + if (countChargedFromTau == 6 || countChargedOnlyFromTau == 6) { + // 6 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-6., 1.); + } + // if (countChargedFromTau != 4) + // return; + if (countChargedFromTau == 4 || countChargedOnlyFromTau == 4) { + // 4 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-5., 1.); // 4 tracks + if (electronFound && flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-4., 1.); // e- + else if (electronFound && !flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-3., 1.); // e+ + if (muonFound && flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-2., 1.); // mu- + else if (muonFound && !flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-1., 1.); // mu+ + if (singlePionFound && flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(0., 1.); // pi- + else if (singlePionFound && !flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(1., 1.); // pi+ + + if (!tauInRapidity) + return; + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(2., 1.); + if (!partFromTauInEta) + return; + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(3., 1.); + + if (electronFound && flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(4., 1.); // e- + else if (electronFound && !flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(5., 1.); // e+ + if (muonFound && flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(6., 1.); // mu- + else if (muonFound && !flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(7., 1.); // mu+ + if (singlePionFound && flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(8., 1.); // pi- + else if (singlePionFound && !flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(9., 1.); // pi+ + + } // end of 4 tracks candidate events } // end of processSimpleMCSG // using LabeledTracks = soa::Join; @@ -3550,7 +3634,7 @@ struct TauTau13topo { // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisionsFull.size()); // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisions.size()); LOGF(info, " UDMcCollision size %d, SmallGroups FullMcUdCollisions size %d, UDtracks %d, UDMcParticles %d", mcCollision.size(), collisions.size(), tracks.size(), mcParticles.size()); - + // loop over generated collisions // for (const auto &mcCollision : mcCollisions) { // LOGF(info, " Per mcCollision not sliced: UDMcParticles size %d, FullMcUdCollisions size %d", mcParts.size(), collisionsFull.size());