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 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
19 #include <atomic>
20 #endif
21 
28 //
30  public:
33 
34  // swap function
36  // copy-ctor
38  // copy assignment operator
40  // move constructor
41 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
43 #endif
44 
46  //return Null item if no such mapping
47  const DetId lookup(HcalElectronicsId fId) const;
48 
50  //return Null item if no such mapping
51  const HcalElectronicsId lookup(DetId fId) const;
52 
54  //return Null item if no such mapping
55  const DetId lookupTrigger(HcalElectronicsId fId) const;
56 
58  //return Null item if no such mapping
59  const HcalElectronicsId lookupTrigger(DetId fId) const;
60 
62  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalGenericDetId& did) const;
64  bool lookup(const HcalElectronicsId pId, HcalElectronicsId& eid, HcalTrigTowerDetId& did) const;
65 
66  std::vector <HcalElectronicsId> allElectronicsId () const;
67  std::vector <HcalElectronicsId> allElectronicsIdPrecision() const;
68  std::vector <HcalElectronicsId> allElectronicsIdTrigger() const;
69  std::vector <HcalGenericDetId> allPrecisionId () const;
70  std::vector <HcalTrigTowerDetId> allTriggerId () const;
71 
72  // map channels
73  bool mapEId2tId (HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
74  bool mapEId2chId (HcalElectronicsId fElectronicsId, DetId fId);
75  // sorting
76  void sortById () const;
77  void sortByTriggerId () const;
78  void sort() {}
79 
80  class PrecisionItem {
81  public:
82  PrecisionItem () {mId = mElId = 0;}
83  PrecisionItem (uint32_t fId, uint32_t fElId)
84  : mId (fId), mElId (fElId) {}
85  uint32_t mId;
86  uint32_t mElId;
87 
89 };
90  class TriggerItem {
91  public:
92  TriggerItem () {mElId = mTrigId = 0;}
93  TriggerItem (uint32_t fTrigId, uint32_t fElId)
94  : mTrigId (fTrigId), mElId (fElId) { }
95  uint32_t mTrigId;
96  uint32_t mElId;
97 
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 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
109  mutable std::atomic<std::vector<const PrecisionItem*>*> mPItemsById COND_TRANSIENT;
110  mutable std::atomic<std::vector<const TriggerItem*>*> mTItemsByTrigId COND_TRANSIENT;
111 #else
112  mutable std::vector<const PrecisionItem*>* mPItemsById COND_TRANSIENT;
113  mutable std::vector<const TriggerItem*>* mTItemsByTrigId COND_TRANSIENT;
114 #endif
115 
117 };
118 
119 #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
#define COND_TRANSIENT
Definition: Serializable.h:61
std::vector< HcalElectronicsId > allElectronicsId() const
const TriggerItem * findTByElId(unsigned long fElId) const
HcalElectronicsMap & operator=(const HcalElectronicsMap &rhs)
#define COND_SERIALIZABLE
Definition: Serializable.h:38
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.
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