Skip to content
Merged
108 changes: 61 additions & 47 deletions PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,9 @@
/// \author CMY
/// \date 2025-04-10

#include <TH1F.h>
#include <TDirectory.h>
#include <THn.h>
#include <TLorentzVector.h>
#include <TMath.h>
#include <TObjArray.h>
#include <TFile.h>
#include <TH2F.h>
#include <TLorentzVector.h>

#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <cstdlib>
#include <iterator> // std::prev

#include "Framework/ASoAHelpers.h"
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/StepTHn.h"
#include "PWGCF/Femto/DataModel/PionDeuteronTables.h"
#include "PWGLF/DataModel/EPCalibrationTables.h"
#include "PWGLF/Utils/svPoolCreator.h"

#include "Common/Core/PID/PIDTOF.h"
#include "Common/Core/PID/TPCPIDResponse.h"
Expand All @@ -52,21 +31,40 @@
#include "Common/DataModel/PIDResponseITS.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/TableProducer/PID/pidTOFBase.h"

#include "EventFiltering/Zorro.h"
#include "EventFiltering/ZorroSummary.h"

#include "CCDB/BasicCCDBManager.h"
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
#include "DataFormatsTPC/BetheBlochAleph.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsTPC/BetheBlochAleph.h"
#include "DetectorsBase/GeometryManager.h"
#include "DetectorsBase/Propagator.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/StepTHn.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/Track.h"

#include "PWGLF/DataModel/EPCalibrationTables.h"
#include "PWGCF/Femto/DataModel/PionDeuteronTables.h"
#include "PWGLF/Utils/svPoolCreator.h"
#include "Math/Boost.h"
#include "Math/Vector4D.h"
#include <TDirectory.h>
#include <TFile.h>
#include <TH1F.h>
#include <TH2F.h>
#include <THn.h>
#include <TMath.h>
#include <TObjArray.h>

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <iterator> // std::prev
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -236,6 +234,10 @@
{"hDePitInvMass", "; M(De + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}},
{"hDePt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}},
{"hPiPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}},
{"hDeEta", "eta distribution; #eta(De)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}},
{"hPiEta", "eta distribution; #eta(#pi)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}},
{"hDePhi", "phi distribution; phi(De)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}},
{"hPiPhi", "phi distribution; phi(#pi)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}},
{"h2dEdxDecandidates", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}},
{"h2NsigmaDeTPC", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}},
{"h2NsigmaDeTPC_preselection", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}},
Expand All @@ -250,6 +252,7 @@
{"hkStar_LS_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}},
{"hkStar_US_M", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}},
{"hkStar_US_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}},
{"hkStar_All", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}},
{"hisBkgEM", "; isBkgEM;", {HistType::kTH1F, {{3, -1, 2}}}}},
OutputObjHandlingPolicy::AnalysisObject,
false,
Expand Down Expand Up @@ -691,6 +694,10 @@
{
mQaRegistry.fill(HIST("hDePt"), piDecand.recoPtDe());
mQaRegistry.fill(HIST("hPiPt"), piDecand.recoPtPi());
mQaRegistry.fill(HIST("hDeEta"), piDecand.recoEtaDe());
mQaRegistry.fill(HIST("hPiEta"), piDecand.recoEtaPi());
mQaRegistry.fill(HIST("hDePhi"), piDecand.recoPhiDe());
mQaRegistry.fill(HIST("hPiPhi"), piDecand.recoPhiPi());
mQaRegistry.fill(HIST("hDePitInvMass"), piDecand.invMass);
mQaRegistry.fill(HIST("hdcaxyDe"), piDecand.dcaxyDe);
mQaRegistry.fill(HIST("hdcazDe"), piDecand.dcazDe);
Expand All @@ -701,10 +708,10 @@

double computePrTPCnsig(double InnerParamTPCHad, double SignalTPCHad)
{
double m_BBparamsProton[6] = {-54.42066571222577, 0.2857381250239097, 1.247140602468868, 0.6297483918147729, 2.985438833884555, 0.09};

Check failure on line 711 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.

float TPCinnerParam = InnerParamTPCHad;

Check failure on line 713 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
float expTPCSignal = o2::tpc::BetheBlochAleph((TPCinnerParam / 0.9382721), m_BBparamsProton[0], m_BBparamsProton[1], m_BBparamsProton[2], m_BBparamsProton[3], m_BBparamsProton[4]);

Check failure on line 714 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.
double resoTPC{expTPCSignal * m_BBparamsProton[5]};
return ((SignalTPCHad - expTPCSignal) / resoTPC);
}
Expand All @@ -715,40 +722,46 @@
const float kp0 = 1.22204e-02;
const float kp1 = 7.48467e-01;

double fSigmaTOFMassHad = (kp0 * TMath::Exp(kp1 * TMath::Abs(ptHad))) * fExpTOFMassHad;

Check failure on line 725 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
double fNSigmaTOFHad = (MassTOFHad - fExpTOFMassHad) / fSigmaTOFMassHad;
return fNSigmaTOFHad;
}

double computeKstar(const PiDecandidate& piDecand)
{
TLorentzVector he3, hadron;
float massHe3 = 2.80839;
float massHad = 0.1395704;
he3.SetPtEtaPhiM(abs(piDecand.recoPtDe()), piDecand.recoEtaDe(), piDecand.recoPhiDe(), massHe3);
hadron.SetPtEtaPhiM(abs(piDecand.recoPtPi()), piDecand.recoEtaPi(), piDecand.recoPhiPi(), massHad);

TLorentzVector p_total_lab = he3 + hadron;
TVector3 v_cm = p_total_lab.BoostVector();
TLorentzVector p1_cm = he3;
TLorentzVector p2_cm = hadron;
p1_cm.Boost(-v_cm);
p2_cm.Boost(-v_cm);
TLorentzVector p_diff_cm = p1_cm - p2_cm;
double kStar = sqrt(p_diff_cm.X() * p_diff_cm.X() + p_diff_cm.Y() * p_diff_cm.Y() + p_diff_cm.Z() * p_diff_cm.Z());
return kStar / 2.0;
constexpr double massDe = o2::constants::physics::MassDeuteron;
constexpr double massHad = o2::constants::physics::MassPiPlus;

const ROOT::Math::PtEtaPhiMVector De(std::abs(piDecand.recoPtDe()), piDecand.recoEtaDe(), piDecand.recoPhiDe(), massDe);

Check failure on line 735 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
const ROOT::Math::PtEtaPhiMVector Had(std::abs(piDecand.recoPtPi()), piDecand.recoEtaPi(), piDecand.recoPhiPi(), massHad);

Check failure on line 736 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
const ROOT::Math::PtEtaPhiMVector trackSum = De + Had;

const float beta = trackSum.Beta();
const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta());
const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta());
const float betaz = beta * std::cos(trackSum.Theta());

ROOT::Math::PxPyPzMVector DeCMS(De);
ROOT::Math::PxPyPzMVector HadCMS(Had);

const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz);
DeCMS = boostPRF(DeCMS);
HadCMS = boostPRF(HadCMS);

const ROOT::Math::PxPyPzMVector RelKstar = DeCMS - HadCMS;
return 0.5 * RelKstar.P();
}

void fillKstar(const PiDecandidate& piDecand)
{
double PrTPCnsigma = computePrTPCnsig(piDecand.momPiTPC, piDecand.tpcSignalPi);
double PrTOFnsigma = tofNSigmaCalculation(piDecand.massTOFPi, piDecand.recoPtPi());
if (abs(PrTPCnsigma) < settingCutNsigTPCPrMin)

Check failure on line 759 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
return;
if (abs(PrTOFnsigma) < settingCutNsigTOFPrMin)

Check failure on line 761 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
return;
float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(piDecand.recoPtDe(), 1.1);

Check failure on line 763 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
if (abs(piDecand.dcaxyDe) > DeDCAxyMin || abs(piDecand.dcazDe) > settingCutDeDCAzMin || abs(piDecand.dcaxyPi) > settingCutPiDCAxyMin || abs(piDecand.dcazPi) > settingCutPiDCAzMin)

Check failure on line 764 in PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
return;
if (std::abs(piDecand.recoPtPi()) < settingCutPiptMin || std::abs(piDecand.recoPtPi()) > settingCutPiptMax)
return;
Expand All @@ -771,6 +784,7 @@
mQaRegistry.fill(HIST("hkStar_US_A"), kstar);
}
}
mQaRegistry.fill(HIST("hkStar_All"), kstar);
}

// ==================================================================================================================
Expand Down
Loading