CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes

RecHitsSortedInPhi Class Reference

#include <RecHitsSortedInPhi.h>

List of all members.

Classes

struct  HitLessPhi
class  HitWithPhi

Public Types

typedef
TransientTrackingRecHit::ConstRecHitPointer 
Hit
typedef std::vector
< HitWithPhi >::const_iterator 
HitIter
typedef std::pair< HitIter,
HitIter
Range

Public Member Functions

Range all () const
bool empty () const
std::vector< Hithits () const
void hits (float phiMin, float phiMax, std::vector< Hit > &result) const
std::vector< Hithits (float phiMin, float phiMax) const
 RecHitsSortedInPhi (const std::vector< Hit > &hits)
Range unsafeRange (float phiMin, float phiMax) const

Static Private Member Functions

static void copyResult (const Range &range, std::vector< Hit > &result)

Private Attributes

std::vector< HitWithPhitheHits

Detailed Description

A RecHit container sorted in phi. Provides fast access for hits in a given phi window using binary search.

Definition at line 13 of file RecHitsSortedInPhi.h.


Member Typedef Documentation

Definition at line 16 of file RecHitsSortedInPhi.h.

typedef std::vector<HitWithPhi>::const_iterator RecHitsSortedInPhi::HitIter

Definition at line 33 of file RecHitsSortedInPhi.h.

Definition at line 34 of file RecHitsSortedInPhi.h.


Constructor & Destructor Documentation

RecHitsSortedInPhi::RecHitsSortedInPhi ( const std::vector< Hit > &  hits)

Definition at line 6 of file RecHitsSortedInPhi.cc.

References i, and python::multivaluedict::sort().

{
  for (std::vector<Hit>::const_iterator i=hits.begin(); i!=hits.end(); i++) {
    theHits.push_back(HitWithPhi(*i));
  }
  sort( theHits.begin(), theHits.end(), HitLessPhi());
}

Member Function Documentation

Range RecHitsSortedInPhi::all ( ) const [inline]
static void RecHitsSortedInPhi::copyResult ( const Range range,
std::vector< Hit > &  result 
) [inline, static, private]

Definition at line 80 of file RecHitsSortedInPhi.h.

References i.

                                                                      {
    result.reserve(result.size()+(range.second-range.first));
    for (HitIter i = range.first; i != range.second; i++) result.push_back( i->hit());
  }
bool RecHitsSortedInPhi::empty ( void  ) const [inline]
std::vector<Hit> RecHitsSortedInPhi::hits ( ) const [inline]

Definition at line 65 of file RecHitsSortedInPhi.h.

References i, query::result, and theHits.

                              {
    std::vector<Hit> result; result.reserve(theHits.size());
    for (HitIter i=theHits.begin(); i!=theHits.end(); i++) result.push_back(i->hit());
    return result;
  }
vector< RecHitsSortedInPhi::Hit > RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax 
) const
void RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax,
std::vector< Hit > &  result 
) const
RecHitsSortedInPhi::Range RecHitsSortedInPhi::unsafeRange ( float  phiMin,
float  phiMax 
) const

Definition at line 43 of file RecHitsSortedInPhi.cc.

{
  return Range( 
      lower_bound( theHits.begin(), theHits.end(), HitWithPhi(phiMin), HitLessPhi()),
        upper_bound( theHits.begin(), theHits.end(), HitWithPhi(phiMax), HitLessPhi()));
}

Member Data Documentation

std::vector<HitWithPhi> RecHitsSortedInPhi::theHits [private]

Definition at line 78 of file RecHitsSortedInPhi.h.

Referenced by all(), empty(), and hits().