CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
HcalItemArrayCollById< Item, N > Class Template Reference

#include <HcalItemArrayCollById.h>

Inheritance diagram for HcalItemArrayCollById< Item, N >:
AbsHcalAlgoData

Public Types

typedef HcalItemArrayColl< Item, N >::InputArray InputArray
 
typedef Item value_type
 

Public Member Functions

const Item & at (const HcalDetId &id, const unsigned arrayIndex) const
 
const Item * get (const HcalDetId &id, const unsigned arrayIndex) const
 
const Item * getByIndex (const unsigned itemIndex, const unsigned arrayIndex) const
 
const Item * getDefault (const unsigned arrayIndex) const
 
unsigned getIndex (const HcalDetId &id) const
 
 HcalItemArrayCollById ()
 
 HcalItemArrayCollById (const HcalItemArrayColl< Item, N > &coll, const HcalIndexLookup &indexLookupTable, const unsigned detIdTransformCode, InputArray &defaultFunctors)
 
void setDefault (InputArray &arr)
 
std::size_t size () const
 
virtual ~HcalItemArrayCollById ()
 
- Public Member Functions inherited from AbsHcalAlgoData
bool operator!= (const AbsHcalAlgoData &r) const
 
bool operator== (const AbsHcalAlgoData &r) const
 
virtual ~AbsHcalAlgoData ()
 

Static Public Member Functions

static constexpr unsigned arraySize ()
 

Protected Member Functions

virtual bool isEqual (const AbsHcalAlgoData &other) const override
 

Private Types

typedef boost::array< std::shared_ptr< Item >, NStoredArray
 

Private Member Functions

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

Private Attributes

HcalItemArrayColl< Item, Ncoll_
 
StoredArray default_
 
HcalIndexLookup lookup_
 
uint32_t transformCode_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename Item, unsigned N>
class HcalItemArrayCollById< Item, N >

Definition at line 27 of file HcalItemArrayCollById.h.

Member Typedef Documentation

◆ InputArray

template<typename Item , unsigned N>
typedef HcalItemArrayColl<Item, N>::InputArray HcalItemArrayCollById< Item, N >::InputArray

Definition at line 30 of file HcalItemArrayCollById.h.

◆ StoredArray

template<typename Item , unsigned N>
typedef boost::array<std::shared_ptr<Item>, N> HcalItemArrayCollById< Item, N >::StoredArray
private

Definition at line 136 of file HcalItemArrayCollById.h.

◆ value_type

template<typename Item , unsigned N>
typedef Item HcalItemArrayCollById< Item, N >::value_type

Definition at line 29 of file HcalItemArrayCollById.h.

Constructor & Destructor Documentation

◆ HcalItemArrayCollById() [1/2]

template<typename Item , unsigned N>
HcalItemArrayCollById< Item, N >::HcalItemArrayCollById ( )
inline

◆ HcalItemArrayCollById() [2/2]

template<typename Item , unsigned N>
HcalItemArrayCollById< Item, N >::HcalItemArrayCollById ( const HcalItemArrayColl< Item, N > &  coll,
const HcalIndexLookup indexLookupTable,
const unsigned  detIdTransformCode,
InputArray defaultFunctors 
)
inline

Definition at line 37 of file HcalItemArrayCollById.h.

41  : coll_(coll), lookup_(indexLookupTable), transformCode_(detIdTransformCode) {
42  // Check that the lookup table is valid for this application
44  throw cms::Exception(
45  "In HcalItemArrayCollById constructor:"
46  " invalid lookup table");
47 
48  // Check that the lookup table is consistent with the size
49  // of the collection
50  const unsigned maxIndex = lookup_.largestIndex();
52  throw cms::Exception(
53  "In HcalItemArrayCollById constructor:"
54  " collection and lookup table are inconsistent");
55 
57 
58  // Take care of the default array
59  setDefault(defaultFunctors);
60  }

References HcalItemArrayCollById< Item, N >::coll_, HcalIndexLookup::hasDuplicateIds(), HcalIndexLookup::InvalidIndex, HcalIndexLookup::largestIndex(), HcalItemArrayCollById< Item, N >::lookup_, ApeEstimator_cff::maxIndex, HcalItemArrayCollById< Item, N >::setDefault(), HcalItemArrayCollById< Item, N >::transformCode_, and HcalDetIdTransform::validateCode().

◆ ~HcalItemArrayCollById()

template<typename Item , unsigned N>
virtual HcalItemArrayCollById< Item, N >::~HcalItemArrayCollById ( )
inlinevirtual

Definition at line 62 of file HcalItemArrayCollById.h.

62 {}

Member Function Documentation

◆ arraySize()

template<typename Item , unsigned N>
static constexpr unsigned HcalItemArrayCollById< Item, N >::arraySize ( )
inlinestaticconstexpr

Definition at line 31 of file HcalItemArrayCollById.h.

31 { return N; }

References N.

◆ at()

template<typename Item , unsigned N>
const Item& HcalItemArrayCollById< Item, N >::at ( const HcalDetId id,
const unsigned  arrayIndex 
) const
inline

Definition at line 106 of file HcalItemArrayCollById.h.

106  {
107  const Item* f = getByIndex(getIndex(id), arrayIndex);
108  if (f == nullptr)
109  throw cms::Exception("In HcalItemArrayCollById::at: invalid detector id");
110  return *f;
111  }

References Exception, f, HcalItemArrayCollById< Item, N >::getByIndex(), and HcalItemArrayCollById< Item, N >::getIndex().

◆ get()

template<typename Item , unsigned N>
const Item* HcalItemArrayCollById< Item, N >::get ( const HcalDetId id,
const unsigned  arrayIndex 
) const
inline

◆ getByIndex()

template<typename Item , unsigned N>
const Item* HcalItemArrayCollById< Item, N >::getByIndex ( const unsigned  itemIndex,
const unsigned  arrayIndex 
) const
inline

Definition at line 81 of file HcalItemArrayCollById.h.

81  {
82  const Item* f = coll_.get(itemIndex, arrayIndex);
83  if (f == nullptr && arrayIndex < N)
84  f = default_[arrayIndex].get();
85  return f;
86  }

References HcalItemArrayCollById< Item, N >::coll_, HcalItemArrayCollById< Item, N >::default_, f, and N.

Referenced by HcalItemArrayCollById< Item, N >::at(), and HcalItemArrayCollById< Item, N >::get().

◆ getDefault()

template<typename Item , unsigned N>
const Item* HcalItemArrayCollById< Item, N >::getDefault ( const unsigned  arrayIndex) const
inline

Definition at line 90 of file HcalItemArrayCollById.h.

90  {
91  if (arrayIndex < N)
92  return default_[arrayIndex].get();
93  else
94  return nullptr;
95  }

References HcalItemArrayCollById< Item, N >::default_, and N.

◆ getIndex()

template<typename Item , unsigned N>
unsigned HcalItemArrayCollById< Item, N >::getIndex ( const HcalDetId id) const
inline

◆ isEqual()

template<typename Item , unsigned N>
virtual bool HcalItemArrayCollById< Item, N >::isEqual ( const AbsHcalAlgoData other) const
inlineoverrideprotectedvirtual

Implements AbsHcalAlgoData.

Definition at line 114 of file HcalItemArrayCollById.h.

114  {
115  const HcalItemArrayCollById& r = static_cast<const HcalItemArrayCollById&>(other);
116  if (coll_ != r.coll_)
117  return false;
118  if (lookup_ != r.lookup_)
119  return false;
120  if (transformCode_ != r.transformCode_)
121  return false;
122  for (unsigned j = 0; j < N; ++j) {
123  // The default may or may not be there
124  const bool ld = default_[j].get();
125  const bool rd = r.default_[j].get();
126  if (ld != rd)
127  return false;
128  if (ld)
129  if (!(*default_[j] == *r.default_[j]))
130  return false;
131  }
132  return true;
133  }

References HcalItemArrayCollById< Item, N >::coll_, HcalItemArrayCollById< Item, N >::default_, dqmiolumiharvest::j, HcalItemArrayCollById< Item, N >::lookup_, N, trackingPlots::other, alignCSCRings::r, and HcalItemArrayCollById< Item, N >::transformCode_.

◆ serialize()

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

◆ setDefault()

template<typename Item , unsigned N>
void HcalItemArrayCollById< Item, N >::setDefault ( InputArray arr)
inline

◆ size()

template<typename Item , unsigned N>
std::size_t HcalItemArrayCollById< Item, N >::size ( void  ) const
inline

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename Item , unsigned N>
friend class boost::serialization::access
friend

Definition at line 143 of file HcalItemArrayCollById.h.

Member Data Documentation

◆ coll_

template<typename Item , unsigned N>
HcalItemArrayColl<Item, N> HcalItemArrayCollById< Item, N >::coll_
private

◆ default_

template<typename Item , unsigned N>
StoredArray HcalItemArrayCollById< Item, N >::default_
private

◆ lookup_

template<typename Item , unsigned N>
HcalIndexLookup HcalItemArrayCollById< Item, N >::lookup_
private

◆ transformCode_

template<typename Item , unsigned N>
uint32_t HcalItemArrayCollById< Item, N >::transformCode_
private
mps_fire.i
i
Definition: mps_fire.py:355
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalItemArrayCollById::setDefault
void setDefault(InputArray &arr)
Definition: HcalItemArrayCollById.h:65
ApeEstimator_cff.maxIndex
maxIndex
Definition: ApeEstimator_cff.py:25
HcalDetIdTransform::N_TRANSFORMS
Definition: HcalDetIdTransform.h:17
HcalItemArrayCollById::getByIndex
const Item * getByIndex(const unsigned itemIndex, const unsigned arrayIndex) const
Definition: HcalItemArrayCollById.h:81
HcalItemArrayCollById::transformCode_
uint32_t transformCode_
Definition: HcalItemArrayCollById.h:141
N
#define N
Definition: blowfish.cc:9
trackingPlots.other
other
Definition: trackingPlots.py:1465
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
HcalItemArrayCollById::lookup_
HcalIndexLookup lookup_
Definition: HcalItemArrayCollById.h:139
HcalIndexLookup::largestIndex
unsigned largestIndex() const
Definition: HcalIndexLookup.cc:54
HcalIndexLookup::InvalidIndex
static const unsigned InvalidIndex
Definition: HcalIndexLookup.h:21
HcalItemArrayCollById::getIndex
unsigned getIndex(const HcalDetId &id) const
Definition: HcalItemArrayCollById.h:74
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalIndexLookup::hasDuplicateIds
bool hasDuplicateIds()
Definition: HcalIndexLookup.cc:17
Exception
Definition: hltDiff.cc:246
HcalIndexLookup::find
unsigned find(unsigned detId) const
Definition: HcalIndexLookup.cc:36
HcalItemArrayCollById::coll_
HcalItemArrayColl< Item, N > coll_
Definition: HcalItemArrayCollById.h:138
cms::Exception
Definition: Exception.h:70
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HcalItemArrayCollById::default_
StoredArray default_
Definition: HcalItemArrayCollById.h:140
HcalDetIdTransform::validateCode
void validateCode(unsigned transformCode)
Definition: HcalDetIdTransform.cc:50
HcalItemArrayCollById
Definition: HcalItemArrayCollById.h:27