CMS 3D CMS Logo

CorrelatedNoisifier.h
Go to the documentation of this file.
1 #ifndef SimAlgos_CorrelatedNoisifier_h
2 #define SimAlgos_CorrelatedNoisifier_h
3 
24 #include <vector>
25 
26 namespace CLHEP {
27  class HepRandomEngine;
28 }
29 
30 template <class M>
31 class CorrelatedNoisifier {
32 public:
33  typedef std::vector<double> VecDou;
34 
35  CorrelatedNoisifier(const M &symCorMat); // correlation matrix
36 
37  CorrelatedNoisifier(int *dummy, const M &cholDecMat); // decomposition matrix
38 
39  virtual ~CorrelatedNoisifier();
40 
41  void resetCorrelationMatrix(const M &symCorMat);
42 
43  void resetCholDecompMatrix(const M &cholMat);
44 
45  template <class T>
46  void noisify(T &frame, // applies random noise to frame
47  CLHEP::HepRandomEngine *,
48  const VecDou *rangau = nullptr) const; // use these
49 
50  const M &cholMat() const; // return decomposition
51 
52  const VecDou &vecgau() const;
53 
54 private:
55  static const double k_precision; // precision to which 0 & 1 are compared
56 
57  void init(const M &symCorMat);
58 
59  void initChol();
60 
61  bool computeDecomposition(const M &symCorMat);
62 
63  bool checkDecomposition(const M &symCorMat, M &HHtDiff) const;
64 
65  void checkOffDiagonal(const M &symCorMat);
66 
67  mutable VecDou m_vecgau;
68 
71 
72  M m_H;
73 };
74 
75 #endif
adds noise to the given frame.
Definition: EcalCoder.h:12
int init
Definition: HydjetWrapper.h:67
static const double k_precision
long double T
std::vector< double > VecDou