fastjet::Dnn3piCylinder Class Reference

class derived from DynamicNearestNeighbours that provides an implementation for the surface of cylinder (using one DnnPlane object spanning 0--3pi). More...

#include <Dnn3piCylinder.hh>

Inheritance diagram for fastjet::Dnn3piCylinder:

Inheritance graph
fastjet::DynamicNearestNeighbours
[legend]
Collaboration diagram for fastjet::Dnn3piCylinder:

Collaboration graph
fastjet::DynamicNearestNeighboursfastjet::DnnPlane
[legend]
List of all members.

Public Member Functions

 Dnn3piCylinder ()
 empty initaliser
 Dnn3piCylinder (const std::vector< EtaPhi > &, const bool &ignore_nearest_is_mirror=false, const bool &verbose=false)
 Initialiser from a set of points on an Eta-Phi plane, where eta can have an arbitrary ranges and phi must be in range 0 <= phi < 2pi;.
int NearestNeighbourIndex (const int &ii) const
 Note: one of the difficulties of the 0--3pi mapping is that a point may have its mirror copy as its own nearest neighbour (if no other point is within a distance of 2pi).
double NearestNeighbourDistance (const int &ii) const
 Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).
bool Valid (const int &index) const
 Returns true iff the given index corresponds to a point that exists in the DNN structure (meaning that it has been added, and not removed in the meantime).
void RemoveAndAddPoints (const std::vector< int > &indices_to_remove, const std::vector< EtaPhi > &points_to_add, std::vector< int > &indices_added, std::vector< int > &indices_of_updated_neighbours)
 remove the points labelled by the std::vector indices_to_remove, and add the points specified by the std::vector points_to_add (corresponding indices will be calculated automatically); the idea behind this routine is that the points to be added will somehow be close to the one or other of the points being removed and this can be used by the implementation to provide hints for inserting the new points in whatever structure it is using.
 ~Dnn3piCylinder ()

Private Member Functions

EtaPhi _remap_phi (const EtaPhi &point)
 given a phi value in the 0--2pi range return one in the pi--3pi range.
void _RegisterCylinderPoint (const EtaPhi &cylinder_point, std::vector< EtaPhi > &plane_points)
 What on earth does this do?

Private Attributes

bool _verbose
bool _ignore_nearest_is_mirror
std::vector< MirrorVertexInfo_mirror_info
std::vector< int > _cylinder_index_of_plane_vertex
DnnPlane_DNN

Static Private Attributes

static const int INEXISTENT_VERTEX = -3

Classes

struct  MirrorVertexInfo

Detailed Description

class derived from DynamicNearestNeighbours that provides an implementation for the surface of cylinder (using one DnnPlane object spanning 0--3pi).

Definition at line 45 of file Dnn3piCylinder.hh.


Constructor & Destructor Documentation

fastjet::Dnn3piCylinder::Dnn3piCylinder (  )  [inline]

empty initaliser

Definition at line 48 of file Dnn3piCylinder.hh.

00048 {}

fastjet::Dnn3piCylinder::Dnn3piCylinder ( const std::vector< EtaPhi > &  ,
const bool &  ignore_nearest_is_mirror = false,
const bool &  verbose = false 
)

Initialiser from a set of points on an Eta-Phi plane, where eta can have an arbitrary ranges and phi must be in range 0 <= phi < 2pi;.

NB: this class is more efficient than the plain Dnn4piCylinder class, but can give wrong answers when the nearest neighbour is further away than 2pi (in this case a point's nearest neighbour becomes itself, because it is considered to be a distance 2pi away). For the kt-algorithm (e.g.) this is actually not a problem (the distance need only be accurate when it is less than R), so we can tell the routine to ignore this problem -- alternatively the routine will crash if it detects it occurring (only when finding the nearest neighbour index, not its distance).

fastjet::Dnn3piCylinder::~Dnn3piCylinder (  )  [inline]

Definition at line 249 of file Dnn3piCylinder.hh.

References _DNN.

00249                                        {
00250   delete _DNN; 
00251 }


Member Function Documentation

int fastjet::Dnn3piCylinder::NearestNeighbourIndex ( const int &  current  )  const [inline, virtual]

Note: one of the difficulties of the 0--3pi mapping is that a point may have its mirror copy as its own nearest neighbour (if no other point is within a distance of 2pi).

This does not matter for the kt_algorithm with reasonable values of radius, but might matter for a general use of this algorithm -- depending on whether or not the user has initialised the class with instructions to ignore this problem the program will detect and ignore it, or crash.

Implements fastjet::DynamicNearestNeighbours.

Definition at line 204 of file Dnn3piCylinder.hh.

References _cylinder_index_of_plane_vertex, _DNN, _ignore_nearest_is_mirror, _mirror_info, INEXISTENT_VERTEX, fastjet::DnnPlane::NearestNeighbourDistance(), and fastjet::DnnPlane::NearestNeighbourIndex().

00204                                                                           {
00205   int main_index = _mirror_info[current].main_index;
00206   int mirror_index = _mirror_info[current].mirror_index;
00207   int plane_index;
00208   if (mirror_index == INEXISTENT_VERTEX ) {
00209     plane_index = _DNN->NearestNeighbourIndex(main_index);
00210   } else {
00211     plane_index = (
00212         _DNN->NearestNeighbourDistance(main_index) < 
00213         _DNN->NearestNeighbourDistance(mirror_index)) ? 
00214       _DNN->NearestNeighbourIndex(main_index) : 
00215       _DNN->NearestNeighbourIndex(mirror_index) ; 
00216   }
00217   int this_cylinder_index = _cylinder_index_of_plane_vertex[plane_index];
00218   // either the user has acknowledged the fact that they may get the
00219   // mirror copy as the closest point, or crash if it should occur
00220   // that mirror copy is the closest point.
00221   assert(_ignore_nearest_is_mirror || this_cylinder_index != current);
00222   //if (this_cylinder_index == current) {
00223   //  std::cerr << "WARNING point "<<current<<
00224   //    " has its mirror copy as its own nearest neighbour"<<endl;
00225   //}
00226   return this_cylinder_index;
00227 }

double fastjet::Dnn3piCylinder::NearestNeighbourDistance ( const int &  ii  )  const [inline, virtual]

Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).

Implements fastjet::DynamicNearestNeighbours.

Definition at line 229 of file Dnn3piCylinder.hh.

References _DNN, _mirror_info, INEXISTENT_VERTEX, and fastjet::DnnPlane::NearestNeighbourDistance().

00229                                                                                 {
00230   int main_index = _mirror_info[current].main_index;
00231   int mirror_index = _mirror_info[current].mirror_index;
00232   if (mirror_index == INEXISTENT_VERTEX ) {
00233     return _DNN->NearestNeighbourDistance(main_index);
00234   } else {
00235     return (
00236         _DNN->NearestNeighbourDistance(main_index) < 
00237         _DNN->NearestNeighbourDistance(mirror_index)) ? 
00238       _DNN->NearestNeighbourDistance(main_index) : 
00239       _DNN->NearestNeighbourDistance(mirror_index) ; 
00240   }
00241  
00242 }

bool fastjet::Dnn3piCylinder::Valid ( const int &  index  )  const [inline, virtual]

Returns true iff the given index corresponds to a point that exists in the DNN structure (meaning that it has been added, and not removed in the meantime).

Implements fastjet::DynamicNearestNeighbours.

Definition at line 244 of file Dnn3piCylinder.hh.

References _DNN, _mirror_info, and fastjet::DnnPlane::Valid().

00244                                                          {
00245   return (_DNN->Valid(_mirror_info[index].main_index));
00246 }

void fastjet::Dnn3piCylinder::RemoveAndAddPoints ( const std::vector< int > &  indices_to_remove,
const std::vector< EtaPhi > &  points_to_add,
std::vector< int > &  indices_added,
std::vector< int > &  indices_of_updated_neighbours 
) [virtual]

remove the points labelled by the std::vector indices_to_remove, and add the points specified by the std::vector points_to_add (corresponding indices will be calculated automatically); the idea behind this routine is that the points to be added will somehow be close to the one or other of the points being removed and this can be used by the implementation to provide hints for inserting the new points in whatever structure it is using.

In a kt-algorithm the points being added will be a result of a combination of the points to be removed -- hence the proximity is (more or less) guaranteed.

Implements fastjet::DynamicNearestNeighbours.

EtaPhi fastjet::Dnn3piCylinder::_remap_phi ( const EtaPhi point  )  [inline, private]

given a phi value in the 0--2pi range return one in the pi--3pi range.

Definition at line 162 of file Dnn3piCylinder.hh.

References fastjet::EtaPhi::first, fastjet::pi, fastjet::EtaPhi::second, and twopi.

00162                                                  {
00163     double phi = point.second;
00164     if (phi < pi) { phi += twopi ;}
00165     return EtaPhi(point.first, phi);}

void fastjet::Dnn3piCylinder::_RegisterCylinderPoint ( const EtaPhi cylinder_point,
std::vector< EtaPhi > &  plane_points 
) [private]

What on earth does this do?

Example: last true "cylinder" index was 15 last plane index was 23

Then: _cylinder_index_of_plane_vertex.size() = 24 and _mirror_info.size() = 16

IF cylinder_point's phi < pi then create: _mirror_info[16] = (main_index = 24, mirror_index=25) _cylinder_index_of_plane_vertex[24] = 16 _cylinder_index_of_plane_vertex[25] = 16 ELSE create: _mirror_info[16] = (main_index = 24, mirror_index=INEXISTENT..) _cylinder_index_of_plane_vertex[24] = 16

ADDITIONALLY push the cylinder_point (and if it exists the mirror copy) onto the vector plane_points.


Member Data Documentation

const int fastjet::Dnn3piCylinder::INEXISTENT_VERTEX = -3 [static, private]

Definition at line 91 of file Dnn3piCylinder.hh.

Referenced by NearestNeighbourDistance(), and NearestNeighbourIndex().

bool fastjet::Dnn3piCylinder::_verbose [private]

Definition at line 93 of file Dnn3piCylinder.hh.

bool fastjet::Dnn3piCylinder::_ignore_nearest_is_mirror [private]

Definition at line 95 of file Dnn3piCylinder.hh.

Referenced by NearestNeighbourIndex().

std::vector<MirrorVertexInfo> fastjet::Dnn3piCylinder::_mirror_info [private]

Definition at line 148 of file Dnn3piCylinder.hh.

Referenced by NearestNeighbourDistance(), NearestNeighbourIndex(), and Valid().

std::vector<int> fastjet::Dnn3piCylinder::_cylinder_index_of_plane_vertex [private]

Definition at line 152 of file Dnn3piCylinder.hh.

Referenced by NearestNeighbourIndex().

DnnPlane* fastjet::Dnn3piCylinder::_DNN [private]

Definition at line 158 of file Dnn3piCylinder.hh.

Referenced by NearestNeighbourDistance(), NearestNeighbourIndex(), Valid(), and ~Dnn3piCylinder().


The documentation for this class was generated from the following file:
Generated on Tue Dec 18 17:05:54 2007 for fastjet by  doxygen 1.5.2