test
CMS 3D CMS Logo

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

#include <SiPixelClusterShapeCache.h>

Classes

struct  Field
 
struct  LazyGetter
 

Public Types

typedef edm::Ref
< edmNew::DetSetVector
< SiPixelCluster >
, SiPixelCluster
ClusterRef
 

Public Member Functions

SiPixelClusterShapeData get (const ClusterRef &cluster, const PixelGeomDetUnit *pixDet) const
 
template<typename T >
void insert (const ClusterRef &cluster, const T &data)
 
bool isFilled (const ClusterRef &cluster) const
 
void resize (size_t size)
 
void shrink_to_fit ()
 
 SiPixelClusterShapeCache ()
 
 SiPixelClusterShapeCache (const edm::HandleBase &handle)
 
 SiPixelClusterShapeCache (const edm::HandleBase &handle, std::shared_ptr< LazyGetter > getter)
 
 SiPixelClusterShapeCache (const edm::ProductID &id)
 
void swap (SiPixelClusterShapeCache &other)
 
 ~SiPixelClusterShapeCache ()
 

Private Member Functions

void checkRef (const ClusterRef &cluster) const
 

Private Attributes

std::vector< Fielddata_
 
std::shared_ptr< LazyGettergetter_
 
edm::ProductID productId_
 
std::vector< std::pair< int,
int > > 
sizeData_
 

Detailed Description

Definition at line 39 of file SiPixelClusterShapeCache.h.

Member Typedef Documentation

Definition at line 41 of file SiPixelClusterShapeCache.h.

Constructor & Destructor Documentation

SiPixelClusterShapeCache::SiPixelClusterShapeCache ( )
inline

Definition at line 63 of file SiPixelClusterShapeCache.h.

63 {};
SiPixelClusterShapeCache::SiPixelClusterShapeCache ( const edm::HandleBase handle)
inlineexplicit

Definition at line 64 of file SiPixelClusterShapeCache.h.

64 : productId_(handle.id()) {}
ProductID id() const
Definition: HandleBase.cc:15
SiPixelClusterShapeCache::SiPixelClusterShapeCache ( const edm::HandleBase handle,
std::shared_ptr< LazyGetter getter 
)
inline

Definition at line 65 of file SiPixelClusterShapeCache.h.

65 : getter_(getter), productId_(handle.id()) {}
std::shared_ptr< LazyGetter > getter_
ProductID id() const
Definition: HandleBase.cc:15
SiPixelClusterShapeCache::SiPixelClusterShapeCache ( const edm::ProductID id)
inlineexplicit

Definition at line 66 of file SiPixelClusterShapeCache.h.

66 : productId_(id) {}
SiPixelClusterShapeCache::~SiPixelClusterShapeCache ( )

Definition at line 9 of file SiPixelClusterShapeCache.cc.

9 {}

Member Function Documentation

void SiPixelClusterShapeCache::checkRef ( const ClusterRef cluster) const
private

Definition at line 11 of file SiPixelClusterShapeCache.cc.

References data_, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::index(), and productId_.

Referenced by get(), insert(), and isFilled().

11  {
12  if(ref.id() != productId_)
13  throw cms::Exception("InvalidReference") << "SiPixelClusterShapeCache caches values for SiPixelClusters with ProductID " << productId_ << ", got SiPixelClusterRef with ID " << ref.id();
14  if(ref.index() >= data_.size())
15  throw cms::Exception("InvalidReference") << "SiPixelClusterShapeCache caches values for SiPixelClusters with ProductID " << productId_ << " that has " << data_.size() << " clusters, got SiPixelClusterRef with index " << ref.index();
16 }
ProductIndex id() const
Definition: ProductID.h:38
SiPixelClusterShapeData SiPixelClusterShapeCache::get ( const ClusterRef cluster,
const PixelGeomDetUnit pixDet 
) const
inline

Definition at line 101 of file SiPixelClusterShapeCache.h.

References checkRef(), SiPixelClusterShapeCache::Field::complete, data_, end, f, SiPixelClusterShapeCache::Field::filled, getter_, SiPixelClusterShapeCache::Field::has, SiPixelClusterShapeCache::Field::offset, SiPixelClusterShapeCache::Field::size, sizeData_, and SiPixelClusterShapeCache::Field::straight.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), ClusterShapeHitFilter::getSizes(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

101  {
102  checkRef(cluster);
103  Field f = data_[cluster.index()];
104  if(!f.filled) {
105  assert(getter_);
106  getter_->fill(cluster, pixDet, *this);
107  f = data_[cluster.index()];
108  }
109 
110  auto beg = sizeData_.begin()+f.offset;
111  auto end = beg+f.size;
112 
113  return SiPixelClusterShapeData(beg, end, f.straight, f.complete, f.has);
114  }
std::shared_ptr< LazyGetter > getter_
std::vector< std::pair< int, int > > sizeData_
void checkRef(const ClusterRef &cluster) const
double f[11][100]
#define end
Definition: vmac.h:37
template<typename T >
void SiPixelClusterShapeCache::insert ( const ClusterRef cluster,
const T data 
)
inline

Definition at line 88 of file SiPixelClusterShapeCache.h.

References checkRef(), filterCSVwithJSON::copy, data_, edm::Ref< C, T, F >::index(), and sizeData_.

Referenced by BeautifulSoup.PageElement::_invert().

88  {
89  static_assert(T::ArrayType::capacity() <= 16, "T::ArrayType::capacity() more than 16, bit field too narrow");
90  checkRef(cluster);
91 
92  data_[cluster.index()] = Field(sizeData_.size(), data.size.size(), data.isStraight, data.isComplete, data.hasBigPixelsOnlyInside);
93  std::copy(data.size.begin(), data.size.end(), std::back_inserter(sizeData_));
94  }
std::vector< std::pair< int, int > > sizeData_
void checkRef(const ClusterRef &cluster) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool SiPixelClusterShapeCache::isFilled ( const ClusterRef cluster) const
inline

Definition at line 96 of file SiPixelClusterShapeCache.h.

References checkRef(), data_, and edm::Ref< C, T, F >::index().

96  {
97  checkRef(cluster);
98  return data_[cluster.index()].filled;
99  }
void checkRef(const ClusterRef &cluster) const
void SiPixelClusterShapeCache::resize ( size_t  size)
inline
void SiPixelClusterShapeCache::shrink_to_fit ( )
inline

Definition at line 82 of file SiPixelClusterShapeCache.h.

References data_, and sizeData_.

82  {
83  data_.shrink_to_fit();
84  sizeData_.shrink_to_fit();
85  }
std::vector< std::pair< int, int > > sizeData_
void SiPixelClusterShapeCache::swap ( SiPixelClusterShapeCache other)
inline

Definition at line 74 of file SiPixelClusterShapeCache.h.

References data_, getter_, productId_, sizeData_, and std::swap().

74  {
75  data_.swap(other.data_);
76  sizeData_.swap(other.sizeData_);
77  std::swap(getter_, other.getter_);
79  }
std::shared_ptr< LazyGetter > getter_
std::vector< std::pair< int, int > > sizeData_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Member Data Documentation

std::vector<Field> SiPixelClusterShapeCache::data_
private

Definition at line 120 of file SiPixelClusterShapeCache.h.

Referenced by checkRef(), get(), insert(), isFilled(), resize(), shrink_to_fit(), and swap().

std::shared_ptr<LazyGetter> SiPixelClusterShapeCache::getter_
private

Definition at line 122 of file SiPixelClusterShapeCache.h.

Referenced by get(), and swap().

edm::ProductID SiPixelClusterShapeCache::productId_
private

Definition at line 123 of file SiPixelClusterShapeCache.h.

Referenced by checkRef(), and swap().

std::vector<std::pair<int, int> > SiPixelClusterShapeCache::sizeData_
private

Definition at line 121 of file SiPixelClusterShapeCache.h.

Referenced by get(), insert(), resize(), shrink_to_fit(), and swap().