CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
HcalDcsMap Class Reference

#include <HcalDcsMap.h>

Classes

class  const_iterator
 
class  Item
 

Public Member Functions

const_iterator beginByDcsId (void) const
 
const_iterator beginById (void) const
 
const_iterator endByDcsId (void) const
 
const_iterator endById (void) const
 
const ItemfindByDcsId (unsigned long fDcsId) const
 
const ItemfindById (unsigned long fId) const
 
 HcalDcsMap ()
 
 HcalDcsMap (const HcalDcsMapAddons::Helper &helper)
 
 HcalDcsMap (const HcalDcsMap &src)
 
 HcalDcsMap (HcalDcsMap &&other)
 
void initialize ()
 
HcalDetId lookup (HcalDcsDetId fId) const
 
HcalDcsDetId lookup (HcalDetId fId, HcalDcsDetId::DcsType type) const
 
HcalDcsMapoperator= (const HcalDcsMap &rhs)
 
void sortByDcsId ()
 
void sortById ()
 
void swap (HcalDcsMap &other)
 
 ~HcalDcsMap ()
 

Protected Member Functions

std::vector< HcalDcsDetIdallHcalDcsDetId () const
 
std::vector< HcalGenericDetIdallHcalDetId () const
 

Protected Attributes

std::vector< ItemmItems
 
std::vector< const Item * > mItemsByDcsId
 
std::vector< const Item * > mItemsById
 

Private Member Functions

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

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Author
Gena Kukartsev POOL object to store map between detector ID and DCS ID Inspired by HcalElectronicsMap $Author: kukartse
Date
2007/12/14 13:31:21
Revision
1.1
Author
Gena Kukartsev POOL object to store map between detector ID and DCS ID Inspired by HcalElectronicsMap $Author: kukartse
Date
2010/02/22 21:08:07
Revision
1.1

Definition at line 34 of file HcalDcsMap.h.

Constructor & Destructor Documentation

◆ HcalDcsMap() [1/4]

HcalDcsMap::HcalDcsMap ( )
inline

Definition at line 46 of file HcalDcsMap.h.

46 {}

◆ HcalDcsMap() [2/4]

HcalDcsMap::HcalDcsMap ( const HcalDcsMapAddons::Helper helper)

Definition at line 18 of file HcalDcsMap.cc.

References initialize().

18  : mItems(helper.mItems.begin(), helper.mItems.end()) {
19  initialize();
20 }
Definition: helper.py:1
void initialize()
Definition: HcalDcsMap.cc:169
std::vector< Item > mItems
Definition: HcalDcsMap.h:122

◆ ~HcalDcsMap()

HcalDcsMap::~HcalDcsMap ( )

Definition at line 22 of file HcalDcsMap.cc.

22 {}

◆ HcalDcsMap() [3/4]

HcalDcsMap::HcalDcsMap ( const HcalDcsMap src)

Definition at line 24 of file HcalDcsMap.cc.

25  : mItems(src.mItems), mItemsById(src.mItemsById), mItemsByDcsId(src.mItemsByDcsId) {}
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124
std::vector< Item > mItems
Definition: HcalDcsMap.h:122
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

◆ HcalDcsMap() [4/4]

HcalDcsMap::HcalDcsMap ( HcalDcsMap &&  other)

Definition at line 39 of file HcalDcsMap.cc.

References trackingPlots::other.

39 : HcalDcsMap() { other.swap(*this); }

Member Function Documentation

◆ allHcalDcsDetId()

std::vector< HcalDcsDetId > HcalDcsMap::allHcalDcsDetId ( ) const
protected

Definition at line 120 of file HcalDcsMap.cc.

References B2GTnPMonitor_cfi::item, mItems, and mps_fire::result.

120  {
121  std::vector<HcalDcsDetId> result;
122  for (std::vector<Item>::const_iterator item = mItems.begin(); item != mItems.end(); item++)
123  if (item->mDcsId)
124  result.push_back(HcalDcsDetId(item->mDcsId));
125  return result;
126 }
std::vector< Item > mItems
Definition: HcalDcsMap.h:122

◆ allHcalDetId()

std::vector< HcalGenericDetId > HcalDcsMap::allHcalDetId ( ) const
protected

Definition at line 129 of file HcalDcsMap.cc.

References B2GTnPMonitor_cfi::item, mItems, and mps_fire::result.

129  {
130  std::vector<HcalGenericDetId> result;
131  std::set<unsigned long> allIds;
132  for (std::vector<Item>::const_iterator item = mItems.begin(); item != mItems.end(); item++)
133  if (item->mId)
134  allIds.insert(item->mId);
135  for (std::set<unsigned long>::const_iterator channel = allIds.begin(); channel != allIds.end(); channel++) {
136  result.push_back(HcalGenericDetId(*channel));
137  }
138  return result;
139 }
std::vector< Item > mItems
Definition: HcalDcsMap.h:122

◆ beginByDcsId()

HcalDcsMap::const_iterator HcalDcsMap::beginByDcsId ( void  ) const

Definition at line 47 of file HcalDcsMap.cc.

References HcalDcsMap::const_iterator::fIter, and mItemsByDcsId.

47  {
48  const_iterator _iter;
49  _iter.fIter = mItemsByDcsId.begin();
50  return _iter;
51 }
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124

◆ beginById()

HcalDcsMap::const_iterator HcalDcsMap::beginById ( void  ) const

Definition at line 41 of file HcalDcsMap.cc.

References HcalDcsMap::const_iterator::fIter, and mItemsById.

41  {
42  const_iterator _iter;
43  _iter.fIter = mItemsById.begin();
44  return _iter;
45 }
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

◆ endByDcsId()

HcalDcsMap::const_iterator HcalDcsMap::endByDcsId ( void  ) const

Definition at line 59 of file HcalDcsMap.cc.

References HcalDcsMap::const_iterator::fIter, and mItemsByDcsId.

59  {
60  const_iterator _iter;
61  _iter.fIter = mItemsByDcsId.end();
62  return _iter;
63 }
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124

◆ endById()

HcalDcsMap::const_iterator HcalDcsMap::endById ( void  ) const

Definition at line 53 of file HcalDcsMap.cc.

References HcalDcsMap::const_iterator::fIter, and mItemsById.

53  {
54  const_iterator _iter;
55  _iter.fIter = mItemsById.end();
56  return _iter;
57 }
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

◆ findByDcsId()

const HcalDcsMap::Item * HcalDcsMap::findByDcsId ( unsigned long  fDcsId) const

Definition at line 95 of file HcalDcsMap.cc.

References mItemsByDcsId, and filterCSVwithJSON::target.

Referenced by lookup().

95  {
96  Item target(0, fDcsId);
97  return HcalObjectAddons::findByT<Item, HcalDcsMapAddons::LessByDcsId>(&target, mItemsByDcsId);
98 }
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124

◆ findById()

const HcalDcsMap::Item * HcalDcsMap::findById ( unsigned long  fId) const

Definition at line 90 of file HcalDcsMap.cc.

References mItemsById, and filterCSVwithJSON::target.

Referenced by lookup().

90  {
91  Item target(fId, 0);
92  return HcalObjectAddons::findByT<Item, HcalDcsMapAddons::LessById>(&target, mItemsById);
93 }
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

◆ initialize()

void HcalDcsMap::initialize ( )

Definition at line 169 of file HcalDcsMap.cc.

References sortByDcsId(), and sortById().

Referenced by HcalDcsMap().

169  {
170  sortById();
171  sortByDcsId();
172 }
void sortById()
Definition: HcalDcsMap.cc:164
void sortByDcsId()
Definition: HcalDcsMap.cc:165

◆ lookup() [1/2]

HcalDetId HcalDcsMap::lookup ( HcalDcsDetId  fId) const

Definition at line 100 of file HcalDcsMap.cc.

References HcalDcsDetId::DCSUNKNOWN, findByDcsId(), B2GTnPMonitor_cfi::item, HcalDcsDetId::ring(), HcalDcsDetId::slice(), HcalDcsDetId::subchannel(), and HcalOtherDetId::subdet().

100  {
101  // DCS type is a part of DcsDetId but it does not make sense to keep
102  // duplicate records in the map for DCS channels where only type is different.
103  // Hence, the type in HcalDcsDetId is always forced to DCSUNKNOWN
104  HcalDcsDetId fDcsId_notype(fId.subdet(),
105  fId.ring(), // side is already included
106  fId.slice(),
108  fId.subchannel());
109  auto item = HcalDcsMap::findByDcsId(fDcsId_notype.rawId());
110  return item ? item->mId : 0;
111 }
const Item * findByDcsId(unsigned long fDcsId) const
Definition: HcalDcsMap.cc:95
int slice() const
Definition: HcalDcsDetId.h:56
int ring() const
Definition: HcalDcsDetId.h:55
int subchannel() const
Definition: HcalDcsDetId.h:58
HcalOtherSubdetector subdet() const
get the category

◆ lookup() [2/2]

HcalDcsDetId HcalDcsMap::lookup ( HcalDetId  fId,
HcalDcsDetId::DcsType  type 
) const

Definition at line 113 of file HcalDcsMap.cc.

References findById(), B2GTnPMonitor_cfi::item, and DetId::rawId().

113  {
114  auto item = HcalDcsMap::findById(fId.rawId());
115  HcalDcsDetId _id(item ? item->mId : 0);
116  return HcalDcsDetId(_id.subdet(), _id.zside() * _id.ring(), _id.slice(), type, _id.subchannel());
117 }
const Item * findById(unsigned long fId) const
Definition: HcalDcsMap.cc:90
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

◆ operator=()

HcalDcsMap & HcalDcsMap::operator= ( const HcalDcsMap rhs)

Definition at line 27 of file HcalDcsMap.cc.

References groupFilesInBlocks::temp.

27  {
28  HcalDcsMap temp(rhs);
29  temp.swap(*this);
30  return *this;
31 }

◆ serialize()

template<class Archive >
void HcalDcsMap::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ sortByDcsId()

void HcalDcsMap::sortByDcsId ( )

Definition at line 165 of file HcalDcsMap.cc.

References mItems, and mItemsByDcsId.

Referenced by initialize().

165  {
166  HcalObjectAddons::sortByT<Item, HcalDcsMapAddons::LessByDcsId>(mItems, mItemsByDcsId);
167 }
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124
std::vector< Item > mItems
Definition: HcalDcsMap.h:122

◆ sortById()

void HcalDcsMap::sortById ( )

Definition at line 164 of file HcalDcsMap.cc.

References mItems, and mItemsById.

Referenced by initialize().

164 { HcalObjectAddons::sortByT<Item, HcalDcsMapAddons::LessById>(mItems, mItemsById); }
std::vector< Item > mItems
Definition: HcalDcsMap.h:122
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

◆ swap()

void HcalDcsMap::swap ( HcalDcsMap other)

Definition at line 33 of file HcalDcsMap.cc.

References mItems, mItemsByDcsId, mItemsById, trackingPlots::other, and edm::swap().

33  {
34  std::swap(mItems, other.mItems);
35  std::swap(mItemsById, other.mItemsById);
36  std::swap(mItemsByDcsId, other.mItemsByDcsId);
37 }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
std::vector< const Item * > mItemsByDcsId
Definition: HcalDcsMap.h:124
std::vector< Item > mItems
Definition: HcalDcsMap.h:122
std::vector< const Item * > mItemsById
Definition: HcalDcsMap.h:123

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 126 of file HcalDcsMap.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 126 of file HcalDcsMap.h.

Member Data Documentation

◆ mItems

std::vector<Item> HcalDcsMap::mItems
protected

◆ mItemsByDcsId

std::vector<const Item*> HcalDcsMap::mItemsByDcsId
protected

Definition at line 124 of file HcalDcsMap.h.

Referenced by beginByDcsId(), endByDcsId(), findByDcsId(), sortByDcsId(), and swap().

◆ mItemsById

std::vector<const Item*> HcalDcsMap::mItemsById
protected

Definition at line 123 of file HcalDcsMap.h.

Referenced by beginById(), endById(), findById(), sortById(), and swap().