Changeset 49234af in git for external/fastjet/plugins/GridJet/GridJetPlugin.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/plugins/GridJet/GridJetPlugin.cc
rf6b6ee7 r49234af 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 20 11, Matteo Cacciari, GavinSalam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: GridJetPlugin.cc 2268 2011-06-20 15:12:26Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 // fastjet stuff … … 43 45 double requested_grid_spacing, 44 46 const JetDefinition & post_jet_def) : 47 #ifdef FASTJET_GRIDJET_USEFJGRID 48 RectangularGrid(ymax, requested_grid_spacing), _post_jet_def(post_jet_def) { 49 } 50 #else 45 51 _ymin(-ymax), _ymax(ymax), 46 52 _requested_grid_spacing(requested_grid_spacing) , … … 49 55 setup_grid(); 50 56 } 51 57 #endif 58 59 #ifdef FASTJET_GRIDJET_USEFJGRID 60 GridJetPlugin::GridJetPlugin (const RectangularGrid & grid, 61 const JetDefinition & post_jet_def) : 62 RectangularGrid(grid), _post_jet_def(post_jet_def) { 63 if (!RectangularGrid::is_initialised()) 64 throw Error("attempt to construct GridJetPlugin with uninitialised RectangularGrid"); 65 } 66 #endif // FASTJET_GRIDJET_USEFJGRID 67 68 #ifndef FASTJET_GRIDJET_USEFJGRID 52 69 void GridJetPlugin::setup_grid() { 53 70 // since we've exchanged the arguments of the constructor, … … 69 86 } 70 87 71 72 //---------------------------------------------------------------------- 73 string GridJetPlugin::description () const { 74 ostringstream desc; 75 desc << "GridJetPlugin plugin with ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")"; 76 if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) { 77 desc << ", followed by " << _post_jet_def.description(); 78 } 79 return desc.str(); 80 } 81 82 83 //---------------------------------------------------------------------- 84 double GridJetPlugin::R() const {return sqrt(_dy*_dphi/pi);} 85 86 87 //---------------------------------------------------------------------- 88 int GridJetPlugin::igrid(const PseudoJet & p) const { 88 //---------------------------------------------------------------------- 89 int GridJetPlugin::tile_index(const PseudoJet & p) const { 89 90 // directly taking int does not work for values between -1 and 0 90 91 // so use floor instead … … 108 109 return igrid_res; 109 110 } 111 #endif // not FASTJET_GRIDJET_USEFJGRID 112 113 114 //---------------------------------------------------------------------- 115 string GridJetPlugin::description () const { 116 ostringstream desc; 117 desc << "GridJetPlugin plugin with "; 118 #ifndef FASTJET_GRIDJET_USEFJGRID 119 desc << "ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")"; 120 #else 121 desc << RectangularGrid::description(); 122 #endif 123 if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) { 124 desc << ", followed by " << _post_jet_def.description(); 125 } 126 return desc.str(); 127 } 128 129 130 //---------------------------------------------------------------------- 131 double GridJetPlugin::R() const {return sqrt(drap()*dphi()/pi);} 110 132 111 133 … … 117 139 // * a number >= 0 will mean that particle indicated by the index 118 140 // is currently the jet on the grid 119 vector<int> grid( _ntotal, -1);141 vector<int> grid(n_tiles(), -1); 120 142 121 143 int nparticles = cs.jets().size(); … … 126 148 // combine particles with whatever is in the grid 127 149 for (int i = 0; i < nparticles; i++) { 128 int igrd = igrid(cs.jets()[i]);150 int igrd = tile_index(cs.jets()[i]); 129 151 //cout << i << " " << cs.jets()[i].rap() << " " << cs.jets()[i].phi() 130 152 // << " " << igrd << " " << grid.size() << " " << _ntotal << endl; 131 153 if (igrd < 0) continue; 132 assert(igrd <= _ntotal);154 assert(igrd <= n_tiles()); 133 155 if (grid[igrd] == -1) { 134 156 grid[igrd] = i; // jet index of initial particle i is i … … 145 167 // make the final jets via iB recombinations 146 168 for (unsigned igrd = 0; igrd < grid.size(); igrd++) { 147 if (grid[igrd] != -1 ) cs.plugin_record_iB_recombination(grid[igrd],148 169 if (grid[igrd] != -1 && tile_is_good(igrd)) 170 cs.plugin_record_iB_recombination(grid[igrd], dij_or_diB); 149 171 } 150 172 } else {
Note:
See TracChangeset
for help on using the changeset viewer.