Belle II Software  release-05-02-19
ECLLocalRunCalibUnit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * ECLLocalRunCalibUnit *
6  * *
7  * This class controls feature (mean value, standard deviation and *
8  * number of accepted events) accumulators for each cell id. *
9  * *
10  * Author: The Belle II Collaboration *
11  * Contributors: Sergei Gribanov (S.S.Gribanov@inp.nsk.su) (BINP) *
12  * *
13  * This software is provided "as is" without any warranty. *
14  **************************************************************************/
15 #pragma once
16 
17 #include <string>
18 #include <vector>
19 #include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibAcc.h>
20 #include <framework/database/IntervalOfValidity.h>
21 #include <ecl/utility/ECLDBTool.h>
22 
23 namespace Belle2 {
34  class ECLLocalRunCalibUnit {
35  public:
43  ECLLocalRunCalibUnit(const int& ncellids,
44  const float& min_value,
45  const float& max_value,
46  const int* const ndevs);
58  void add(const int& cellid, const float& value);
62  void calc();
74  void writeToDB(
75  bool isLocal,
76  const std::string& dbName,
77  const std::string& payloadName,
78  const IntervalOfValidity& iov,
79  const int& run,
80  const bool& changePrev,
81  const bool& addref);
88  void enableNegAmpl();
94  bool isNegAmpl() const;
95  private:
102  bool m_isNegAmpl;
110  void markAsRefference(const bool& isLocal,
111  const std::string& dbName,
112  const int& run,
113  const IntervalOfValidity& iov);
119  void changePreviousIoV(const ECLDBTool& payload,
120  const IntervalOfValidity& iov);
125  std::vector<ECLLocalRunCalibAcc> m_unitData;
131  template <typename T>
132  void callAccGetter(
133  std::vector<T>* vec,
134  T(ECLLocalRunCalibAcc::*getter)() const);
135  };
137 } // Belle2
138 
Belle2::ECLLocalRunCalibUnit::isNegAmpl
bool isNegAmpl() const
Check presence of negative amplitudes in the current run.
Definition: ECLLocalRunCalibUnit.cc:48
Belle2::ECLLocalRunCalibUnit::m_unitData
std::vector< ECLLocalRunCalibAcc > m_unitData
Mean value and standard deviation accumulators for each cell id.
Definition: ECLLocalRunCalibUnit.h:138
Belle2::ECLLocalRunCalibUnit::changePreviousIoV
void changePreviousIoV(const ECLDBTool &payload, const IntervalOfValidity &iov)
Change previous validity interval.
Definition: ECLLocalRunCalibUnit.cc:91
Belle2::ECLLocalRunCalibUnit::markAsRefference
void markAsRefference(const bool &isLocal, const std::string &dbName, const int &run, const IntervalOfValidity &iov)
Mark current run as reference.
Definition: ECLLocalRunCalibUnit.cc:78
Belle2::ECLLocalRunCalibUnit::writeToDB
void writeToDB(bool isLocal, const std::string &dbName, const std::string &payloadName, const IntervalOfValidity &iov, const int &run, const bool &changePrev, const bool &addref)
Write calibration results into a database.
Definition: ECLLocalRunCalibUnit.cc:106
Belle2::ECLLocalRunCalibUnit::add
void add(const int &cellid, const float &value)
Add value to accumulate mean value, standard deviation and number of accepted events.
Definition: ECLLocalRunCalibUnit.cc:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLLocalRunCalibUnit::ECLLocalRunCalibUnit
ECLLocalRunCalibUnit(const int &ncellids, const float &min_value, const float &max_value, const int *const ndevs)
Constructor.
Definition: ECLLocalRunCalibUnit.cc:23
Belle2::ECLLocalRunCalibUnit::callAccGetter
void callAccGetter(std::vector< T > *vec, T(ECLLocalRunCalibAcc::*getter)() const)
Getter of accumulated values.
Definition: ECLLocalRunCalibUnit.cc:69
Belle2::ECLLocalRunCalibUnit::calc
void calc()
Calculate accumulated values.
Definition: ECLLocalRunCalibUnit.cc:61
Belle2::ECLLocalRunCalibUnit::enableNegAmpl
void enableNegAmpl()
This function will be called only in the case, if negative amplitudes are observed in the current run...
Definition: ECLLocalRunCalibUnit.cc:42
Belle2::ECLLocalRunCalibUnit::~ECLLocalRunCalibUnit
~ECLLocalRunCalibUnit()
Destructor.
Definition: ECLLocalRunCalibUnit.cc:36
Belle2::ECLLocalRunCalibUnit::m_isNegAmpl
bool m_isNegAmpl
m_isNegAmpl is true if there are negative amplitudes in the current run and false otherwise.
Definition: ECLLocalRunCalibUnit.h:115