CMS 3D CMS Logo

CastorElectronicsMap.h
Go to the documentation of this file.
1 #ifndef CastorElectronicsMap_h
2 #define CastorElectronicsMap_h
3 
15 
16 #include <vector>
17 #include <algorithm>
18 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
19 #include <atomic>
20 #endif
21 
28 #include <cstdint>
29 //
31 public:
34 
35  // swap function
37  // copy-ctor
38  CastorElectronicsMap(const CastorElectronicsMap& src); // 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(CastorElectronicsId fId) const;
48 
50  //return Null item if no such mapping
51  const CastorElectronicsId lookup(DetId fId) const;
52 
54  //return Null item if no such mapping
55  const DetId lookupTrigger(CastorElectronicsId fId) const;
56 
58  //return Null item if no such mapping
59  const CastorElectronicsId lookupTrigger(DetId fId) const;
60 
65 
66  std::vector<CastorElectronicsId> allElectronicsId() const;
67  std::vector<CastorElectronicsId> allElectronicsIdPrecision() const;
68  std::vector<CastorElectronicsId> allElectronicsIdTrigger() const;
69  std::vector<HcalGenericDetId> allPrecisionId() const;
70  std::vector<HcalTrigTowerDetId> allTriggerId() const;
71 
72  // map channels
73  bool mapEId2tId(CastorElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
74  bool mapEId2chId(CastorElectronicsId 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) : mId(fId), mElId(fElId) {}
84  uint32_t mId;
85  uint32_t mElId;
86 
88  };
89  class TriggerItem {
90  public:
91  TriggerItem() { mElId = mTrigId = 0; }
92  TriggerItem(uint32_t fTrigId, uint32_t fElId) : mTrigId(fTrigId), mElId(fElId) {}
93  uint32_t mTrigId;
94  uint32_t mElId;
95 
97  };
98 
99 protected:
100  const PrecisionItem* findById(unsigned long fId) const;
101  const PrecisionItem* findPByElId(unsigned long fElId) const;
102  const TriggerItem* findTByElId(unsigned long fElId) const;
103  const TriggerItem* findByTrigId(unsigned long fTrigId) const;
104 
105  std::vector<PrecisionItem> mPItems;
106  std::vector<TriggerItem> mTItems;
107 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
108  mutable std::atomic<std::vector<const PrecisionItem*>*> mPItemsById COND_TRANSIENT;
109  mutable std::atomic<std::vector<const TriggerItem*>*> mTItemsByTrigId COND_TRANSIENT;
110 #else
111  mutable std::vector<const PrecisionItem*>* mPItemsById COND_TRANSIENT;
112  mutable std::vector<const TriggerItem*>* mTItemsByTrigId COND_TRANSIENT;
113 #endif
114 
116 };
117 
118 #endif
std::vector< PrecisionItem > mPItems
const PrecisionItem * findById(unsigned long fId) const
void swap(CastorElectronicsMap &other)
PrecisionItem(uint32_t fId, uint32_t fElId)
const PrecisionItem * findPByElId(unsigned long fElId) const
std::atomic< std::vector< const PrecisionItem * > * > mPItemsById
const DetId lookupTrigger(CastorElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
bool mapEId2tId(CastorElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
std::vector< CastorElectronicsId > allElectronicsId() const
const TriggerItem * findByTrigId(unsigned long fTrigId) const
TriggerItem(uint32_t fTrigId, uint32_t fElId)
const TriggerItem * findTByElId(unsigned long fElId) const
std::vector< CastorElectronicsId > allElectronicsIdPrecision() const
Definition: DetId.h:17
#define COND_TRANSIENT
Definition: Serializable.h:63
std::vector< HcalGenericDetId > allPrecisionId() const
const DetId lookup(CastorElectronicsId fId) const
lookup the logical detid associated with the given electronics id
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::atomic< std::vector< const TriggerItem * > * > mTItemsByTrigId
std::vector< TriggerItem > mTItems
CastorElectronicsMap & operator=(const CastorElectronicsMap &rhs)
bool mapEId2chId(CastorElectronicsId fElectronicsId, DetId fId)
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...
std::vector< HcalTrigTowerDetId > allTriggerId() const
std::vector< CastorElectronicsId > allElectronicsIdTrigger() const