CMS 3D CMS Logo

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
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
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 
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
Definition: helper.py:1
int getAuxi1(int type) const
get auxiliary words
PrecisionItem(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1, float auxi2)
const PrecisionItem * findByType(int type) const
std::vector< float > getNonLinearities(int type) const
get nonlinearity constants
bool good(const HcalSiPMCharacteristics::PrecisionItem &a) const
float getAuxi2(int type) const
bool equal(const HcalSiPMCharacteristics::PrecisionItem *a, const HcalSiPMCharacteristics::PrecisionItem *b) const
void swap(HcalSiPMCharacteristics &other)
HcalSiPMCharacteristics & operator=(const HcalSiPMCharacteristics &rhs)
float getCrossTalk(int type) const
get cross talk
bool operator()(const HcalSiPMCharacteristics::PrecisionItem &a, const HcalSiPMCharacteristics::PrecisionItem &b) const
bool operator()(const HcalSiPMCharacteristics::PrecisionItem *a, const HcalSiPMCharacteristics::PrecisionItem *b) const
int getType(unsigned int k) const
#define COND_TRANSIENT
Definition: Serializable.h:63
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)
#define COND_SERIALIZABLE
Definition: Serializable.h:39
int getPixels(int type) const
get # of pixels
double a
Definition: hdecay.h:119
std::set< HcalSiPMCharacteristics::PrecisionItem, LessByType > mPItems
std::vector< const PrecisionItem * > mPItemsByType
unsigned int getTypes() const
get # of types
std::vector< PrecisionItem > mPItems