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 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

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

Definition at line 30 of file HcalItemArrayCollById.h.

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.

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

Definition at line 29 of file HcalItemArrayCollById.h.

Constructor & Destructor Documentation

template<typename Item , unsigned N>
HcalItemArrayCollById< Item, N >::HcalItemArrayCollById ( )
inline
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.

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().

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();
51  if (maxIndex != HcalIndexLookup::InvalidIndex && maxIndex >= coll_.size())
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  }
unsigned largestIndex() const
void validateCode(unsigned transformCode)
HcalItemArrayColl< Item, N > coll_
void setDefault(InputArray &arr)
static const unsigned InvalidIndex
template<typename Item , unsigned N>
virtual HcalItemArrayCollById< Item, N >::~HcalItemArrayCollById ( )
inlinevirtual

Definition at line 62 of file HcalItemArrayCollById.h.

62 {}

Member Function Documentation

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

Definition at line 31 of file HcalItemArrayCollById.h.

References N.

31 { return N; }
#define N
Definition: blowfish.cc:9
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.

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

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  }
double f[11][100]
unsigned getIndex(const HcalDetId &id) const
const Item * getByIndex(const unsigned itemIndex, const unsigned arrayIndex) const
template<typename Item , unsigned N>
const Item* HcalItemArrayCollById< Item, N >::get ( const HcalDetId id,
const unsigned  arrayIndex 
) const
inline
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.

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

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

81  {
82  const Item* f = coll_.get(itemIndex, arrayIndex);
83  if (f == nullptr && arrayIndex < N)
84  f = default_[arrayIndex].get();
85  return f;
86  }
double f[11][100]
HcalItemArrayColl< Item, N > coll_
#define N
Definition: blowfish.cc:9
template<typename Item , unsigned N>
const Item* HcalItemArrayCollById< Item, N >::getDefault ( const unsigned  arrayIndex) const
inline

Definition at line 90 of file HcalItemArrayCollById.h.

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

90  {
91  if (arrayIndex < N)
92  return default_[arrayIndex].get();
93  else
94  return nullptr;
95  }
#define N
Definition: blowfish.cc:9
template<typename Item , unsigned N>
unsigned HcalItemArrayCollById< Item, N >::getIndex ( const HcalDetId id) const
inline
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.

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_.

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;
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  }
HcalItemArrayColl< Item, N > coll_
#define N
Definition: blowfish.cc:9
template<typename Item , unsigned N>
template<class Archive >
void HcalItemArrayCollById< Item, N >::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 146 of file HcalItemArrayCollById.h.

References HcalItemArrayCollById< Item, N >::transformCode_.

146  {
148  }
HcalItemArrayColl< Item, N > coll_
template<typename Item , unsigned N>
void HcalItemArrayCollById< Item, N >::setDefault ( InputArray arr)
inline
template<typename Item , unsigned N>
std::size_t HcalItemArrayCollById< Item, N >::size ( void  ) const
inline

Definition at line 71 of file HcalItemArrayCollById.h.

References HcalItemArrayCollById< Item, N >::coll_.

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

71 { return coll_.size(); }
HcalItemArrayColl< Item, N > coll_

Friends And Related Function Documentation

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

Definition at line 143 of file HcalItemArrayCollById.h.

Member Data Documentation

template<typename Item , unsigned N>
HcalItemArrayColl<Item, N> HcalItemArrayCollById< Item, N >::coll_
private
template<typename Item , unsigned N>
StoredArray HcalItemArrayCollById< Item, N >::default_
private
template<typename Item , unsigned N>
HcalIndexLookup HcalItemArrayCollById< Item, N >::lookup_
private
template<typename Item , unsigned N>
uint32_t HcalItemArrayCollById< Item, N >::transformCode_
private