CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes
RecHitsSortedInPhi Class Reference

#include <RecHitsSortedInPhi.h>

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 (float phiMin, float phiMax) const
 
void hits (float phiMin, float phiMax, std::vector< Hit > &result) const
 
std::vector< Hithits () 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().

7 {
8  for (std::vector<Hit>::const_iterator i=hits.begin(); i!=hits.end(); i++) {
9  theHits.push_back(HitWithPhi(*i));
10  }
11  sort( theHits.begin(), theHits.end(), HitLessPhi());
12 }
std::vector< HitWithPhi > theHits
int i
Definition: DBlmapReader.cc:9
std::vector< Hit > hits() const

Member Function Documentation

Range RecHitsSortedInPhi::all ( ) const
inline

Definition at line 72 of file RecHitsSortedInPhi.h.

References theHits.

Referenced by HitPairGeneratorFromLayerPair::hitPairs(), and HitQuadrupletGeneratorFromLayerPairForPhotonConversion::hitPairs().

72  {
73  return Range(theHits.begin(), theHits.end());
74  }
std::vector< HitWithPhi > theHits
std::pair< HitIter, HitIter > Range
static void RecHitsSortedInPhi::copyResult ( const Range range,
std::vector< Hit > &  result 
)
inlinestaticprivate

Definition at line 80 of file RecHitsSortedInPhi.h.

References i.

80  {
81  result.reserve(result.size()+(range.second-range.first));
82  for (HitIter i = range.first; i != range.second; i++) result.push_back( i->hit());
83  }
int i
Definition: DBlmapReader.cc:9
std::vector< HitWithPhi >::const_iterator HitIter
tuple result
Definition: query.py:137
bool RecHitsSortedInPhi::empty ( void  ) const
inline
vector< RecHitsSortedInPhi::Hit > RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax 
) const
void RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax,
std::vector< Hit > &  result 
) const

Definition at line 14 of file RecHitsSortedInPhi.cc.

References Geom::fpi(), Geom::ftwoPi(), and Geom::pi().

15 {
16  if ( phiMin < phiMax) {
17  if ( phiMin < -Geom::fpi()) {
20  }
21  else if (phiMax > Geom::pi()) {
24  }
25  else {
27  }
28  }
29  else {
32  }
33 }
Range unsafeRange(float phiMin, float phiMax) const
float fpi()
Definition: Pi.h:35
tuple result
Definition: query.py:137
static void copyResult(const Range &range, std::vector< Hit > &result)
double pi()
Definition: Pi.h:31
float ftwoPi()
Definition: Pi.h:36
std::vector<Hit> RecHitsSortedInPhi::hits ( ) const
inline

Definition at line 65 of file RecHitsSortedInPhi.h.

References i, query::result, and theHits.

65  {
66  std::vector<Hit> result; result.reserve(theHits.size());
67  for (HitIter i=theHits.begin(); i!=theHits.end(); i++) result.push_back(i->hit());
68  return result;
69  }
std::vector< HitWithPhi > theHits
int i
Definition: DBlmapReader.cc:9
std::vector< HitWithPhi >::const_iterator HitIter
tuple result
Definition: query.py:137
RecHitsSortedInPhi::Range RecHitsSortedInPhi::unsafeRange ( float  phiMin,
float  phiMax 
) const

Definition at line 43 of file RecHitsSortedInPhi.cc.

44 {
45  return Range(
46  lower_bound( theHits.begin(), theHits.end(), HitWithPhi(phiMin), HitLessPhi()),
47  upper_bound( theHits.begin(), theHits.end(), HitWithPhi(phiMax), HitLessPhi()));
48 }
std::vector< HitWithPhi > theHits
std::pair< HitIter, HitIter > Range

Member Data Documentation

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

Definition at line 78 of file RecHitsSortedInPhi.h.

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