Belle II Software  release-06-02-00
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 // STL
11 #include <cstdint>
12 #include <string>
13 
14 // FRAMEWORK
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 // ECL
21 #include <ecl/dataobjects/ECLDigit.h>
22 #include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibUnit.h>
23 
24 // ROOT
25 #include <TTree.h>
26 #include <TH1F.h>
27 
28 namespace Belle2 {
39  public:
51  void beginRun() override;
55  void event() override;
59  void endRun() override;
60  private:
65  int16_t getTimeShift(const ECLDigit& digit) const;
70  inline uint32_t decodeTrigTime(uint32_t time) const;
74  static const int c_ncellids;
91  int m_cellid;
98  std::string m_histoFileName;
102  float m_minTime;
106  float m_maxTime;
110  float m_minAmpl;
114  float m_maxAmpl;
120  int m_devs;
125  std::string m_dbName;
130  bool m_isLocal;
150  bool m_addref;
159  TH1F* m_histo_time{nullptr};
168  TH1F* m_histo_ampl{nullptr};
172  static const std::string c_timePayloadName;
176  static const std::string c_amplPayloadName;
180  int m_lowRun;
215  TTree* m_tree{nullptr};
225  float m_tree_time{0};
230  float m_tree_ampl{0};
235  int m_tree_event{0};
241  void writeHistoToFile();
246  void writeCalibResultsToDB();
247  };
249 } // namespace Belle2
250 
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:95
Abstract base class for different kinds of events.