Changes in external/fastjet/ClusterSequence.hh [273e668:d69dfe4] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/ClusterSequence.hh
r273e668 rd69dfe4 1 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__ 2 #define __FASTJET_CLUSTERSEQUENCE_HH__ 3 4 //FJSTARTHEADER 5 // $Id: ClusterSequence.hh 3709 2014-09-29 13:19:11Z soyez $ 1 //STARTHEADER 2 // $Id: ClusterSequence.hh 3114 2013-05-04 08:46:00Z salam $ 6 3 // 7 // Copyright (c) 2005-201 4, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 5 // 9 6 //---------------------------------------------------------------------- … … 16 13 // 17 14 // The algorithms that underlie FastJet have required considerable 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 15 // development and are described in hep-ph/0512210. If you use 20 16 // FastJet as part of work towards a scientific publication, please 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 17 // include a citation to the FastJet paper. 23 18 // 24 19 // FastJet is distributed in the hope that it will be useful, … … 30 25 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 31 26 //---------------------------------------------------------------------- 32 //FJENDHEADER 33 27 //ENDHEADER 28 29 30 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__ 31 #define __FASTJET_CLUSTERSEQUENCE_HH__ 34 32 35 33 #include<vector> … … 67 65 ClusterSequence () : _deletes_self_when_unused(false) {} 68 66 69 /// create a ClusterSequence, starting from the supplied set 70 /// of PseudoJets and clustering them with jet definition specified 67 // /// create a clustersequence starting from the supplied set 68 // /// of pseudojets and clustering them with the long-invariant 69 // /// kt algorithm (E-scheme recombination) with the supplied 70 // /// value for R. 71 // /// 72 // /// If strategy=DumbN3 a very stupid N^3 algorithm is used for the 73 // /// clustering; otherwise strategy = NlnN* uses cylinders algorithms 74 // /// with some number of pi coverage. If writeout_combinations=true a 75 // /// summary of the recombination sequence is written out 76 // template<class L> ClusterSequence (const std::vector<L> & pseudojets, 77 // const double & R = 1.0, 78 // const Strategy & strategy = Best, 79 // const bool & writeout_combinations = false); 80 81 82 /// create a clustersequence starting from the supplied set 83 /// of pseudojets and clustering them with jet definition specified 71 84 /// by jet_def (which also specifies the clustering strategy) 72 85 template<class L> ClusterSequence ( … … 91 104 /// algorithm) with pt >= ptmin. Time taken should be of the order 92 105 /// of the number of jets returned. 93 std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const;106 std::vector<PseudoJet> inclusive_jets (const double & ptmin = 0.0) const; 94 107 95 108 /// return the number of jets (in the sense of the exclusive 96 109 /// algorithm) that would be obtained when running the algorithm 97 110 /// with the given dcut. 98 int n_exclusive_jets (const double dcut) const;111 int n_exclusive_jets (const double & dcut) const; 99 112 100 113 /// return a vector of all jets (in the sense of the exclusive 101 114 /// algorithm) that would be obtained when running the algorithm 102 115 /// with the given dcut. 103 std::vector<PseudoJet> exclusive_jets (const double dcut) const;116 std::vector<PseudoJet> exclusive_jets (const double & dcut) const; 104 117 105 118 /// return a vector of all jets when the event is clustered (in the … … 108 121 /// If there are fewer than njets particles in the ClusterSequence 109 122 /// an error is thrown 110 std::vector<PseudoJet> exclusive_jets (const int njets) const;123 std::vector<PseudoJet> exclusive_jets (const int & njets) const; 111 124 112 125 /// return a vector of all jets when the event is clustered (in the … … 115 128 /// If there are fewer than njets particles in the ClusterSequence 116 129 /// the function just returns however many particles there were. 117 std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const;130 std::vector<PseudoJet> exclusive_jets_up_to (const int & njets) const; 118 131 119 132 /// return the dmin corresponding to the recombination that went 120 133 /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number 121 134 /// of particles in the event is <= njets, the function returns 0. 122 double exclusive_dmerge (const int njets) const;135 double exclusive_dmerge (const int & njets) const; 123 136 124 137 /// return the maximum of the dmin encountered during all recombinations … … 126 139 /// exclusive_dmerge, except in cases where the dmin do not increase 127 140 /// monotonically. 128 double exclusive_dmerge_max (const int njets) const;141 double exclusive_dmerge_max (const int & njets) const; 129 142 130 143 /// return the ymin corresponding to the recombination that went from … … 145 158 146 159 147 //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const;160 //int n_exclusive_jets (const PseudoJet & jet, const double & dcut) const; 148 161 149 162 /// return a vector of all subjets of the current jet (in the sense … … 156 169 /// just getting that list of constituents. 157 170 std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet, 158 const double dcut) const;171 const double & dcut) const; 159 172 160 173 /// return the size of exclusive_subjets(...); still n ln n with same … … 162 175 /// exclusive_subjets.size() 163 176 int n_exclusive_subjets(const PseudoJet & jet, 164 const double dcut) const;177 const double & dcut) const; 165 178 166 179 /// return the list of subjets obtained by unclustering the supplied … … 180 193 int nsub) const; 181 194 182 /// return sthe dij that was present in the merging nsub+1 -> nsub195 /// return the dij that was present in the merging nsub+1 -> nsub 183 196 /// subjets inside this jet. 184 197 /// … … 186 199 double exclusive_subdmerge(const PseudoJet & jet, int nsub) const; 187 200 188 /// return sthe maximum dij that occurred in the whole event at the201 /// return the maximum dij that occurred in the whole event at the 189 202 /// stage that the nsub+1 -> nsub merge of subjets occurred inside 190 203 /// this jet. … … 194 207 195 208 //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet, 196 // const int njets) const;197 //double exclusive_dmerge (const PseudoJet & jet, const int njets) const;209 // const int & njets) const; 210 //double exclusive_dmerge (const PseudoJet & jet, const int & njets) const; 198 211 199 212 /// returns the sum of all energies in the event (relevant mainly for e+e-) … … 259 272 // Not yet. Perhaps in a future release. 260 273 // /// print out all inclusive jets with pt > ptmin 261 // virtual void print_jets (const double ptmin=0.0) const;274 // virtual void print_jets (const double & ptmin=0.0) const; 262 275 263 276 /// add on to subjet_vector the constituents of jet (for internal use mainly) … … 287 300 /// 288 301 /// NB: after having made this call, the user is still allowed to 289 /// delete the CS. Jets associated with it will then simply not be 290 /// able to access their substructure after that point. 302 /// delete the CS or let it go out of scope. Jets associated with it 303 /// will then simply not be able to access their substructure after 304 /// that point. 291 305 void delete_self_when_unused(); 292 306 … … 299 313 300 314 /// returns the scale associated with a jet as required for this 301 /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 302 /// Cambridge algorithm). Intended mainly for internal use and not 303 /// valid for plugin algorithms. 315 /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 316 /// Cambridge algorithm). [May become virtual at some point] 304 317 double jet_scale_for_algorithm(const PseudoJet & jet) const; 305 318 … … 350 363 351 364 /// the plugin can associate some extra information with the 352 /// ClusterSequence object by calling this function. The353 /// ClusterSequence takes ownership of the pointer (and354 /// responsibility for deleting it when the CS gets deleted).355 inline void plugin_associate_extras(Extras * extras_in) {356 _extras.reset(extras_in);357 }358 359 /// the plugin can associate some extra information with the360 365 /// ClusterSequence object by calling this function 361 ///362 /// As of FJ v3.1, this is deprecated, in line with the deprecation363 /// of auto_ptr in C++11364 366 inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) { 367 //_extras = extras_in; 365 368 _extras.reset(extras_in.release()); 366 369 } … … 596 599 //DEP /// clustering, provided for legacy purposes. The jet finder is that 597 600 //DEP /// specified in the static member _default_jet_algorithm. 598 //DEP void _initialise_and_run (const double R,601 //DEP void _initialise_and_run (const double & R, 599 602 //DEP const Strategy & strategy, 600 603 //DEP const bool & writeout_combinations); … … 619 622 /// jet_j, at distance scale dij; return the index newjet_k of the 620 623 /// result of the recombination of i and j. 621 void _do_ij_recombination_step(const int jet_i, const intjet_j,622 const double dij, int & newjet_k);624 void _do_ij_recombination_step(const int & jet_i, const int & jet_j, 625 const double & dij, int & newjet_k); 623 626 624 627 /// carry out an recombination step in which _jets[jet_i] merges with 625 628 /// the beam, 626 void _do_iB_recombination_step(const int jet_i, const doublediB);629 void _do_iB_recombination_step(const int & jet_i, const double & diB); 627 630 628 631 /// every time a jet is added internally during clustering, this … … 637 640 void _update_structure_use_count(); 638 641 639 /// returns a suggestion for the best strategy to use on event640 /// multiplicity, algorithm, R, etc.641 Strategy _best_strategy() const;642 643 /// \if internal_doc644 /// \class _Parabola645 /// returns c*(a*R**2 + b*R + 1);646 /// Written as a class in case we want to give names to different647 /// parabolas648 /// \endif649 class _Parabola {650 public:651 _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {}652 inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);}653 private:654 double _a, _b, _c;655 };656 657 /// \if internal_doc658 /// \class _Line659 /// operator()(R) returns a*R+b;660 /// \endif661 class _Line {662 public:663 _Line(double a, double b) : _a(a), _b(b) {}664 inline double operator()(const double R) const {return _a*R + _b;}665 private:666 double _a, _b;667 };668 642 669 643 /// This contains the physical PseudoJets; for each PseudoJet one … … 707 681 708 682 bool _plugin_activated; 683 //std::auto_ptr<Extras> _extras; // things the plugin might want to add 709 684 SharedPtr<Extras> _extras; // things the plugin might want to add 710 685 … … 730 705 void _fast_NsqrtN_cluster(); 731 706 732 void _add_step_to_history(const int step_number, const intparent1,733 const int parent2, const intjetp_index,734 const double dij);707 void _add_step_to_history(const int & step_number, const int & parent1, 708 const int & parent2, const int & jetp_index, 709 const double & dij); 735 710 736 711 /// internal routine associated with the construction of the unique … … 751 726 752 727 /// currently used only in the Voronoi based code 753 void _add_ktdistance_to_map(const int ii,728 void _add_ktdistance_to_map(const int & ii, 754 729 DistMap & DijMap, 755 730 const DynamicNearestNeighbours * DNN); … … 759 734 static bool _first_time; 760 735 761 /// manage warnings related to exclusive jets access 762 static LimitedWarning _exclusive_warnings; 736 /// record the number of warnings provided about the exclusive 737 /// algorithm -- so that we don't print it out more than a few 738 /// times. 739 static int _n_exclusive_warnings; 763 740 764 741 /// the limited warning member for notification of user that … … 777 754 int _jets_index; 778 755 }; 756 779 757 780 758 /// structure analogous to BriefJet, but with the extra information … … 884 862 // routines for tiled case, including some overloads of the plain 885 863 // BriefJet cases 886 int _tile_index(const double eta, const doublephi) const;864 int _tile_index(const double & eta, const double & phi) const; 887 865 void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index); 888 866 void _bj_remove_from_tiles(TiledJet * const jet); … … 893 871 void _add_untagged_neighbours_to_tile_union(const int tile_index, 894 872 std::vector<int> & tile_union, int & n_near_tiles); 873 895 874 896 875 //---------------------------------------------------------------------- … … 944 923 // template<class L> ClusterSequence::ClusterSequence ( 945 924 // const std::vector<L> & pseudojets, 946 // const double R,925 // const double & R, 947 926 // const Strategy & strategy, 948 927 // const bool & writeout_combinations) { … … 987 966 988 967 inline unsigned int ClusterSequence::n_particles() const {return _initial_n;} 989 990 //----------------------------------------------------------------------991 // implementation of JetDefinition::operator() is here to avoid nasty992 // issues of order of implementations and includes993 template<class L>994 std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const {995 // create a new cluster sequence996 ClusterSequence * cs = new ClusterSequence(particles, *this);997 998 // get the jets, and sort them according to whether the algorithm999 // is spherical or not1000 std::vector<PseudoJet> jets;1001 if (is_spherical()) {1002 jets = sorted_by_E(cs->inclusive_jets());1003 } else {1004 jets = sorted_by_pt(cs->inclusive_jets());1005 }1006 1007 // make sure the ClusterSequence gets deleted once it's no longer1008 // needed1009 if (jets.size() != 0) {1010 cs->delete_self_when_unused();1011 } else {1012 delete cs;1013 }1014 1015 return jets;1016 }1017 968 1018 969
Note:
See TracChangeset
for help on using the changeset viewer.