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

RecHitsSortedInPhiadd (const SeedingLayerSetsHits::SeedingLayer &layer, std::unique_ptr< RecHitsSortedInPhi > hits)
 
void clear ()
 
void extend (const LayerHitMapCache &other)
 
 LayerHitMapCache (LayerHitMapCache &&)=default
 
 LayerHitMapCache (unsigned int initSize=50)
 
const RecHitsSortedInPhioperator() (const SeedingLayerSetsHits::SeedingLayer &layer, const TrackingRegion &region, const edm::EventSetup &iSetup)
 
LayerHitMapCacheoperator= (LayerHitMapCache &&)=default
 

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

◆ Cache

Definition at line 62 of file LayerHitMapCache.h.

Constructor & Destructor Documentation

◆ LayerHitMapCache() [1/2]

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

Definition at line 65 of file LayerHitMapCache.h.

65 : theCache(initSize) {}

◆ LayerHitMapCache() [2/2]

LayerHitMapCache::LayerHitMapCache ( LayerHitMapCache &&  )
default

Member Function Documentation

◆ add()

RecHitsSortedInPhi* LayerHitMapCache::add ( const SeedingLayerSetsHits::SeedingLayer layer,
std::unique_ptr< RecHitsSortedInPhi hits 
)
inline

Definition at line 74 of file LayerHitMapCache.h.

74  {
75  RecHitsSortedInPhi* ptr = hits.get();
76  theCache.add(layer.index(), hits.release());
77  return ptr;
78  }

References LayerHitMapCache::SimpleCache::add(), hfClusterShapes_cfi::hits, phase1PixelTopology::layer, and theCache.

Referenced by operator()(), and counter.Counter::register().

◆ clear()

void LayerHitMapCache::clear ( void  )
inline

◆ extend()

void LayerHitMapCache::extend ( const LayerHitMapCache other)
inline

◆ operator()()

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

Definition at line 80 of file LayerHitMapCache.h.

82  {
83  int key = layer.index();
84  assert(key >= 0);
85  const RecHitsSortedInPhi* lhm = theCache.get(key);
86  if (lhm == nullptr) {
87  auto tmp = add(
88  layer, std::make_unique<RecHitsSortedInPhi>(region.hits(iSetup, layer), region.origin(), layer.detLayer()));
89  tmp->theOrigin = region.origin();
90  lhm = tmp;
91  LogDebug("LayerHitMapCache") << " I got" << lhm->all().second - lhm->all().first
92  << " hits in the cache for: " << layer.detLayer();
93  } else {
94  // std::cout << region.origin() << " " << lhm->theOrigin << std::endl;
95  LogDebug("LayerHitMapCache") << " I got" << lhm->all().second - lhm->all().first
96  << " hits FROM THE cache for: " << layer.detLayer();
97  }
98  return *lhm;
99  }

References add(), RecHitsSortedInPhi::all(), cms::cuda::assert(), LayerHitMapCache::SimpleCache::get(), crabWrapper::key, phase1PixelTopology::layer, LogDebug, HLT_FULL_cff::region, theCache, and createJobs::tmp.

◆ operator=()

LayerHitMapCache& LayerHitMapCache::operator= ( LayerHitMapCache &&  )
default

Member Data Documentation

◆ theCache

Cache LayerHitMapCache::theCache
private

Definition at line 102 of file LayerHitMapCache.h.

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

RecHitsSortedInPhi::all
Range all() const
Definition: RecHitsSortedInPhi.h:84
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
cms::cuda::assert
assert(be >=bs)
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
LayerHitMapCache::add
RecHitsSortedInPhi * add(const SeedingLayerSetsHits::SeedingLayer &layer, std::unique_ptr< RecHitsSortedInPhi > hits)
Definition: LayerHitMapCache.h:74
LayerHitMapCache::SimpleCache::clear
void clear()
emptify cache, delete values associated to Key
Definition: LayerHitMapCache.h:51
trackingPlots.other
other
Definition: trackingPlots.py:1460
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
RecHitsSortedInPhi
Definition: RecHitsSortedInPhi.h:17
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88267
LayerHitMapCache::theCache
Cache theCache
Definition: LayerHitMapCache.h:102
LayerHitMapCache::SimpleCache::add
void add(KeyType key, ValueType *value)
add object to cache. It is caller responsibility to check that object is not yet there.
Definition: LayerHitMapCache.h:29
LayerHitMapCache::SimpleCache::extend
void extend(const SimpleCache &other)
Definition: LayerHitMapCache.h:34
LayerHitMapCache::SimpleCache::get
const ValueType * get(KeyType key) const
Definition: LayerHitMapCache.h:27
crabWrapper.key
key
Definition: crabWrapper.py:19