@@ -41,6 +41,20 @@ static constexpr bool HasPrimaries = !std::is_same_v<TPrimaries, std::nullptr_t>
4141template <typename TSecondaries>
4242static constexpr bool HasSecondaries = !std::is_same_v<TSecondaries, std::nullptr_t >;
4343
44+ template <typename T>
45+ concept IsNonLinIterator = o2::soa::is_iterator<T> && requires (T t) {
46+ // Check that the *elements* of the container have the required methods:
47+ { t.corrE () } -> std::same_as<float >;
48+ { t.corrPt () } -> std::same_as<float >;
49+ };
50+
51+ template <typename T>
52+ concept IsNonLinContainer = o2::soa::is_table<T> && requires (T t) {
53+ // Check that the *elements* of the container have the required methods:
54+ { t.begin ().corrE () } -> std::same_as<float >;
55+ { t.begin ().corrPt () } -> std::same_as<float >;
56+ };
57+
4458template <typename T>
4559concept IsTrackIterator = o2::soa::is_iterator<T> && requires (T t) {
4660 // Check that the *elements* of the container have the required methods:
@@ -114,7 +128,7 @@ class EMCPhotonCut : public TNamed
114128
115129 static const char * mCutNames [static_cast <int >(EMCPhotonCuts::kNCuts )];
116130
117- constexpr auto getClusterId (o2::soa::is_iterator auto const & t) const
131+ static constexpr auto getClusterId (o2::soa::is_iterator auto const & t)
118132 {
119133 if constexpr (requires { t.emEmcClusterId (); }) {
120134 return t.emEmcClusterId ();
@@ -384,7 +398,11 @@ class EMCPhotonCut : public TNamed
384398 return cluster.definition () == mDefinition ;
385399
386400 case EMCPhotonCuts::kEnergy :
387- return cluster.e () > mMinE ;
401+ if constexpr (IsNonLinIterator<std::decay_t <decltype (cluster)>>) {
402+ return cluster.corrE () > mMinE ;
403+ } else {
404+ return cluster.e () > mMinE ;
405+ }
388406
389407 case EMCPhotonCuts::kNCell :
390408 return cluster.nCells () >= mMinNCell ;
@@ -478,7 +496,11 @@ class EMCPhotonCut : public TNamed
478496 return cluster.definition () == mDefinition ;
479497
480498 case EMCPhotonCuts::kEnergy :
481- return cluster.e () > mMinE ;
499+ if constexpr (IsNonLinIterator<Cluster>) {
500+ return cluster.corrE () > mMinE ;
501+ } else {
502+ return cluster.e () > mMinE ;
503+ }
482504
483505 case EMCPhotonCuts::kNCell :
484506 return cluster.nCells () >= mMinNCell ;
@@ -496,7 +518,9 @@ class EMCPhotonCut : public TNamed
496518 auto dPhi = std::fabs (emcmatchedtrack.deltaPhi ());
497519 auto trackpt = emcmatchedtrack.trackPt ();
498520 auto trackp = emcmatchedtrack.trackP ();
499- bool result = (dEta > GetTrackMatchingEta (trackpt)) || (dPhi > GetTrackMatchingPhi (trackpt)) || (cluster.e () / trackp >= mMinEoverP );
521+ bool result = (dEta > GetTrackMatchingEta (trackpt)) ||
522+ (dPhi > GetTrackMatchingPhi (trackpt)) ||
523+ (cluster.e () / trackp >= mMinEoverP );
500524 if (!result) {
501525 return false ;
502526 }
@@ -506,7 +530,7 @@ class EMCPhotonCut : public TNamed
506530 auto dPhis = cluster.deltaPhi (); // std:vector<float>
507531 auto trackspt = cluster.trackpt (); // std:vector<float>
508532 auto tracksp = cluster.trackp (); // std:vector<float>
509- int ntrack = tracksp .size ();
533+ int ntrack = trackspt .size ();
510534 for (int itr = 0 ; itr < ntrack; itr++) {
511535 float dEta = std::fabs (dEtas[itr]);
512536 float dPhi = std::fabs (dPhis[itr]);
@@ -526,8 +550,8 @@ class EMCPhotonCut : public TNamed
526550 auto dEta = std::fabs (emcmatchedtrack.deltaEta ());
527551 auto dPhi = std::fabs (emcmatchedtrack.deltaPhi ());
528552 auto trackpt = emcmatchedtrack.trackPt ();
529- auto trackp = emcmatchedtrack. trackP ();
530- bool result = (dEta > GetSecTrackMatchingEta (trackpt)) || (dPhi > GetSecTrackMatchingPhi (trackpt)) || (cluster. e () / trackp >= mMinEoverP );
553+ bool result = (dEta > GetSecTrackMatchingEta (trackpt)) ||
554+ (dPhi > GetSecTrackMatchingPhi (trackpt) );
531555 if (!result) {
532556 return false ;
533557 }
@@ -536,8 +560,7 @@ class EMCPhotonCut : public TNamed
536560 auto dEtas = cluster.deltaEtaSec (); // std:vector<float>
537561 auto dPhis = cluster.deltaPhiSec (); // std:vector<float>
538562 auto trackspt = cluster.trackptSec (); // std:vector<float>
539- auto tracksp = cluster.trackpSec (); // std:vector<float>
540- int ntrack = tracksp.size ();
563+ int ntrack = trackspt.size ();
541564 for (int itr = 0 ; itr < ntrack; itr++) {
542565 float dEta = std::fabs (dEtas[itr]);
543566 float dPhi = std::fabs (dPhis[itr]);
0 commit comments