Belle II Software  release-05-02-19
ECLLocalRunCalibratorModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * ECLLocalRunCalibratorModule *
6  * *
7  * This module computes the mean values and standard deviations *
8  * for the fitted time and amplitude. *
9  * *
10  * Author: The Belle II Collaboration *
11  * Contributors: Sergei Gribanov (S.S.Gribanov@inp.nsk.su) (BINP), *
12  * Vitaly Vorobyev (vvorob@inp.nsk.su) (BINP) *
13  * *
14  * This software is provided "as is" without any warranty. *
15  **************************************************************************/
16 #pragma once
17 
18 // STL
19 #include <cstdint>
20 #include <string>
21 
22 // FRAMEWORK
23 #include <framework/core/Module.h>
24 
25 // ECL
26 #include <ecl/dataobjects/ECLDigit.h>
27 #include <ecl/modules/eclLocalRunCalibration/ECLLocalRunCalibUnit.h>
28 
29 // ROOT
30 #include <TTree.h>
31 #include <TH1F.h>
32 
33 namespace Belle2 {
46  class ECLLocalRunCalibratorModule : public Module {
47  public:
59  void beginRun() override;
63  void event() override;
67  void endRun() override;
68  private:
73  int16_t getTimeShift(const ECLDigit& digit) const;
78  inline uint32_t decodeTrigTime(uint32_t time) const;
82  static const int c_ncellids;
93  bool m_isFillHisto;
99  int m_cellid;
106  std::string m_histoFileName;
110  float m_minTime;
114  float m_maxTime;
118  float m_minAmpl;
122  float m_maxAmpl;
128  int m_devs;
133  std::string m_dbName;
138  bool m_isLocal;
150  bool m_changePrev;
158  bool m_addref;
167  TH1F* m_histo_time{nullptr};
176  TH1F* m_histo_ampl{nullptr};
180  static const std::string c_timePayloadName;
184  static const std::string c_amplPayloadName;
188  int m_lowRun;
192  int m_highRun;
197  ECLLocalRunCalibUnit* m_time;
209  bool m_fulltree;
215  TTree* m_tree{nullptr};
220  int m_tree_cellid{0};
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 
Belle2::ECLLocalRunCalibratorModule::getTimeShift
int16_t getTimeShift(const ECLDigit &digit) const
Calculate time shift.
Definition: ECLLocalRunCalibratorModule.cc:291
Belle2::ECLLocalRunCalibratorModule::decodeTrigTime
uint32_t decodeTrigTime(uint32_t time) const
Decode time.
Definition: ECLLocalRunCalibratorModule.cc:306
Belle2::ECLLocalRunCalibratorModule::m_histo_ampl
TH1F * m_histo_ampl
m_histo_ampl is the name of the histogram, which contains amplitude distribution for a certain cell i...
Definition: ECLLocalRunCalibratorModule.h:190
Belle2::ECLLocalRunCalibratorModule::beginRun
void beginRun() override
Begin run.
Definition: ECLLocalRunCalibratorModule.cc:127
Belle2::ECLLocalRunCalibratorModule::m_cellid
int m_cellid
cell id number.
Definition: ECLLocalRunCalibratorModule.h:113
Belle2::ECLLocalRunCalibratorModule::~ECLLocalRunCalibratorModule
~ECLLocalRunCalibratorModule()
Destructor.
Definition: ECLLocalRunCalibratorModule.cc:117
Belle2::ECLLocalRunCalibratorModule::m_tree_time
float m_tree_time
Time varible used to fill tree.
Definition: ECLLocalRunCalibratorModule.h:239
Belle2::ECLLocalRunCalibratorModule::m_fulltree
bool m_fulltree
Write full tree of times and amplitudes per each cellid (before calculating mean values) to file "ecl...
Definition: ECLLocalRunCalibratorModule.h:223
Belle2::ECLLocalRunCalibratorModule::c_timePayloadName
static const std::string c_timePayloadName
Name of the time payload.
Definition: ECLLocalRunCalibratorModule.h:194
Belle2::ECLLocalRunCalibratorModule::m_lowRun
int m_lowRun
Low run of the validity interval.
Definition: ECLLocalRunCalibratorModule.h:202
Belle2::ECLLocalRunCalibratorModule::m_maxAmpl
float m_maxAmpl
Maximum allowed amplitude value.
Definition: ECLLocalRunCalibratorModule.h:136
Belle2::ECLLocalRunCalibratorModule::m_addref
bool m_addref
If m_addref is true, then the current calibration run will be marked as reference run immediately aft...
Definition: ECLLocalRunCalibratorModule.h:172
Belle2::ECLLocalRunCalibratorModule::m_dbName
std::string m_dbName
Tag of central database or path to a local database.
Definition: ECLLocalRunCalibratorModule.h:147
Belle2::ECLLocalRunCalibratorModule::writeCalibResultsToDB
void writeCalibResultsToDB()
Write calibration results into a database.
Definition: ECLLocalRunCalibratorModule.cc:235
Belle2::ECLLocalRunCalibUnit
ECLLocalRunCalibUnit is the class designed for the control of mean value and the standard deviation a...
Definition: ECLLocalRunCalibUnit.h:47
Belle2::ECLLocalRunCalibratorModule::m_histoFileName
std::string m_histoFileName
The path of the .root file with the histograms obtained in the histogram filling mode.
Definition: ECLLocalRunCalibratorModule.h:120
Belle2::ECLLocalRunCalibratorModule::m_maxTime
float m_maxTime
Maximum allowed time value.
Definition: ECLLocalRunCalibratorModule.h:128
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLLocalRunCalibratorModule::c_ncellids
static const int c_ncellids
Number of cell ids.
Definition: ECLLocalRunCalibratorModule.h:96
Belle2::ECLLocalRunCalibratorModule::m_tree_ampl
float m_tree_ampl
Amplitude varible used to fill tree.
Definition: ECLLocalRunCalibratorModule.h:244
Belle2::ECLLocalRunCalibratorModule::m_isFillHisto
bool m_isFillHisto
If m_isFillHisto is false, than the mode of local run calibration is enabled.
Definition: ECLLocalRunCalibratorModule.h:107
Belle2::ECLLocalRunCalibratorModule::m_isLocal
bool m_isLocal
Enables local database usage.
Definition: ECLLocalRunCalibratorModule.h:152
Belle2::ECLLocalRunCalibratorModule::m_changePrev
bool m_changePrev
If m_changePrev is true, the validity intervals of the previous payloads stored into the database wil...
Definition: ECLLocalRunCalibratorModule.h:164
Belle2::ECLLocalRunCalibratorModule::m_tree_cellid
int m_tree_cellid
Cellid varible used to fill tree.
Definition: ECLLocalRunCalibratorModule.h:234
Belle2::ECLLocalRunCalibratorModule::endRun
void endRun() override
End run.
Definition: ECLLocalRunCalibratorModule.cc:262
Belle2::ECLLocalRunCalibratorModule::ECLLocalRunCalibratorModule
ECLLocalRunCalibratorModule()
Constructor.
Definition: ECLLocalRunCalibratorModule.cc:46
Belle2::ECLLocalRunCalibratorModule::m_highRun
int m_highRun
High run of the validity interval.
Definition: ECLLocalRunCalibratorModule.h:206
Belle2::ECLLocalRunCalibratorModule::m_tree
TTree * m_tree
Full tree of times and amplitudes per each cellid before calculating mean values.
Definition: ECLLocalRunCalibratorModule.h:229
Belle2::ECLLocalRunCalibratorModule::m_ampl
ECLLocalRunCalibUnit * m_ampl
m_ampl contains amplitude mean value and standard deviation accumulators for all cell ids.
Definition: ECLLocalRunCalibratorModule.h:216
Belle2::ECLLocalRunCalibratorModule::m_devs
int m_devs
Number of standard deviations used to update value limits.
Definition: ECLLocalRunCalibratorModule.h:142
Belle2::ECLLocalRunCalibratorModule::m_minAmpl
float m_minAmpl
Minimum allowed amplitude value.
Definition: ECLLocalRunCalibratorModule.h:132
Belle2::ECLLocalRunCalibratorModule::m_histo_time
TH1F * m_histo_time
m_histo_time is the name of the histogram, which contains time distribution for a certain cell id.
Definition: ECLLocalRunCalibratorModule.h:181
Belle2::ECLLocalRunCalibratorModule::m_minTime
float m_minTime
Minimum allowed time value.
Definition: ECLLocalRunCalibratorModule.h:124
Belle2::ECLLocalRunCalibratorModule::event
void event() override
Event.
Definition: ECLLocalRunCalibratorModule.cc:162
Belle2::ECLLocalRunCalibratorModule::c_amplPayloadName
static const std::string c_amplPayloadName
Name of the amplitude payload.
Definition: ECLLocalRunCalibratorModule.h:198
Belle2::ECLLocalRunCalibratorModule::m_time
ECLLocalRunCalibUnit * m_time
m_time contains time mean value and standard deviation accumulators for all cell ids.
Definition: ECLLocalRunCalibratorModule.h:211
Belle2::ECLLocalRunCalibratorModule::writeHistoToFile
void writeHistoToFile()
Write histograms to file in the case, if the histogram filling mode is enabled.
Definition: ECLLocalRunCalibratorModule.cc:223
Belle2::ECLLocalRunCalibratorModule::m_tree_event
int m_tree_event
Event varible used to fill tree.
Definition: ECLLocalRunCalibratorModule.h:249