ATLAS Offline Software
T0MTHistos.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // T0MTHistos.h
6 // Header file for class T0MTHistos
8 // (c) ATLAS Detector software
10 //
12 
13 #ifndef T0MTHISTOS_H
14 #define T0MTHISTOS_H
15 
16 // c - c++
17 #include <iostream>
18 
19 // root
20 #include "TF1.h"
21 #include "TH1.h"
22 class TDirectory;
23 
24 // this
25 #include "T0MTSettings.h"
26 
27 namespace MuonCalib {
28 
40  class T0MTHistos {
41  public:
42  //---------------------------constructor----------------------------------------
44  T0MTHistos() = default;
50  T0MTHistos(int id, const T0MTSettings *settings, const char *hname = nullptr) : m_t0_fermi(nullptr), m_tmax_fermi(nullptr) {
51  Initialize(id, settings, hname);
52  }
53  //---------------------------static constants-----------------------------------
55  static constexpr int N_T0_FIT_PAR = 4;
57  static constexpr int T0_PAR_NR_T0 = 0, T0_PAR_NR_T = 1, T0_PAR_NR_BACK = 2, T0_PAR_NR_A = 3;
59  static constexpr int N_TMAX_FIT_PAR = 6;
61  static constexpr int TMAX_PAR_NR_TMAX = 0, TMAX_PAR_NR_T = 1, TMAX_PAR_NR_BACK = 2, TMAX_PAR_NR_A = 3, TMAX_PAR_NR_B = 4,
63  //---------------------------public member functions----------------------------
69  void Initialize(int id, const T0MTSettings *settings, const char *hname = nullptr);
70 
72  inline TH1F *GetTSpec() const { return m_time.get(); }
73 
79  void SetTSpec(int id, TH1F *spec, const T0MTSettings *settings, bool copy_spec = true);
80 
84  void FillT(double t);
85 
89  bool FitT0();
90 
94  bool FitTmax();
95 
97  inline int Id() const { return m_id; }
98 
100  inline bool T0Ok() const { return m_t0_ok; }
102  inline int StatusCode() const { return m_status_code; }
104  inline const TF1 *GetT0Function() const { return m_t0_fermi.get(); }
106  inline TF1 *GetT0Function() { return m_t0_fermi.get(); }
108  inline bool TmaxOk() const { return m_tmax_ok; }
110  inline const TF1 *GetTMaxFunction() const { return m_tmax_fermi.get(); }
112  inline TF1 *GetTMaxFunctionNC() const { return m_tmax_fermi.get(); }
114  inline const double &T0Chi2() const { return m_chi2; }
115 
116  private:
117  //---------------------------private data members-------------------------------
119  std::unique_ptr<TH1F> m_time{nullptr};
121  int m_id{-1};
123  std::unique_ptr<TF1> m_t0_fermi{nullptr};
125  bool m_t0_ok{false};
127  int m_status_code{99};
129  std::unique_ptr<TF1> m_tmax_fermi{nullptr};
131  double m_tmax_ok{FLT_MAX};
133  TDirectory *m_dir{nullptr};
135  const T0MTSettings *m_settings{nullptr};
137  double m_chi2{FLT_MAX};
139  bool NormalFit();
141  bool T0Scramble();
143  void TopChi2();
145  void TopSlicing();
146  class Slice {
147  public:
148  double chi_2{FLT_MAX};
149  int min_bin{0};
150  int max_bin{0};
151  int n_bins{0};
152  };
153 
154  }; // end class T0MTHistos
155 
156 } // end namespace MuonCalib
157 
158 #endif
MuonCalib::T0MTHistos::FillT
void FillT(double t)
fill drift time spectrum
Definition: T0MTHistos.cxx:56
MuonCalib::T0MTHistos::Id
int Id() const
return tube id
Definition: T0MTHistos.h:97
MuonCalib::T0MTHistos::m_t0_fermi
std::unique_ptr< TF1 > m_t0_fermi
function fitted to the riding edghe of the spectrum
Definition: T0MTHistos.h:123
MuonCalib::T0MTHistos::T0Chi2
const double & T0Chi2() const
returns t0 chi2
Definition: T0MTHistos.h:114
MuonCalib::T0MTHistos::m_dir
TDirectory * m_dir
TDirectory where debug and result histograms are stored.
Definition: T0MTHistos.h:133
T0MTSettings.h
MuonCalib::T0MTHistos::TopChi2
void TopChi2()
top chi2 calculation
Definition: T0MTHistos.cxx:366
MuonCalib::T0MTHistos::N_T0_FIT_PAR
static constexpr int N_T0_FIT_PAR
number of parameters in t0 fit
Definition: T0MTHistos.h:55
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
MuonCalib::T0MTHistos::Slice::min_bin
int min_bin
Definition: T0MTHistos.h:149
MuonCalib::T0MTHistos::m_chi2
double m_chi2
chi2/NDF value
Definition: T0MTHistos.h:137
MuonCalib::T0MTHistos::GetT0Function
const TF1 * GetT0Function() const
returns function fitted to the riding edge of the spectrum
Definition: T0MTHistos.h:104
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonCalib::T0MTHistos::StatusCode
int StatusCode() const
returns status code - the status code applies only to the t0 fit
Definition: T0MTHistos.h:102
MuonCalib::T0MTHistos::GetTSpec
TH1F * GetTSpec() const
get drift time spectrum
Definition: T0MTHistos.h:72
MuonCalib::T0MTHistos::Slice::chi_2
double chi_2
Definition: T0MTHistos.h:148
MuonCalib::T0MTHistos::T0_PAR_NR_T
static constexpr int T0_PAR_NR_T
Definition: T0MTHistos.h:57
MuonCalib::T0MTHistos::m_tmax_fermi
std::unique_ptr< TF1 > m_tmax_fermi
function fitted to the falling edge of the spectrum
Definition: T0MTHistos.h:129
MuonCalib::T0MTHistos::FitTmax
bool FitTmax()
Performs tmax-fit Returns true if fit is successfull.
Definition: T0MTHistos.cxx:142
MuonCalib::T0MTHistos
Definition: T0MTHistos.h:40
MuonCalib::T0MTHistos::T0_PAR_NR_BACK
static constexpr int T0_PAR_NR_BACK
Definition: T0MTHistos.h:57
MuonCalib::T0MTHistos::m_status_code
int m_status_code
status code for t0 fit (0 ok, 1 not fitted, 2 low statistics, 3 failed)
Definition: T0MTHistos.h:127
MuonCalib::T0MTHistos::SetTSpec
void SetTSpec(int id, TH1F *spec, const T0MTSettings *settings, bool copy_spec=true)
set the pointer of the drift-time spectrum to an existing spectrum.
Definition: T0MTHistos.cxx:95
MuonCalib::T0MTHistos::m_t0_ok
bool m_t0_ok
is true if t0 fit was successful
Definition: T0MTHistos.h:125
MuonCalib::T0MTHistos::TMAX_PAR_NR_A
static constexpr int TMAX_PAR_NR_A
Definition: T0MTHistos.h:61
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::T0MTHistos::Initialize
void Initialize(int id, const T0MTSettings *settings, const char *hname=nullptr)
Initialize class.
Definition: T0MTHistos.cxx:61
MuonCalib::T0MTHistos::GetTMaxFunctionNC
TF1 * GetTMaxFunctionNC() const
returns function fitted to the riding edge of the spectrum
Definition: T0MTHistos.h:112
MuonCalib::T0MTHistos::TMAX_PAR_NR_B
static constexpr int TMAX_PAR_NR_B
Definition: T0MTHistos.h:61
MuonCalib::T0MTHistos::TMAX_PAR_NR_T0
static constexpr int TMAX_PAR_NR_T0
Definition: T0MTHistos.h:62
MuonCalib::T0MTHistos::GetT0Function
TF1 * GetT0Function()
returns function fitted to the riding edge of the spectrum
Definition: T0MTHistos.h:106
MuonCalib::T0MTHistos::T0_PAR_NR_T0
static constexpr int T0_PAR_NR_T0
parameter numbers in t0 fit
Definition: T0MTHistos.h:57
MuonCalib::T0MTHistos::T0MTHistos
T0MTHistos(int id, const T0MTSettings *settings, const char *hname=nullptr)
Initializing constructor.
Definition: T0MTHistos.h:50
MuonCalib::T0MTHistos::Slice::n_bins
int n_bins
Definition: T0MTHistos.h:151
MuonCalib::T0MTHistos::m_settings
const T0MTSettings * m_settings
Pointer to settings class.
Definition: T0MTHistos.h:135
MuonCalib::T0MTHistos::Slice::max_bin
int max_bin
Definition: T0MTHistos.h:150
MuonCalib::T0MTHistos::GetTMaxFunction
const TF1 * GetTMaxFunction() const
returns function fitted to the riding edge of the spectrum
Definition: T0MTHistos.h:110
MuonCalib::T0MTHistos::T0Scramble
bool T0Scramble()
try to get better start values from a scrambled histogram
Definition: T0MTHistos.cxx:292
MuonCalib::T0MTHistos::FitT0
bool FitT0()
Perform t0-fit Returns true if fit is successfull.
Definition: T0MTHistos.cxx:114
MuonCalib::T0MTHistos::m_tmax_ok
double m_tmax_ok
is true if tmax fit was successful
Definition: T0MTHistos.h:131
MuonCalib::T0MTHistos::m_time
std::unique_ptr< TH1F > m_time
time spectrum
Definition: T0MTHistos.h:119
MuonCalib::T0MTHistos::T0MTHistos
T0MTHistos()=default
Default Constructor.
MuonCalib::T0MTHistos::T0_PAR_NR_A
static constexpr int T0_PAR_NR_A
Definition: T0MTHistos.h:57
MuonCalib::T0MTHistos::TMAX_PAR_NR_T
static constexpr int TMAX_PAR_NR_T
Definition: T0MTHistos.h:61
MuonCalib::T0MTHistos::m_id
int m_id
tube id;
Definition: T0MTHistos.h:121
TH1F
Definition: rootspy.cxx:320
MuonCalib::T0MTHistos::N_TMAX_FIT_PAR
static constexpr int N_TMAX_FIT_PAR
number of parameters for tmax fit
Definition: T0MTHistos.h:59
MuonCalib::T0MTHistos::TMAX_PAR_NR_TMAX
static constexpr int TMAX_PAR_NR_TMAX
parameters numbers for tmax fit
Definition: T0MTHistos.h:61
MuonCalib::T0MTHistos::TopSlicing
void TopSlicing()
top slicing metyhod
Definition: T0MTHistos.cxx:392
MuonCalib::T0MTHistos::TMAX_PAR_NR_BACK
static constexpr int TMAX_PAR_NR_BACK
Definition: T0MTHistos.h:61
MuonCalib::T0MTHistos::T0Ok
bool T0Ok() const
returns true if t0-fit was successfull
Definition: T0MTHistos.h:100
MuonCalib::T0MTHistos::TmaxOk
bool TmaxOk() const
returns true if tmax-fir was successfull
Definition: T0MTHistos.h:108
MuonCalib::T0MTSettings
Definition: T0MTSettings.h:28
MuonCalib::T0MTHistos::Slice
Definition: T0MTHistos.h:146
MuonCalib::T0MTHistos::NormalFit
bool NormalFit()
normal t0 fit
Definition: T0MTHistos.cxx:212