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 #include <boost/cstdint.hpp>
19 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
20 #include <atomic>
21 #endif
22 
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 
64  bool lookup(const CastorElectronicsId pId, CastorElectronicsId& eid, HcalTrigTowerDetId& did) const;
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)
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
std::vector< PrecisionItem > mPItems
const DetId lookupTrigger(CastorElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
std::vector< CastorElectronicsId > allElectronicsIdTrigger() const
std::vector< CastorElectronicsId > allElectronicsIdPrecision() const
void swap(CastorElectronicsMap &other)
PrecisionItem(uint32_t fId, uint32_t fElId)
std::atomic< std::vector< const PrecisionItem * > * > mPItemsById
bool mapEId2tId(CastorElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
const PrecisionItem * findById(unsigned long fId) const
const DetId lookup(CastorElectronicsId fId) const
lookup the logical detid associated with the given electronics id
const TriggerItem * findTByElId(unsigned long fElId) const
std::vector< HcalTrigTowerDetId > allTriggerId() const
TriggerItem(uint32_t fTrigId, uint32_t fElId)
const PrecisionItem * findPByElId(unsigned long fElId) const
const TriggerItem * findByTrigId(unsigned long fTrigId) const
Definition: DetId.h:18
#define COND_TRANSIENT
Definition: Serializable.h:61
std::vector< HcalGenericDetId > allPrecisionId() const
#define COND_SERIALIZABLE
Definition: Serializable.h:38
std::vector< CastorElectronicsId > allElectronicsId() const
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] ...