CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalSiPMCharacteristics.h
Go to the documentation of this file.
1 #ifndef CondFormatsHcalObjectsHcalSiPMCharacteristics_h
2 #define CondFormatsHcalObjectsHcalSiPMCharacteristics_h
3 
5 
6 #include <vector>
7 #include <set>
8 #include <algorithm>
9 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
10 #include <atomic>
11 #endif
12 
13 //forward declarations
14 namespace HcalSiPMCharacteristicsAddons {
15  class Helper;
16 }
17 
19 public:
20  class PrecisionItem {
21  public:
23  type_ = auxi1_ = pixels_ = 0;
25  }
27  int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1, float auxi2)
28  : type_(type),
29  pixels_(pixels),
30  parLin1_(parLin1),
31  parLin2_(parLin2),
32  parLin3_(parLin3),
33  crossTalk_(crossTalk),
34  auxi1_(auxi1),
35  auxi2_(auxi2) {}
36 
37  int type_;
38  int pixels_;
39  float parLin1_;
40  float parLin2_;
41  float parLin3_;
42  float crossTalk_;
43  int auxi1_;
44  float auxi2_;
45 
47  };
48 
52 
53  // swap function
54  void swap(HcalSiPMCharacteristics& other);
55  // copy-ctor
57  // copy assignment operator
59  // move constructor
60 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
62 #endif
63 
65  unsigned int getTypes() const { return mPItems.size(); }
66  int getType(unsigned int k) const { return mPItems[k].type_; }
68  int getPixels(int type) const;
70  std::vector<float> getNonLinearities(int type) const;
72  float getCrossTalk(int type) const;
74  int getAuxi1(int type) const;
75  float getAuxi2(int type) const;
76 
77  const PrecisionItem* findByType(int type) const;
78 
79  // sorting
80  void sortByType();
81  void initialize();
82 
83 protected:
84  std::vector<PrecisionItem> mPItems;
85  std::vector<const PrecisionItem*> mPItemsByType COND_TRANSIENT;
86 
88 };
89 
90 namespace HcalSiPMCharacteristicsAddons {
91  class LessByType {
92  public:
95  return a->type_ < b->type_;
96  }
99  return a.type_ < b.type_;
100  }
102  return a->type_ == b->type_;
103  }
104  bool good(const HcalSiPMCharacteristics::PrecisionItem& a) const { return a.type_; }
105  };
106  class Helper {
107  public:
108  Helper();
109  // Load a new entry
110  bool loadObject(int type,
111  int pixels,
112  float parLin1,
113  float parLin2,
114  float parLin3,
115  float crossTalk,
116  int auxi1 = 0,
117  float auxi2 = 0);
118 
119  std::set<HcalSiPMCharacteristics::PrecisionItem, LessByType> mPItems;
120  };
121 } // namespace HcalSiPMCharacteristicsAddons
122 
123 #endif
PrecisionItem(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1, float auxi2)
bool equal(const HcalSiPMCharacteristics::PrecisionItem *a, const HcalSiPMCharacteristics::PrecisionItem *b) const
bool operator()(const HcalSiPMCharacteristics::PrecisionItem *a, const HcalSiPMCharacteristics::PrecisionItem *b) const
void swap(HcalSiPMCharacteristics &other)
float getCrossTalk(int type) const
get cross talk
HcalSiPMCharacteristics & operator=(const HcalSiPMCharacteristics &rhs)
bool good(const HcalSiPMCharacteristics::PrecisionItem &a) const
const PrecisionItem * findByType(int type) const
unsigned int getTypes() const
get # of types
bool operator()(const HcalSiPMCharacteristics::PrecisionItem &a, const HcalSiPMCharacteristics::PrecisionItem &b) const
#define COND_TRANSIENT
Definition: Serializable.h:63
int getAuxi1(int type) const
get auxiliary words
int getType(unsigned int k) const
double b
Definition: hdecay.h:118
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
std::vector< float > getNonLinearities(int type) const
get nonlinearity constants
#define COND_SERIALIZABLE
Definition: Serializable.h:39
double a
Definition: hdecay.h:119
float getAuxi2(int type) const
std::set< HcalSiPMCharacteristics::PrecisionItem, LessByType > mPItems
std::vector< const PrecisionItem * > mPItemsByType
int getPixels(int type) const
get # of pixels
std::vector< PrecisionItem > mPItems