Belle II Software  release-08-01-10
CrudeT0CalibrationAlgorithm.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 #include <calibration/CalibrationAlgorithm.h>
11 #include <TH1F.h>
12 #include "vector"
13 namespace Belle2 {
18  namespace CDC {
23  public:
32 
37  void setFitWindow(std::vector<unsigned short> window)
38  {
39  if (window.size() != 2) {
40  B2FATAL("Please specify [TDC_min, TDC_max]");
41  }
42  m_tdcMin = window.at(0);
43  m_tdcMax = window.at(1);
44  }
48  void setInitialValue(float t)
49  {
50  m_initT0 = t;
51  }
52 
56  void setZOffset(float z)
57  {
58  m_zOffset = z;
59  }
60 
65  void setCosmics(bool b)
66  {
67  m_cosmic = b;
68  }
69 
74  void saveHisto();
75  protected:
77  EResult calibrate() override;
79  virtual void createHisto(StoreObjPtr<EventMetaData>& evtPtr);
81  virtual void write(StoreObjPtr<EventMetaData>& evtPtr);
82  private:
83 
84  double m_t0b[300];
85  double m_t0[56][400];
86  bool m_flag[56][400] = {{false}};
88  TH1D* m_hTDC[56][400];
89  TH1D* m_hTDCBoard[300];
90  TH1D* m_hT0All;
91  unsigned short m_tdcMin = 4500;
92  unsigned short m_tdcMax = 5000;
93  float m_initT0 = 4887.;
94  unsigned short m_minEntries = 100;
95  float m_zOffset = 0.0;
96  bool m_cosmic = true;
97  };
98  }
100 }
101 
Algorithm class for crude T0 calibration.
TH1D * m_hT0All
T0 distribution of all channel.
void setInitialValue(float t)
Set inital value for fitting.
unsigned short m_tdcMax
maximum of TDC hist for fitting
TH1D * m_hTDCBoard[300]
T0 distribution of each board.
void setFitWindow(std::vector< unsigned short > window)
Set window for fitting.
float m_initT0
Common initial T0 for fitting.
bool m_flag[56][400]
flag =1 for good, =0 for low statistic or bad fit
void saveHisto()
Save hitograms of the calibration results.
bool m_cosmic
for cosmic case, tof of upper sector will be negative
virtual void createHisto(StoreObjPtr< EventMetaData > &evtPtr)
create histo for each channel
unsigned short m_tdcMin
minimum of TDC hist for fitting
virtual void write(StoreObjPtr< EventMetaData > &evtPtr)
write outut or store db
unsigned short m_minEntries
minimum entries required by histo.
EResult calibrate() override
Run algo on data.
TH1D * m_hTDC[56][400]
TDC distribution histo.
float m_zOffset
z offset for calculate prop time, it is position of trigger counter,
Base class for calibration algorithms.
EResult
The result of calibration.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.