Index: external/fastjet/ClusterSequence_TiledN2.cc
===================================================================
--- external/fastjet/ClusterSequence_TiledN2.cc	(revision d69dfe4aebfe1009f10ecbbabd92ce813ba93f3e)
+++ external/fastjet/ClusterSequence_TiledN2.cc	(revision 492aef9106f3f50b8c80a1788f28110caa406c7b)
@@ -1,6 +1,6 @@
-//STARTHEADER
-// $Id$
+//FJSTARTHEADER
+// $Id: ClusterSequence_TiledN2.cc 3433 2014-07-23 08:17:03Z salam $
 //
-// 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,8 +27,8 @@
 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
 //----------------------------------------------------------------------
-//ENDHEADER
-
-
-// The plain N^2 part of the ClusterSequence class -- separated out
+//FJENDHEADER
+
+
+// The tiled N^2 part of the ClusterSequence class -- separated out
 // from the rest of the class implementation so as to speed up
 // compilation of this particular part while it is under test.
@@ -39,4 +41,5 @@
 #include "fastjet/ClusterSequence.hh"
 #include "fastjet/internal/MinHeap.hh"
+#include "fastjet/internal/TilingExtent.hh"
 
 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
@@ -94,20 +97,24 @@
   _tile_size_phi = twopi / _n_tiles_phi; // >= _Rparam and fits in 2pi
 
-  // always include zero rapidity in the tiling region
-  _tiles_eta_min = 0.0;
-  _tiles_eta_max = 0.0;
-  // but go no further than following
-  const double maxrap = 7.0;
-
-  // and find out how much further one should go
-  for(unsigned int i = 0; i < _jets.size(); i++) {
-    double eta = _jets[i].rap();
-    // first check if eta is in range -- to avoid taking into account
-    // very spurious rapidities due to particles with near-zero kt.
-    if (abs(eta) < maxrap) {
-      if (eta < _tiles_eta_min) {_tiles_eta_min = eta;}
-      if (eta > _tiles_eta_max) {_tiles_eta_max = eta;}
-    }
-  }
+  TilingExtent tiling_analysis(*this);
+  _tiles_eta_min = tiling_analysis.minrap();
+  _tiles_eta_max = tiling_analysis.maxrap();
+
+  // // always include zero rapidity in the tiling region
+  // _tiles_eta_min = 0.0;
+  // _tiles_eta_max = 0.0;
+  // // but go no further than following
+  // const double maxrap = 7.0;
+  // 
+  // // and find out how much further one should go
+  // for(unsigned int i = 0; i < _jets.size(); i++) {
+  //   double eta = _jets[i].rap();
+  //   // first check if eta is in range -- to avoid taking into account
+  //   // very spurious rapidities due to particles with near-zero kt.
+  //   if (abs(eta) < maxrap) {
+  //     if (eta < _tiles_eta_min) {_tiles_eta_min = eta;}
+  //     if (eta > _tiles_eta_max) {_tiles_eta_max = eta;}
+  //   }
+  // }
 
   // now adjust the values
@@ -167,5 +174,5 @@
 //----------------------------------------------------------------------
 /// return the tile index corresponding to the given eta,phi point
-int ClusterSequence::_tile_index(const double & eta, const double & phi) const {
+int ClusterSequence::_tile_index(const double eta, const double phi) const {
   int ieta, iphi;
   if      (eta <= _tiles_eta_min) {ieta = 0;}
@@ -249,4 +256,21 @@
 /// their "tagged" status is false; when a neighbour is added its
 /// tagged status is set to true.
+///
+/// Note that with a high level of warnings (-pedantic -Wextra -ansi,
+/// gcc complains about tile_index maybe being used uninitialised for
+/// oldB in ClusterSequence::_minheap_faster_tiled_N2_cluster(). We
+/// have explicitly checked that it was harmless so we could disable
+/// the gcc warning by hand using the construct below
+///
+///  #pragma GCC diagnostic push
+///  #pragma GCC diagnostic ignored "-Wpragmas"
+///  #pragma GCC diagnostic ignored "-Wuninitialized"
+///  #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+///    ...
+///  #pragma GCC diagnostic pop
+///
+/// the @GCC diagnostic push/pop directive was only introduced in
+/// gcc-4.6, so for broader usage, we'd need to insert #pragma GCC
+/// diagnostic ignored "-Wpragmas" at the top of this file
 inline void ClusterSequence::_add_untagged_neighbours_to_tile_union(
                const int tile_index, 
@@ -274,5 +298,5 @@
   TiledJet * jetA = briefjets, * jetB;
   TiledJet oldB;
-  oldB.tile_index=0; // prevents a gcc warning  
+  oldB.tile_index=0; // prevents a gcc warning
 
   // will be used quite deep inside loops, but declare it here so that
@@ -517,5 +541,5 @@
   TiledJet * jetA = briefjets, * jetB;
   TiledJet oldB;
-  oldB.tile_index=0; // prevents a gcc warning  
+  oldB.tile_index=0; // prevents a gcc warning
 
   // will be used quite deep inside loops, but declare it here so that
@@ -555,5 +579,4 @@
     // when we set NN for both jetA and jetB on the RH tiles.
   }
-
   
   // now create the diJ (where J is i's NN) table -- remember that 
@@ -721,6 +744,4 @@
 }
 
-
-
 //----------------------------------------------------------------------
 /// run a tiled clustering, with our minheap for keeping track of the
@@ -735,5 +756,4 @@
   TiledJet oldB;
   oldB.tile_index=0; // prevents a gcc warning
-  
 
   // will be used quite deep inside loops, but declare it here so that
