Changeset 973b92a in git for external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh
- Timestamp:
- Oct 9, 2015, 2:47:38 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 8713dee
- Parents:
- f118021
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh
rf118021 r973b92a 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: Nsubjettiness.hh 670 2014-06-06 01:24:42Z jthaler $7 // $Id: Nsubjettiness.hh 822 2015-06-15 23:52:57Z jthaler $ 8 8 //---------------------------------------------------------------------- 9 9 // This file is part of FastJet contrib. … … 38 38 namespace contrib { 39 39 40 //------------------------------------------------------------------------ 40 // Classes defined in this file. 41 class Nsubjettiness; 42 class NsubjettinessRatio; 43 44 ///------------------------------------------------------------------------ 41 45 /// \class Nsubjettiness 42 /// Nsubjettiness extends the concept of Njettiness to a jet shape, but other 43 /// than the set of particles considered, they are identical. This class 44 /// wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet 45 /// interface for convenience in larger analyses. See NjettinessPlugin.hh for 46 /// definitions of tau_N and the constructor options. 46 /// \brief Implements the N-subjettiness jet shape 47 /// 48 /** 49 * The N-jettiness jet shape. 50 * 51 * Nsubjettiness extends the concept of Njettiness to a jet shape, but other 52 * than the set of particles considered, they are identical. This class 53 * wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet 54 * interface for convenience in larger analyses. 55 * 56 * The recommended AxesDefinitions are: 57 * KT_Axes : exclusive kt axes 58 * WTA_KT_Axes : exclusive kt with winner-take-all recombination 59 * OnePass_KT_Axes : one-pass minimization from kt starting point 60 * OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point 61 * More AxesDefinitions are listed in the README and defined in AxesDefinition.hh 62 * 63 * The recommended MeasureDefinitions are (with the corresponding parameters) 64 * NormalizedMeasure(beta,R0) 65 * : This was the original N-subjettiness measure (dimensionless) 66 * UnnormalizedMeasure(beta) 67 * : This is the new recommended default, same as above but without 68 * : the normalization factor, and hence has units of GeV 69 * NormalizedCutoffMeasure(beta,R0,Rcutoff) 70 * : Same as normalized_measure, but cuts off at Rcutoff 71 * UnnormalizedCutoffMeasure(beta,Rcutoff) 72 * : Same as unnormalized_measure, but cuts off at Rcutoff 73 * More MeasureDefinitions are listed in the README and defined in MeasureDefinition.hh 74 * 75 * For example, for the UnnormalizedMeasure(beta), N-subjettiness is defined as: 76 * 77 * tau_N = Sum_{i in jet} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...) 78 * 79 * DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i 80 * and jet j. 81 * 82 * The NormalizedMeausure include an extra parameter R0, and the various cutoff 83 * measures include an Rcutoff, which effectively defines an angular cutoff 84 * similar in effect to a cone-jet radius. 85 */ 47 86 class Nsubjettiness : public FunctionOfPseudoJet<double> { 48 87 49 88 public: 50 51 52 // Main constructor, which takes N, the AxesDefiniation, and the MeasureDefinition. 53 // The Definitions are given in NjettinessDefinition.hh 54 // 55 // The recommended AxesDefinitions are (more are available as listed in the README 56 // and defined in NjettinessDefinition.hh): 57 // KT_Axes : exclusive kt axes 58 // WTA_KT_Axes : exclusive kt with winner-take-all recombination 59 // OnePass_KT_Axes : one-pass minimization from kt starting point 60 // OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point 61 // 62 // The recommended measure definitions are (with the corresponding parameters) 63 // NormalizedMeasure(beta,R0) 64 // : This was the original N-subjettiness measure (dimensionless) 65 // UnnormalizedMeasure(beta) 66 // : This is the new recommended default, same as above but without 67 // : the normalization factor, and hence has units of GeV 68 // NormalizedCutoffMeasure(beta,R0,Rcutoff) 69 // : Same as normalized_measure, but cuts off at Rcutoff 70 // UnnormalizedCutoffMeasure(beta,Rcutoff) 71 // : Same as unnormalized_measure, but cuts off at Rcutoff 89 90 /// Main constructor, which takes N, the AxesDefinition, and the MeasureDefinition. 91 /// The Definitions are given in AxesDefinition.hh and MeasureDefinition.hh 72 92 Nsubjettiness(int N, 73 93 const AxesDefinition& axes_def, … … 75 95 : _njettinessFinder(axes_def,measure_def), _N(N) {} 76 96 77 78 // Alternative constructors that define the measure via enums and parameters 79 // These constructors are likely be removed 80 // Zero parameter arguments 81 // (Currently, no measure uses this) 97 /// Returns tau_N, measured on the constituents of this jet 98 double result(const PseudoJet& jet) const; 99 100 /// Returns components of tau_N, so that user can find individual tau values. 101 TauComponents component_result(const PseudoJet& jet) const; 102 103 /// To set axes in manual mode 104 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) { 105 // Note that cross check that manual mode has been set is in Njettiness 106 _njettinessFinder.setAxes(myAxes); 107 } 108 109 /// returns seed axes used for onepass minimization (otherwise same as currentAxes) 110 std::vector<fastjet::PseudoJet> seedAxes() const { 111 return _njettinessFinder.seedAxes(); 112 } 113 114 /// returns current axes found by result() calculation 115 std::vector<fastjet::PseudoJet> currentAxes() const { 116 return _njettinessFinder.currentAxes(); 117 } 118 119 /// returns subjet regions found by result() calculation (these have valid constituents) 120 /// Note that the axes and the subjets are not the same 121 std::vector<fastjet::PseudoJet> currentSubjets() const { 122 return _njettinessFinder.currentJets(); 123 } 124 125 /// returns components of tau_N without recalculating anything 126 TauComponents currentTauComponents() const { 127 return _njettinessFinder.currentTauComponents(); 128 } 129 130 /// returns components of tau_N without recalculating anything 131 TauPartition currentPartition() const { 132 return _njettinessFinder.currentPartition(); 133 } 134 135 private: 136 137 /// Core Njettiness code that is called 138 Njettiness _njettinessFinder; // TODO: should muck with this so result can be const without this mutable 139 /// Number of subjets to find 140 int _N; 141 142 /// Warning if the user tries to use v1.0.3 constructor. 143 static LimitedWarning _old_constructor_warning; 144 145 public: 146 147 // The following interfaces are included for backwards compatibility, but no longer recommended. 148 // They may be deleted in a future release 149 150 /// \deprecated 151 /// Alternative constructors that define the measure via enums and parameters 152 /// These constructors will be removed in v3.0 153 /// Zero parameter arguments 154 /// (Currently, no measure uses this) 82 155 Nsubjettiness(int N, 83 156 Njettiness::AxesMode axes_mode, 84 157 Njettiness::MeasureMode measure_mode) 85 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {} 86 87 // One parameter argument 88 // (for unnormalized_measure, para1=beta) 158 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) { 159 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead."); 160 } 161 162 /// \deprecated 163 /// Construcotr for one parameter argument 164 /// (for unnormalized_measure, para1=beta) 89 165 Nsubjettiness(int N, 90 166 Njettiness::AxesMode axes_mode, 91 167 Njettiness::MeasureMode measure_mode, 92 168 double para1) 93 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {} 94 95 // Two parameter arguments 96 // (for normalized_measure, para1=beta, para2=R0) 97 // (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff) 169 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) { 170 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead."); 171 } 172 173 /// \deprecated 174 /// Constructor for two parameter arguments 175 /// (for normalized_measure, para1=beta, para2=R0) 176 /// (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff) 98 177 Nsubjettiness(int N, 99 178 Njettiness::AxesMode axes_mode, … … 101 180 double para1, 102 181 double para2) 103 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {} 104 105 // Three parameter arguments 106 // (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff) 182 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) { 183 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead."); 184 } 185 186 /// \deprecated 187 /// Constructor for three parameter arguments 188 /// (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff) 107 189 Nsubjettiness(int N, 108 190 Njettiness::AxesMode axes_mode, … … 111 193 double para2, 112 194 double para3) 113 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {} 114 115 // Old constructor for backwards compatibility with v1.0, 116 // where normalized_cutoff_measure was the only option 195 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) { 196 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead."); 197 } 198 199 /// \deprecated 200 /// Old constructor for backwards compatibility with v1.0, 201 /// where normalized_cutoff_measure was the only option 117 202 Nsubjettiness(int N, 118 203 Njettiness::AxesMode axes_mode, … … 120 205 double R0, 121 206 double Rcutoff=std::numeric_limits<double>::max()) 122 : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {} 123 124 /// returns tau_N, measured on the constituents of this jet 125 double result(const PseudoJet& jet) const; 126 127 /// returns components of tau_N, so that user can find individual tau values. 128 TauComponents component_result(const PseudoJet& jet) const; 129 130 /// returns current axes found by result() calculation 131 std::vector<fastjet::PseudoJet> currentAxes() const { 132 return _njettinessFinder.currentAxes(); 133 } 134 135 /// returns seed axes used for onepass minimization (otherwise same as currentAxes) 136 std::vector<fastjet::PseudoJet> seedAxes() const { 137 return _njettinessFinder.seedAxes(); 138 } 139 140 /// returns subjet regions found by result() calculation (these have valid constituents) 141 /// Note that the axes and the subjets are not the same 142 std::vector<fastjet::PseudoJet> currentSubjets() const { 143 return _njettinessFinder.currentJets(); 144 } 145 146 /// returns components of tau_N without recalculating anything 147 TauComponents currentTauComponents() const { 148 return _njettinessFinder.currentTauComponents(); 149 } 150 151 // To set axes for manual use 152 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) { 153 // Cross check that manual axes are being used is in Njettiness 154 _njettinessFinder.setAxes(myAxes); 155 } 156 157 158 private: 159 160 Njettiness _njettinessFinder; // TODO: should muck with this so result can be const without this mutable 161 int _N; 162 207 : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) { 208 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead."); 209 } 210 163 211 }; 164 212 165 213 166 // ------------------------------------------------------------------------214 ///------------------------------------------------------------------------ 167 215 /// \class NsubjettinessRatio 168 // NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio 169 // tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values 170 // is often used in analyses, so this class is helpful to streamline code. 216 /// \brief Implements ratios of N-subjettiness jet shapes 217 /// 218 /// NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio 219 /// tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values 220 /// is often used in analyses, so this class is helpful to streamline code. Note that 221 /// manual axis mode is not supported 171 222 class NsubjettinessRatio : public FunctionOfPseudoJet<double> { 172 223 public: 173 224 174 // Main constructor. Apart from specifying both N and M, the same options as Nsubjettiness225 /// Main constructor. Apart from specifying both N and M, the same options as Nsubjettiness 175 226 NsubjettinessRatio(int N, 176 227 int M, … … 178 229 const MeasureDefinition & measure_def) 179 230 : _nsub_numerator(N,axes_def,measure_def), 180 _nsub_denominator(M,axes_def,measure_def) {} 181 182 // Alternative constructor with enums and parameters 183 // Again, likely to be removed 231 _nsub_denominator(M,axes_def,measure_def) { 232 if (axes_def.needsManualAxes()) { 233 throw Error("NsubjettinessRatio does not support ManualAxes mode."); 234 } 235 } 236 237 /// Returns tau_N/tau_M based off the input jet using result function from Nsubjettiness 238 double result(const PseudoJet& jet) const; 239 240 private: 241 242 Nsubjettiness _nsub_numerator; ///< Function for numerator 243 Nsubjettiness _nsub_denominator; ///< Function for denominator 244 245 public: 246 247 // The following interfaces are included for backwards compatibility, but no longer recommended. 248 // They may be deprecated at some point. 249 250 /// \deprecated 251 /// Old-style constructor for zero arguments 252 /// Alternative constructor with enums and parameters 253 /// Again, likely to be removed 184 254 NsubjettinessRatio(int N, 185 255 int M, … … 188 258 : _nsub_numerator(N, axes_mode, measure_mode), 189 259 _nsub_denominator(M, axes_mode, measure_mode) {} 190 191 260 261 /// \deprecated 262 /// Old-style constructor for one argument 192 263 NsubjettinessRatio(int N, 193 264 int M, … … 197 268 : _nsub_numerator(N, axes_mode, measure_mode, para1), 198 269 _nsub_denominator(M, axes_mode, measure_mode, para1) {} 199 270 271 /// \deprecated 272 /// Old-style constructor for 2 arguments 200 273 NsubjettinessRatio(int N, 201 274 int M, … … 207 280 _nsub_denominator(M, axes_mode, measure_mode, para1, para2) {} 208 281 282 /// \deprecated 283 /// Old-style constructor for 3 arguments 209 284 NsubjettinessRatio(int N, 210 285 int M, … … 217 292 _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3) {} 218 293 219 //returns tau_N/tau_M based off the input jet using result function from Nsubjettiness 220 double result(const PseudoJet& jet) const; 221 222 private: 223 224 Nsubjettiness _nsub_numerator; 225 Nsubjettiness _nsub_denominator; 226 294 227 295 }; 228 296
Note:
See TracChangeset
for help on using the changeset viewer.