Index: external/fastjet/Selector.cc
===================================================================
--- external/fastjet/Selector.cc	(revision d69dfe4aebfe1009f10ecbbabd92ce813ba93f3e)
+++ external/fastjet/Selector.cc	(revision 49234af6f43184fff8e2bfee34c7b17846289882)
@@ -1,6 +1,6 @@
-//STARTHEADER
-// $Id$
+//FJSTARTHEADER
+// $Id: Selector.cc 3504 2014-08-01 06:07:54Z soyez $
 //
-// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
+// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
 //
 //----------------------------------------------------------------------
@@ -13,7 +13,9 @@
 //
 //  The algorithms that underlie FastJet have required considerable
-//  development and are described in hep-ph/0512210. If you use
+//  development. They are described in the original FastJet paper,
+//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
 //  FastJet as part of work towards a scientific publication, please
-//  include a citation to the FastJet paper.
+//  quote the version you use and include a citation to the manual and
+//  optionally also to hep-ph/0512210.
 //
 //  FastJet is distributed in the hope that it will be useful,
@@ -25,5 +27,5 @@
 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
 //----------------------------------------------------------------------
-//ENDHEADER
+//FJENDHEADER
 
 
@@ -95,4 +97,54 @@
 }
 
+//----------------------------------------------------------------------
+// sum the momenta of the jets that pass the cuts
+PseudoJet Selector::sum(const std::vector<PseudoJet> & jets) const {
+  PseudoJet this_sum(0,0,0,0);
+  const SelectorWorker * worker_local = validated_worker();
+  
+  // separate strategies according to whether the worker applies jet by jet
+  if (worker_local->applies_jet_by_jet()) {
+    for (unsigned i = 0; i < jets.size(); i++) {
+      if (worker_local->pass(jets[i])) this_sum += jets[i];
+    }
+  } else {
+    std::vector<const PseudoJet *> jetptrs(jets.size());
+    for (unsigned i = 0; i < jets.size(); i++) {
+      jetptrs[i] = & jets[i];
+    }
+    worker_local->terminator(jetptrs);
+    for (unsigned i = 0; i < jetptrs.size(); i++) {
+      if (jetptrs[i]) this_sum += jets[i];
+    }
+  }
+
+  return this_sum;
+}
+
+//----------------------------------------------------------------------
+// sum the (scalar) pt of the jets that pass the cuts
+double Selector::scalar_pt_sum(const std::vector<PseudoJet> & jets) const {
+  double this_sum = 0.0;
+  const SelectorWorker * worker_local = validated_worker();
+  
+  // separate strategies according to whether the worker applies jet by jet
+  if (worker_local->applies_jet_by_jet()) {
+    for (unsigned i = 0; i < jets.size(); i++) {
+      if (worker_local->pass(jets[i])) this_sum += jets[i].pt();
+    }
+  } else {
+    std::vector<const PseudoJet *> jetptrs(jets.size());
+    for (unsigned i = 0; i < jets.size(); i++) {
+      jetptrs[i] = & jets[i];
+    }
+    worker_local->terminator(jetptrs);
+    for (unsigned i = 0; i < jetptrs.size(); i++) {
+      if (jetptrs[i]) this_sum += jets[i].pt();
+    }
+  }
+
+  return this_sum;
+}
+
 
 //----------------------------------------------------------------------
@@ -1055,5 +1107,5 @@
 class SW_Circle : public SW_WithReference {
 public:
-  SW_Circle(const double &radius) : _radius2(radius*radius) {}
+  SW_Circle(const double radius) : _radius2(radius*radius) {}
 
   /// return a copy of the current object
@@ -1100,5 +1152,5 @@
 
 // select on objets within a distance 'radius' of a variable location
-Selector SelectorCircle(const double & radius) {
+Selector SelectorCircle(const double radius) {
   return Selector(new SW_Circle(radius));
 }
@@ -1110,5 +1162,5 @@
 class SW_Doughnut : public SW_WithReference {
 public:
-  SW_Doughnut(const double &radius_in, const double &radius_out)
+  SW_Doughnut(const double radius_in, const double radius_out)
     : _radius_in2(radius_in*radius_in), _radius_out2(radius_out*radius_out) {}
 
@@ -1159,5 +1211,5 @@
 
 // select on objets with distance from the centre is between 'radius_in' and 'radius_out' 
-Selector SelectorDoughnut(const double & radius_in, const double & radius_out) {
+Selector SelectorDoughnut(const double radius_in, const double radius_out) {
   return Selector(new SW_Doughnut(radius_in, radius_out));
 }
@@ -1168,5 +1220,5 @@
 class SW_Strip : public SW_WithReference {
 public:
-  SW_Strip(const double &delta) : _delta(delta) {}
+  SW_Strip(const double delta) : _delta(delta) {}
 
   /// return a copy of the current object
@@ -1213,5 +1265,5 @@
 
 // select on objets within a distance 'radius' of a variable location
-Selector SelectorStrip(const double & half_width) {
+Selector SelectorStrip(const double half_width) {
   return Selector(new SW_Strip(half_width));
 }
@@ -1224,5 +1276,5 @@
 class SW_Rectangle : public SW_WithReference {
 public:
-  SW_Rectangle(const double &delta_rap, const double &delta_phi)
+  SW_Rectangle(const double delta_rap, const double delta_phi)
     : _delta_rap(delta_rap),  _delta_phi(delta_phi) {}
 
@@ -1270,5 +1322,5 @@
 
 // select on objets within a distance 'radius' of a variable location
-Selector SelectorRectangle(const double & half_rap_width, const double & half_phi_width) {
+Selector SelectorRectangle(const double half_rap_width, const double half_phi_width) {
   return Selector(new SW_Rectangle(half_rap_width, half_phi_width));
 }
