Changeset 1d208a2 in git for external/fastjet/plugins/Jade
- Timestamp:
- Aug 30, 2016, 12:36:00 AM (8 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 6be4bc0
- Parents:
- d091310
- Location:
- external/fastjet/plugins/Jade
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/plugins/Jade/JadePlugin.cc
rd091310 r1d208a2 1 1 //FJSTARTHEADER 2 // $Id: JadePlugin.cc 3433 2014-07-23 08:17:03Z salam $2 // $Id: JadePlugin.cc 4063 2016-03-04 10:31:40Z salam $ 3 3 // 4 4 // Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez … … 35 35 //#include "fastjet/internal/ClusterSequence_N2.icc" 36 36 #include "fastjet/NNH.hh" 37 #include "fastjet/NNFJN2Plain.hh" 37 38 38 39 // other stuff … … 51 52 //---------------------------------------------------------------------- 52 53 /// class to help run a JADE algorithm 54 /// 55 /// This class works both with NNH and NNFJN2Plain clustering 56 /// helpers. They both use the same init(...) call, but for the 57 /// clustering: 58 /// 59 /// - NNH uses distance(...) and beam_distance() 60 /// - NNFJPlainN2 uses geometrical_distance(...), momentum_factor() 61 /// and geometrical_beam_distance() 62 /// 63 /// For NNFJPlainN2 the 2 E_i E_j (1-cos theta_{ij}) factor 64 /// gets broken up into 65 /// 66 /// sqrt(2)*min(E_i,E_j) * [sqrt(2)*max(E_i,E_j) (1 - cos \theta_{ij})] 67 /// 68 /// The second factor is what we call the "geometrical_distance" even 69 /// though it isn't actually purely geometrical. But the fact that it 70 /// gets multiplied by min(E_i,E_j) to get the full distance is 71 /// sufficient for the validity of the FJ lemma, allowing for the use 72 /// of NNFJN2Plain. 53 73 class JadeBriefJet { 54 74 public: … … 69 89 } 70 90 91 double geometrical_distance(const JadeBriefJet * jet) const { 92 double dij = 1 - nx*jet->nx 93 - ny*jet->ny 94 - nz*jet->nz; 95 dij *= max(rt2E,jet->rt2E); 96 return dij; 97 } 98 99 double momentum_factor() const { 100 return rt2E; 101 } 102 71 103 double beam_distance() const { 72 104 return numeric_limits<double>::max(); 73 105 } 74 106 107 double geometrical_beam_distance() const { 108 // get a number that is almost the same as max(), just a little 109 // smaller so as to ensure that when we divide it by rt2E and then 110 // multiply it again, we won't get an overflow 111 const double almost_max = numeric_limits<double>::max() * (1 - 1e-13); 112 return almost_max / rt2E; 113 } 114 75 115 private: 76 116 double rt2E, nx, ny, nz; … … 82 122 ostringstream desc; 83 123 desc << "e+e- JADE algorithm plugin"; 124 switch(_strategy) { 125 case strategy_NNH: 126 desc << ", using NNH strategy"; break; 127 case strategy_NNFJN2Plain: 128 desc << ", using NNFJN2Plain strategy"; break; 129 default: 130 throw Error("Unrecognized strategy in JadePlugin"); 131 } 132 84 133 return desc.str(); 85 134 } 86 135 87 //---------------------------------------------------------------------- 88 void JadePlugin::run_clustering(ClusterSequence & cs) const { 136 // //---------------------------------------------------------------------- 137 // void JadePlugin::run_clustering(ClusterSequence & cs) const { 138 // int njets = cs.jets().size(); 139 // 140 // //SharedPtr<NNBase<> > nn; 141 // NNBase<> * nn; 142 // switch(_strategy) { 143 // case strategy_NNH: 144 // //nn.reset(new NNH<JadeBriefJet>(cs.jets())); 145 // nn = new NNH<JadeBriefJet>(cs.jets()); 146 // break; 147 // case strategy_NNFJN2Plain: 148 // //nn.reset(new NNFJN2Plain<JadeBriefJet>(cs.jets())); 149 // nn = new NNFJN2Plain<JadeBriefJet>(cs.jets()); 150 // break; 151 // default: 152 // throw Error("Unrecognized strategy in JadePlugin"); 153 // } 154 // //NNH<JadeBriefJet> nnh(cs.jets()); 155 // //NNFJN2Plain<JadeBriefJet> nnh(cs.jets()); 156 // 157 // // if testing against Hoeth's implementation, need to rescale the 158 // // dij by Q^2. 159 // //double Q2 = cs.Q2(); 160 // 161 // while (njets > 0) { 162 // int i, j, k; 163 // double dij = nn->dij_min(i, j); 164 // 165 // if (j >= 0) { 166 // cs.plugin_record_ij_recombination(i, j, dij, k); 167 // nn->merge_jets(i, j, cs.jets()[k], k); 168 // } else { 169 // double diB = cs.jets()[i].E()*cs.jets()[i].E(); // get new diB 170 // cs.plugin_record_iB_recombination(i, diB); 171 // nn->remove_jet(i); 172 // } 173 // njets--; 174 // } 175 // delete nn; 176 // } 177 178 179 template<class N> void JadePlugin::_actual_run_clustering(ClusterSequence & cs) const { 180 89 181 int njets = cs.jets().size(); 90 NNH<JadeBriefJet> nnh(cs.jets()); 182 183 N nn(cs.jets()); 91 184 92 185 // if testing against Hoeth's implementation, need to rescale the … … 96 189 while (njets > 0) { 97 190 int i, j, k; 98 double dij = nn h.dij_min(i, j);191 double dij = nn.dij_min(i, j); 99 192 100 193 if (j >= 0) { 101 194 cs.plugin_record_ij_recombination(i, j, dij, k); 102 nn h.merge_jets(i, j, cs.jets()[k], k);195 nn.merge_jets(i, j, cs.jets()[k], k); 103 196 } else { 104 197 double diB = cs.jets()[i].E()*cs.jets()[i].E(); // get new diB 105 198 cs.plugin_record_iB_recombination(i, diB); 106 nn h.remove_jet(i);199 nn.remove_jet(i); 107 200 } 108 201 njets--; 109 202 } 203 110 204 } 111 205 206 //---------------------------------------------------------------------- 207 void JadePlugin::run_clustering(ClusterSequence & cs) const { 208 209 switch(_strategy) { 210 case strategy_NNH: 211 _actual_run_clustering<NNH<JadeBriefJet> >(cs); 212 break; 213 case strategy_NNFJN2Plain: 214 _actual_run_clustering<NNFJN2Plain<JadeBriefJet> >(cs); 215 break; 216 default: 217 throw Error("Unrecognized strategy in JadePlugin"); 218 } 219 } 220 221 112 222 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh -
external/fastjet/plugins/Jade/fastjet/JadePlugin.hh
rd091310 r1d208a2 3 3 4 4 //FJSTARTHEADER 5 // $Id: JadePlugin.hh 3433 2014-07-23 08:17:03Z salam $5 // $Id: JadePlugin.hh 4061 2016-03-03 21:51:25Z salam $ 6 6 // 7 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez … … 77 77 class JadePlugin : public JetDefinition::Plugin { 78 78 public: 79 /// enum that contains the two clustering strategy options; for 80 /// higher multiplicities, strategy_NNFJN2Plain is about a factor of 81 /// two faster. 82 enum Strategy { strategy_NNH = 0, strategy_NNFJN2Plain = 1}; 83 79 84 /// Main constructor for the Jade Plugin class. 80 JadePlugin ( ){}85 JadePlugin (Strategy strategy = strategy_NNFJN2Plain) : _strategy(strategy) {} 81 86 82 87 /// copy constructor … … 100 105 private: 101 106 107 template<class N> void _actual_run_clustering(ClusterSequence &) const; 108 109 Strategy _strategy; 102 110 }; 103 111
Note:
See TracChangeset
for help on using the changeset viewer.