Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gar::rec::alg::NNDistance< HitClass, PosType > Class Template Reference

#include <NNClusters.h>

Public Types

typedef HitClass hit_type
 

Public Member Functions

 NNDistance (float dCut)
 
bool mergeHits (GenericHit< HitClass > *h0, GenericHit< HitClass > *h1)
 

Protected Member Functions

 NNDistance ()
 

Protected Attributes

float _dCutSquared
 
float _dCut
 

Detailed Description

template<class HitClass, typename PosType>
class gar::rec::alg::NNDistance< HitClass, PosType >

Simple predicate class for NN clustering. Requires PosType* HitClass::Position(), e.g for CalorimeterHits use:
NNDistance<CaloHit,float> dist( myDistCut ) ;

Definition at line 256 of file NNClusters.h.

Member Typedef Documentation

template<class HitClass, typename PosType>
typedef HitClass gar::rec::alg::NNDistance< HitClass, PosType >::hit_type

Required typedef for cluster algorithm

Definition at line 261 of file NNClusters.h.

Constructor & Destructor Documentation

template<class HitClass, typename PosType>
gar::rec::alg::NNDistance< HitClass, PosType >::NNDistance ( float  dCut)
inline

C'tor takes merge distance

Definition at line 264 of file NNClusters.h.

264 : _dCutSquared( dCut*dCut ) , _dCut(dCut) {}
template<class HitClass, typename PosType>
gar::rec::alg::NNDistance< HitClass, PosType >::NNDistance ( )
protected

Member Function Documentation

template<class HitClass, typename PosType>
bool gar::rec::alg::NNDistance< HitClass, PosType >::mergeHits ( GenericHit< HitClass > *  h0,
GenericHit< HitClass > *  h1 
)
inline

Merge condition: true if distance is less than dCut given in the C'tor.

Definition at line 268 of file NNClusters.h.

268  {
269 
270  if( std::abs( h0->Index0 - h1->Index0 ) > 1 ) return false ;
271 
272  const PosType* pos0 = h0->first->Position() ;
273  const PosType* pos1 = h1->first->Position() ;
274 
275  return
276  ( pos0[0] - pos1[0] ) * ( pos0[0] - pos1[0] ) +
277  ( pos0[1] - pos1[1] ) * ( pos0[1] - pos1[1] ) +
278  ( pos0[2] - pos1[2] ) * ( pos0[2] - pos1[2] )
279  < _dCutSquared ;
280  }
T abs(T value)

Member Data Documentation

template<class HitClass, typename PosType>
float gar::rec::alg::NNDistance< HitClass, PosType >::_dCut
protected

Definition at line 285 of file NNClusters.h.

template<class HitClass, typename PosType>
float gar::rec::alg::NNDistance< HitClass, PosType >::_dCutSquared
protected

Definition at line 284 of file NNClusters.h.


The documentation for this class was generated from the following file: