Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

fastjet::Dnn4piCylinder Class Reference

class derived from DynamicNearestNeighbours that provides an implementation for the surface of cylinder (using two copies of DnnPlane, one running from 0--2pi, the other from pi--3pi). More...

#include <Dnn4piCylinder.hh>

Inheritance diagram for fastjet::Dnn4piCylinder:

Inheritance graph
[legend]
Collaboration diagram for fastjet::Dnn4piCylinder:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Dnn4piCylinder ()
 empty initaliser
 Dnn4piCylinder (const std::vector< EtaPhi > &, const bool &verbose=false)
 initialiser...
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)
 insertion and removal of points
 ~Dnn4piCylinder ()

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.

Private Attributes

bool _verbose
DnnPlane_DNN1
DnnPlane_DNN2

Detailed Description

class derived from DynamicNearestNeighbours that provides an implementation for the surface of cylinder (using two copies of DnnPlane, one running from 0--2pi, the other from pi--3pi).

Definition at line 45 of file Dnn4piCylinder.hh.


Constructor & Destructor Documentation

fastjet::Dnn4piCylinder::Dnn4piCylinder  )  [inline]
 

empty initaliser

Definition at line 48 of file Dnn4piCylinder.hh.

00048 {}

fastjet::Dnn4piCylinder::Dnn4piCylinder const std::vector< EtaPhi > &  ,
const bool &  verbose = false
 

initialiser...

Definition at line 41 of file Dnn4piCylinder.cc.

References _DNN1, _DNN2, _remap_phi(), _verbose, and fastjet::pi.

00042                                                                    {
00043   
00044   _verbose = verbose;
00045   vector<EtaPhi> copied_points(input_points.size());
00046   for (unsigned int i=0; i < input_points.size(); i++) {
00047     double phi = input_points[i].second;
00048     assert(phi >= 0.0 && phi < 2*pi);
00049     copied_points[i] = _remap_phi(input_points[i]);
00050   }
00051 
00052   if (_verbose) cout << "============== Preparing _DNN1" << endl;
00053   _DNN1 = new DnnPlane(input_points, verbose);
00054   if (_verbose) cout << "============== Preparing _DNN2" << endl;
00055   _DNN2 = new DnnPlane(copied_points, verbose);
00056 }

fastjet::Dnn4piCylinder::~Dnn4piCylinder  )  [inline]
 

Definition at line 117 of file Dnn4piCylinder.hh.

References _DNN1, and _DNN2.

00117                                        {
00118   delete _DNN1; 
00119   delete _DNN2;
00120 }


Member Function Documentation

EtaPhi fastjet::Dnn4piCylinder::_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 87 of file Dnn4piCylinder.hh.

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

Referenced by Dnn4piCylinder(), and RemoveAndAddPoints().

00087                                                  {
00088     double phi = point.second;
00089     if (phi < pi) { phi += twopi ;}
00090     return EtaPhi(point.first, phi);}

double fastjet::Dnn4piCylinder::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 105 of file Dnn4piCylinder.hh.

References _DNN1, _DNN2, and fastjet::DnnPlane::NearestNeighbourDistance().

00105                                                                                 {
00106   return (_DNN1->NearestNeighbourDistance(current) < 
00107           _DNN2->NearestNeighbourDistance(current)) ? 
00108     _DNN1->NearestNeighbourDistance(current) : 
00109     _DNN2->NearestNeighbourDistance(current) ; 
00110 }

int fastjet::Dnn4piCylinder::NearestNeighbourIndex const int &  ii  )  const [inline, virtual]
 

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

Implements fastjet::DynamicNearestNeighbours.

Definition at line 98 of file Dnn4piCylinder.hh.

References _DNN1, _DNN2, fastjet::DnnPlane::NearestNeighbourDistance(), and fastjet::DnnPlane::NearestNeighbourIndex().

00098                                                                           {
00099   return (_DNN1->NearestNeighbourDistance(current) < 
00100           _DNN2->NearestNeighbourDistance(current)) ? 
00101     _DNN1->NearestNeighbourIndex(current) : 
00102     _DNN2->NearestNeighbourIndex(current) ; 
00103 }

void fastjet::Dnn4piCylinder::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]
 

insertion and removal of points

Implements fastjet::DynamicNearestNeighbours.

Definition at line 61 of file Dnn4piCylinder.cc.

References _DNN1, _DNN2, _remap_phi(), and fastjet::DnnPlane::RemoveAndAddPoints().

00064                                                                              {
00065   
00066   vector<int> indices1, indices2;
00067   
00068   _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add,
00069                                       indices_added,indices1);
00070 
00071   // create a vector with the remapped points (pi..3pi)
00072   vector<EtaPhi> remapped_points(points_to_add.size());
00073   for (size_t i = 0; i < points_to_add.size(); i++) {
00074     remapped_points[i] = _remap_phi(points_to_add[i]);
00075   }
00076   _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points, 
00077                                       indices_added,indices2);
00078   
00079   // merge the two sequences of updated vertices, avoiding double entries
00080   // of vertices with the same index
00081   set<int> index_set;
00082   unsigned int i;
00083   for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);}
00084   for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);}
00085 
00086   indices_of_updated_neighbours.clear();
00087   for (set<int>::iterator iter = index_set.begin(); 
00088        iter != index_set.end(); iter++) {
00089     indices_of_updated_neighbours.push_back(*iter);
00090   }
00091 }

bool fastjet::Dnn4piCylinder::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 112 of file Dnn4piCylinder.hh.

References _DNN1, _DNN2, and fastjet::DnnPlane::Valid().

00112                                                          {
00113   return (_DNN1->Valid(index) && _DNN2->Valid(index));
00114 }


Member Data Documentation

DnnPlane* fastjet::Dnn4piCylinder::_DNN1 [private]
 

Definition at line 83 of file Dnn4piCylinder.hh.

Referenced by Dnn4piCylinder(), NearestNeighbourDistance(), NearestNeighbourIndex(), RemoveAndAddPoints(), Valid(), and ~Dnn4piCylinder().

DnnPlane * fastjet::Dnn4piCylinder::_DNN2 [private]
 

Definition at line 83 of file Dnn4piCylinder.hh.

Referenced by Dnn4piCylinder(), NearestNeighbourDistance(), NearestNeighbourIndex(), RemoveAndAddPoints(), Valid(), and ~Dnn4piCylinder().

bool fastjet::Dnn4piCylinder::_verbose [private]
 

Definition at line 77 of file Dnn4piCylinder.hh.

Referenced by Dnn4piCylinder().


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 20:58:22 2007 for fastjet by  doxygen 1.4.2