CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorElectronicsMap.h
Go to the documentation of this file.
1 #ifndef CastorElectronicsMap_h
2 #define CastorElectronicsMap_h
3 
14 #include <vector>
15 #include <algorithm>
16 #include <boost/cstdint.hpp>
17 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
18 #include <atomic>
19 #endif
20 
27 //
29  public:
32 
33  // swap function
34  void swap(CastorElectronicsMap& other);
35  // copy-ctor
36  CastorElectronicsMap(const CastorElectronicsMap& src); // 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(CastorElectronicsId fId) const;
46 
48  //return Null item if no such mapping
49  const CastorElectronicsId lookup(DetId fId) const;
50 
52  //return Null item if no such mapping
53  const DetId lookupTrigger(CastorElectronicsId fId) const;
54 
56  //return Null item if no such mapping
57  const CastorElectronicsId lookupTrigger(DetId fId) const;
58 
60  bool lookup(const CastorElectronicsId pId, CastorElectronicsId& eid, HcalGenericDetId& did) const;
62  bool lookup(const CastorElectronicsId pId, CastorElectronicsId& eid, HcalTrigTowerDetId& did) const;
63 
64  std::vector <CastorElectronicsId> allElectronicsId () const;
65  std::vector <CastorElectronicsId> allElectronicsIdPrecision() const;
66  std::vector <CastorElectronicsId> allElectronicsIdTrigger() const;
67  std::vector <HcalGenericDetId> allPrecisionId () const;
68  std::vector <HcalTrigTowerDetId> allTriggerId () const;
69 
70  // map channels
71  bool mapEId2tId (CastorElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId);
72  bool mapEId2chId (CastorElectronicsId 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
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
std::vector< HcalGenericDetId > allPrecisionId() const
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] ...