CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondFormats/HcalObjects/src/HcalPedestalWidth.cc

Go to the documentation of this file.
00001 
00010 #include <math.h>
00011 #include <iostream>
00012 
00013 #include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h"
00014 
00015 namespace {
00016   int offset (int fCapId1, int fCapId2) {
00017     //    static int offsets [4] = {0, 1, 3, 6};
00018     //    if (fCapId1 < fCapId2) { // swap
00019     //      int tmp = fCapId1; fCapId1 = fCapId2; fCapId2 = tmp;
00020     //    }
00021     //    return offsets [fCapId1] + fCapId2;
00022     return fCapId1*4 + fCapId2;
00023   }
00024 }
00025 
00026 HcalPedestalWidth::HcalPedestalWidth (int fId) : mId (fId) {
00027   for (int i = 16; --i >= 0; *(&mSigma00 + i) = 0) {}
00028 }
00029 
00030 float HcalPedestalWidth::getWidth (int fCapId) const {
00031   return sqrt (*(getValues () + offset (fCapId, fCapId)));
00032 }
00033 
00034 float HcalPedestalWidth::getSigma (int fCapId1, int fCapId2) const {
00035   return *(getValues () + offset (fCapId1, fCapId2));
00036 }
00037 
00038 void HcalPedestalWidth::setSigma (int fCapId1, int fCapId2, float fSigma) {
00039   *(&mSigma00 + offset (fCapId1, fCapId2)) = fSigma;
00040 }
00041