CMS 3D CMS Logo

HcalSiPMCharacteristics.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <iostream>
3 #include <set>
4 
8 
10  mPItems(helper.mPItems.begin(),helper.mPItems.end())
11 {
12  initialize();
13 }
14 
16 }
17 
18 // copy-ctor
21 
22 // copy assignment operator
25  temp.swap(*this);
26  return *this;
27 }
28 
29 // public swap function
31  std::swap(mPItems, other.mPItems);
33 }
34 
35 // move constructor
37  other.swap(*this);
38 }
39 
41  PrecisionItem target(type, 0, 0, 0, 0, 0, 0, 0);
42  return HcalObjectAddons::findByT<PrecisionItem,HcalSiPMCharacteristicsAddons::LessByType>(&target,mPItemsByType);
43 }
44 
46 
47 bool HcalSiPMCharacteristicsAddons::Helper::loadObject(int type, int pixels, float parLin1,
48  float parLin2, float parLin3,
49  float crossTalk, int auxi1,
50  float auxi2) {
52  parLin2,parLin3,crossTalk,
53  auxi1,auxi2);
54  auto iter = mPItems.find(target);
55  if (iter!=mPItems.end()) {
56  edm::LogWarning("HCAL") << "HcalSiPMCharacteristics::loadObject type "
57  << type << " already exists with pixels "
58  << iter->pixels_ << " NoLinearity parameters "
59  << iter->parLin1_ << ":" << iter->parLin2_ << ":"
60  << iter->parLin3_ << " CrossTalk parameter "
61  << iter->crossTalk_ << " new values " << pixels
62  << ", " << parLin1 << ", " << parLin2 << ", "
63  << parLin3 << ", " << crossTalk << ", " << auxi1
64  << " and " << auxi2 << " are ignored";
65  return false;
66  } else {
67  mPItems.insert(target);
68  return true;
69  }
70 }
71 
74  return (item ? item->pixels_ : 0);
75 }
76 
77 std::vector<float> HcalSiPMCharacteristics::getNonLinearities(int type) const {
79  std::vector<float> pars;
80  if (item) {
81  pars.push_back(item->parLin1_);
82  pars.push_back(item->parLin2_);
83  pars.push_back(item->parLin3_);
84  }
85  return pars;
86 }
87 
89  const PrecisionItem* item = findByType(type);
90  return (item ? item->crossTalk_ : 0);
91 }
92 
95  return (item ? item->auxi1_ : 0);
96 }
97 
100  return (item ? item->auxi2_ : 0);
101 }
102 
104  HcalObjectAddons::sortByT<PrecisionItem,HcalSiPMCharacteristicsAddons::LessByType>(mPItems,mPItemsByType);
105 }
106 
109 }
type
Definition: HCALResponse.h:21
Definition: helper.py:1
void swap(HcalSiPMCharacteristics &other)
float getCrossTalk(int type) const
get cross talk
HcalSiPMCharacteristics & operator=(const HcalSiPMCharacteristics &rhs)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const PrecisionItem * findByType(int type) const
#define end
Definition: vmac.h:39
int getAuxi1(int type) const
get auxiliary words
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 begin
Definition: vmac.h:32
float getAuxi2(int type) const
std::vector< const PrecisionItem * > mPItemsByType
int getPixels(int type) const
get # of pixels
std::vector< PrecisionItem > mPItems