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< boost::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 31 of file HcalItemArrayCollById.h.

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

Definition at line 146 of file HcalItemArrayCollById.h.

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

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

43  : coll_(coll),
44  lookup_(indexLookupTable),
45  transformCode_(detIdTransformCode)
46  {
47  // Check that the lookup table is valid for this application
49  throw cms::Exception("In HcalItemArrayCollById constructor:"
50  " invalid lookup table");
51 
52  // Check that the lookup table is consistent with the size
53  // of the collection
54  const unsigned maxIndex = lookup_.largestIndex();
55  if (maxIndex != HcalIndexLookup::InvalidIndex &&
56  maxIndex >= coll_.size())
57  throw cms::Exception("In HcalItemArrayCollById constructor:"
58  " collection and lookup table are inconsistent");
59 
61 
62  // Take care of the default array
63  setDefault(defaultFunctors);
64  }
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 66 of file HcalItemArrayCollById.h.

66 {}

Member Function Documentation

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

Definition at line 32 of file HcalItemArrayCollById.h.

References N.

32 {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 111 of file HcalItemArrayCollById.h.

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

113  {
114  const Item* f = getByIndex(getIndex(id), arrayIndex);
115  if (f == nullptr) throw cms::Exception(
116  "In HcalItemArrayCollById::at: invalid detector id");
117  return *f;
118  }
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 85 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().

87  {
88  const Item* f = coll_.get(itemIndex, arrayIndex);
89  if (f == nullptr && arrayIndex < N)
90  f = default_[arrayIndex].get();
91  return f;
92  }
HcalItemArrayColl< Item, N > coll_
double f[11][100]
#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 96 of file HcalItemArrayCollById.h.

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

97  {
98  if (arrayIndex < N) return default_[arrayIndex].get();
99  else return nullptr;
100  }
#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 121 of file HcalItemArrayCollById.h.

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

122  {
123  const HcalItemArrayCollById& r =
124  static_cast<const HcalItemArrayCollById&>(other);
125  if (coll_ != r.coll_)
126  return false;
127  if (lookup_ != r.lookup_)
128  return false;
130  return false;
131  for (unsigned j=0; j<N; ++j)
132  {
133  // The default may or may not be there
134  const bool ld = default_[j].get();
135  const bool rd = r.default_[j].get();
136  if (ld != rd)
137  return false;
138  if (ld)
139  if (!(*default_[j] == *r.default_[j]))
140  return false;
141  }
142  return true;
143  }
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 156 of file HcalItemArrayCollById.h.

References HcalItemArrayCollById< Item, N >::transformCode_.

157  {
159  }
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

Friends And Related Function Documentation

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

Definition at line 153 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