CMS 3D CMS Logo

LayerHitMap Class Reference

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

List of all members.

Public Types

typedef std::vector
< TkHitPairsCachedHit >
::const_iterator 
HitIter
typedef PixelRecoRange< float > Range
typedef ctfseeding::SeedingHit TkHitPairsCachedHit

Public Member Functions

bool empty () const
 LayerHitMap (const LayerHitMap &lhm)
 LayerHitMap (const DetLayer *layer, const std::vector< ctfseeding::SeedingHit > &hits)
 LayerHitMap ()
LayerHitMapLoop loop (const Range &phiRange, const Range &rzRange) const
LayerHitMapLoop loop () const
 ~LayerHitMap ()

Private Member Functions

TkHitPairsCacheCellcell (int idx_rz, int idx_phi) const
int idxRz (float rz) const
void initCells () const

Private Attributes

float theCellDeltaPhi
float theCellDeltaRZ
TkHitPairsCellManagertheCells
std::vector
< ctfseeding::SeedingHit
theHits
float theLayerPhimin
float theLayerRZmin
int theNbinsPhi
int theNbinsRZ

Friends

class LayerHitMapLoop


Detailed Description

Definition at line 14 of file LayerHitMap.h.


Member Typedef Documentation

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

Definition at line 19 of file LayerHitMap.h.

typedef PixelRecoRange<float> LayerHitMap::Range

Definition at line 17 of file LayerHitMap.h.

typedef ctfseeding::SeedingHit LayerHitMap::TkHitPairsCachedHit

Definition at line 18 of file LayerHitMap.h.


Constructor & Destructor Documentation

LayerHitMap::LayerHitMap (  )  [inline]

Definition at line 21 of file LayerHitMap.h.

00021 : theCells(0) { }

LayerHitMap::LayerHitMap ( const DetLayer layer,
const std::vector< ctfseeding::SeedingHit > &  hits 
)

LayerHitMap::LayerHitMap ( const LayerHitMap lhm  ) 

Definition at line 49 of file LayerHitMap.cc.

References initCells(), and theCells.

00050     : theCells(0),
00051       theHits(lhm.theHits),
00052       theLayerRZmin(lhm.theLayerRZmin),
00053       theCellDeltaRZ(lhm.theCellDeltaRZ),
00054       theLayerPhimin(lhm.theLayerPhimin),
00055       theCellDeltaPhi(lhm.theCellDeltaPhi),
00056       theNbinsRZ(lhm.theNbinsRZ), theNbinsPhi(lhm.theNbinsPhi) 
00057 {
00058   if(lhm.theCells) initCells(); }

LayerHitMap::~LayerHitMap (  )  [inline]

Definition at line 24 of file LayerHitMap.h.

References theCells.

00024 { delete theCells; }


Member Function Documentation

TkHitPairsCacheCell& LayerHitMap::cell ( int  idx_rz,
int  idx_phi 
) const [inline, private]

Definition at line 34 of file LayerHitMap.h.

References theCells.

Referenced by initCells(), and LayerHitMapLoop::nextRange().

00035   { return (*theCells)(idx_rz,idx_phi); } 

bool LayerHitMap::empty ( void   )  const [inline]

Definition at line 29 of file LayerHitMap.h.

References theHits.

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

00029 { return theHits.empty(); }

int LayerHitMap::idxRz ( float  rz  )  const [inline, private]

Definition at line 33 of file LayerHitMap.h.

References int, theCellDeltaRZ, and theLayerRZmin.

Referenced by initCells(), LayerHitMapLoop::LayerHitMapLoop(), and LayerHitMapLoop::setSafeRzRange().

00033 { return int((rz-theLayerRZmin)/theCellDeltaRZ); }

void LayerHitMap::initCells (  )  const [private]

Definition at line 70 of file LayerHitMap.cc.

References cell(), idxRz(), TkHitPairsCacheCell::lessPhiHitHit(), TkHitPairsCacheCell::lessPhiValHit(), size, python::multivaluedict::sort(), theCellDeltaPhi, theCells, theHits, theNbinsPhi, and theNbinsRZ.

Referenced by LayerHitMap(), and loop().

00071 {
00072   vector<SeedingHit> hits(theHits);
00073   int size = hits.size();
00074 
00075   typedef vector<SeedingHit*> Cell;
00076   Cell aCell; aCell.reserve(2*size/theNbinsRZ);
00077   vector<Cell> cells(theNbinsRZ, aCell);
00078 
00079   vector<SeedingHit>::iterator ih;
00080   for (ih = hits.begin(); ih != hits.end(); ih++) {
00081     int irz = idxRz(ih->rOrZ());
00082     // --- FIX MANDATORY  to make caching work also with SiStrip RecHit
00083     // It is connected to the fact that sometimes the mathed hit are located
00084     // outside their gluedDet surface.
00085     if(irz>=theNbinsRZ) irz = theNbinsRZ-1;
00086     if(irz<0)   irz = 0;
00087     // ---
00088     cells[irz].push_back(&(*ih));
00089   }
00090 
00091   theCells = new TkHitPairsCellManager(theNbinsRZ, theNbinsPhi);
00092   Cell::const_iterator ph;
00093   
00094   int idx_theHits = 0;
00095   vector<SeedingHit>::iterator iBeg, iEnd, ie;
00096   for (int irz = 0; irz < theNbinsRZ; irz++) {
00097     Cell & vec = cells[irz];
00098     sort(vec.begin(), vec.end(), TkHitPairsCacheCell::lessPhiHitHit);
00099     iBeg = theHits.begin()+idx_theHits;
00100     for (ph = vec.begin(); ph < vec.end(); ph++) theHits[idx_theHits++] = **ph;
00101     iEnd = theHits.begin()+idx_theHits;
00102     for (int iphi = 0; iphi < theNbinsPhi; iphi++) {
00103       float upval= -M_PI + (iphi+1)*theCellDeltaPhi;
00104       ie = upper_bound( iBeg, iEnd, upval, TkHitPairsCacheCell::lessPhiValHit);
00105       cell(irz, iphi) = TkHitPairsCacheCell(iBeg,ie);
00106       iBeg = ie;
00107     }
00108   }
00109 }

LayerHitMapLoop LayerHitMap::loop ( const Range phiRange,
const Range rzRange 
) const

Definition at line 63 of file LayerHitMap.cc.

References initCells(), LayerHitMapLoop, and theCells.

00065 {
00066     if(!theCells) initCells();
00067  
00068     return LayerHitMapLoop(*this,phiRange,rzRange); }

LayerHitMapLoop LayerHitMap::loop (  )  const

Definition at line 60 of file LayerHitMap.cc.

References LayerHitMapLoop.

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

00061   { return LayerHitMapLoop(*this); }


Friends And Related Function Documentation

friend class LayerHitMapLoop [friend]

Definition at line 37 of file LayerHitMap.h.

Referenced by loop().


Member Data Documentation

float LayerHitMap::theCellDeltaPhi [private]

Definition at line 43 of file LayerHitMap.h.

Referenced by initCells(), and LayerHitMapLoop::LayerHitMapLoop().

float LayerHitMap::theCellDeltaRZ [private]

Definition at line 42 of file LayerHitMap.h.

Referenced by idxRz().

TkHitPairsCellManager* LayerHitMap::theCells [mutable, private]

Definition at line 40 of file LayerHitMap.h.

Referenced by cell(), initCells(), LayerHitMap(), loop(), and ~LayerHitMap().

std::vector<ctfseeding::SeedingHit> LayerHitMap::theHits [mutable, private]

Definition at line 41 of file LayerHitMap.h.

Referenced by empty(), initCells(), and LayerHitMapLoop::LayerHitMapLoop().

float LayerHitMap::theLayerPhimin [private]

Definition at line 43 of file LayerHitMap.h.

float LayerHitMap::theLayerRZmin [private]

Definition at line 42 of file LayerHitMap.h.

Referenced by idxRz().

int LayerHitMap::theNbinsPhi [private]

Definition at line 44 of file LayerHitMap.h.

Referenced by initCells(), and LayerHitMapLoop::nextRange().

int LayerHitMap::theNbinsRZ [private]

Definition at line 44 of file LayerHitMap.h.

Referenced by initCells(), and LayerHitMapLoop::LayerHitMapLoop().


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