CMS 3D CMS Logo

HcalElectronicsMap.h
Go to the documentation of this file.
1 #ifndef HcalElectronicsMap_h
2 #define HcalElectronicsMap_h
3 
14 
15 #include <vector>
16 #include <algorithm>
17 
24 #include <cstdint>
25 
26 //forward declaration
28  class Helper;
29 }
30 
32 public:
33  class PrecisionItem {
34  public:
35  PrecisionItem() { mId = mElId = 0; }
36  PrecisionItem(uint32_t fId, uint32_t fElId) : mId(fId), mElId(fElId) {}
37  uint32_t mId;
38  uint32_t mElId;
39 
41  };
42 
43  class TriggerItem {
44  public:
45  TriggerItem() { mElId = mTrigId = 0; }
46  TriggerItem(uint32_t fTrigId, uint32_t fElId) : mTrigId(fTrigId), mElId(fElId) {}
47  uint32_t mTrigId;
48  uint32_t mElId;
49 
51  };
52 
56 
57  // swap function
59  // copy-ctor
61  // copy assignment operator
63  // move constructor
64 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
66 #endif
67 
69  //return Null item if no such mapping
70  const DetId lookup(HcalElectronicsId fId) const;
71 
73  //return Null item if no such mapping
74  const HcalElectronicsId lookup(DetId fId) const;
75 
77  //return Null item if no such mapping
78  const DetId lookupTrigger(HcalElectronicsId fId) const;
79 
81  //return Null item if no such mapping
82  const HcalElectronicsId lookupTrigger(DetId fId) const;
83 
85  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
87  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
88 
89  std::vector<HcalElectronicsId> allElectronicsId() const;
90  std::vector<HcalElectronicsId> allElectronicsIdPrecision() const;
91  std::vector<HcalElectronicsId> allElectronicsIdTrigger() const;
92  std::vector<HcalGenericDetId> allPrecisionId() const;
93  std::vector<HcalTrigTowerDetId> allTriggerId() const;
94 
95  void initialize();
96 
97 protected:
98  const PrecisionItem* findById(unsigned long fId) const;
99  const PrecisionItem* findPByElId(unsigned long fElId) const;
100  const TriggerItem* findTByElId(unsigned long fElId) const;
101  const TriggerItem* findByTrigId(unsigned long fTrigId) const;
102 
103  std::vector<PrecisionItem> mPItems;
104  std::vector<TriggerItem> mTItems;
105  std::vector<const PrecisionItem*> mPItemsById COND_TRANSIENT;
106  std::vector<const TriggerItem*> mTItemsByTrigId COND_TRANSIENT;
107 
108 private:
109  // sorting
110  void sortById();
111  void sortByTriggerId();
112 
114 };
115 
116 namespace HcalElectronicsMapAddons {
117  class LessById {
118  public:
120  return a->mId < b->mId;
121  }
123  return a->mId == b->mId;
124  }
125  bool good(const HcalElectronicsMap::PrecisionItem& a) { return a.mId; }
126  };
127  class LessByTrigId {
128  public:
130  return a->mTrigId < b->mTrigId;
131  }
133  return a->mTrigId == b->mTrigId;
134  }
135  bool good(const HcalElectronicsMap::TriggerItem& a) { return a.mTrigId; }
136  };
137  class Helper {
138  public:
139  Helper();
140  // map channels
141  bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
142  bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId);
143 
144  std::vector<HcalElectronicsMap::PrecisionItem> mPItems;
145  std::vector<HcalElectronicsMap::TriggerItem> mTItems;
146  };
147 } // namespace HcalElectronicsMapAddons
148 
149 #endif
HcalElectronicsMapAddons::LessByTrigId::equal
bool equal(const HcalElectronicsMap::TriggerItem *a, const HcalElectronicsMap::TriggerItem *b)
Definition: HcalElectronicsMap.h:132
HcalElectronicsMap::allElectronicsId
std::vector< HcalElectronicsId > allElectronicsId() const
Definition: HcalElectronicsMap.cc:110
HcalGenericDetId
Definition: HcalGenericDetId.h:15
HcalElectronicsMap::findById
const PrecisionItem * findById(unsigned long fId) const
Definition: HcalElectronicsMap.cc:42
HcalElectronicsMapAddons::LessById::operator()
bool operator()(const HcalElectronicsMap::PrecisionItem *a, const HcalElectronicsMap::PrecisionItem *b)
Definition: HcalElectronicsMap.h:119
HcalElectronicsMapAddons::LessByTrigId
Definition: HcalElectronicsMap.h:127
HcalElectronicsMap::findByTrigId
const TriggerItem * findByTrigId(unsigned long fTrigId) const
Definition: HcalElectronicsMap.cc:65
HcalElectronicsMap::mTItemsByTrigId
std::vector< const TriggerItem * > mTItemsByTrigId
Definition: HcalElectronicsMap.h:106
HcalElectronicsMap::HcalElectronicsMap
HcalElectronicsMap()
Definition: HcalElectronicsMap.h:53
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
COND_TRANSIENT
#define COND_TRANSIENT
Definition: Serializable.h:63
HcalGenericDetId.h
HcalElectronicsMapAddons
Definition: HcalElectronicsMap.h:27
HcalElectronicsMapAddons::Helper::mapEId2tId
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
Definition: HcalElectronicsMap.cc:166
HcalElectronicsMap::findTByElId
const TriggerItem * findTByElId(unsigned long fElId) const
Definition: HcalElectronicsMap.cc:56
HcalElectronicsMap::TriggerItem::mElId
uint32_t mElId
Definition: HcalElectronicsMap.h:48
HcalElectronicsMap::~HcalElectronicsMap
~HcalElectronicsMap()
Definition: HcalElectronicsMap.cc:22
HcalElectronicsMap::operator=
HcalElectronicsMap & operator=(const HcalElectronicsMap &rhs)
Definition: HcalElectronicsMap.cc:27
HcalElectronicsMap::PrecisionItem::PrecisionItem
PrecisionItem(uint32_t fId, uint32_t fElId)
Definition: HcalElectronicsMap.h:36
HcalElectronicsMap::PrecisionItem::mElId
uint32_t mElId
Definition: HcalElectronicsMap.h:38
HcalElectronicsMap::lookupTrigger
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:80
HcalElectronicsMap::findPByElId
const PrecisionItem * findPByElId(unsigned long fElId) const
Definition: HcalElectronicsMap.cc:47
HcalElectronicsMap::allPrecisionId
std::vector< HcalGenericDetId > allPrecisionId() const
Definition: HcalElectronicsMap.cc:139
DetId
Definition: DetId.h:17
HcalElectronicsMap::allTriggerId
std::vector< HcalTrigTowerDetId > allTriggerId() const
Definition: HcalElectronicsMap.cc:151
HcalElectronicsMapAddons::Helper::Helper
Helper()
Definition: HcalElectronicsMap.cc:163
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalCalibDetId.h
trackingPlots.other
other
Definition: trackingPlots.py:1465
HcalElectronicsMap::allElectronicsIdTrigger
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
Definition: HcalElectronicsMap.cc:130
b
double b
Definition: hdecay.h:118
HcalElectronicsMapAddons::Helper::mTItems
std::vector< HcalElectronicsMap::TriggerItem > mTItems
Definition: HcalElectronicsMap.h:145
HcalTrigTowerDetId.h
HcalElectronicsMapAddons::LessById::equal
bool equal(const HcalElectronicsMap::PrecisionItem *a, const HcalElectronicsMap::PrecisionItem *b)
Definition: HcalElectronicsMap.h:122
a
double a
Definition: hdecay.h:119
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
HcalElectronicsMap::PrecisionItem::PrecisionItem
PrecisionItem()
Definition: HcalElectronicsMap.h:35
HcalDetId.h
helper
Definition: helper.py:1
Serializable.h
HcalElectronicsMap::sortByTriggerId
void sortByTriggerId()
Definition: HcalElectronicsMap.cc:202
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalElectronicsMapAddons::LessByTrigId::operator()
bool operator()(const HcalElectronicsMap::TriggerItem *a, const HcalElectronicsMap::TriggerItem *b)
Definition: HcalElectronicsMap.h:129
HcalElectronicsMap::TriggerItem
Definition: HcalElectronicsMap.h:43
HcalElectronicsMap::mTItems
std::vector< TriggerItem > mTItems
Definition: HcalElectronicsMap.h:104
HcalElectronicsMap::allElectronicsIdPrecision
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
Definition: HcalElectronicsMap.cc:122
HcalElectronicsId.h
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
HcalElectronicsMapAddons::LessById::good
bool good(const HcalElectronicsMap::PrecisionItem &a)
Definition: HcalElectronicsMap.h:125
HcalElectronicsMap::lookup
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:70
HcalElectronicsMap::swap
void swap(HcalElectronicsMap &other)
Definition: HcalElectronicsMap.cc:33
HcalElectronicsMap::sortById
void sortById()
Definition: HcalElectronicsMap.cc:198
DetId.h
HcalElectronicsMapAddons::Helper
Definition: HcalElectronicsMap.h:137
HcalElectronicsMapAddons::Helper::mapEId2chId
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: HcalElectronicsMap.cc:182
HcalElectronicsMap::mPItemsById
std::vector< const PrecisionItem * > mPItemsById
Definition: HcalElectronicsMap.h:105
HcalElectronicsMapAddons::Helper::mPItems
std::vector< HcalElectronicsMap::PrecisionItem > mPItems
Definition: HcalElectronicsMap.h:144
HcalElectronicsMap::initialize
void initialize()
Definition: HcalElectronicsMap.cc:206
HcalElectronicsMap::PrecisionItem
Definition: HcalElectronicsMap.h:33
HcalElectronicsMap::TriggerItem::mTrigId
uint32_t mTrigId
Definition: HcalElectronicsMap.h:47
HcalElectronicsMap::PrecisionItem::mId
uint32_t mId
Definition: HcalElectronicsMap.h:37
HcalElectronicsMapAddons::LessById
Definition: HcalElectronicsMap.h:117
HcalElectronicsMap::mPItems
std::vector< PrecisionItem > mPItems
Definition: HcalElectronicsMap.h:103
HcalElectronicsMap::TriggerItem::TriggerItem
TriggerItem()
Definition: HcalElectronicsMap.h:45
HcalElectronicsMap::TriggerItem::TriggerItem
TriggerItem(uint32_t fTrigId, uint32_t fElId)
Definition: HcalElectronicsMap.h:46
HcalElectronicsMapAddons::LessByTrigId::good
bool good(const HcalElectronicsMap::TriggerItem &a)
Definition: HcalElectronicsMap.h:135
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14