@@ -794,41 +794,48 @@ struct FullJetSpectra {
794794 filteredClusterPt = 0.0 ;
795795
796796 // --- Track cuts: ALL tracks must satisfy 0.15 <= pT <= 140 GeV/c---
797- // if (leadingTrackPtMin > kLeadingTrackPtMinThreshold || leadingTrackPtMax < kLeadingTrackPtMaxThreshold) {
798- bool hasValidTrack = false ;
799- for (const auto & constituent : jet.template tracks_as <T>()) {
800- const float pt = constituent.pt ();
801- if ((minTrackPt > kLeadingTrackPtMinThreshold && pt < minTrackPt) ||
802- (maxTrackPt < kLeadingTrackPtMaxThreshold && pt > maxTrackPt)) {
803- continue ; // SKIP this invalid track
797+ if (minTrackPt > kLeadingTrackPtMinThreshold || maxTrackPt < kLeadingTrackPtMaxThreshold ) {
798+ bool hasValidTrack = false ;
799+ for (const auto & constituent : jet.template tracks_as <T>()) {
800+ const float pt = constituent.pt ();
801+
802+ // Reject entire jet if ANY track fails the cuts
803+ if ((minTrackPt > kLeadingTrackPtMinThreshold && pt < minTrackPt) ||
804+ (maxTrackPt < kLeadingTrackPtMaxThreshold && pt > maxTrackPt)) {
805+ return false ; // Reject the jet
806+ }
807+ filteredTrackPt += pt; // Accumulate valid track pT
808+ hasValidTrack = true ; // At least one track exists (if needed)
809+ }
810+ // Reject jets without valid tracks (edge case) when minimum cut is active
811+ if (minTrackPt > kLeadingTrackPtMinThreshold && !hasValidTrack) {
812+ return false ;
804813 }
805- filteredTrackPt += pt; // Accumulate valid track pT
806- hasValidTrack = true ; // At least one track exists (if needed)
807- }
808- // Reject jets without valid tracks (edge case)
809- if (!hasValidTrack) {
810- return false ;
811814 }
812- // }
813815
814816 // --- Cluster cuts: ALL clusters must satisfy min <= pT <= max == 0.3 <= pT <= 250
815- // if (leadingClusterPtMin > kLeadingClusterPtMinThreshold || leadingClusterPtMax < kLeadingClusterPtMaxThreshold) {
816- bool hasValidCluster = false ;
817- for (const auto & cluster : jet.template clusters_as <S>()) {
818- const double pt = cluster.energy () / std::cosh (cluster.eta ());
819- if ((minClusterPt > kLeadingClusterPtMinThreshold && pt < minClusterPt) ||
820- (maxClusterPt < kLeadingClusterPtMaxThreshold && pt > maxClusterPt)) {
821- continue ; // SKIP this invalid cluster
817+ // Reject jet if ANY cluster is outside range
818+ if (minClusterPt > kLeadingClusterPtMinThreshold || maxClusterPt < kLeadingClusterPtMaxThreshold ) {
819+ bool hasValidCluster = false ;
820+ for (const auto & cluster : jet.template clusters_as <S>()) {
821+ const double pt = cluster.energy () / std::cosh (cluster.eta ());
822+
823+ // Reject entire jet if ANY cluster fails the cuts
824+ if ((minClusterPt > kLeadingClusterPtMinThreshold && pt < minClusterPt) ||
825+ (maxClusterPt < kLeadingClusterPtMaxThreshold && pt > maxClusterPt)) {
826+ return false ;
827+ }
828+ filteredClusterPt += pt;
829+ hasValidCluster = true ; // At least one cluster exists
830+ }
831+ // Reject jets without valid clusters (edge case)
832+ // Reject if no clusters exist when minimum cut is active
833+ if (minClusterPt > kLeadingClusterPtMinThreshold && !hasValidCluster) {
834+ return false ;
822835 }
823- filteredClusterPt += pt;
824- hasValidCluster = true ; // At least one cluster exists
825- }
826- // Reject jets without valid clusters (edge case)
827- if (!hasValidCluster) {
828- return false ;
829836 }
830- // }
831- return true ; // Valid Jet
837+
838+ return true ; // Valid Jet that passes all cuts
832839 } // isAcceptedRecoJet ends
833840
834841 /* template <typename T, typename U>
0 commit comments