Belle II Software  release-05-01-25
ECLSampledShaper.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015-2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Guglielmo De Nardo *
7  * Alon Hershenhorn *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #ifndef ECLSampleShaper
13 #define ECLSampleShaper
14 
15 #include <TH1.h>
16 
17 namespace Belle2 {
22  namespace ECL {
23 
25  class ECLSampledShaper {
26  public:
28  ECLSampledShaper(const TH1F* s, double ts = 1)
29  : m_sampledShape(s), m_timeScale(ts) {}
33  void fillarray(int N, double* a)
34  {
35  if (m_timeScale == 1)
36  for (int i = 0; i < N; i++) a[i] = m_sampledShape->GetBinContent(i * m_timeScale + 1);
37  else {
38  for (int i = 0; i < N; i++) {
39  a[i] = 0;
40  for (int j = 0; j < m_timeScale; j++)
41  a[i] += m_sampledShape->GetBinContent(i * m_timeScale + j);
42  a[i] /= m_timeScale;
43  }
44  }
45  }
46  private:
47  const TH1F* m_sampledShape;
48  const int m_timeScale;
49  };
50 
51  }
53 }
54 #endif
Belle2::ECL::ECLSampledShaper::fillarray
void fillarray(int N, double *a)
fill the sampled shape array
Definition: ECLSampledShaper.h:42
Belle2::ECL::ECLSampledShaper::m_timeScale
const int m_timeScale
the time scale
Definition: ECLSampledShaper.h:57
Belle2::ECL::ECLSampledShaper::ECLSampledShaper
ECLSampledShaper(const TH1F *s, double ts=1)
constructor
Definition: ECLSampledShaper.h:37
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECL::ECLSampledShaper::m_sampledShape
const TH1F * m_sampledShape
the sampled shape
Definition: ECLSampledShaper.h:56
Belle2::ECL::ECLSampledShaper::~ECLSampledShaper
~ECLSampledShaper()
destructor
Definition: ECLSampledShaper.h:40