CMS 3D CMS Logo

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

#include <LayerHitMapCache.h>

Classes

class  SimpleCache
 

Public Member Functions

void clear ()
 
 LayerHitMapCache (unsigned int initSize=50)
 
const RecHitsSortedInPhioperator() (const SeedingLayerSetsHits::SeedingLayer &layer, const TrackingRegion &region, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Types

typedef SimpleCache Cache
 

Private Attributes

Cache theCache
 

Detailed Description

A cache adressable by DetLayer* and TrackingRegion* . Used to cache all the hits of a DetLayer.

Definition at line 14 of file LayerHitMapCache.h.

Member Typedef Documentation

Definition at line 42 of file LayerHitMapCache.h.

Constructor & Destructor Documentation

LayerHitMapCache::LayerHitMapCache ( unsigned int  initSize = 50)
inline

Definition at line 44 of file LayerHitMapCache.h.

44 : theCache(initSize) { }

Member Function Documentation

void LayerHitMapCache::clear ( void  )
inline
const RecHitsSortedInPhi& LayerHitMapCache::operator() ( const SeedingLayerSetsHits::SeedingLayer layer,
const TrackingRegion region,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inline

Definition at line 49 of file LayerHitMapCache.h.

References LayerHitMapCache::SimpleCache::add(), RecHitsSortedInPhi::all(), assert(), SeedingLayerSetsHits::SeedingLayer::detLayer(), LayerHitMapCache::SimpleCache::get(), TrackingRegion::hits(), SeedingLayerSetsHits::SeedingLayer::index(), relval_steps::key, LogDebug, TrackingRegion::origin(), theCache, and RecHitsSortedInPhi::theOrigin.

50  {
51  int key = layer.index();
52  assert (key>=0);
53  const RecHitsSortedInPhi * lhm = theCache.get(key);
54  if (lhm==nullptr) {
55  lhm=new RecHitsSortedInPhi (region.hits(iEvent,iSetup,layer), region.origin(), layer.detLayer());
56  lhm->theOrigin = region.origin();
57  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits in the cache for: "<<layer.detLayer();
58  theCache.add( key, lhm);
59  }
60  else{
61  // std::cout << region.origin() << " " << lhm->theOrigin << std::endl;
62  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits FROM THE cache for: "<<layer.detLayer();
63  }
64  return *lhm;
65  }
#define LogDebug(id)
GlobalPoint const & origin() const
assert(m_qm.get())
virtual Hits hits(const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const =0
get hits from layer compatible with region constraints
const ValueType * get(KeyType key)
const DetLayer * detLayer() const
void add(KeyType key, const ValueType *value)
add object to cache. It is caller responsibility to check that object is not yet there.

Member Data Documentation

Cache LayerHitMapCache::theCache
private

Definition at line 68 of file LayerHitMapCache.h.

Referenced by clear(), and operator()().