Changeset 49234af in git for external/fastjet/contribs/Nsubjettiness/AxesFinder.cc
- 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/contribs/Nsubjettiness/AxesFinder.cc
rf6b6ee7 r49234af 5 5 // Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason 6 6 // 7 // $Id: AxesFinder.cc 670 2014-06-06 01:24:42Z jthaler $ 7 8 //---------------------------------------------------------------------- 8 9 // This file is part of FastJet contrib. … … 37 38 template <int N> 38 39 std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes, 39 const std::vector <fastjet::PseudoJet> & inputJets) {40 const std::vector <fastjet::PseudoJet> & inputJets) const { 40 41 assert(old_axes.size() == N); 41 42 … … 45 46 for (int n = 0; n < N; ++n) { 46 47 new_axes[n].reset(0.0,0.0,0.0,0.0); 47 #ifdef FASTJET248 new_jets[n].reset(0.0,0.0,0.0,0.0);49 #else50 // use cheaper reset if available51 48 new_jets[n].reset_momentum(0.0,0.0,0.0,0.0); 52 #endif53 49 } 54 50 … … 135 131 // (This is just a wrapper for the templated version above.) 136 132 std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxes(const std::vector <LightLikeAxis> & old_axes, 137 const std::vector <fastjet::PseudoJet> & inputJets) {133 const std::vector <fastjet::PseudoJet> & inputJets) const { 138 134 int N = old_axes.size(); 139 135 switch (N) { … … 166 162 // uses minimization of N-jettiness to continually update axes until convergence. 167 163 // The function returns the axes found at the (local) minimum 168 std::vector<fastjet::PseudoJet> AxesFinderFromOnePassMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes){164 std::vector<fastjet::PseudoJet> AxesFinderFromOnePassMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const { 169 165 170 166 // convert from PseudoJets to LightLikeAxes … … 211 207 } 212 208 213 PseudoJet AxesFinderFromKmeansMinimization::jiggle(const PseudoJet& axis) {209 PseudoJet AxesFinderFromKmeansMinimization::jiggle(const PseudoJet& axis) const { 214 210 double phi_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range; 215 211 double rap_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range; … … 226 222 227 223 // Repeatedly calls the one pass finder to try to find global minimum 228 std::vector<fastjet::PseudoJet> AxesFinderFromKmeansMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes){224 std::vector<fastjet::PseudoJet> AxesFinderFromKmeansMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const { 229 225 230 226 // first iteration … … 256 252 // It continually updates until it reaches convergence or it reaches the maximum number of attempts. 257 253 // This is essentially the same as a stable cone finder. 258 std::vector<fastjet::PseudoJet> AxesFinderFromGeometricMinimization::get BetterAxes(int n_jets, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes){254 std::vector<fastjet::PseudoJet> AxesFinderFromGeometricMinimization::getAxes(int /*n_jets*/, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes) const { 259 255 260 256 std::vector<fastjet::PseudoJet> seedAxes = currentAxes; 261 double seedTau = _function ->tau(particles, seedAxes);257 double seedTau = _function.tau(particles, seedAxes); 262 258 263 259 for (int i = 0; i < _nAttempts; i++) { … … 270 266 // start from unclustered beam measure 271 267 int minJ = -1; 272 double minDist = _function ->beam_distance_squared(particles[i]);268 double minDist = _function.beam_distance_squared(particles[i]); 273 269 274 270 // which axis am I closest to? 275 271 for (unsigned int j = 0; j < seedAxes.size(); j++) { 276 double tempDist = _function ->jet_distance_squared(particles[i],seedAxes[j]);272 double tempDist = _function.jet_distance_squared(particles[i],seedAxes[j]); 277 273 if (tempDist < minDist) { 278 274 minDist = tempDist; … … 287 283 // calculate tau on new axes 288 284 seedAxes = newAxes; 289 double tempTau = _function ->tau(particles, newAxes);285 double tempTau = _function.tau(particles, newAxes); 290 286 291 287 // close enough to stop?
Note:
See TracChangeset
for help on using the changeset viewer.