@@ -83,8 +83,10 @@ struct FullJetSpectra {
8383 Configurable<float > jetpTMax{" jetpTMax" , 350 ., " maximum jet pT" };
8484 Configurable<float > jetEtaMin{" jetEtaMin" , -0.3 , " minimum jet eta" }; // each of these jet configurables are for the fiducial emcal cuts
8585 Configurable<float > jetEtaMax{" jetEtaMax" , 0.3 , " maximum jet eta" }; // for R = 0.4 (EMCAL eta acceptance: eta_jet = 0.7 - R)
86- Configurable<float > jetPhiMin{" jetPhiMin" , 1.80 , " minimum jet phi" }; // phi_jet_min for R = 0.4 is 1.80
87- Configurable<float > jetPhiMax{" jetPhiMax" , 2.86 , " maximum jet phi" }; // phi_jet_min for R = 0.4 is 2.86
86+ // Configurable<float> emcalPhiMin{"jetPhiMin", 1.3962634, "minimum emcal phi"};
87+ // Configurable<float> emcalPhiMax{"jetPhiMax", 3.2836100, "maximum emcal phi"};
88+ Configurable<float > jetPhiMin{" jetPhiMin" , 1.3962634 , " minimum emcal phi" };
89+ Configurable<float > jetPhiMax{" jetPhiMax" , 3.2836100 , " maximum emcal phi" };
8890 Configurable<float > jetAreaFractionMin{" jetAreaFractionMin" , -99.0 , " used to make a cut on the jet areas" };
8991
9092 // Leading track and cluster pT configurables
@@ -771,6 +773,37 @@ struct FullJetSpectra {
771773 return true ;
772774 }
773775
776+ template <typename T>
777+ bool isInPhiAcceptance (T const & jet) const
778+ {
779+ const double twoPi = 2.0 * M_PI;
780+ // convert encoded radius to real R (radians)
781+ const double R = static_cast <double >(jet.r ()) / 100.0 ;
782+
783+ // emcalPhiMin/emcalPhiMax are configured emcal phi edges in radians, e.g. 1.3962634, 3.2836100
784+ double jetPhiMin = emcalPhiMin + R;
785+ double jetPhiMax = emcalPhiMax - R;
786+
787+ // normalize to [0, 2pi)
788+ auto norm = [&](double a) {
789+ while (a < 0 ) a += twoPi;
790+ while (a >= twoPi) a -= twoPi;
791+ return a;
792+ };
793+
794+ double phi = norm (jet.phi ());
795+ jetPhiMin = norm (jetPhiMin);
796+ jetPhiMax = norm (jetPhiMax);
797+
798+ if (jetPhiMin <= jetPhiMax) {
799+ // non-wrap case (your EMCal default)
800+ return (phi >= jetPhiMin && phi <= jetPhiMax);
801+ } else {
802+ // wrap-around case (defensive)
803+ return (phi >= jetPhiMin || phi <= jetPhiMax);
804+ }
805+ }
806+
774807 template <typename T>
775808 void fillJetHistograms (T const & jet, float weight = 1.0 )
776809 {
0 commit comments