CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalFrontEndMap.h
Go to the documentation of this file.
1 #ifndef HcalFrontEndMap_h
2 #define HcalFrontEndMap_h
3 
5 
6 #include <set>
7 #include <vector>
8 #include <algorithm>
9 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
10 #include <atomic>
11 #endif
12 
16 #include <cstdint>
17 
18 //forward declaration
19 namespace HcalFrontEndMapAddons {
20  class Helper;
21 }
22 
24 public:
25  class PrecisionItem {
26  public:
28  mId = mRM = 0;
29  mRBX = "";
30  }
31  PrecisionItem(uint32_t fId, int fRM, std::string fRBX) : mId(fId), mRM(fRM), mRBX(fRBX) {}
32  uint32_t mId;
33  int mRM;
35 
37  };
38 
42 
43  // swap function
44  void swap(HcalFrontEndMap& other);
45  // copy-ctor
47  // copy assignment operator
49  // move constructor
50 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
52 #endif
53 
55  //return Null item if no such mapping
56  const int lookupRM(DetId fId) const;
57  const int lookupRMIndex(DetId fId) const;
58  const int maxRMIndex() const { return HcalFrontEndId::maxRmIndex; }
59 
61  //return Null item if no such mapping
62  const std::string lookupRBX(DetId fId) const;
63  const int lookupRBXIndex(DetId fId) const;
64 
65  std::vector<DetId> allDetIds() const;
66  std::vector<int> allRMs() const;
67  std::vector<std::string> allRBXs() const;
68 
69  const PrecisionItem* findById(uint32_t fId) const;
70 
71  // sorting
72  void sortById();
73  void initialize();
74 
75 protected:
76  std::vector<PrecisionItem> mPItems;
77  std::vector<const PrecisionItem*> mPItemsById COND_TRANSIENT;
78 
80 };
81 
82 namespace HcalFrontEndMapAddons {
83  class LessById {
84  public:
86  return a->mId < b->mId;
87  }
89  return a.mId < b.mId;
90  }
92  return a->mId == b->mId;
93  }
94  bool good(const HcalFrontEndMap::PrecisionItem& a) const { return a.mId; }
95  };
96  class Helper {
97  public:
98  Helper();
100  bool loadObject(DetId fId, int rm, std::string rbx);
101 
102  std::set<HcalFrontEndMap::PrecisionItem, LessById> mPItems;
103  };
104 } // namespace HcalFrontEndMapAddons
105 
106 #endif
std::vector< std::string > allRBXs() const
bool equal(const HcalFrontEndMap::PrecisionItem *a, const HcalFrontEndMap::PrecisionItem *b) const
std::vector< const PrecisionItem * > mPItemsById
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
PrecisionItem(uint32_t fId, int fRM, std::string fRBX)
HcalFrontEndMap & operator=(const HcalFrontEndMap &rhs)
std::set< HcalFrontEndMap::PrecisionItem, LessById > mPItems
const int lookupRMIndex(DetId fId) const
bool operator()(const HcalFrontEndMap::PrecisionItem &a, const HcalFrontEndMap::PrecisionItem &b) const
bool operator()(const HcalFrontEndMap::PrecisionItem *a, const HcalFrontEndMap::PrecisionItem *b) const
bool good(const HcalFrontEndMap::PrecisionItem &a) const
const int lookupRBXIndex(DetId fId) const
std::vector< DetId > allDetIds() const
static const int maxRmIndex
void swap(HcalFrontEndMap &other)
const PrecisionItem * findById(uint32_t fId) const
Definition: DetId.h:17
#define COND_TRANSIENT
Definition: Serializable.h:63
const int lookupRM(DetId fId) const
brief lookup the RM associated with the given logical id
double b
Definition: hdecay.h:118
#define COND_SERIALIZABLE
Definition: Serializable.h:39
double a
Definition: hdecay.h:119
std::vector< int > allRMs() const
def rm
Definition: eostools.py:363
const int maxRMIndex() const
const std::string lookupRBX(DetId fId) const
brief lookup the RBX associated with the given logical id
std::vector< PrecisionItem > mPItems