Belle II Software  release-06-00-14
ECLAutoCovariance.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <TObject.h>
10 
13 namespace Belle2 {
21  float sigmaNoiseSq = -1;
22  short int packedCovMat[30] = {};
24  };
25 
29  class ECLAutoCovariance: public TObject {
30  public:
31 
36 
41 
43  const PackedAutoCovariance& getPacked(const int cellID) const
44  {
45  if (cellID < 1 || cellID > 8736) return m_acov[0];
46  return m_acov[cellID - 1];
47  }
48 
50  void getAutoCovariance(const int cellID, double acov[31]) const
51  {
52  if (cellID < 1 || cellID > 8736) return;
53  const PackedAutoCovariance& tempPacked = m_acov[cellID - 1];
54  acov[0] = static_cast<double>(tempPacked.sigmaNoiseSq);
55  const double norm = acov[0] * (1.0 / 32767);
56  for (int i = 0; i < 30; i++) acov[i + 1] = norm * static_cast<double>(tempPacked.packedCovMat[i]);
57  }
58 
60  void setAutoCovariance(const int cellID, const double acov[31])
61  {
62  if (cellID < 1 || cellID > 8736) return;
63  const double norm = 32767 / acov[0];
64  PackedAutoCovariance& tempPacked = m_acov[cellID - 1];
65  tempPacked.sigmaNoiseSq = static_cast<float>(acov[0]);
66  for (int i = 0; i < 30; i++)
67  tempPacked.packedCovMat[i] = static_cast<short int>(std::max(-32767.0, std::min(acov[i + 1] * norm, 32767.0)));
68  }
69 
70  private:
73  //Initial Version
75  };
77 } // end namespace Belle2
Covariance matrices for offline ECL waveform fit.
void getAutoCovariance(const int cellID, double acov[31]) const
Get auto covariance for a channel.
const PackedAutoCovariance & getPacked(const int cellID) const
Get packed autocovariance.
ECLAutoCovariance()
Default constructor.
PackedAutoCovariance m_acov[8736]
Packed autocovariance matrix for each crystal.
void setAutoCovariance(const int cellID, const double acov[31])
Set auto covariance for a channel.
ClassDef(ECLAutoCovariance, 1)
ClassDef.
Abstract base class for different kinds of events.
packed covariance matrix
float sigmaNoiseSq
sigma noise squared in ADC channels
ClassDef(PackedAutoCovariance, 1)
ClassDef to make streamer.
short int packedCovMat[30]
packed covariance, the range [-1.0, 1.0] is mapped to [-32767, 32767]