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
 

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::ProductID &id)
 
void swap (SiPixelClusterShapeCache &other)
 
 ~SiPixelClusterShapeCache ()
 

Private Member Functions

void checkRef (const ClusterRef &cluster) const
 

Private Attributes

std::vector< Fielddata_
 
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 56 of file SiPixelClusterShapeCache.h.

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

Definition at line 57 of file SiPixelClusterShapeCache.h.

57 : productId_(handle.id()) {}
ProductID id() const
Definition: HandleBase.cc:15
SiPixelClusterShapeCache::SiPixelClusterShapeCache ( const edm::ProductID id)
inlineexplicit

Definition at line 58 of file SiPixelClusterShapeCache.h.

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

Definition at line 6 of file SiPixelClusterShapeCache.cc.

6 {}

Member Function Documentation

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

Definition at line 8 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().

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

Definition at line 92 of file SiPixelClusterShapeCache.h.

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

Referenced by Options.Options::__getitem__().

92  {
93  checkRef(cluster);
94  Field f = data_[cluster.index()];
95  assert(f.filled);
96 
97  auto beg = sizeData_.begin()+f.offset;
98  auto end = beg+f.size;
99 
100  return SiPixelClusterShapeData(beg, end, f.straight, f.complete, f.has);
101  }
std::vector< std::pair< int, int > > sizeData_
void checkRef(const ClusterRef &cluster) const
assert(m_qm.get())
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 79 of file SiPixelClusterShapeCache.h.

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

79  {
80  static_assert(T::ArrayType::capacity() <= 16, "T::ArrayType::capacity() more than 16, bit field too narrow");
81  checkRef(cluster);
82 
83  data_[cluster.index()] = Field(sizeData_.size(), data.size.size(), data.isStraight, data.isComplete, data.hasBigPixelsOnlyInside);
84  std::copy(data.size.begin(), data.size.end(), std::back_inserter(sizeData_));
85  }
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 87 of file SiPixelClusterShapeCache.h.

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

87  {
88  checkRef(cluster);
89  return data_[cluster.index()].filled;
90  }
void checkRef(const ClusterRef &cluster) const
void SiPixelClusterShapeCache::resize ( size_t  size)
inline

Definition at line 61 of file SiPixelClusterShapeCache.h.

References data_, and sizeData_.

Referenced by Vispa.Gui.TextDialog.TextDialog::__init__().

61  {
62  data_.resize(size);
63  sizeData_.reserve(size);
64  }
std::vector< std::pair< int, int > > sizeData_
tuple size
Write out results.
void SiPixelClusterShapeCache::shrink_to_fit ( )
inline

Definition at line 73 of file SiPixelClusterShapeCache.h.

References data_, and sizeData_.

73  {
74  data_.shrink_to_fit();
75  sizeData_.shrink_to_fit();
76  }
std::vector< std::pair< int, int > > sizeData_
void SiPixelClusterShapeCache::swap ( SiPixelClusterShapeCache other)
inline

Definition at line 66 of file SiPixelClusterShapeCache.h.

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

66  {
67  data_.swap(other.data_);
68  sizeData_.swap(other.sizeData_);
70  }
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 107 of file SiPixelClusterShapeCache.h.

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

edm::ProductID SiPixelClusterShapeCache::productId_
private

Definition at line 109 of file SiPixelClusterShapeCache.h.

Referenced by checkRef(), and swap().

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

Definition at line 108 of file SiPixelClusterShapeCache.h.

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