Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-25 06:38:07

0001 #ifndef EcalPulseSymmCovariances_h
0002 #define EcalPulseSymmCovariances_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include "CondFormats/EcalObjects/interface/EcalPulseShapes.h"
0007 #include "CondFormats/EcalObjects/interface/EcalCondObjectContainer.h"
0008 
0009 #include <algorithm>
0010 
0011 struct EcalPulseSymmCovariance {
0012 public:
0013   EcalPulseSymmCovariance();
0014 
0015   float covval[EcalPulseShape::TEMPLATESAMPLES * (EcalPulseShape::TEMPLATESAMPLES + 1) / 2];
0016 
0017   int indexFor(int i, int j) const {
0018     int m = std::min(i, j);
0019     int n = std::max(i, j);
0020     return n + EcalPulseShape::TEMPLATESAMPLES * m - m * (m + 1) / 2;
0021   }
0022 
0023   float val(int i, int j) const { return covval[indexFor(i, j)]; }
0024   float& val(int i, int j) { return covval[indexFor(i, j)]; }
0025 
0026   COND_SERIALIZABLE;
0027 };
0028 
0029 typedef EcalCondObjectContainer<EcalPulseSymmCovariance> EcalPulseSymmCovariancesMap;
0030 typedef EcalPulseSymmCovariancesMap::const_iterator EcalPulseSymmCovariancesMapIterator;
0031 typedef EcalPulseSymmCovariancesMap EcalPulseSymmCovariances;
0032 
0033 #endif