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 #include <boost/cstdint.hpp>
18 
25 
26 //forward declaration
28  class Helper;
29 }
30 
32  public:
33 
34  class PrecisionItem {
35  public:
36  PrecisionItem () {mId = mElId = 0;}
37  PrecisionItem (uint32_t fId, uint32_t fElId)
38  : mId (fId), mElId (fElId) {}
39  uint32_t mId;
40  uint32_t mElId;
41 
43  };
44 
45  class TriggerItem {
46  public:
47  TriggerItem () {mElId = mTrigId = 0;}
48  TriggerItem (uint32_t fTrigId, uint32_t fElId)
49  : mTrigId (fTrigId), mElId (fElId) { }
50  uint32_t mTrigId;
51  uint32_t mElId;
52 
54  };
55 
59 
60  // swap function
62  // copy-ctor
64  // copy assignment operator
65  HcalElectronicsMap& operator=(const HcalElectronicsMap& rhs);
66  // move constructor
67 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
69 #endif
70 
72  //return Null item if no such mapping
73  const DetId lookup(HcalElectronicsId fId) const;
74 
76  //return Null item if no such mapping
77  const HcalElectronicsId lookup(DetId fId) const;
78 
80  //return Null item if no such mapping
81  const DetId lookupTrigger(HcalElectronicsId fId) const;
82 
84  //return Null item if no such mapping
85  const HcalElectronicsId lookupTrigger(DetId fId) const;
86 
88  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
90  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
91 
92  std::vector <HcalElectronicsId> allElectronicsId () const;
93  std::vector <HcalElectronicsId> allElectronicsIdPrecision() const;
94  std::vector <HcalElectronicsId> allElectronicsIdTrigger() const;
95  std::vector <HcalGenericDetId> allPrecisionId () const;
96  std::vector <HcalTrigTowerDetId> allTriggerId () const;
97 
98  void initialize();
99 
100  protected:
101  const PrecisionItem* findById (unsigned long fId) const;
102  const PrecisionItem* findPByElId (unsigned long fElId) const;
103  const TriggerItem* findTByElId (unsigned long fElId) const;
104  const TriggerItem* findByTrigId (unsigned long fTrigId) const;
105 
106  std::vector<PrecisionItem> mPItems;
107  std::vector<TriggerItem> mTItems;
108  std::vector<const PrecisionItem*> mPItemsById COND_TRANSIENT;
109  std::vector<const TriggerItem*> mTItemsByTrigId COND_TRANSIENT;
110 
111  private:
112  // sorting
113  void sortById ();
114  void sortByTriggerId ();
115 
117 };
118 
119 namespace HcalElectronicsMapAddons {
120  class LessById {
121  public:
122  bool operator () (const HcalElectronicsMap::PrecisionItem* a, const HcalElectronicsMap::PrecisionItem* b) {return a->mId < b->mId;}
124  bool good (const HcalElectronicsMap::PrecisionItem& a) {return a.mId;}
125  };
126  class LessByTrigId {
127  public:
128  bool operator () (const HcalElectronicsMap::TriggerItem* a, const HcalElectronicsMap::TriggerItem* b) {return a->mTrigId < b->mTrigId;}
130  bool good (const HcalElectronicsMap::TriggerItem& a) {return a.mTrigId;}
131  };
132  class Helper {
133  public:
134  Helper();
135  // map channels
136  bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
137  bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId);
138 
139  std::vector<HcalElectronicsMap::PrecisionItem> mPItems;
140  std::vector<HcalElectronicsMap::TriggerItem> mTItems;
141  };
142 }
143 
144 
145 #endif
static AlgebraicMatrix initialize()
Definition: helper.py:1
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(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
bool equal(const HcalElectronicsMap::PrecisionItem *a, const HcalElectronicsMap::PrecisionItem *b)
std::vector< TriggerItem > mTItems
std::vector< HcalElectronicsMap::PrecisionItem > mPItems
Definition: DetId.h:18
#define COND_TRANSIENT
Definition: Serializable.h:61
double b
Definition: hdecay.h:120
#define COND_SERIALIZABLE
Definition: Serializable.h:38
TriggerItem(uint32_t fTrigId, uint32_t fElId)
double a
Definition: hdecay.h:121
Readout chain identification for Hcal.
bool good(const HcalElectronicsMap::TriggerItem &a)