CMS 3D CMS Logo

RecHitsSortedInPhi Class Reference

A RecHit container sorted in phi. More...

#include <RecoTracker/TkHitPairs/src/RecHitsSortedInPhi.h>

List of all members.

Public Types

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

Public Member Functions

std::vector< const
TrackingRecHit * > 
hits ()
void hits (float phiMin, float phiMax, std::vector< const TrackingRecHit * > &result) const
 Same as above but the result is allocated by the caller and passed by reference.
std::vector< const
TrackingRecHit * > 
hits (float phiMin, float phiMax) const
 Returns the hits in the phi range (phi in radians).
 RecHitsSortedInPhi (const std::vector< const TrackingRecHit * > &hits, const TrackerGeometry *theGeometry)
Range unsafeRange (float phiMin, float phiMax) const
 Fast access to the hits in the phi interval (phi in radians).

Private Member Functions

void copyResult (const Range &range, std::vector< const TrackingRecHit * > &result) const

Private Attributes

std::vector< HittheHits

Classes

class  Hit
 A RecHit extension that caches the phi angle for fast access. More...
class  HitLessPhi
 Less Predicate for Hit. More...


Detailed Description

A RecHit container sorted in phi.

Provides fast access for hits in a given phi window using binary search.

Definition at line 16 of file RecHitsSortedInPhi.h.


Member Typedef Documentation

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

Definition at line 48 of file RecHitsSortedInPhi.h.

typedef std::pair<HitIter,HitIter> RecHitsSortedInPhi::Range

Definition at line 49 of file RecHitsSortedInPhi.h.


Constructor & Destructor Documentation

RecHitsSortedInPhi::RecHitsSortedInPhi ( const std::vector< const TrackingRecHit * > &  hits,
const TrackerGeometry theGeometry 
)


Member Function Documentation

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

Definition at line 100 of file RecHitsSortedInPhi.h.

References i.

00100                                                                                        {
00101     //TimeMe tm2( *theCopyResultTimer, false);
00102     for (HitIter i = range.first; i != range.second; i++) result.push_back( i->recHit());
00103   }

std::vector<const TrackingRecHit*> RecHitsSortedInPhi::hits (  )  [inline]

Definition at line 79 of file RecHitsSortedInPhi.h.

References i, HLT_VtxMuL3::result, and theHits.

Referenced by hits().

00079                                           {
00080     std::vector<const TrackingRecHit*> result;
00081     for (std::vector<Hit>::const_iterator i=theHits.begin(); i!=theHits.end(); i++) {
00082       result.push_back( i->recHit());
00083     }
00084     return result;
00085   }

void RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax,
std::vector< const TrackingRecHit * > &  result 
) const

Same as above but the result is allocated by the caller and passed by reference.

The caller is responsible for clearing of the container "result". This interface is not nice and not safe, but is much faster, since the dominant CPU time of the "nice" method hits(phimin,phimax) is spent in memory allocation of the result! (this is true for gcc 2.95.x, should be checked with gcc 3.2.y)

vector< const TrackingRecHit * > RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax 
) const

Returns the hits in the phi range (phi in radians).

The phi interval ( phiMin, phiMax) defined as the signed path along the trigonometric circle from the point at phiMin to the point at phiMax must be positive and smaller than pi. Examples of correct intervals: (-3,-2), (-4,-3), (3.1,3.2), (3,-3). Examples of WRONG intervals: (3,2), (4,3), (3.2,3.1), (-3,3). Example of use: myHits = recHitsSortedInPhi( phi-deltaPhi, phi+deltaPhi);

Definition at line 40 of file RecHitsSortedInPhi.cc.

References hits().

Referenced by HitPairGeneratorFromLayerPair::hitPairsWithErrors().

00041 {
00042   vector<const TrackingRecHit*> result;
00043   hits( phiMin, phiMax, result);
00044   return result;
00045 }

RecHitsSortedInPhi::Range RecHitsSortedInPhi::unsafeRange ( float  phiMin,
float  phiMax 
) const

Fast access to the hits in the phi interval (phi in radians).

The arguments must satisfy -pi <= phiMin < phiMax <= pi No check is made for this.

Definition at line 48 of file RecHitsSortedInPhi.cc.

References theHits.

00049 {
00050   //TimeMe tm1( *theSearchTimer, false);
00051   return Range( lower_bound( theHits.begin(), theHits.end(), Hit(phiMin), HitLessPhi()),
00052                 upper_bound( theHits.begin(), theHits.end(), Hit(phiMax), HitLessPhi()));
00053 }


Member Data Documentation

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

Definition at line 89 of file RecHitsSortedInPhi.h.

Referenced by hits(), and unsafeRange().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:40 2009 for CMSSW by  doxygen 1.5.4