@@ -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 }
@@ -527,7 +551,8 @@ class EMCPhotonCut : public TNamed
527551 auto dPhi = std::fabs (emcmatchedtrack.deltaPhi ());
528552 auto trackpt = emcmatchedtrack.trackPt ();
529553 auto trackp = emcmatchedtrack.trackP ();
530- bool result = (dEta > GetSecTrackMatchingEta (trackpt)) || (dPhi > GetSecTrackMatchingPhi (trackpt)) || (cluster.e () / trackp >= mMinEoverP );
554+ bool result = (dEta > GetSecTrackMatchingEta (trackpt)) ||
555+ (dPhi > GetSecTrackMatchingPhi (trackpt));
531556 if (!result) {
532557 return false ;
533558 }
0 commit comments