#include <RecoTracker/TkHitPairs/interface/LayerHitMapLoop.h>
Public Types | |
typedef std::vector < TkHitPairsCachedHit > ::const_iterator | HitIter |
typedef PixelRecoRange< HitIter > | HitIterRange |
enum | PhiOption { inRange, firstEdge, secondEdge, skip } |
typedef PixelRecoRange< float > | RangeF |
typedef PixelRecoRange< int > | RangeI |
typedef ctfseeding::SeedingHit | TkHitPairsCachedHit |
Public Member Functions | |
const TkHitPairsCachedHit * | getHit () |
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 |
bool * | setStatus |
int | theBinRz |
RangeI | theBinsPhi |
RangeI | theBinsRz |
RangeI | theBinsRzSafe |
const LayerHitMap & | theMap |
PhiOption | theNextPhi |
RangeF | theRangePhi |
RangeF | theRangeRz |
RangeF | theRangeRzSafe |
Definition at line 10 of file LayerHitMapLoop.h.
typedef std::vector<TkHitPairsCachedHit>::const_iterator LayerHitMapLoop::HitIter |
Definition at line 14 of file LayerHitMapLoop.h.
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.
Definition at line 12 of file LayerHitMapLoop.h.
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 }
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 }
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 }
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] |
bool * LayerHitMapLoop::setStatus [private] |
int LayerHitMapLoop::theBinRz [private] |
RangeI LayerHitMapLoop::theBinsPhi [private] |
RangeI LayerHitMapLoop::theBinsRz [private] |
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] |
RangeF LayerHitMapLoop::theRangePhi [private] |
RangeF LayerHitMapLoop::theRangeRz [private] |
RangeF LayerHitMapLoop::theRangeRzSafe [private] |