CMS 3D CMS Logo

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 ()
 
void extend (const LayerHitMapCache &other)
 
 LayerHitMapCache (unsigned int initSize=50)
 
 LayerHitMapCache (LayerHitMapCache &&rh)
 
const RecHitsSortedInPhioperator() (const SeedingLayerSetsHits::SeedingLayer &layer, const TrackingRegion &region, 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 53 of file LayerHitMapCache.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file LayerHitMapCache.h.

55 : theCache(initSize) { }
LayerHitMapCache::LayerHitMapCache ( LayerHitMapCache &&  rh)
inline

Definition at line 56 of file LayerHitMapCache.h.

56 : theCache(std::move(rh.theCache)) {}
def move(src, dest)
Definition: eostools.py:510

Member Function Documentation

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

Definition at line 65 of file LayerHitMapCache.h.

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

66  {
67  int key = layer.index();
68  assert (key>=0);
69  const RecHitsSortedInPhi * lhm = theCache.get(key);
70  if (lhm==nullptr) {
71  auto tmp=new RecHitsSortedInPhi (region.hits(iSetup,layer), region.origin(), layer.detLayer());
72  tmp->theOrigin = region.origin();
73  theCache.add( key, tmp);
74  lhm = tmp;
75  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits in the cache for: "<<layer.detLayer();
76  }
77  else{
78  // std::cout << region.origin() << " " << lhm->theOrigin << std::endl;
79  LogDebug("LayerHitMapCache")<<" I got"<< lhm->all().second-lhm->all().first<<" hits FROM THE cache for: "<<layer.detLayer();
80  }
81  return *lhm;
82  }
#define LogDebug(id)
GlobalPoint const & origin() const
void add(KeyType key, ValueType *value)
add object to cache. It is caller responsibility to check that object is not yet there.
virtual Hits hits(const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const =0
get hits from layer compatible with region constraints
const DetLayer * detLayer() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const ValueType * get(KeyType key) const

Member Data Documentation

Cache LayerHitMapCache::theCache
private

Definition at line 85 of file LayerHitMapCache.h.

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