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 (int initSize=50)
 
 LayerHitMapCache (const LayerHitMapCache &)
 
const RecHitsSortedInPhioperator() (const ctfseeding::SeedingLayer *layer, const TrackingRegion &region, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~LayerHitMapCache ()
 

Private Types

typedef SimpleCache
< LayerRegionKey,
RecHitsSortedInPhi
Cache
 
typedef const DetLayerLayerRegionKey
 

Private Attributes

CachetheCache
 

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 48 of file LayerHitMapCache.h.

Definition at line 47 of file LayerHitMapCache.h.

Constructor & Destructor Documentation

LayerHitMapCache::LayerHitMapCache ( int  initSize = 50)
inline

Definition at line 50 of file LayerHitMapCache.h.

References theCache.

50 { theCache = new Cache(initSize); }
SimpleCache< LayerRegionKey, RecHitsSortedInPhi > Cache
LayerHitMapCache::~LayerHitMapCache ( )
inline

Definition at line 52 of file LayerHitMapCache.h.

References theCache.

52 { delete theCache; }
LayerHitMapCache::LayerHitMapCache ( const LayerHitMapCache )
inline

Definition at line 73 of file LayerHitMapCache.h.

73 { }

Member Function Documentation

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

Definition at line 56 of file LayerHitMapCache.h.

References LayerHitMapCache::SimpleCache< KeyType, ValueType >::add(), ctfseeding::SeedingLayer::detLayer(), LayerHitMapCache::SimpleCache< KeyType, ValueType >::get(), TrackingRegion::hits(), combine::key, LogDebug, and theCache.

58  {
59  LayerRegionKey key(layer->detLayer());
60  const RecHitsSortedInPhi * lhm = theCache->get(key);
61  if (lhm==0) {
62  lhm=new RecHitsSortedInPhi (region.hits(iEvent,iSetup,layer));
63  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits in the cache for: "<<layer->detLayer();
64  theCache->add( key, lhm);
65  }
66  else{
67  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits FROM THE cache for: "<<layer->detLayer();
68  }
69  return *lhm;
70  }
#define LogDebug(id)
virtual Hits hits(const edm::Event &ev, const edm::EventSetup &es, const ctfseeding::SeedingLayer *layer) const =0
get hits from layer compatible with region constraints
const DetLayer * detLayer() const
Definition: SeedingLayer.cc:80
const DetLayer * LayerRegionKey
const ValueType * get(const KeyType &key)
list key
Definition: combine.py:13
void add(const 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 76 of file LayerHitMapCache.h.

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