Skip to content

Commit 9da224a

Browse files
authored
[PWGLF] Use concepts everywhere, not only for MC (#9940)
1 parent 484fa6e commit 9da224a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ struct nucleiSpectra {
479479
float getCentrality(Tcoll const& collision)
480480
{
481481
float centrality = 1.;
482-
if constexpr (std::is_same<Tcoll, CollWithCent>::value || std::is_same<Tcoll, CollWithEP>::value || std::is_same<Tcoll, CollWithQvec>::value) {
482+
if constexpr (o2::aod::HasCentrality<Tcoll>) {
483483
if (cfgCentralityEstimator == nuclei::centDetectors::kFV0A) {
484484
centrality = collision.centFV0A();
485485
} else if (cfgCentralityEstimator == nuclei::centDetectors::kFT0M) {
@@ -640,13 +640,18 @@ struct nucleiSpectra {
640640
}
641641

642642
if (cfgFlowHist->get(iS) && doprocessDataFlow) {
643-
if constexpr (std::is_same<Tcoll, CollWithEP>::value) {
643+
if constexpr (requires {
644+
collision.psiFT0C();
645+
}) {
644646
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - collision.psiFT0C(), 0.f, 2);
645647
auto v2 = std::cos(2.0 * deltaPhiInRange);
646648
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
647649
}
648650
} else if (cfgFlowHist->get(iS) && doprocessDataFlowAlternative) {
649-
if constexpr (std::is_same<Tcoll, CollWithQvec>::value) {
651+
if constexpr (requires {
652+
collision.qvecFT0CIm();
653+
collision.qvecFT0CRe();
654+
}) {
650655
auto deltaPhiInRange = RecoDecay::constrainAngle(fvector.phi() - computeEventPlane(collision.qvecFT0CIm(), collision.qvecFT0CRe()), 0.f, 2);
651656
auto v2 = std::cos(2.0 * deltaPhiInRange);
652657
nuclei::hFlowHists[iC][iS]->Fill(collision.centFT0C(), fvector.pt(), nSigma[0][iS], tofMasses[iS], v2, track.itsNCls(), track.tpcNClsFound());
@@ -672,7 +677,9 @@ struct nucleiSpectra {
672677
}
673678
}
674679
if (flag & (kProton | kDeuteron | kTriton | kHe3 | kHe4) || doprocessMC) { /// ignore PID pre-selections for the MC
675-
if constexpr (std::is_same<Tcoll, CollWithEP>::value) {
680+
if constexpr (requires {
681+
collision.psiFT0A();
682+
}) {
676683
nuclei::candidates_flow.emplace_back(NucleusCandidateFlow{
677684
collision.centFV0A(),
678685
collision.centFT0M(),
@@ -689,7 +696,9 @@ struct nucleiSpectra {
689696
collision.qTPCL(),
690697
collision.qTPCR(),
691698
});
692-
} else if constexpr (std::is_same<Tcoll, CollWithQvec>::value) {
699+
} else if constexpr (requires {
700+
collision.qvecFT0AIm();
701+
}) {
693702
nuclei::candidates_flow.emplace_back(NucleusCandidateFlow{
694703
collision.centFV0A(),
695704
collision.centFT0M(),

0 commit comments

Comments
 (0)