Belle II Software development
ECLSampledShaper.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#pragma once
10
11/* ROOT headers. */
12#include <TH1.h>
13
14namespace Belle2 {
19 namespace ECL {
20
23 public:
25 explicit ECLSampledShaper(const TH1F* s, double ts = 1)
26 : m_sampledShape(s), m_timeScale(ts) {}
30 void fillarray(int N, double* a)
31 {
32 if (m_timeScale == 1)
33 for (int i = 0; i < N; i++) a[i] = m_sampledShape->GetBinContent(i * m_timeScale + 1);
34 else {
35 for (int i = 0; i < N; i++) {
36 a[i] = 0;
37 for (int j = 0; j < m_timeScale; j++)
38 a[i] += m_sampledShape->GetBinContent(i * m_timeScale + j);
39 a[i] /= m_timeScale;
40 }
41 }
42 }
43 private:
44 const TH1F* m_sampledShape;
45 const int m_timeScale;
46 };
47
48 }
50}
const int m_timeScale
the time scale
const TH1F * m_sampledShape
the sampled shape
void fillarray(int N, double *a)
fill the sampled shape array
ECLSampledShaper(const TH1F *s, double ts=1)
constructor
Abstract base class for different kinds of events.