CMS 3D CMS Logo

CovarianceParameterization.h
Go to the documentation of this file.
1 #ifndef _DataFormats_PatCandidates_CovarianceParameterization_h_
2 #define _DataFormats_PatCandidates_CovarianceParameterization_h_
3 #include <TFile.h>
4 #include <TH3D.h>
5 #include <iostream>
6 #include <unordered_map>
7 #include <array>
8 #include <TKey.h>
10  public:
14  CompressionElement(Method m, Target t, int bitsUsed, std::vector<float> p): method(m),target(t),bits(bitsUsed),params(p){}
17  int bits;
18  std::vector<float> params;
19  uint16_t pack(float value, float ref=0.) const ;
20  float unpack(uint16_t packed, float ref=0.) const;
21 
22 };
23 
24 
26  public:
27  static int index(int i, int j) {if(i>=j) return j+i*(i+1)/2; else return i+j*(j+1)/2 ; }
30  std::array<CompressionElement,15> elements;
31  CompressionElement & operator()(int i,int j) {return elements[index(i,j)];}
32  const CompressionElement & operator()(int i,int j) const {return elements[index(i,j)];}
33  };
34  CovarianceParameterization() : loadedVersion_(-1)
35  {
36  }
37  bool isValid() const {return loadedVersion_!=-1; }
38  int loadedVersion() const {return loadedVersion_; }
39  void load(int version);
40  float meanValue(int i,int j,int sign,float pt, float eta, int nHits,int pixelHits, float cii=1.,float cjj=1.) const ;
41  float pack(float value,int schema, int i,int j,float pt, float eta, int nHits,int pixelHits, float cii=1.,float cjj=1.) const;
42  float unpack(uint16_t packed,int schema, int i,int j,float pt, float eta, int nHits,int pixelHits, float cii=1.,float cjj=1.) const;
43  private:
44  void readFile( TFile &);
45  void addTheHistogram(std::vector<TH3D *> * HistoVector, std::string StringToAddInTheName, int i, int j, TFile & fileToRead);
47  TFile * fileToRead_;
48  std::unordered_map<uint16_t,CompressionSchema> schemas;
49  std::vector<TH3D *> cov_elements_pixelHit;
50  std::vector<TH3D *> cov_elements_noPixelHit;
51 };
52 
53 #endif
54 
CompressionElement(Method m, Target t, int bitsUsed, std::vector< float > p)
std::vector< float > params
Definition: value.py:1
uint16_t pack(float value, float ref=0.) const
std::vector< TH3D * > cov_elements_pixelHit
std::unordered_map< uint16_t, CompressionSchema > schemas
def load(fileName)
Definition: svgfig.py:546
float unpack(uint16_t packed, float ref=0.) const
const CompressionElement & operator()(int i, int j) const
std::vector< TH3D * > cov_elements_noPixelHit