fastjet 2.4.5
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
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
[legend]
Collaboration diagram for fastjet::Dnn3piCylinder:
Collaboration graph
[legend]

List of all members.

Classes

struct  MirrorVertexInfo
 Picture of how things will work... More...

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
 Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid)
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

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.

{}
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.

                                       {
  delete _DNN; 
}

Member Function Documentation

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

What on earth does this do?

Actions here are similar to those in the Dnn3piCylinder::_RegisterCylinderPoint case, however here we do NOT create the mirror point -- instead we initialise the structure as if there were no need for the mirror point.

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.

ADDITIONALLY push the cylinder_point onto the vector plane_points.

Definition at line 73 of file Dnn2piCylinder.cc.

References fastjet::Dnn3piCylinder::MirrorVertexInfo::main_index, fastjet::Dnn3piCylinder::MirrorVertexInfo::mirror_index, fastjet::d0::inline_maths::phi(), fastjet::pi, and fastjet::EtaPhi::second.

                                                                            {
  double phi = cylinder_point.second;
  assert(phi >= 0.0 && phi < 2*pi);
  
  // do main point
  MirrorVertexInfo mvi;
  mvi.main_index = _cylinder_index_of_plane_vertex.size();
  _cylinder_index_of_plane_vertex.push_back(_mirror_info.size());
  plane_points.push_back(cylinder_point);
  mvi.mirror_index = INEXISTENT_VERTEX;
  
  // 
  _mirror_info.push_back(mvi);
}
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::d0::inline_maths::phi(), fastjet::pi, fastjet::EtaPhi::second, and twopi.

                                                 {
    double phi = point.second;
    if (phi < pi) { phi += twopi ;}
    return EtaPhi(point.first, phi);}
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.

                                                                                {
  int main_index = _mirror_info[current].main_index;
  int mirror_index = _mirror_info[current].mirror_index;
  if (mirror_index == INEXISTENT_VERTEX ) {
    return _DNN->NearestNeighbourDistance(main_index);
  } else {
    return (
        _DNN->NearestNeighbourDistance(main_index) < 
        _DNN->NearestNeighbourDistance(mirror_index)) ? 
      _DNN->NearestNeighbourDistance(main_index) : 
      _DNN->NearestNeighbourDistance(mirror_index) ; 
  }
 
}
int fastjet::Dnn3piCylinder::NearestNeighbourIndex ( const int &  current) const [inline, virtual]

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

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.

                                                                          {
  int main_index = _mirror_info[current].main_index;
  int mirror_index = _mirror_info[current].mirror_index;
  int plane_index;
  if (mirror_index == INEXISTENT_VERTEX ) {
    plane_index = _DNN->NearestNeighbourIndex(main_index);
  } else {
    plane_index = (
        _DNN->NearestNeighbourDistance(main_index) < 
        _DNN->NearestNeighbourDistance(mirror_index)) ? 
      _DNN->NearestNeighbourIndex(main_index) : 
      _DNN->NearestNeighbourIndex(mirror_index) ; 
  }
  int this_cylinder_index = _cylinder_index_of_plane_vertex[plane_index];
  // either the user has acknowledged the fact that they may get the
  // mirror copy as the closest point, or crash if it should occur
  // that mirror copy is the closest point.
  assert(_ignore_nearest_is_mirror || this_cylinder_index != current);
  //if (this_cylinder_index == current) {
  //  std::cerr << "WARNING point "<<current<<
  //    " has its mirror copy as its own nearest neighbour"<<endl;
  //}
  return this_cylinder_index;
}
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.

remove the points labelled by the vector indices_to_remove, and add the points specified by the 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.

insertion and removal of points

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.

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.

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

Member Data Documentation

Definition at line 152 of file Dnn3piCylinder.hh.

Definition at line 158 of file Dnn3piCylinder.hh.

Definition at line 95 of file Dnn3piCylinder.hh.

Definition at line 148 of file Dnn3piCylinder.hh.

Definition at line 93 of file Dnn3piCylinder.hh.

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

Definition at line 91 of file Dnn3piCylinder.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines