ATLAS Offline Software
Loading...
Searching...
No Matches
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"
22class TDirectory;
23
24// this
25#include "T0MTSettings.h"
26
27namespace 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 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};
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
static constexpr int T0_PAR_NR_T0
parameter numbers in t0 fit
Definition T0MTHistos.h:57
static constexpr int N_T0_FIT_PAR
number of parameters in t0 fit
Definition T0MTHistos.h:55
static constexpr int TMAX_PAR_NR_TMAX
parameters numbers for tmax fit
Definition T0MTHistos.h:61
TH1F * GetTSpec() const
get drift time spectrum
Definition T0MTHistos.h:72
int StatusCode() const
returns status code - the status code applies only to the t0 fit
Definition T0MTHistos.h:102
static constexpr int TMAX_PAR_NR_T0
Definition T0MTHistos.h:62
bool T0Ok() const
returns true if t0-fit was successfull
Definition T0MTHistos.h:100
TF1 * GetT0Function()
returns function fitted to the riding edge of the spectrum
Definition T0MTHistos.h:106
bool m_t0_ok
is true if t0 fit was successful
Definition T0MTHistos.h:125
T0MTHistos(int id, const T0MTSettings *settings, const char *hname=nullptr)
Initializing constructor.
Definition T0MTHistos.h:50
static constexpr int T0_PAR_NR_T
Definition T0MTHistos.h:57
double m_tmax_ok
is true if tmax fit was successful
Definition T0MTHistos.h:131
static constexpr int TMAX_PAR_NR_T
Definition T0MTHistos.h:61
void Initialize(int id, const T0MTSettings *settings, const char *hname=nullptr)
Initialize class.
std::unique_ptr< TF1 > m_t0_fermi
function fitted to the riding edghe of the spectrum
Definition T0MTHistos.h:123
static constexpr int TMAX_PAR_NR_B
Definition T0MTHistos.h:61
int m_status_code
status code for t0 fit (0 ok, 1 not fitted, 2 low statistics, 3 failed)
Definition T0MTHistos.h:127
bool T0Scramble()
try to get better start values from a scrambled histogram
double T0Chi2() const
returns t0 chi2
Definition T0MTHistos.h:114
static constexpr int TMAX_PAR_NR_BACK
Definition T0MTHistos.h:61
bool FitT0()
Perform t0-fit Returns true if fit is successfull.
bool FitTmax()
Performs tmax-fit Returns true if fit is successfull.
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.
T0MTHistos()=default
Default Constructor.
static constexpr int T0_PAR_NR_A
Definition T0MTHistos.h:57
static constexpr int N_TMAX_FIT_PAR
number of parameters for tmax fit
Definition T0MTHistos.h:59
double m_chi2
chi2/NDF value
Definition T0MTHistos.h:137
const TF1 * GetT0Function() const
returns function fitted to the riding edge of the spectrum
Definition T0MTHistos.h:104
void TopChi2()
top chi2 calculation
bool NormalFit()
normal t0 fit
TDirectory * m_dir
TDirectory where debug and result histograms are stored.
Definition T0MTHistos.h:133
std::unique_ptr< TH1F > m_time
time spectrum
Definition T0MTHistos.h:119
std::unique_ptr< TF1 > m_tmax_fermi
function fitted to the falling edge of the spectrum
Definition T0MTHistos.h:129
const T0MTSettings * m_settings
Pointer to settings class.
Definition T0MTHistos.h:135
static constexpr int TMAX_PAR_NR_A
Definition T0MTHistos.h:61
void TopSlicing()
top slicing metyhod
void FillT(double t)
fill drift time spectrum
int Id() const
return tube id
Definition T0MTHistos.h:97
static constexpr int T0_PAR_NR_BACK
Definition T0MTHistos.h:57
bool TmaxOk() const
returns true if tmax-fir was successfull
Definition T0MTHistos.h:108
TF1 * GetTMaxFunctionNC() const
returns function fitted to the riding edge of the spectrum
Definition T0MTHistos.h:112
const TF1 * GetTMaxFunction() const
returns function fitted to the riding edge of the spectrum
Definition T0MTHistos.h:110
Settings for the T0 calibration (histogram booking and fitting parameters) Parameters for pattern rec...
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.