CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
27 namespace HcalElectronicsMapAddons {
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
58  void swap(HcalElectronicsMap& other);
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
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
const TriggerItem * findByTrigId(unsigned long fTrigId) const
const PrecisionItem * findPByElId(unsigned long fElId) const
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
bool equal(const HcalElectronicsMap::TriggerItem *a, const HcalElectronicsMap::TriggerItem *b)
bool good(const HcalElectronicsMap::PrecisionItem &a)
std::vector< PrecisionItem > mPItems
std::vector< HcalElectronicsMap::TriggerItem > mTItems
PrecisionItem(uint32_t fId, uint32_t fElId)
void swap(HcalElectronicsMap &other)
bool equal(const HcalElectronicsMap::PrecisionItem *a, const HcalElectronicsMap::PrecisionItem *b)
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
std::vector< const PrecisionItem * > mPItemsById
const PrecisionItem * findById(unsigned long fId) const
std::vector< TriggerItem > mTItems
std::vector< HcalGenericDetId > allPrecisionId() const
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
std::vector< HcalElectronicsMap::PrecisionItem > mPItems
Definition: DetId.h:17
#define COND_TRANSIENT
Definition: Serializable.h:63
std::vector< HcalElectronicsId > allElectronicsId() const
std::vector< const TriggerItem * > mTItemsByTrigId
bool operator()(const HcalElectronicsMap::TriggerItem *a, const HcalElectronicsMap::TriggerItem *b)
bool operator()(const HcalElectronicsMap::PrecisionItem *a, const HcalElectronicsMap::PrecisionItem *b)
double b
Definition: hdecay.h:118
const TriggerItem * findTByElId(unsigned long fElId) const
HcalElectronicsMap & operator=(const HcalElectronicsMap &rhs)
#define COND_SERIALIZABLE
Definition: Serializable.h:39
TriggerItem(uint32_t fTrigId, uint32_t fElId)
double a
Definition: hdecay.h:119
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Readout chain identification for Hcal.
std::vector< HcalTrigTowerDetId > allTriggerId() const
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool good(const HcalElectronicsMap::TriggerItem &a)