Changes in external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh [b7b836a:1f1f858] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh
rb7b836a r1f1f858 1 // $Id: RecursiveSymmetryCutBase.hh 1074 2017-09-18 15:15:20Z gsoyez $1 // $Id: RecursiveSymmetryCutBase.hh 700 2014-07-07 12:50:05Z gsoyez $ 2 2 // 3 3 // Copyright (c) 2014-, Gavin P. Salam, Gregory Soyez, Jesse Thaler … … 24 24 25 25 #include <limits> 26 #include <cassert>27 26 #include <fastjet/internal/base.hh> 28 27 #include "fastjet/tools/Transformer.hh" 29 28 #include "fastjet/WrappedStructure.hh" 30 #include "fastjet/CompositeJetStructure.hh" 31 32 #include "fastjet/config.h" 33 34 // we'll use the native FJ class for reculstering if available 35 #if FASTJET_VERSION_NUMBER >= 30100 36 #include "fastjet/tools/Recluster.hh" 37 #else 29 38 30 #include "Recluster.hh" 39 #endif40 31 41 32 /** \mainpage RecursiveTools contrib 42 33 43 The RecursiveTools contrib provides a set of tools for 44 recursive investigation jet substructure. Currently it includes: 34 The aims RecursiveTools contrib to provide a set of tools for 35 recursive investigation of the substructure of jets. 36 37 Currently it includes: 45 38 - fastjet::contrib::ModifiedMassDropTagger 46 39 - fastjet::contrib::SoftDrop 47 - fastjet::contrib::RecursiveSymmetryCutBase (from which the above two classes derive) 48 - fastjet::contrib::IteratedSoftDropSymmetryFactors (defines ISD procedure) 49 - fastjet::contrib::IteratedSoftDropMultiplicity (defines a useful observable using ISD) 50 - example*.cc provides usage examples 40 - the two above classes derive from fastjet::contrib::RecursiveSymmetryCutBase 41 - fastjet::contrib::Recluster provides a reclustering transformer 42 - example*.cc provides a usage examples 51 43 */ 52 44 … … 86 78 87 79 /// an enum of the different (a)symmetry measures that can be used 88 enum SymmetryMeasure{scalar_z, ///< \f$ \min(p_{ti}, p_{tj})/(p_{ti} + p_{tj}) \f$ 89 vector_z, ///< \f$ \min(p_{ti}, p_{tj})/p_{t(i+j)} \f$ 90 y, ///< \f$ \min(p_{ti}^2,p_{tj}^2) \Delta R_{ij}^2 / m_{ij}^2 \f$ 91 theta_E, ///< \f$ \min(E_i,E_j)/(E_i+E_j) \f$ with 3d angle (ee collisions) 92 cos_theta_E ///< \f$ \min(E_i,E_j)/(E_i+E_j) \f$ with 93 /// \f$ \sqrt{2[1-cos(theta)]}\f$ for angles (ee collisions) 80 enum SymmetryMeasure{scalar_z, ///< \f$ \min(p_{ti}, p_{tj})/(p_{ti} + p_{tj}) \f$ 81 vector_z, ///< \f$ \min(p_{ti}, p_{tj})/p_{t(i+j)} \f$ 82 y /// \f$ \min(p_{ti}^2,p_{tj}^2) \Delta R_{ij}^2 / m_{ij}^2 \f$ 83 94 84 }; 95 85 … … 97 87 enum RecursionChoice{larger_pt, ///< choose the subjet with larger \f$ p_t \f$ 98 88 larger_mt, ///< choose the subjet with larger \f$ m_t \equiv (m^2+p_t^2)^{\frac12}] \f$ 99 larger_m, ///< choose the subjet with larger mass (deprecated) 100 larger_E ///< choose the subjet with larger energy (meant for ee collisions) 89 larger_m /// choose the subjet with larger mass (deprecated) 101 90 }; 102 91 … … 130 119 virtual ~RecursiveSymmetryCutBase(){} 131 120 132 // access to class info133 //----------------------------------------------------------------------134 SymmetryMeasure symmetry_measure() const { return _symmetry_measure; }135 double mu_cut() const { return _mu_cut; }136 RecursionChoice recursion_choice() const { return _recursion_choice; }137 138 121 // internal subtraction configuration 139 122 //---------------------------------------------------------------------- … … 164 147 //---------------------------------------------------------------------- 165 148 166 /// configure the reclustering prior to the recursivede-clustering149 /// configure the reclustering prior to the SoftDrop de-clustering 167 150 /// \param do_reclustering recluster the jet or not? 168 151 /// \param recluster how to recluster the jet … … 191 174 /// in particular values of symmetry, delta_R, and mu of dropped branches 192 175 void set_verbose_structure(bool enable=true) { _verbose_structure = enable; } 193 bool has_verbose_structure() const { return _verbose_structure; }194 176 195 177 … … 203 185 /// subtracted jet. 204 186 virtual PseudoJet result(const PseudoJet & j) const; 205 187 206 188 /// description of the tool 207 189 virtual std::string description() const; 208 190 209 /// returns the gepometrical distance between the two particles 210 /// depending on the symmetry measure used 211 double squared_geometric_distance(const PseudoJet &j1, 212 const PseudoJet &j2) const; 213 191 /// the type of the associated structure 192 //typedef RecursiveSymmetryCutBaseStructure StructureType; 214 193 215 194 class StructureType; … … 224 203 /// apply for a given pair of subjets p1 and p2 225 204 virtual double symmetry_cut_fn(const PseudoJet & /* p1 */, 226 const PseudoJet & /* p2 */, 227 void *extra_parameters = 0) const = 0; 205 const PseudoJet & /* p2 */) const = 0; 228 206 /// the associated dwescription 229 207 virtual std::string symmetry_cut_description() const = 0; 230 231 //----------------------------------------------------------------------232 /// this defines status codes when checking for substructure233 enum RecursionStatus{234 recursion_success=0, //< found some substructure235 recursion_dropped, //< dropped softest prong; recursion continues236 recursion_no_parents, //< down to constituents; bottom of recursion237 recursion_issue //< something went wrong; recursion stops238 };239 240 //----------------------------------------------------------------------241 /// the method below is the one actually performing one step of the242 /// recursion.243 ///244 /// It returns a status code (defined above)245 ///246 /// In case of success, all the information is filled247 /// In case of "no parents", piee1 is the same subjet248 /// In case of trouble, piece2 will be a 0 PJ and piece1 is the PJ we249 /// should return (either 0 itself if the issue was critical, or250 /// non-wero in case of a minor issue just causing the recursion to251 /// stop)252 ///253 /// The extra_parameter argument allows one to pass extra agruments254 /// to the symmetry condition255 RecursionStatus recurse_one_step(const PseudoJet & subjet,256 PseudoJet &piece1, PseudoJet &piece2,257 double &sym, double &mu2,258 void *extra_parameters = 0) const;259 260 //----------------------------------------------------------------------261 /// helper for handling the reclustering262 PseudoJet _recluster_if_needed(const PseudoJet &jet) const;263 264 //----------------------------------------------------------------------265 // helpers for selecting between ee and pp cases266 bool is_ee() const{267 return ((_symmetry_measure==theta_E) || (_symmetry_measure==cos_theta_E));268 }269 208 270 209 private: … … 299 238 public: 300 239 StructureType(const PseudoJet & j) : 301 WrappedStructure(j.structure_shared_ptr()), _delta_R(-1.0), _symmetry(-1.0), _mu(-1.0), 302 _is_composite(false), _has_verbose(false) // by default, do not store verbose structure 303 {} 304 305 /// construct a structure with 306 /// - basic info inherited from the reference jet "j" 307 /// - a given deltaR for substructure 308 /// - a given symmetry for substructure 309 /// - a given mu parameter for substructure 310 /// If j is a "copmposite jet", it means that it has further 311 /// substructure to potentially recurse into 312 StructureType(const PseudoJet & j, double delta_R_in, double symmetry_in, double mu_in=-1.0) : 313 WrappedStructure(j.structure_shared_ptr()), _delta_R(delta_R_in), _symmetry(symmetry_in), _mu(mu_in), 314 _is_composite(dynamic_cast<const CompositeJetStructure*>(j.structure_ptr()) != NULL), 240 WrappedStructure(j.structure_shared_ptr()), 315 241 _has_verbose(false) // by default, do not store verbose structure 316 242 {} 317 243 318 244 // information about kept branch 319 double delta_R() const {return _delta_R;} 320 double thetag() const {return _delta_R;} // alternative name 321 double symmetry() const {return _symmetry;} 322 double zg() const {return _symmetry;} // alternative name 323 double mu() const {return _mu;} 245 double delta_R() const {return _delta_R;}; 246 double symmetry() const {return _symmetry;}; 247 double mu() const {return _mu;}; 324 248 325 249 // additional verbose information about dropped branches 326 250 bool has_verbose() const { return _has_verbose;} 327 void set_verbose(bool value) { _has_verbose = value;}328 329 /// returns true if the current jet has some substructure (i.e. has330 /// been tagged by the resursion) or not331 ///332 /// Note that this should include deltaR==0 (e.g. a perfectly333 /// collinear branching with SoftDrop)334 bool has_substructure() const { return _delta_R>=0; }335 336 /// number of dropped branches337 int dropped_count(bool global=true) const;338 339 /// delta_R of dropped branches 340 // / when "global" is set, recurse into possile further substructure341 std::vector<double> dropped_ delta_R(bool global=true) const;342 void set_dropped_delta_R(const std::vector<double> &v) { _dropped_delta_R = v; }343 344 /// symmetry values of dropped branches345 std::vector<double> dropped_symmetry(bool global=true) const; 346 void set_dropped_symmetry(const std::vector<double> &v) { _dropped_symmetry = v; }347 348 /// mass drop values of dropped branches349 std::vector<double> dropped_mu(bool global=true) const;350 void set_dropped_mu(const std::vector<double> &v) { _dropped_mu = v;}351 352 // /maximum symmetry value dropped353 double max_dropped_symmetry( bool global=true) const;354 355 /// (global) list of groomed away elements as zg and thetag356 /// sorted from largest to smallest anlge357 std::vector<std::pair<double,double> > sorted_zg_and_thetag() const;358 251 252 // number of dropped branches 253 int dropped_count() const { 254 if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_count() values."); 255 return _dropped_delta_R.size(); 256 } 257 258 // delta_R of dropped branches 259 std::vector<double> dropped_delta_R() const { 260 if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_delta_R() values."); 261 return _dropped_delta_R; 262 } 263 264 // symmetry values of dropped branches 265 std::vector<double> dropped_symmetry() const { 266 if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_symmetry() values."); 267 return _dropped_symmetry; 268 } 269 270 // mass drop values of dropped branches 271 std::vector<double> dropped_mu() const { 272 if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_mu() values."); 273 return _dropped_mu; 274 } 275 276 // maximum symmetry value dropped 277 double max_dropped_symmetry() const { 278 if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get max_dropped_symmetry()."); 279 if (_dropped_symmetry.size() == 0) return 0.0; 280 return *std::max_element(_dropped_symmetry.begin(),_dropped_symmetry.end()); 281 } 282 359 283 private: 360 284 double _delta_R, _symmetry, _mu; 361 285 friend class RecursiveSymmetryCutBase; 362 286 363 bool _is_composite;364 365 287 // additional verbose information 366 288 bool _has_verbose; … … 369 291 std::vector<double> _dropped_symmetry; 370 292 std::vector<double> _dropped_mu; 371 372 bool check_verbose(const std::string &what) const{373 if (!_has_verbose){374 throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get "+what+".");375 return false;376 }377 return true;378 }379 380 293 381 294 };
Note:
See TracChangeset
for help on using the changeset viewer.