CMS 3D CMS Logo

LayerHitMapLoop Class Reference

#include <RecoTracker/TkHitPairs/interface/LayerHitMapLoop.h>

List of all members.

Public Types

typedef std::vector
< TkHitPairsCachedHit >
::const_iterator 
HitIter
typedef PixelRecoRange< HitIterHitIterRange
enum  PhiOption { inRange, firstEdge, secondEdge, skip }
typedef PixelRecoRange< float > RangeF
typedef PixelRecoRange< intRangeI
typedef ctfseeding::SeedingHit TkHitPairsCachedHit

Public Member Functions

const TkHitPairsCachedHitgetHit ()
 LayerHitMapLoop (const LayerHitMap &map, const RangeF &phiRange, const RangeF &rzRange)
 LayerHitMapLoop (const LayerHitMap &map)
void setSafeRzRange (const RangeF &rzSafeRange, bool *status)

Private Member Functions

bool nextRange ()

Private Attributes

HitIter hitEnd
HitIter hitItr
bool safeBinRz
boolsetStatus
int theBinRz
RangeI theBinsPhi
RangeI theBinsRz
RangeI theBinsRzSafe
const LayerHitMaptheMap
PhiOption theNextPhi
RangeF theRangePhi
RangeF theRangeRz
RangeF theRangeRzSafe


Detailed Description

Definition at line 10 of file LayerHitMapLoop.h.


Member Typedef Documentation

typedef std::vector<TkHitPairsCachedHit>::const_iterator LayerHitMapLoop::HitIter

Definition at line 14 of file LayerHitMapLoop.h.

typedef PixelRecoRange<HitIter> LayerHitMapLoop::HitIterRange

Definition at line 15 of file LayerHitMapLoop.h.

typedef PixelRecoRange<float> LayerHitMapLoop::RangeF

Definition at line 16 of file LayerHitMapLoop.h.

typedef PixelRecoRange<int> LayerHitMapLoop::RangeI

Definition at line 17 of file LayerHitMapLoop.h.

typedef ctfseeding::SeedingHit LayerHitMapLoop::TkHitPairsCachedHit

Definition at line 12 of file LayerHitMapLoop.h.


Member Enumeration Documentation

enum LayerHitMapLoop::PhiOption

Enumerator:
inRange 
firstEdge 
secondEdge 
skip 

Definition at line 18 of file LayerHitMapLoop.h.


Constructor & Destructor Documentation

LayerHitMapLoop::LayerHitMapLoop ( const LayerHitMap map  ) 

Definition at line 7 of file LayerHitMapLoop.cc.

References hitEnd, hitItr, skip, LayerHitMap::theHits, theMap, and theNextPhi.

00008   : theMap(map), safeBinRz(true), setStatus(0)
00009 {
00010   hitItr = theMap.theHits.begin();
00011   hitEnd = theMap.theHits.end();
00012   theNextPhi = skip;
00013 }

LayerHitMapLoop::LayerHitMapLoop ( const LayerHitMap map,
const RangeF phiRange,
const RangeF rzRange 
)

Definition at line 15 of file LayerHitMapLoop.cc.

References LayerHitMap::empty(), firstEdge, hitEnd, hitItr, LayerHitMap::idxRz(), inRange, int, max, PixelRecoRange< T >::max(), min, PixelRecoRange< T >::min(), skip, theBinRz, theBinsPhi, theBinsRz, theBinsRzSafe, LayerHitMap::theCellDeltaPhi, LayerHitMap::theHits, theMap, LayerHitMap::theNbinsRZ, theNextPhi, and theRangePhi.

00017   : theMap(map), 
00018     theRangeRz(rzRange), theRangeRzSafe(rzRange),
00019     theRangePhi(phiRange), setStatus(0)
00020 {
00021 
00022   hitItr = hitEnd = theMap.theHits.end();
00023   if (theMap.empty()) { theNextPhi = skip; return; } 
00024 
00025   int irz1 = theMap.idxRz(rzRange.min());
00026   int irz2 = theMap.idxRz(rzRange.max()); 
00027   theBinsRz     = RangeI( max( irz1,  0), min( irz2,  theMap.theNbinsRZ-1));
00028   theBinsRzSafe = RangeI( irz1+1, irz2-1); 
00029 
00030   if (theRangePhi.first >= -M_PI && theRangePhi.second < M_PI) {
00031     theNextPhi = inRange;
00032   } else {
00033     theNextPhi = firstEdge;
00034     while (theRangePhi.first <  -M_PI) theRangePhi.first  += 2*M_PI;
00035     while (theRangePhi.second >= M_PI) theRangePhi.second -= 2*M_PI;
00036   } 
00037 
00038   theBinsPhi  = RangeI (
00039       int ( (theRangePhi.min() + M_PI)/theMap.theCellDeltaPhi ),
00040       int ( (theRangePhi.max() + M_PI)/theMap.theCellDeltaPhi ));
00041 
00042   theBinRz = theBinsRz.min()-1; 
00043 
00044 }


Member Function Documentation

const LayerHitMapLoop::TkHitPairsCachedHit * LayerHitMapLoop::getHit (  ) 

Definition at line 58 of file LayerHitMapLoop.cc.

References hitEnd, hitItr, PixelRecoRange< T >::inside(), nextRange(), ctfseeding::SeedingHit::rOrZ(), safeBinRz, setStatus, theRangeRz, and theRangeRzSafe.

Referenced by HitPairGeneratorFromLayerPair::hitPairs(), TripletGenerator::hitTriplets(), and PixelTripletHLTGenerator::hitTriplets().

00059 {
00060 
00061 
00062 
00063   while (hitItr < hitEnd) {
00064 
00065     const TkHitPairsCachedHit * hit = &*hitItr++;
00066     if (safeBinRz)      return hit;
00067    
00068     else if (theRangeRzSafe.inside(hit->rOrZ()))
00069         return hit;
00070     else if (setStatus && theRangeRz.inside(hit->rOrZ())) {
00071       *setStatus = false;
00072       return hit;
00073     }
00074   }
00075 
00076   if (nextRange()) return getHit();
00077   else return 0;
00078 }

bool LayerHitMapLoop::nextRange (  )  [inline, private]

Definition at line 80 of file LayerHitMapLoop.cc.

References LayerHitMap::cell(), firstEdge, hitEnd, hitItr, inRange, PixelRecoRange< T >::inside(), max, PixelRecoRange< T >::max(), min, PixelRecoRange< T >::min(), range, safeBinRz, secondEdge, theBinRz, theBinsPhi, theBinsRz, theBinsRzSafe, theMap, LayerHitMap::theNbinsPhi, theNextPhi, and theRangePhi.

Referenced by getHit().

00081 {
00082 
00083   switch (theNextPhi) {
00084   case inRange:
00085     if (++theBinRz > theBinsRz.max()) return false; 
00086     safeBinRz = theBinsRzSafe.inside(theBinRz);
00087     hitItr = theMap.cell(theBinRz,theBinsPhi.min()).
00088                  range_from(theRangePhi.min()).min();
00089     hitEnd = theMap.cell(theBinRz,theBinsPhi.max()).
00090                  range_upto(theRangePhi.max()).max();
00091     return true;
00092   case firstEdge:
00093     if (++theBinRz > theBinsRz.max()) return false; 
00094     safeBinRz = theBinsRzSafe.inside(theBinRz);
00095     hitItr = theMap.cell(theBinRz,theBinsPhi.min()).
00096                  range_from(theRangePhi.min()).min();
00097     hitEnd = theMap.cell(theBinRz,theMap.theNbinsPhi-1).
00098                  range().max();
00099     theNextPhi = secondEdge;
00100     return true;
00101   case secondEdge:
00102     hitItr = theMap.cell(theBinRz,0).
00103                  range().min();
00104     hitEnd = theMap.cell(theBinRz,theBinsPhi.max()).
00105                  range_upto(theRangePhi.max()).max();
00106     theNextPhi = firstEdge;
00107  
00108     return true;
00109   default: 
00110     return false;
00111   }
00112 }

void LayerHitMapLoop::setSafeRzRange ( const RangeF rzSafeRange,
bool status 
)

Definition at line 46 of file LayerHitMapLoop.cc.

References LayerHitMap::idxRz(), PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), setStatus, theBinsRzSafe, theMap, and theRangeRzSafe.

00047 { 
00048 
00049   theRangeRzSafe = rzSafe;
00050   setStatus = status;
00051 
00052   theBinsRzSafe = 
00053       RangeI( theMap.idxRz(rzSafe.min())+1, theMap.idxRz(rzSafe.max())-1);
00054 
00055 } 


Member Data Documentation

HitIter LayerHitMapLoop::hitEnd [private]

Definition at line 39 of file LayerHitMapLoop.h.

Referenced by getHit(), LayerHitMapLoop(), and nextRange().

HitIter LayerHitMapLoop::hitItr [private]

Definition at line 39 of file LayerHitMapLoop.h.

Referenced by getHit(), LayerHitMapLoop(), and nextRange().

bool LayerHitMapLoop::safeBinRz [private]

Definition at line 38 of file LayerHitMapLoop.h.

Referenced by getHit(), and nextRange().

bool * LayerHitMapLoop::setStatus [private]

Definition at line 38 of file LayerHitMapLoop.h.

Referenced by getHit(), and setSafeRzRange().

int LayerHitMapLoop::theBinRz [private]

Definition at line 35 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), and nextRange().

RangeI LayerHitMapLoop::theBinsPhi [private]

Definition at line 33 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), and nextRange().

RangeI LayerHitMapLoop::theBinsRz [private]

Definition at line 33 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), and nextRange().

RangeI LayerHitMapLoop::theBinsRzSafe [private]

Definition at line 33 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), nextRange(), and setSafeRzRange().

const LayerHitMap& LayerHitMapLoop::theMap [private]

Definition at line 31 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), nextRange(), and setSafeRzRange().

PhiOption LayerHitMapLoop::theNextPhi [private]

Definition at line 36 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), and nextRange().

RangeF LayerHitMapLoop::theRangePhi [private]

Definition at line 34 of file LayerHitMapLoop.h.

Referenced by LayerHitMapLoop(), and nextRange().

RangeF LayerHitMapLoop::theRangeRz [private]

Definition at line 34 of file LayerHitMapLoop.h.

Referenced by getHit().

RangeF LayerHitMapLoop::theRangeRzSafe [private]

Definition at line 34 of file LayerHitMapLoop.h.

Referenced by getHit(), and setSafeRzRange().


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