Changeset 35cdc46 in git for external/fastjet/ClusterSequence.hh
- Timestamp:
- Sep 3, 2014, 3:18:54 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- be2222c
- Parents:
- 5b5a56b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/ClusterSequence.hh
r5b5a56b r35cdc46 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 3619 2014-08-13 14:17:19Z salam $ 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 /// returns c*(a*R**2 + b*R + 1); 644 /// Written as a class in case we want to give names to different 645 /// parabolas 646 class _Parabola { 647 public: 648 _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {} 649 inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);} 650 private: 651 double _a, _b, _c; 652 }; 653 654 /// operator()(R) returns a*R+b; 655 class _Line { 656 public: 657 _Line(double a, double b) : _a(a), _b(b) {} 658 inline double operator()(const double R) const {return _a*R + _b;} 659 private: 660 double _a, _b; 661 }; 642 662 643 663 /// This contains the physical PseudoJets; for each PseudoJet one … … 681 701 682 702 bool _plugin_activated; 683 //std::auto_ptr<Extras> _extras; // things the plugin might want to add684 703 SharedPtr<Extras> _extras; // things the plugin might want to add 685 704 … … 705 724 void _fast_NsqrtN_cluster(); 706 725 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);726 void _add_step_to_history(const int step_number, const int parent1, 727 const int parent2, const int jetp_index, 728 const double dij); 710 729 711 730 /// internal routine associated with the construction of the unique … … 726 745 727 746 /// currently used only in the Voronoi based code 728 void _add_ktdistance_to_map(const int &ii,747 void _add_ktdistance_to_map(const int ii, 729 748 DistMap & DijMap, 730 749 const DynamicNearestNeighbours * DNN); … … 734 753 static bool _first_time; 735 754 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; 755 /// manage warnings related to exclusive jets access 756 static LimitedWarning _exclusive_warnings; 740 757 741 758 /// the limited warning member for notification of user that … … 754 771 int _jets_index; 755 772 }; 756 757 773 758 774 /// structure analogous to BriefJet, but with the extra information … … 862 878 // routines for tiled case, including some overloads of the plain 863 879 // BriefJet cases 864 int _tile_index(const double & eta, const double &phi) const;880 int _tile_index(const double eta, const double phi) const; 865 881 void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index); 866 882 void _bj_remove_from_tiles(TiledJet * const jet); … … 871 887 void _add_untagged_neighbours_to_tile_union(const int tile_index, 872 888 std::vector<int> & tile_union, int & n_near_tiles); 873 874 889 875 890 //---------------------------------------------------------------------- … … 923 938 // template<class L> ClusterSequence::ClusterSequence ( 924 939 // const std::vector<L> & pseudojets, 925 // const double &R,940 // const double R, 926 941 // const Strategy & strategy, 927 942 // const bool & writeout_combinations) { … … 966 981 967 982 inline unsigned int ClusterSequence::n_particles() const {return _initial_n;} 983 984 //---------------------------------------------------------------------- 985 // implementation of JetDefinition::operator() is here to avoid nasty 986 // issues of order of implementations and includes 987 template<class L> 988 std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const { 989 // create a new cluster sequence 990 ClusterSequence * cs = new ClusterSequence(particles, *this); 991 992 // get the jets, and sort them according to whether the algorithm 993 // is spherical or not 994 std::vector<PseudoJet> jets; 995 if (is_spherical()) { 996 jets = sorted_by_E(cs->inclusive_jets()); 997 } else { 998 jets = sorted_by_pt(cs->inclusive_jets()); 999 } 1000 1001 // make sure the ClusterSequence gets deleted once it's no longer 1002 // needed 1003 if (jets.size() != 0) { 1004 cs->delete_self_when_unused(); 1005 } else { 1006 delete cs; 1007 } 1008 1009 return jets; 1010 } 968 1011 969 1012
Note:
See TracChangeset
for help on using the changeset viewer.