Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:16

0001 /**
0002 \class HcalPedestalWidth
0003 \author Fedor Ratnikov (UMd)
0004 correlation matrix for pedestals
0005 $Author: ratnikov
0006 $Date: 2008/11/07 16:06:24 $
0007 $Revision: 1.8 $
0008 */
0009 
0010 #include <cmath>
0011 #include <iostream>
0012 
0013 #include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h"
0014 
0015 namespace {
0016   int offset(int fCapId1, int fCapId2) {
0017     //    static int offsets [4] = {0, 1, 3, 6};
0018     //    if (fCapId1 < fCapId2) { // swap
0019     //      int tmp = fCapId1; fCapId1 = fCapId2; fCapId2 = tmp;
0020     //    }
0021     //    return offsets [fCapId1] + fCapId2;
0022     return fCapId1 * 4 + fCapId2;
0023   }
0024 }  // namespace
0025 
0026 HcalPedestalWidth::HcalPedestalWidth(int fId) : mId(fId) {
0027   for (int i = 16; --i >= 0; *(&mSigma00 + i) = 0) {
0028   }
0029 }
0030 
0031 float HcalPedestalWidth::getWidth(int fCapId) const { return sqrt(*(getValues() + offset(fCapId, fCapId))); }
0032 
0033 float HcalPedestalWidth::getSigma(int fCapId1, int fCapId2) const { return *(getValues() + offset(fCapId1, fCapId2)); }
0034 
0035 void HcalPedestalWidth::setSigma(int fCapId1, int fCapId2, float fSigma) {
0036   *(&mSigma00 + offset(fCapId1, fCapId2)) = fSigma;
0037 }