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 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
17 #include <atomic>
18 #endif
19 
26 //
28  public:
31 
32  // swap function
33  void swap(HcalElectronicsMap& other);
34  // copy-ctor
36  // copy assignment operator
38  // move constructor
39 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
41 #endif
42 
44  //return Null item if no such mapping
45  const DetId lookup(HcalElectronicsId fId) const;
46 
48  //return Null item if no such mapping
49  const HcalElectronicsId lookup(DetId fId) const;
50 
52  //return Null item if no such mapping
53  const DetId lookupTrigger(HcalElectronicsId fId) const;
54 
56  //return Null item if no such mapping
57  const HcalElectronicsId lookupTrigger(DetId fId) const;
58 
60  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
62  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
63 
64  std::vector <HcalElectronicsId> allElectronicsId () const;
65  std::vector <HcalElectronicsId> allElectronicsIdPrecision() const;
66  std::vector <HcalElectronicsId> allElectronicsIdTrigger() const;
67  std::vector <HcalGenericDetId> allPrecisionId () const;
68  std::vector <HcalTrigTowerDetId> allTriggerId () const;
69 
70  // map channels
71  bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
72  bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId);
73  // sorting
74  void sortById () const;
75  void sortByTriggerId () const;
76  void sort() {}
77 
78  class PrecisionItem {
79  public:
80  PrecisionItem () {mId = mElId = 0;}
81  PrecisionItem (uint32_t fId, uint32_t fElId)
82  : mId (fId), mElId (fElId) {}
83  uint32_t mId;
84  uint32_t mElId;
85  };
86  class TriggerItem {
87  public:
89  TriggerItem (uint32_t fTrigId, uint32_t fElId)
90  : mTrigId (fTrigId), mElId (fElId) { }
91  uint32_t mTrigId;
92  uint32_t mElId;
93  };
94  protected:
95  const PrecisionItem* findById (unsigned long fId) const;
96  const PrecisionItem* findPByElId (unsigned long fElId) const;
97  const TriggerItem* findTByElId (unsigned long fElId) const;
98  const TriggerItem* findByTrigId (unsigned long fTrigId) const;
99 
100  std::vector<PrecisionItem> mPItems;
101  std::vector<TriggerItem> mTItems;
102 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
103  mutable std::atomic<std::vector<const PrecisionItem*>*> mPItemsById;
104  mutable std::atomic<std::vector<const TriggerItem*>*> mTItemsByTrigId;
105 #else
106  mutable std::vector<const PrecisionItem*>* mPItemsById;
107  mutable std::vector<const TriggerItem*>* mTItemsByTrigId;
108 #endif
109 };
110 
111 #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)
void swap(HcalElectronicsMap &other)
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
const PrecisionItem * findById(unsigned long fId) const
std::atomic< std::vector< const PrecisionItem * > * > mPItemsById
std::vector< TriggerItem > mTItems
std::vector< HcalGenericDetId > allPrecisionId() const
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: DetId.h:18
std::vector< HcalElectronicsId > allElectronicsId() const
const TriggerItem * findTByElId(unsigned long fElId) const
HcalElectronicsMap & operator=(const HcalElectronicsMap &rhs)
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
std::atomic< std::vector< const TriggerItem * > * > mTItemsByTrigId