Changeset 49234af in git for external/fastjet/Selector.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/Selector.cc
rf6b6ee7 r49234af 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Selector.cc 3504 2014-08-01 06:07:54Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // 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 … … 95 97 } 96 98 99 //---------------------------------------------------------------------- 100 // sum the momenta of the jets that pass the cuts 101 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 jet 106 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 cuts 126 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 jet 131 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 } 148 97 149 98 150 //---------------------------------------------------------------------- … … 1055 1107 class SW_Circle : public SW_WithReference { 1056 1108 public: 1057 SW_Circle(const double &radius) : _radius2(radius*radius) {}1109 SW_Circle(const double radius) : _radius2(radius*radius) {} 1058 1110 1059 1111 /// return a copy of the current object … … 1100 1152 1101 1153 // select on objets within a distance 'radius' of a variable location 1102 Selector SelectorCircle(const double &radius) {1154 Selector SelectorCircle(const double radius) { 1103 1155 return Selector(new SW_Circle(radius)); 1104 1156 } … … 1110 1162 class SW_Doughnut : public SW_WithReference { 1111 1163 public: 1112 SW_Doughnut(const double &radius_in, const double &radius_out)1164 SW_Doughnut(const double radius_in, const double radius_out) 1113 1165 : _radius_in2(radius_in*radius_in), _radius_out2(radius_out*radius_out) {} 1114 1166 … … 1159 1211 1160 1212 // select on objets with distance from the centre is between 'radius_in' and 'radius_out' 1161 Selector SelectorDoughnut(const double & radius_in, const double &radius_out) {1213 Selector SelectorDoughnut(const double radius_in, const double radius_out) { 1162 1214 return Selector(new SW_Doughnut(radius_in, radius_out)); 1163 1215 } … … 1168 1220 class SW_Strip : public SW_WithReference { 1169 1221 public: 1170 SW_Strip(const double &delta) : _delta(delta) {}1222 SW_Strip(const double delta) : _delta(delta) {} 1171 1223 1172 1224 /// return a copy of the current object … … 1213 1265 1214 1266 // select on objets within a distance 'radius' of a variable location 1215 Selector SelectorStrip(const double &half_width) {1267 Selector SelectorStrip(const double half_width) { 1216 1268 return Selector(new SW_Strip(half_width)); 1217 1269 } … … 1224 1276 class SW_Rectangle : public SW_WithReference { 1225 1277 public: 1226 SW_Rectangle(const double &delta_rap, const double &delta_phi)1278 SW_Rectangle(const double delta_rap, const double delta_phi) 1227 1279 : _delta_rap(delta_rap), _delta_phi(delta_phi) {} 1228 1280 … … 1270 1322 1271 1323 // select on objets within a distance 'radius' of a variable location 1272 Selector SelectorRectangle(const double & half_rap_width, const double &half_phi_width) {1324 Selector SelectorRectangle(const double half_rap_width, const double half_phi_width) { 1273 1325 return Selector(new SW_Rectangle(half_rap_width, half_phi_width)); 1274 1326 }
Note:
See TracChangeset
for help on using the changeset viewer.