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:
11  enum Method { float16 = 0, reduceMantissa = 1, logPack = 2, tanLogPack = 3, zero = 4, one = 5 };
12  enum Target { realValue = 0, ratioToRef = 1, differenceToRef = 2 };
14  CompressionElement(Method m, Target t, int bitsUsed, std::vector<float> p)
15  : method(m), target(t), bits(bitsUsed), params(p) {}
18  int bits;
19  std::vector<float> params;
20  uint16_t pack(float value, float ref = 0.) const;
21  float unpack(uint16_t packed, float ref = 0.) const;
22 };
23 
25 public:
26  static int index(int i, int j) {
27  if (i >= j)
28  return j + i * (i + 1) / 2;
29  else
30  return i + j * (j + 1) / 2;
31  }
34  std::array<CompressionElement, 15> elements;
35  CompressionElement &operator()(int i, int j) { return elements[index(i, j)]; }
36  const CompressionElement &operator()(int i, int j) const { return elements[index(i, j)]; }
37  };
39  bool isValid() const { return loadedVersion_ != -1; }
40  int loadedVersion() const { return loadedVersion_; }
41  void load(int version);
42  float meanValue(
43  int i, int j, int sign, float pt, float eta, int nHits, int pixelHits, float cii = 1., float cjj = 1.) const;
44  float pack(float value,
45  int schema,
46  int i,
47  int j,
48  float pt,
49  float eta,
50  int nHits,
51  int pixelHits,
52  float cii = 1.,
53  float cjj = 1.) const;
54  float unpack(uint16_t packed,
55  int schema,
56  int i,
57  int j,
58  float pt,
59  float eta,
60  int nHits,
61  int pixelHits,
62  float cii = 1.,
63  float cjj = 1.) const;
64 
65 private:
66  void readFile(TFile &);
67  void addTheHistogram(
68  std::vector<TH3D *> *HistoVector, std::string StringToAddInTheName, int i, int j, TFile &fileToRead);
70  TFile *fileToRead_;
71  std::unordered_map<uint16_t, CompressionSchema> schemas;
72  std::vector<TH3D *> cov_elements_pixelHit;
73  std::vector<TH3D *> cov_elements_noPixelHit;
74 };
75 
76 #endif
mps_fire.i
i
Definition: mps_fire.py:355
CovarianceParameterization::readFile
void readFile(TFile &)
Definition: CovarianceParameterization.cc:125
CompressionElement::target
Target target
Definition: CovarianceParameterization.h:17
CompressionElement::params
std::vector< float > params
Definition: CovarianceParameterization.h:19
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CompressionElement::method
Method method
Definition: CovarianceParameterization.h:16
CovarianceParameterization::index
static int index(int i, int j)
Definition: CovarianceParameterization.h:26
CompressionElement::realValue
Definition: CovarianceParameterization.h:12
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
CompressionElement::Method
Method
Definition: CovarianceParameterization.h:11
CovarianceParameterization::pack
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
Definition: CovarianceParameterization.cc:176
CompressionElement::ratioToRef
Definition: CovarianceParameterization.h:12
CovarianceParameterization::loadedVersion_
int loadedVersion_
Definition: CovarianceParameterization.h:69
CompressionElement::tanLogPack
Definition: CovarianceParameterization.h:11
CovarianceParameterization::meanValue
float meanValue(int i, int j, int sign, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
Definition: CovarianceParameterization.cc:147
CovarianceParameterization::cov_elements_pixelHit
std::vector< TH3D * > cov_elements_pixelHit
Definition: CovarianceParameterization.h:72
PVValHelper::eta
Definition: PVValidationHelpers.h:69
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
CovarianceParameterization::CompressionSchema::CompressionSchema
CompressionSchema()
Definition: CovarianceParameterization.h:33
CovarianceParameterization::CompressionSchema::operator()
CompressionElement & operator()(int i, int j)
Definition: CovarianceParameterization.h:35
CompressionElement::unpack
float unpack(uint16_t packed, float ref=0.) const
Definition: CovarianceParameterization.cc:47
CovarianceParameterization::schemas
std::unordered_map< uint16_t, CompressionSchema > schemas
Definition: CovarianceParameterization.h:71
CovarianceParameterization::cov_elements_noPixelHit
std::vector< TH3D * > cov_elements_noPixelHit
Definition: CovarianceParameterization.h:73
CompressionElement
Definition: CovarianceParameterization.h:9
CovarianceParameterization::isValid
bool isValid() const
Definition: CovarianceParameterization.h:39
OrderedSet.t
t
Definition: OrderedSet.py:90
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CompressionElement::pack
uint16_t pack(float value, float ref=0.) const
Definition: CovarianceParameterization.cc:11
CompressionElement::Target
Target
Definition: CovarianceParameterization.h:12
CovarianceParameterization::unpack
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
Definition: CovarianceParameterization.cc:192
CovarianceParameterization::addTheHistogram
void addTheHistogram(std::vector< TH3D * > *HistoVector, std::string StringToAddInTheName, int i, int j, TFile &fileToRead)
Definition: CovarianceParameterization.cc:137
CompressionElement::CompressionElement
CompressionElement()
Definition: CovarianceParameterization.h:13
CompressionElement::reduceMantissa
Definition: CovarianceParameterization.h:11
value
Definition: value.py:1
CovarianceParameterization::CompressionSchema::elements
std::array< CompressionElement, 15 > elements
Definition: CovarianceParameterization.h:34
CompressionElement::bits
int bits
Definition: CovarianceParameterization.h:18
CompressionElement::zero
Definition: CovarianceParameterization.h:11
CompressionElement::one
Definition: CovarianceParameterization.h:11
CompressionElement::float16
Definition: CovarianceParameterization.h:11
CovarianceParameterization::loadedVersion
int loadedVersion() const
Definition: CovarianceParameterization.h:40
CovarianceParameterization::fileToRead_
TFile * fileToRead_
Definition: CovarianceParameterization.h:70
CovarianceParameterization::CompressionSchema
Definition: CovarianceParameterization.h:32
CovarianceParameterization::load
void load(int version)
Definition: CovarianceParameterization.cc:78
CompressionElement::logPack
Definition: CovarianceParameterization.h:11
CompressionElement::CompressionElement
CompressionElement(Method m, Target t, int bitsUsed, std::vector< float > p)
Definition: CovarianceParameterization.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CovarianceParameterization::CompressionSchema::operator()
const CompressionElement & operator()(int i, int j) const
Definition: CovarianceParameterization.h:36
CovarianceParameterization
Definition: CovarianceParameterization.h:24
CompressionElement::differenceToRef
Definition: CovarianceParameterization.h:12
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
CovarianceParameterization::CovarianceParameterization
CovarianceParameterization()
Definition: CovarianceParameterization.h:38