CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
HcalItemCollById< Item > Class Template Reference

#include <HcalItemCollById.h>

Inheritance diagram for HcalItemCollById< Item >:
AbsHcalAlgoData

Public Types

typedef Item value_type
 

Public Member Functions

const Item & at (const HcalDetId &id) const
 
const Item * get (const HcalDetId &id) const
 
const Item * getByIndex (const unsigned index) const
 
const Item * getDefault () const
 
unsigned getIndex (const HcalDetId &id) const
 
 HcalItemCollById ()
 
 HcalItemCollById (const HcalItemColl< Item > &coll, const HcalIndexLookup &indexLookupTable, const unsigned detIdTransformCode, std::unique_ptr< Item > defaultItem)
 
void setDefault (std::unique_ptr< Item > f)
 
std::size_t size () const
 
 ~HcalItemCollById () override
 
- Public Member Functions inherited from AbsHcalAlgoData
bool operator!= (const AbsHcalAlgoData &r) const
 
bool operator== (const AbsHcalAlgoData &r) const
 
virtual ~AbsHcalAlgoData ()
 

Protected Member Functions

bool isEqual (const AbsHcalAlgoData &other) const override
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned)
 

Private Attributes

HcalItemColl< Item > coll_
 
std::shared_ptr< Item > default_
 
HcalIndexLookup lookup_
 
uint32_t transformCode_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename Item>
class HcalItemCollById< Item >

Definition at line 27 of file HcalItemCollById.h.

Member Typedef Documentation

◆ value_type

template<typename Item>
typedef Item HcalItemCollById< Item >::value_type

Definition at line 29 of file HcalItemCollById.h.

Constructor & Destructor Documentation

◆ HcalItemCollById() [1/2]

template<typename Item>
HcalItemCollById< Item >::HcalItemCollById ( )
inline

◆ HcalItemCollById() [2/2]

template<typename Item>
HcalItemCollById< Item >::HcalItemCollById ( const HcalItemColl< Item > &  coll,
const HcalIndexLookup indexLookupTable,
const unsigned  detIdTransformCode,
std::unique_ptr< Item >  defaultItem 
)
inline

Definition at line 35 of file HcalItemCollById.h.

39  : coll_(coll), lookup_(indexLookupTable), default_(defaultItem.release()), transformCode_(detIdTransformCode) {
40  // Check that the lookup table is valid for this application
42  throw cms::Exception(
43  "In HcalItemCollById constructor:"
44  " invalid lookup table");
45 
46  // Check that the lookup table is consistent with the size
47  // of the collection
48  const unsigned maxIndex = lookup_.largestIndex();
50  throw cms::Exception(
51  "In HcalItemCollById constructor:"
52  " collection and lookup table are inconsistent");
53 
55  }

◆ ~HcalItemCollById()

template<typename Item>
HcalItemCollById< Item >::~HcalItemCollById ( )
inlineoverride

Definition at line 57 of file HcalItemCollById.h.

57 {}

Member Function Documentation

◆ at()

template<typename Item>
const Item& HcalItemCollById< Item >::at ( const HcalDetId id) const
inline

Definition at line 90 of file HcalItemCollById.h.

90  {
91  const Item* ptr = getByIndex(getIndex(id));
92  if (ptr == nullptr)
93  throw cms::Exception("In HcalItemCollById::at: invalid detector id");
94  return *ptr;
95  }

Referenced by HFFlexibleTimeCheck::reconstruct().

◆ get()

template<typename Item>
const Item* HcalItemCollById< Item >::get ( const HcalDetId id) const
inline

◆ getByIndex()

template<typename Item>
const Item* HcalItemCollById< Item >::getByIndex ( const unsigned  index) const
inline

Definition at line 77 of file HcalItemCollById.h.

77  {
78  if (index < coll_.size())
79  return coll_.get(index);
80  else
81  return default_.get();
82  }

Referenced by HcalItemCollById< HFPhase1PMTData >::at(), and HcalItemCollById< HFPhase1PMTData >::get().

◆ getDefault()

template<typename Item>
const Item* HcalItemCollById< Item >::getDefault ( ) const
inline

Definition at line 66 of file HcalItemCollById.h.

66 { return default_.get(); }

◆ getIndex()

template<typename Item>
unsigned HcalItemCollById< Item >::getIndex ( const HcalDetId id) const
inline

◆ isEqual()

template<typename Item>
bool HcalItemCollById< Item >::isEqual ( const AbsHcalAlgoData other) const
inlineoverrideprotectedvirtual

Implements AbsHcalAlgoData.

Definition at line 98 of file HcalItemCollById.h.

98  {
99  const HcalItemCollById& r = static_cast<const HcalItemCollById&>(other);
100  if (coll_ != r.coll_)
101  return false;
102  if (lookup_ != r.lookup_)
103  return false;
104  if (transformCode_ != r.transformCode_)
105  return false;
106  // The default may or may not be there
107  const bool ld = default_.get();
108  const bool rd = r.default_.get();
109  if (ld != rd)
110  return false;
111  if (ld)
112  if (!(*default_ == *r.default_))
113  return false;
114  return true;
115  }

◆ serialize()

template<typename Item>
template<class Archive >
void HcalItemCollById< Item >::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 126 of file HcalItemCollById.h.

126  {
128  }

◆ setDefault()

template<typename Item>
void HcalItemCollById< Item >::setDefault ( std::unique_ptr< Item >  f)
inline

Definition at line 60 of file HcalItemCollById.h.

60 { default_ = std::shared_ptr<Item>(f.release()); }

Referenced by VarParsing.VarParsing::__setattr__(), VarParsing.VarParsing::parseArguments(), and VarParsing.VarParsing::setType().

◆ size()

template<typename Item>
std::size_t HcalItemCollById< Item >::size ( void  ) const
inline

Definition at line 63 of file HcalItemCollById.h.

63 { return coll_.size(); }

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename Item>
friend class boost::serialization::access
friend

Definition at line 123 of file HcalItemCollById.h.

Member Data Documentation

◆ coll_

template<typename Item>
HcalItemColl<Item> HcalItemCollById< Item >::coll_
private

◆ default_

template<typename Item>
std::shared_ptr<Item> HcalItemCollById< Item >::default_
private

◆ lookup_

template<typename Item>
HcalIndexLookup HcalItemCollById< Item >::lookup_
private

◆ transformCode_

template<typename Item>
uint32_t HcalItemCollById< Item >::transformCode_
private
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalItemCollById::lookup_
HcalIndexLookup lookup_
Definition: HcalItemCollById.h:119
HcalItemCollById::coll_
HcalItemColl< Item > coll_
Definition: HcalItemCollById.h:118
ApeEstimator_cff.maxIndex
maxIndex
Definition: ApeEstimator_cff.py:25
HcalDetIdTransform::N_TRANSFORMS
Definition: HcalDetIdTransform.h:17
HcalItemCollById
Definition: HcalItemCollById.h:27
HcalItemCollById::getIndex
unsigned getIndex(const HcalDetId &id) const
Definition: HcalItemCollById.h:69
HcalItemCollById::transformCode_
uint32_t transformCode_
Definition: HcalItemCollById.h:121
trackingPlots.other
other
Definition: trackingPlots.py:1465
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
HcalIndexLookup::largestIndex
unsigned largestIndex() const
Definition: HcalIndexLookup.cc:54
HcalIndexLookup::InvalidIndex
static const unsigned InvalidIndex
Definition: HcalIndexLookup.h:21
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalItemCollById::getByIndex
const Item * getByIndex(const unsigned index) const
Definition: HcalItemCollById.h:77
HcalIndexLookup::hasDuplicateIds
bool hasDuplicateIds()
Definition: HcalIndexLookup.cc:17
HcalItemCollById::default_
std::shared_ptr< Item > default_
Definition: HcalItemCollById.h:120
Exception
Definition: hltDiff.cc:246
HcalIndexLookup::find
unsigned find(unsigned detId) const
Definition: HcalIndexLookup.cc:36
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cms::Exception
Definition: Exception.h:70
HcalDetIdTransform::validateCode
void validateCode(unsigned transformCode)
Definition: HcalDetIdTransform.cc:50