test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalPedestalWidth.cc
Go to the documentation of this file.
1 
10 #include <math.h>
11 #include <iostream>
12 
14 
15 namespace {
16  int offset (int fCapId1, int fCapId2) {
17  // static int offsets [4] = {0, 1, 3, 6};
18  // if (fCapId1 < fCapId2) { // swap
19  // int tmp = fCapId1; fCapId1 = fCapId2; fCapId2 = tmp;
20  // }
21  // return offsets [fCapId1] + fCapId2;
22  return fCapId1*4 + fCapId2;
23  }
24 }
25 
26 HcalPedestalWidth::HcalPedestalWidth (int fId) : mId (fId) {
27  for (int i = 16; --i >= 0; *(&mSigma00 + i) = 0) {}
28 }
29 
30 float HcalPedestalWidth::getWidth (int fCapId) const {
31  return sqrt (*(getValues () + offset (fCapId, fCapId)));
32 }
33 
34 float HcalPedestalWidth::getSigma (int fCapId1, int fCapId2) const {
35  return *(getValues () + offset (fCapId1, fCapId2));
36 }
37 
38 void HcalPedestalWidth::setSigma (int fCapId1, int fCapId2, float fSigma) {
39  *(&mSigma00 + offset (fCapId1, fCapId2)) = fSigma;
40 }
41 
int i
Definition: DBlmapReader.cc:9
const float * getValues() const
get value for all capId = 0..3, 10 values in total
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
T sqrt(T t)
Definition: SSEVec.h:48
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
HcalPedestalWidth(int fId=0)
void setSigma(int fCapId1, int fCapId2, float fSigma)