Changes in external/fastjet/Selector.cc [35cdc46:d69dfe4] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/Selector.cc
r35cdc46 rd69dfe4 1 // FJSTARTHEADER2 // $Id : Selector.cc 3504 2014-08-01 06:07:54Z soyez$1 //STARTHEADER 2 // $Id$ 3 3 // 4 // Copyright (c) 2005-201 4, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2011, 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. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 15 // development and are described in hep-ph/0512210. If you use 17 16 // FastJet as part of work towards a scientific publication, please 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 17 // include a citation to the FastJet paper. 20 18 // 21 19 // FastJet is distributed in the hope that it will be useful, … … 27 25 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 28 26 //---------------------------------------------------------------------- 29 // FJENDHEADER27 //ENDHEADER 30 28 31 29 … … 95 93 96 94 return n; 97 }98 99 //----------------------------------------------------------------------100 // sum the momenta of the jets that pass the cuts101 PseudoJet Selector::sum(const std::vector<PseudoJet> & jets) const {102 PseudoJet this_sum(0,0,0,0);103 const SelectorWorker * worker_local = validated_worker();104 105 // separate strategies according to whether the worker applies jet by jet106 if (worker_local->applies_jet_by_jet()) {107 for (unsigned i = 0; i < jets.size(); i++) {108 if (worker_local->pass(jets[i])) this_sum += jets[i];109 }110 } else {111 std::vector<const PseudoJet *> jetptrs(jets.size());112 for (unsigned i = 0; i < jets.size(); i++) {113 jetptrs[i] = & jets[i];114 }115 worker_local->terminator(jetptrs);116 for (unsigned i = 0; i < jetptrs.size(); i++) {117 if (jetptrs[i]) this_sum += jets[i];118 }119 }120 121 return this_sum;122 }123 124 //----------------------------------------------------------------------125 // sum the (scalar) pt of the jets that pass the cuts126 double Selector::scalar_pt_sum(const std::vector<PseudoJet> & jets) const {127 double this_sum = 0.0;128 const SelectorWorker * worker_local = validated_worker();129 130 // separate strategies according to whether the worker applies jet by jet131 if (worker_local->applies_jet_by_jet()) {132 for (unsigned i = 0; i < jets.size(); i++) {133 if (worker_local->pass(jets[i])) this_sum += jets[i].pt();134 }135 } else {136 std::vector<const PseudoJet *> jetptrs(jets.size());137 for (unsigned i = 0; i < jets.size(); i++) {138 jetptrs[i] = & jets[i];139 }140 worker_local->terminator(jetptrs);141 for (unsigned i = 0; i < jetptrs.size(); i++) {142 if (jetptrs[i]) this_sum += jets[i].pt();143 }144 }145 146 return this_sum;147 95 } 148 96 … … 1107 1055 class SW_Circle : public SW_WithReference { 1108 1056 public: 1109 SW_Circle(const double radius) : _radius2(radius*radius) {}1057 SW_Circle(const double &radius) : _radius2(radius*radius) {} 1110 1058 1111 1059 /// return a copy of the current object … … 1152 1100 1153 1101 // select on objets within a distance 'radius' of a variable location 1154 Selector SelectorCircle(const double radius) {1102 Selector SelectorCircle(const double & radius) { 1155 1103 return Selector(new SW_Circle(radius)); 1156 1104 } … … 1162 1110 class SW_Doughnut : public SW_WithReference { 1163 1111 public: 1164 SW_Doughnut(const double radius_in, const doubleradius_out)1112 SW_Doughnut(const double &radius_in, const double &radius_out) 1165 1113 : _radius_in2(radius_in*radius_in), _radius_out2(radius_out*radius_out) {} 1166 1114 … … 1211 1159 1212 1160 // select on objets with distance from the centre is between 'radius_in' and 'radius_out' 1213 Selector SelectorDoughnut(const double radius_in, const doubleradius_out) {1161 Selector SelectorDoughnut(const double & radius_in, const double & radius_out) { 1214 1162 return Selector(new SW_Doughnut(radius_in, radius_out)); 1215 1163 } … … 1220 1168 class SW_Strip : public SW_WithReference { 1221 1169 public: 1222 SW_Strip(const double delta) : _delta(delta) {}1170 SW_Strip(const double &delta) : _delta(delta) {} 1223 1171 1224 1172 /// return a copy of the current object … … 1265 1213 1266 1214 // select on objets within a distance 'radius' of a variable location 1267 Selector SelectorStrip(const double half_width) {1215 Selector SelectorStrip(const double & half_width) { 1268 1216 return Selector(new SW_Strip(half_width)); 1269 1217 } … … 1276 1224 class SW_Rectangle : public SW_WithReference { 1277 1225 public: 1278 SW_Rectangle(const double delta_rap, const doubledelta_phi)1226 SW_Rectangle(const double &delta_rap, const double &delta_phi) 1279 1227 : _delta_rap(delta_rap), _delta_phi(delta_phi) {} 1280 1228 … … 1322 1270 1323 1271 // select on objets within a distance 'radius' of a variable location 1324 Selector SelectorRectangle(const double half_rap_width, const doublehalf_phi_width) {1272 Selector SelectorRectangle(const double & half_rap_width, const double & half_phi_width) { 1325 1273 return Selector(new SW_Rectangle(half_rap_width, half_phi_width)); 1326 1274 }
Note:
See TracChangeset
for help on using the changeset viewer.