Belle II Software  release-08-01-10
ECLLocalRunCalibratorModule.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 #pragma once
9 
10 /* ECL headers. */
11 #include <ecl/dataobjects/ECLDigit.h>
12 #include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibUnit.h>
13 
14 /* Basf2 headers. */
15 #include <framework/core/Module.h>
16 #include <framework/dataobjects/EventMetaData.h>
17 #include <framework/datastore/StoreArray.h>
18 #include <framework/datastore/StoreObjPtr.h>
19 
20 /* ROOT headers. */
21 #include <TH1F.h>
22 #include <TTree.h>
23 
24 /* C++ headers. */
25 #include <cstdint>
26 #include <string>
27 
28 namespace Belle2 {
42  public:
54  void beginRun() override;
58  void event() override;
62  void endRun() override;
63  private:
68  int16_t getTimeShift(const ECLDigit& digit) const;
73  inline uint32_t decodeTrigTime(uint32_t time) const;
77  static const int c_ncellids;
94  int m_cellid;
101  std::string m_histoFileName;
105  float m_minTime;
109  float m_maxTime;
113  float m_minAmpl;
117  float m_maxAmpl;
123  int m_devs;
128  std::string m_dbName;
133  bool m_isLocal;
153  bool m_addref;
162  TH1F* m_histo_time{nullptr};
171  TH1F* m_histo_ampl{nullptr};
175  static const std::string c_timePayloadName;
179  static const std::string c_amplPayloadName;
183  int m_lowRun;
218  TTree* m_tree{nullptr};
228  float m_tree_time{0};
233  float m_tree_ampl{0};
238  int m_tree_event{0};
244  void writeHistoToFile();
249  void writeCalibResultsToDB();
250  };
252 } // namespace Belle2
253 
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
Definition: ECLDigit.h:24
ECLLocalRunCalibUnit is the class designed for the control of mean value and the standard deviation a...
ECLLocalRunCalibratorModule is the module developed to perform ECL local run calibration.
std::string m_dbName
Tag of central database or path to a local database.
float m_tree_ampl
Amplitude varible used to fill tree.
bool m_isFillHisto
If m_isFillHisto is false, than the mode of local run calibration is enabled.
bool m_isLocal
Enables local database usage.
TTree * m_tree
Full tree of times and amplitudes per each cellid before calculating mean values.
float m_tree_time
Time varible used to fill tree.
static const std::string c_amplPayloadName
Name of the amplitude payload.
static const std::string c_timePayloadName
Name of the time payload.
bool m_addref
If m_addref is true, then the current calibration run will be marked as reference run immediately aft...
float m_maxAmpl
Maximum allowed amplitude value.
float m_minTime
Minimum allowed time value.
StoreArray< ECLDigit > m_ECLDigits
ECL digits.
int m_tree_event
Event varible used to fill tree.
int m_tree_cellid
Cellid varible used to fill tree.
ECLLocalRunCalibUnit * m_ampl
m_ampl contains amplitude mean value and standard deviation accumulators for all cell ids.
TH1F * m_histo_ampl
m_histo_ampl is the name of the histogram, which contains amplitude distribution for a certain cell i...
bool m_fulltree
Write full tree of times and amplitudes per each cellid (before calculating mean values) to file "ecl...
ECLLocalRunCalibUnit * m_time
m_time contains time mean value and standard deviation accumulators for all cell ids.
uint32_t decodeTrigTime(uint32_t time) const
Decode time.
float m_maxTime
Maximum allowed time value.
static const int c_ncellids
Number of cell ids.
std::string m_histoFileName
The path of the .root file with the histograms obtained in the histogram filling mode.
bool m_changePrev
If m_changePrev is true, the validity intervals of the previous payloads stored into the database wil...
int m_highRun
High run of the validity interval.
int m_lowRun
Low run of the validity interval.
void writeHistoToFile()
Write histograms to file in the case, if the histogram filling mode is enabled.
TH1F * m_histo_time
m_histo_time is the name of the histogram, which contains time distribution for a certain cell id.
void writeCalibResultsToDB()
Write calibration results into a database.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
float m_minAmpl
Minimum allowed amplitude value.
int m_devs
Number of standard deviations used to update value limits.
int16_t getTimeShift(const ECLDigit &digit) const
Calculate time shift.
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.