Changeset 49234af in git for external/fastjet/ClusterSequence.hh
- Timestamp:
- Dec 9, 2014, 1:27:13 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 37deb3b, 9e991f8
- Parents:
- f6b6ee7 (diff), e7e90df (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/ClusterSequence.hh
rf6b6ee7 r49234af 1 //STARTHEADER 2 // $Id: ClusterSequence.hh 3114 2013-05-04 08:46:00Z salam $ 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 $ 3 6 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 8 // 6 9 //---------------------------------------------------------------------- … … 13 16 // 14 17 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 20 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 18 23 // 19 24 // FastJet is distributed in the hope that it will be useful, … … 25 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 31 //---------------------------------------------------------------------- 27 //ENDHEADER 28 29 30 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__ 31 #define __FASTJET_CLUSTERSEQUENCE_HH__ 32 //FJENDHEADER 33 32 34 33 35 #include<vector> … … 65 67 ClusterSequence () : _deletes_self_when_unused(false) {} 66 68 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 69 /// create a ClusterSequence, starting from the supplied set 70 /// of PseudoJets and clustering them with jet definition specified 84 71 /// by jet_def (which also specifies the clustering strategy) 85 72 template<class L> ClusterSequence ( … … 104 91 /// algorithm) with pt >= ptmin. Time taken should be of the order 105 92 /// of the number of jets returned. 106 std::vector<PseudoJet> inclusive_jets (const double &ptmin = 0.0) const;93 std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const; 107 94 108 95 /// return the number of jets (in the sense of the exclusive 109 96 /// algorithm) that would be obtained when running the algorithm 110 97 /// with the given dcut. 111 int n_exclusive_jets (const double &dcut) const;98 int n_exclusive_jets (const double dcut) const; 112 99 113 100 /// return a vector of all jets (in the sense of the exclusive 114 101 /// algorithm) that would be obtained when running the algorithm 115 102 /// with the given dcut. 116 std::vector<PseudoJet> exclusive_jets (const double &dcut) const;103 std::vector<PseudoJet> exclusive_jets (const double dcut) const; 117 104 118 105 /// return a vector of all jets when the event is clustered (in the … … 121 108 /// If there are fewer than njets particles in the ClusterSequence 122 109 /// an error is thrown 123 std::vector<PseudoJet> exclusive_jets (const int &njets) const;110 std::vector<PseudoJet> exclusive_jets (const int njets) const; 124 111 125 112 /// return a vector of all jets when the event is clustered (in the … … 128 115 /// If there are fewer than njets particles in the ClusterSequence 129 116 /// the function just returns however many particles there were. 130 std::vector<PseudoJet> exclusive_jets_up_to (const int &njets) const;117 std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const; 131 118 132 119 /// return the dmin corresponding to the recombination that went 133 120 /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number 134 121 /// of particles in the event is <= njets, the function returns 0. 135 double exclusive_dmerge (const int &njets) const;122 double exclusive_dmerge (const int njets) const; 136 123 137 124 /// return the maximum of the dmin encountered during all recombinations … … 139 126 /// exclusive_dmerge, except in cases where the dmin do not increase 140 127 /// monotonically. 141 double exclusive_dmerge_max (const int &njets) const;128 double exclusive_dmerge_max (const int njets) const; 142 129 143 130 /// return the ymin corresponding to the recombination that went from … … 158 145 159 146 160 //int n_exclusive_jets (const PseudoJet & jet, const double &dcut) const;147 //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const; 161 148 162 149 /// return a vector of all subjets of the current jet (in the sense … … 169 156 /// just getting that list of constituents. 170 157 std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet, 171 const double &dcut) const;158 const double dcut) const; 172 159 173 160 /// return the size of exclusive_subjets(...); still n ln n with same … … 175 162 /// exclusive_subjets.size() 176 163 int n_exclusive_subjets(const PseudoJet & jet, 177 const double &dcut) const;164 const double dcut) const; 178 165 179 166 /// return the list of subjets obtained by unclustering the supplied … … 193 180 int nsub) const; 194 181 195 /// return the dij that was present in the merging nsub+1 -> nsub182 /// returns the dij that was present in the merging nsub+1 -> nsub 196 183 /// subjets inside this jet. 197 184 /// … … 199 186 double exclusive_subdmerge(const PseudoJet & jet, int nsub) const; 200 187 201 /// return the maximum dij that occurred in the whole event at the188 /// returns the maximum dij that occurred in the whole event at the 202 189 /// stage that the nsub+1 -> nsub merge of subjets occurred inside 203 190 /// this jet. … … 207 194 208 195 //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet, 209 // const int &njets) const;210 //double exclusive_dmerge (const PseudoJet & jet, const int &njets) const;196 // const int njets) const; 197 //double exclusive_dmerge (const PseudoJet & jet, const int njets) const; 211 198 212 199 /// returns the sum of all energies in the event (relevant mainly for e+e-) … … 272 259 // Not yet. Perhaps in a future release. 273 260 // /// print out all inclusive jets with pt > ptmin 274 // virtual void print_jets (const double &ptmin=0.0) const;261 // virtual void print_jets (const double ptmin=0.0) const; 275 262 276 263 /// add on to subjet_vector the constituents of jet (for internal use mainly) … … 300 287 /// 301 288 /// NB: after having made this call, the user is still allowed to 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. 289 /// delete the CS. Jets associated with it will then simply not be 290 /// able to access their substructure after that point. 305 291 void delete_self_when_unused(); 306 292 … … 313 299 314 300 /// returns the scale associated with a jet as required for this 315 /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 316 /// Cambridge algorithm). [May become virtual at some point] 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. 317 304 double jet_scale_for_algorithm(const PseudoJet & jet) const; 318 305 … … 363 350 364 351 /// the plugin can associate some extra information with the 352 /// ClusterSequence object by calling this function. The 353 /// ClusterSequence takes ownership of the pointer (and 354 /// 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 the 365 360 /// ClusterSequence object by calling this function 361 /// 362 /// As of FJ v3.1, this is deprecated, in line with the deprecation 363 /// of auto_ptr in C++11 366 364 inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) { 367 //_extras = extras_in;368 365 _extras.reset(extras_in.release()); 369 366 } … … 599 596 //DEP /// clustering, provided for legacy purposes. The jet finder is that 600 597 //DEP /// specified in the static member _default_jet_algorithm. 601 //DEP void _initialise_and_run (const double &R,598 //DEP void _initialise_and_run (const double R, 602 599 //DEP const Strategy & strategy, 603 600 //DEP const bool & writeout_combinations); … … 622 619 /// jet_j, at distance scale dij; return the index newjet_k of the 623 620 /// result of the recombination of i and j. 624 void _do_ij_recombination_step(const int & jet_i, const int &jet_j,625 const double &dij, int & newjet_k);621 void _do_ij_recombination_step(const int jet_i, const int jet_j, 622 const double dij, int & newjet_k); 626 623 627 624 /// carry out an recombination step in which _jets[jet_i] merges with 628 625 /// the beam, 629 void _do_iB_recombination_step(const int & jet_i, const double &diB);626 void _do_iB_recombination_step(const int jet_i, const double diB); 630 627 631 628 /// every time a jet is added internally during clustering, this … … 640 637 void _update_structure_use_count(); 641 638 639 /// returns a suggestion for the best strategy to use on event 640 /// multiplicity, algorithm, R, etc. 641 Strategy _best_strategy() const; 642 643 /// \if internal_doc 644 /// \class _Parabola 645 /// returns c*(a*R**2 + b*R + 1); 646 /// Written as a class in case we want to give names to different 647 /// parabolas 648 /// \endif 649 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_doc 658 /// \class _Line 659 /// operator()(R) returns a*R+b; 660 /// \endif 661 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 }; 642 668 643 669 /// This contains the physical PseudoJets; for each PseudoJet one … … 681 707 682 708 bool _plugin_activated; 683 //std::auto_ptr<Extras> _extras; // things the plugin might want to add684 709 SharedPtr<Extras> _extras; // things the plugin might want to add 685 710 … … 705 730 void _fast_NsqrtN_cluster(); 706 731 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);732 void _add_step_to_history(const int step_number, const int parent1, 733 const int parent2, const int jetp_index, 734 const double dij); 710 735 711 736 /// internal routine associated with the construction of the unique … … 726 751 727 752 /// currently used only in the Voronoi based code 728 void _add_ktdistance_to_map(const int &ii,753 void _add_ktdistance_to_map(const int ii, 729 754 DistMap & DijMap, 730 755 const DynamicNearestNeighbours * DNN); … … 734 759 static bool _first_time; 735 760 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; 761 /// manage warnings related to exclusive jets access 762 static LimitedWarning _exclusive_warnings; 740 763 741 764 /// the limited warning member for notification of user that … … 754 777 int _jets_index; 755 778 }; 756 757 779 758 780 /// structure analogous to BriefJet, but with the extra information … … 862 884 // routines for tiled case, including some overloads of the plain 863 885 // BriefJet cases 864 int _tile_index(const double & eta, const double &phi) const;886 int _tile_index(const double eta, const double phi) const; 865 887 void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index); 866 888 void _bj_remove_from_tiles(TiledJet * const jet); … … 871 893 void _add_untagged_neighbours_to_tile_union(const int tile_index, 872 894 std::vector<int> & tile_union, int & n_near_tiles); 873 874 895 875 896 //---------------------------------------------------------------------- … … 923 944 // template<class L> ClusterSequence::ClusterSequence ( 924 945 // const std::vector<L> & pseudojets, 925 // const double &R,946 // const double R, 926 947 // const Strategy & strategy, 927 948 // const bool & writeout_combinations) { … … 966 987 967 988 inline unsigned int ClusterSequence::n_particles() const {return _initial_n;} 989 990 //---------------------------------------------------------------------- 991 // implementation of JetDefinition::operator() is here to avoid nasty 992 // issues of order of implementations and includes 993 template<class L> 994 std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const { 995 // create a new cluster sequence 996 ClusterSequence * cs = new ClusterSequence(particles, *this); 997 998 // get the jets, and sort them according to whether the algorithm 999 // is spherical or not 1000 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 longer 1008 // needed 1009 if (jets.size() != 0) { 1010 cs->delete_self_when_unused(); 1011 } else { 1012 delete cs; 1013 } 1014 1015 return jets; 1016 } 968 1017 969 1018
Note:
See TracChangeset
for help on using the changeset viewer.