Skip to content

Commit

Permalink
[PWGLF] Improve matching study code (#9266)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpuccio authored Jan 10, 2025
1 parent 4b7f47b commit 6a17c16
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "Common/Core/EventPlaneHelper.h"
#include "Common/DataModel/Qvectors.h"
#include "Common/Tools/TrackTuner.h"
#include "Common/Core/RecoDecay.h"

#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
Expand Down Expand Up @@ -321,18 +322,6 @@ struct nucleiSpectra {

HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};

double getPhiInRange(double phi)
{
double result = phi;
while (result < 0) {
result = result + 2. * TMath::Pi() / 2;
}
while (result > 2. * TMath::Pi() / 2) {
result = result - 2. * TMath::Pi() / 2;
}
return result;
}

double computeAbsoDecL(aod::McParticles::iterator particle)
{
if (!particle.has_daughters())
Expand Down Expand Up @@ -469,7 +458,7 @@ struct nucleiSpectra {
if (doprocessMatching) {
for (int iC{0}; iC < 2; ++iC) {
nuclei::hMatchingStudy[iC] = spectra.add<THnSparse>(fmt::format("hMatchingStudy{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;n#sigma_{ITS};n#sigma{TPC};n#sigma_{TOF};Centrality", HistType::kTHnSparseF, {{20, 1., 9.}, {10, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {50, -5., 5.}, {50, -5., 5.}, {50, 0., 1.}, {8, 0., 80.}});
nuclei::hMatchingStudyHadrons[iC] = spectra.add<THn>(fmt::format("hMatchingStudyHadrons{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;Centrality;Track type", HistType::kTHnSparseF, {{23, 0.4, 5.}, {20, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {8, 0., 80.}, {2, -0.5, 1.5}});
nuclei::hMatchingStudyHadrons[iC] = spectra.add<THn>(fmt::format("hMatchingStudyHadrons{}", nuclei::matter[iC]).data(), ";#it{p}_{T};#phi;#eta;Centrality;Track type", HistType::kTHnF, {{23, 0.4, 5.}, {20, 0., o2::constants::math::TwoPI}, {10, -1., 1.}, {8, 0., 80.}, {2, -0.5, 1.5}});
}
}

Expand Down Expand Up @@ -648,13 +637,13 @@ struct nucleiSpectra {

if (cfgFlowHist->get(iS) && doprocessDataFlow) {
if constexpr (std::is_same<Tcoll, CollWithEP>::value) {
auto deltaPhiInRange = getPhiInRange(fvector.phi() - collision.psiFT0C());
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - collision.psiFT0C(), 0.f, 2);
auto v2 = std::cos(2.0 * deltaPhiInRange);
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
}
} else if (cfgFlowHist->get(iS) && doprocessDataFlowAlternative) {
if constexpr (std::is_same<Tcoll, CollWithQvec>::value) {
auto deltaPhiInRange = getPhiInRange(fvector.phi() - computeEventPlane(collision.qvecFT0CIm(), collision.qvecFT0CRe()));
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - computeEventPlane(collision.qvecFT0CIm(), collision.qvecFT0CRe()), 0.f, 2);
auto v2 = std::cos(2.0 * deltaPhiInRange);
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
}
Expand Down Expand Up @@ -908,23 +897,24 @@ struct nucleiSpectra {
if (!eventSelection(collision) || !collision.triggereventep()) {
return;
}
const float centrality = getCentrality(collision);
const float centrality = collision.centFT0C();
o2::aod::ITSResponse itsResponse;
for (const auto& track : tracks) {
if (std::abs(track.eta()) > cfgCutEta ||
track.itsNCls() < 7 ||
track.itsChi2NCl() > 36.f ||
itsResponse.nSigmaITS<o2::track::PID::Helium3>(track) < -1.) {
track.itsChi2NCl() > 36.f) {
continue;
}
double expBethe{tpc::BetheBlochAleph(static_cast<double>(track.tpcInnerParam() * 2. / o2::constants::physics::MassHelium3), cfgBetheBlochParams->get(4, 0u), cfgBetheBlochParams->get(4, 1u), cfgBetheBlochParams->get(4, 2u), cfgBetheBlochParams->get(4, 3u), cfgBetheBlochParams->get(4, 4u))};
double expSigma{expBethe * cfgBetheBlochParams->get(4, 5u)};
double nSigmaTPC{(track.tpcSignal() - expBethe) / expSigma};
int iC = track.signed1Pt() > 0;
const float pt = track.pt();
const float phi = getPhiInRange(track.phi() - collision.psiFT0C());
nuclei::hMatchingStudy[iC]->Fill(pt * 2, phi, track.eta(), itsResponse.nSigmaITS<o2::track::PID::Helium3>(track), nSigmaTPC, o2::pid::tof::Beta::GetBeta(track), centrality);
const float phi = 2.f * RecoDecay::constrainAngle(track.phi() - collision.psiFT0C(), 0.f, 2);
nuclei::hMatchingStudyHadrons[iC]->Fill(pt, phi, track.eta(), centrality, track.hasTPC());
if (itsResponse.nSigmaITS<o2::track::PID::Helium3>(track) > -1.) {
nuclei::hMatchingStudy[iC]->Fill(pt * 2, phi, track.eta(), itsResponse.nSigmaITS<o2::track::PID::Helium3>(track), nSigmaTPC, o2::pid::tof::Beta::GetBeta(track), centrality);
}
}
}

Expand Down

0 comments on commit 6a17c16

Please sign in to comment.