Skip to content

Commit 6a17c16

Browse files
authored
[PWGLF] Improve matching study code (#9266)
1 parent 4b7f47b commit 6a17c16

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "Common/Core/EventPlaneHelper.h"
4343
#include "Common/DataModel/Qvectors.h"
4444
#include "Common/Tools/TrackTuner.h"
45+
#include "Common/Core/RecoDecay.h"
4546

4647
#include "DataFormatsParameters/GRPMagField.h"
4748
#include "DataFormatsParameters/GRPObject.h"
@@ -321,18 +322,6 @@ struct nucleiSpectra {
321322

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

324-
double getPhiInRange(double phi)
325-
{
326-
double result = phi;
327-
while (result < 0) {
328-
result = result + 2. * TMath::Pi() / 2;
329-
}
330-
while (result > 2. * TMath::Pi() / 2) {
331-
result = result - 2. * TMath::Pi() / 2;
332-
}
333-
return result;
334-
}
335-
336325
double computeAbsoDecL(aod::McParticles::iterator particle)
337326
{
338327
if (!particle.has_daughters())
@@ -469,7 +458,7 @@ struct nucleiSpectra {
469458
if (doprocessMatching) {
470459
for (int iC{0}; iC < 2; ++iC) {
471460
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.}});
472-
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}});
461+
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}});
473462
}
474463
}
475464

@@ -648,13 +637,13 @@ struct nucleiSpectra {
648637

649638
if (cfgFlowHist->get(iS) && doprocessDataFlow) {
650639
if constexpr (std::is_same<Tcoll, CollWithEP>::value) {
651-
auto deltaPhiInRange = getPhiInRange(fvector.phi() - collision.psiFT0C());
640+
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - collision.psiFT0C(), 0.f, 2);
652641
auto v2 = std::cos(2.0 * deltaPhiInRange);
653642
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
654643
}
655644
} else if (cfgFlowHist->get(iS) && doprocessDataFlowAlternative) {
656645
if constexpr (std::is_same<Tcoll, CollWithQvec>::value) {
657-
auto deltaPhiInRange = getPhiInRange(fvector.phi() - computeEventPlane(collision.qvecFT0CIm(), collision.qvecFT0CRe()));
646+
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - computeEventPlane(collision.qvecFT0CIm(), collision.qvecFT0CRe()), 0.f, 2);
658647
auto v2 = std::cos(2.0 * deltaPhiInRange);
659648
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
660649
}
@@ -908,23 +897,24 @@ struct nucleiSpectra {
908897
if (!eventSelection(collision) || !collision.triggereventep()) {
909898
return;
910899
}
911-
const float centrality = getCentrality(collision);
900+
const float centrality = collision.centFT0C();
912901
o2::aod::ITSResponse itsResponse;
913902
for (const auto& track : tracks) {
914903
if (std::abs(track.eta()) > cfgCutEta ||
915904
track.itsNCls() < 7 ||
916-
track.itsChi2NCl() > 36.f ||
917-
itsResponse.nSigmaITS<o2::track::PID::Helium3>(track) < -1.) {
905+
track.itsChi2NCl() > 36.f) {
918906
continue;
919907
}
920908
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))};
921909
double expSigma{expBethe * cfgBetheBlochParams->get(4, 5u)};
922910
double nSigmaTPC{(track.tpcSignal() - expBethe) / expSigma};
923911
int iC = track.signed1Pt() > 0;
924912
const float pt = track.pt();
925-
const float phi = getPhiInRange(track.phi() - collision.psiFT0C());
926-
nuclei::hMatchingStudy[iC]->Fill(pt * 2, phi, track.eta(), itsResponse.nSigmaITS<o2::track::PID::Helium3>(track), nSigmaTPC, o2::pid::tof::Beta::GetBeta(track), centrality);
913+
const float phi = 2.f * RecoDecay::constrainAngle(track.phi() - collision.psiFT0C(), 0.f, 2);
927914
nuclei::hMatchingStudyHadrons[iC]->Fill(pt, phi, track.eta(), centrality, track.hasTPC());
915+
if (itsResponse.nSigmaITS<o2::track::PID::Helium3>(track) > -1.) {
916+
nuclei::hMatchingStudy[iC]->Fill(pt * 2, phi, track.eta(), itsResponse.nSigmaITS<o2::track::PID::Helium3>(track), nSigmaTPC, o2::pid::tof::Beta::GetBeta(track), centrality);
917+
}
928918
}
929919
}
930920

0 commit comments

Comments
 (0)