CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalElectronicsMap.h
Go to the documentation of this file.
1 #ifndef HcalElectronicsMap_h
2 #define HcalElectronicsMap_h
3 
13 #include <vector>
14 #include <algorithm>
15 #include <boost/cstdint.hpp>
16 
23 //
25  public:
28 
30  //return Null item if no such mapping
31  const DetId lookup(HcalElectronicsId fId) const;
32 
34  //return Null item if no such mapping
35  const HcalElectronicsId lookup(DetId fId) const;
36 
38  //return Null item if no such mapping
39  const DetId lookupTrigger(HcalElectronicsId fId) const;
40 
42  //return Null item if no such mapping
43  const HcalElectronicsId lookupTrigger(DetId fId) const;
44 
46  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
48  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
49 
50  std::vector <HcalElectronicsId> allElectronicsId () const;
51  std::vector <HcalElectronicsId> allElectronicsIdPrecision() const;
52  std::vector <HcalElectronicsId> allElectronicsIdTrigger() const;
53  std::vector <HcalGenericDetId> allPrecisionId () const;
54  std::vector <HcalTrigTowerDetId> allTriggerId () const;
55 
56  // map channels
57  bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
58  bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId);
59  // sorting
60  void sortById () const;
61  void sortByTriggerId () const;
62  void sort() {}
63 
64  class PrecisionItem {
65  public:
66  PrecisionItem () {mId = mElId = 0;}
67  PrecisionItem (uint32_t fId, uint32_t fElId)
68  : mId (fId), mElId (fElId) {}
69  uint32_t mId;
70  uint32_t mElId;
71  };
72  class TriggerItem {
73  public:
75  TriggerItem (uint32_t fTrigId, uint32_t fElId)
76  : mTrigId (fTrigId), mElId (fElId) { }
77  uint32_t mTrigId;
78  uint32_t mElId;
79  };
80  protected:
81  const PrecisionItem* findById (unsigned long fId) const;
82  const PrecisionItem* findPByElId (unsigned long fElId) const;
83  const TriggerItem* findTByElId (unsigned long fElId) const;
84  const TriggerItem* findByTrigId (unsigned long fTrigId) const;
85 
86  std::vector<PrecisionItem> mPItems;
87  std::vector<TriggerItem> mTItems;
88  mutable std::vector<const PrecisionItem*> mPItemsById;
89  mutable bool sortedByPId;
90  mutable std::vector<const TriggerItem*> mTItemsByTrigId;
91  mutable bool sortedByTId;
92 };
93 
94 #endif
const TriggerItem * findByTrigId(unsigned long fTrigId) const
const PrecisionItem * findPByElId(unsigned long fElId) const
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
std::vector< PrecisionItem > mPItems
PrecisionItem(uint32_t fId, uint32_t fElId)
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
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 mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: DetId.h:20
std::vector< HcalElectronicsId > allElectronicsId() const
std::vector< const TriggerItem * > mTItemsByTrigId
const TriggerItem * findTByElId(unsigned long fElId) const
TriggerItem(uint32_t fTrigId, uint32_t fElId)
void sortByTriggerId() const
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
std::vector< HcalTrigTowerDetId > allTriggerId() const
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id