![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
#include <T0MTHistos.h>
Histogram and fitter class for drift time and pulsehight spectra The rising slope is fitted by a fermi-function: \(f(t)=r_{u,0} + \frac{A}{1+exp((t_0 - t)/T_0}\). The falling slope is fitted by \(g(t)=r_{u,max} + \frac{e(t,a,b)}{1+exp((t_{max} - t)/T_{max}}\) where \(e(t, a, b) = a e^{bt}\). A pattern recognition determines the fit ranges and the parameters \(r_u\), \(A\), \(a\) and \(b\).
- Author
- Felix.nosp@m..Rau.nosp@m.scher.nosp@m.@Phy.nosp@m.sik.U.nosp@m.ni-M.nosp@m.uench.nosp@m.en.D.nosp@m.e
- Date
- June 2006
}
Definition at line 40 of file T0MTHistos.h.
◆ T0MTHistos() [1/2]
MuonCalib::T0MTHistos::T0MTHistos |
( |
| ) |
|
|
default |
◆ T0MTHistos() [2/2]
Initializing constructor.
- Parameters
-
id | tube id |
settings | t0-fit settings: settings will be asked about histogram binning |
Definition at line 50 of file T0MTHistos.h.
◆ FillT()
void MuonCalib::T0MTHistos::FillT |
( |
double |
t | ) |
|
fill drift time spectrum
- Parameters
-
Definition at line 56 of file T0MTHistos.cxx.
56 {
m_time->Fill(
static_cast<Axis_t
>(
t)); }
◆ FitT0()
bool MuonCalib::T0MTHistos::FitT0 |
( |
| ) |
|
Perform t0-fit Returns true if fit is successfull.
Definition at line 114 of file T0MTHistos.cxx.
115 if (
m_time->GetEntries() < 1000) {
120 if (
m_time->GetEntries() < 10000) {
◆ FitTmax()
bool MuonCalib::T0MTHistos::FitTmax |
( |
| ) |
|
Performs tmax-fit Returns true if fit is successfull.
Definition at line 142 of file T0MTHistos.cxx.
147 log << MSG::WARNING <<
"T0MTHistos::FitTmax: Class is not initialized!" <<
endmsg;
155 log << MSG::WARNING <<
"T0MTHistos::FitTmax for tube " <<
m_id <<
": No valid t0-value!" <<
endmsg;
161 MTTmaxPatternRecognition rec;
165 log << MSG::WARNING <<
"T0MTHistos::FitTmax for tube " <<
m_id <<
": Pattern recognition failed!" <<
endmsg;
172 snprintf(
buffer, 100,
"mt_tmax_fermi");
191 if (
m_dir !=
nullptr) {
196 std::string fitopt(
"LR");
◆ GetT0Function() [1/2]
TF1* MuonCalib::T0MTHistos::GetT0Function |
( |
| ) |
|
|
inline |
returns function fitted to the riding edge of the spectrum
Definition at line 106 of file T0MTHistos.h.
◆ GetT0Function() [2/2]
const TF1* MuonCalib::T0MTHistos::GetT0Function |
( |
| ) |
const |
|
inline |
returns function fitted to the riding edge of the spectrum
Definition at line 104 of file T0MTHistos.h.
◆ GetTMaxFunction()
const TF1* MuonCalib::T0MTHistos::GetTMaxFunction |
( |
| ) |
const |
|
inline |
returns function fitted to the riding edge of the spectrum
Definition at line 110 of file T0MTHistos.h.
◆ GetTMaxFunctionNC()
TF1* MuonCalib::T0MTHistos::GetTMaxFunctionNC |
( |
| ) |
const |
|
inline |
returns function fitted to the riding edge of the spectrum
Definition at line 112 of file T0MTHistos.h.
◆ GetTSpec()
TH1F* MuonCalib::T0MTHistos::GetTSpec |
( |
| ) |
const |
|
inline |
◆ Id()
int MuonCalib::T0MTHistos::Id |
( |
| ) |
const |
|
inline |
◆ Initialize()
void MuonCalib::T0MTHistos::Initialize |
( |
int |
id, |
|
|
const T0MTSettings * |
settings, |
|
|
const char * |
hname = nullptr |
|
) |
| |
Initialize class.
- Parameters
-
id | tube id |
settings | t0-fit settings: settings will be asked about histogram binning |
Definition at line 61 of file T0MTHistos.cxx.
69 snprintf(buf, 100,
"t_spec_%d",
id);
71 snprintf(buf, 100,
"t_spec_%s",
hname);
75 m_time = std::make_unique<TH1F>(buf,
"", settings->NBinsTime(), settings->TimeMin(), settings->TimeMax());
77 if (settings->DrawDebugGraphs()) {
82 snprintf(buf, 100,
"t0_tmax_dir_%d",
id);
◆ NormalFit()
bool MuonCalib::T0MTHistos::NormalFit |
( |
| ) |
|
|
private |
normal t0 fit
Definition at line 212 of file T0MTHistos.cxx.
224 log << MSG::WARNING <<
"T0MTHistos::FitT0: Class is not initialized!" <<
endmsg;
231 MTT0PatternRecognition rec;
238 log << MSG::WARNING <<
"T0MTHistos::FitT0 for tube " <<
m_id <<
": Pattern recognition failed!" <<
endmsg;
247 snprintf(
buffer, 100,
"mt_t0_fermi");
262 if (
m_dir !=
nullptr) {
263 std::unique_ptr<TLine>
ln = std::make_unique<TLine>(rec.GetFitRangeMin(), 0, rec.GetFitRangeMin(),
m_time->GetMaximum());
264 ln->Write(
"t0_range_min");
265 ln = std::make_unique<TLine>(rec.GetFitRangeMax(), 0, rec.GetFitRangeMax(),
m_time->GetMaximum());
266 ln->Write(
"t0_range_max");
271 std::string fitopt(
"BLR");
278 m_time->Fit(
m_t0_fermi.get(), fitopt.c_str(),
"", rec.GetFitRangeMin(), rec.GetFitRangeMax());
282 m_chi2 =
m_time->GetFunction(
"mt_t0_fermi")->GetChisquare() /
m_time->GetFunction(
"mt_t0_fermi")->GetNDF();
◆ SetTSpec()
void MuonCalib::T0MTHistos::SetTSpec |
( |
int |
id, |
|
|
TH1F * |
spec, |
|
|
const T0MTSettings * |
settings, |
|
|
bool |
copy_spec = true |
|
) |
| |
set the pointer of the drift-time spectrum to an existing spectrum.
This is for testapps
- Parameters
-
id | tube id |
spec | Pointer to an existing spectrum |
Definition at line 95 of file T0MTHistos.cxx.
103 if (settings->DrawDebugGraphs()) {
105 snprintf(
buffer, 100,
"t0_tmax_dir_%d",
id);
◆ StatusCode()
int MuonCalib::T0MTHistos::StatusCode |
( |
| ) |
const |
|
inline |
returns status code - the status code applies only to the t0 fit
Definition at line 102 of file T0MTHistos.h.
◆ T0Chi2()
const double& MuonCalib::T0MTHistos::T0Chi2 |
( |
| ) |
const |
|
inline |
◆ T0Ok()
bool MuonCalib::T0MTHistos::T0Ok |
( |
| ) |
const |
|
inline |
returns true if t0-fit was successfull
Definition at line 100 of file T0MTHistos.h.
◆ T0Scramble()
bool MuonCalib::T0MTHistos::T0Scramble |
( |
| ) |
|
|
private |
try to get better start values from a scrambled histogram
Definition at line 292 of file T0MTHistos.cxx.
297 std::string fitopt(
"BLR");
305 char scramhistname[100];
306 snprintf(scramhistname, 100,
"%s_scram",
m_time->GetName());
307 std::unique_ptr<TH1F> scramhist = std::make_unique<TH1F>(scramhistname,
"scrambled histogram",
m_time->GetSize() - 2,
308 m_time->GetXaxis()->GetXmin(),
m_time->GetXaxis()->GetXmax());
310 for (
int binnr = 0; binnr <
m_time->GetSize(); binnr++) {
312 scramhist->SetBinError(binnr,
m_time->GetBinError(binnr) * 1.41421356);
317 MTT0PatternRecognition scramrec;
319 if (!scramrec.Initialize(scramhist.get(),
m_settings)) {
323 log << MSG::WARNING <<
"T0MTHistos::FitT0 for tube " <<
m_id <<
": Scrambed pattern recognition failed!" <<
endmsg;
327 char scrambuffer[100];
328 snprintf(scrambuffer, 100,
"scrammt_t0_fermi");
329 std::unique_ptr<TF1> scramm_t0_fermi = std::make_unique<TF1>();
331 scramm_t0_fermi->SetName(scrambuffer);
332 scramm_t0_fermi->SetRange(scramrec.GetFitRangeMin(), scramrec.GetFitRangeMax());
339 scramm_t0_fermi->FixParameter(
T0_PAR_NR_BACK, scramrec.GetBackground());
340 scramm_t0_fermi->SetParameter(
T0_PAR_NR_A, scramrec.GetHeight() - scramrec.GetBackground());
342 scramm_t0_fermi->SetParameter(
T0_PAR_NR_T0, scramrec.GetEstimatedT0());
346 scramhist->Fit(scrambuffer, fitopt.c_str(),
"", scramrec.GetFitRangeMin(), scramrec.GetFitRangeMax());
348 m_time->GetListOfFunctions()->Clear();
356 m_time->GetListOfFunctions()->Clear();
357 m_time->Fit(
"mt_t0_fermi", fitopt.c_str(),
"", scramrec.GetFitRangeMin(), scramrec.GetFitRangeMax());
361 m_chi2 =
m_time->GetFunction(
"mt_t0_fermi")->GetChisquare() /
m_time->GetFunction(
"mt_t0_fermi")->GetNDF();
◆ TmaxOk()
bool MuonCalib::T0MTHistos::TmaxOk |
( |
| ) |
const |
|
inline |
returns true if tmax-fir was successfull
Definition at line 108 of file T0MTHistos.h.
◆ TopChi2()
void MuonCalib::T0MTHistos::TopChi2 |
( |
| ) |
|
|
private |
top chi2 calculation
Definition at line 366 of file T0MTHistos.cxx.
370 TF1 *t0_fermi =
m_time->GetFunction(
"mt_t0_fermi");
372 t0_fermi->GetRange(
min,
max);
375 for (
int bin = startbin;
bin < endbin;
bin++) {
376 float measval =
m_time->GetBinContent(
bin);
377 float funcval = t0_fermi->Eval(
m_time->GetBinCenter(
bin));
380 if (measval < 10 && funcval < 10 &&
384 m_chi2 += (measval - funcval) * (measval - funcval);
386 m_chi2 += (measval - funcval) * (measval - funcval) / (errval * errval);
◆ TopSlicing()
void MuonCalib::T0MTHistos::TopSlicing |
( |
| ) |
|
|
private |
top slicing metyhod
Definition at line 392 of file T0MTHistos.cxx.
398 std::list<Slice> slice_chi2;
402 TF1 *t0_fermi =
m_time->GetFunction(
"mt_t0_fermi");
405 t0_fermi->GetRange(
min,
max);
421 double measval =
m_time->GetBinContent(
bin);
422 double funcval = t0_fermi->Eval(
m_time->GetBinCenter(
bin));
423 double errval =
m_time->GetBinError(
bin);
436 if (
it == slice_chi2.begin()) {
442 }
while (
it->chi_2 /
static_cast<double>(
it->n_bins) > 3);
444 m_time->GetListOfFunctions()->Clear();
445 std::string fitopt(
"BLR");
452 m_time->Fit(
"mt_t0_fermi", fitopt.c_str(),
"",
min,
max);
456 m_chi2 =
m_time->GetFunction(
"mt_t0_fermi")->GetChisquare() /
m_time->GetFunction(
"mt_t0_fermi")->GetNDF();
◆ m_chi2
double MuonCalib::T0MTHistos::m_chi2 {FLT_MAX} |
|
private |
◆ m_dir
TDirectory* MuonCalib::T0MTHistos::m_dir {nullptr} |
|
private |
TDirectory where debug and result histograms are stored.
Definition at line 133 of file T0MTHistos.h.
◆ m_id
int MuonCalib::T0MTHistos::m_id {-1} |
|
private |
◆ m_settings
◆ m_status_code
int MuonCalib::T0MTHistos::m_status_code {99} |
|
private |
status code for t0 fit (0 ok, 1 not fitted, 2 low statistics, 3 failed)
Definition at line 127 of file T0MTHistos.h.
◆ m_t0_fermi
std::unique_ptr<TF1> MuonCalib::T0MTHistos::m_t0_fermi {nullptr} |
|
private |
function fitted to the riding edghe of the spectrum
Definition at line 123 of file T0MTHistos.h.
◆ m_t0_ok
bool MuonCalib::T0MTHistos::m_t0_ok {false} |
|
private |
is true if t0 fit was successful
Definition at line 125 of file T0MTHistos.h.
◆ m_time
std::unique_ptr<TH1F> MuonCalib::T0MTHistos::m_time {nullptr} |
|
private |
◆ m_tmax_fermi
std::unique_ptr<TF1> MuonCalib::T0MTHistos::m_tmax_fermi {nullptr} |
|
private |
function fitted to the falling edge of the spectrum
Definition at line 129 of file T0MTHistos.h.
◆ m_tmax_ok
double MuonCalib::T0MTHistos::m_tmax_ok {FLT_MAX} |
|
private |
is true if tmax fit was successful
Definition at line 131 of file T0MTHistos.h.
◆ N_T0_FIT_PAR
constexpr int MuonCalib::T0MTHistos::N_T0_FIT_PAR = 4 |
|
staticconstexpr |
number of parameters in t0 fit
Definition at line 55 of file T0MTHistos.h.
◆ N_TMAX_FIT_PAR
constexpr int MuonCalib::T0MTHistos::N_TMAX_FIT_PAR = 6 |
|
staticconstexpr |
number of parameters for tmax fit
Definition at line 59 of file T0MTHistos.h.
◆ T0_PAR_NR_A
constexpr int MuonCalib::T0MTHistos::T0_PAR_NR_A = 3 |
|
static |
◆ T0_PAR_NR_BACK
constexpr int MuonCalib::T0MTHistos::T0_PAR_NR_BACK = 2 |
|
static |
◆ T0_PAR_NR_T
constexpr int MuonCalib::T0MTHistos::T0_PAR_NR_T = 1 |
|
static |
◆ T0_PAR_NR_T0
constexpr int MuonCalib::T0MTHistos::T0_PAR_NR_T0 = 0 |
|
staticconstexpr |
parameter numbers in t0 fit
Definition at line 57 of file T0MTHistos.h.
◆ TMAX_PAR_NR_A
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_A = 3 |
|
static |
◆ TMAX_PAR_NR_B
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_B = 4 |
|
static |
◆ TMAX_PAR_NR_BACK
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_BACK = 2 |
|
static |
◆ TMAX_PAR_NR_T
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_T = 1 |
|
static |
◆ TMAX_PAR_NR_T0
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_T0 = 5 |
|
static |
◆ TMAX_PAR_NR_TMAX
constexpr int MuonCalib::T0MTHistos::TMAX_PAR_NR_TMAX = 0 |
|
staticconstexpr |
parameters numbers for tmax fit
Definition at line 61 of file T0MTHistos.h.
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
const double & ScrambleThreshold() const
the chi2 threshold at which the scrambling method is used
std::unique_ptr< TF1 > m_t0_fermi
function fitted to the riding edghe of the spectrum
double GetBinContent(int) const
TDirectory * m_dir
TDirectory where debug and result histograms are stored.
void TopChi2()
top chi2 calculation
static constexpr int N_T0_FIT_PAR
number of parameters in t0 fit
Double_t mt_t0_fermi(Double_t *x, Double_t *par)
The fermi function to be fitted at the rising edge of the spectrum.
const bool & UseTopChi2() const
If true use only the top part of the function for the chi2 calculation.
Int_t FindBin(const TAxis *axis, const double x)
TRandom3 * getTLSRandomGen()
double m_chi2
chi2/NDF value
const T0MTSettingsT0 * T0Settings() const
get settings for the t0-fit
const double & SlicingThreshold() const
the chi2 threshold at which the slicing method is used
IMessageSvc * getMessageSvc(bool quiet=false)
static constexpr int T0_PAR_NR_T
std::unique_ptr< TF1 > m_tmax_fermi
function fitted to the falling edge of the spectrum
static constexpr int T0_PAR_NR_BACK
int m_status_code
status code for t0 fit (0 ok, 1 not fitted, 2 low statistics, 3 failed)
const int & VerboseLevel() const
verbose level 0: no output 1: Fitter output
bool m_t0_ok
is true if t0 fit was successful
static constexpr int TMAX_PAR_NR_A
void Initialize(int id, const T0MTSettings *settings, const char *hname=nullptr)
Initialize class.
void SetBinContent(int, double)
static constexpr int TMAX_PAR_NR_B
static constexpr int TMAX_PAR_NR_T0
static constexpr int T0_PAR_NR_T0
parameter numbers in t0 fit
const T0MTSettings * m_settings
Pointer to settings class.
bool T0Scramble()
try to get better start values from a scrambled histogram
double m_tmax_ok
is true if tmax fit was successful
std::unique_ptr< TH1F > m_time
time spectrum
const bool & AddFitfun() const
If set to true the fitted functions are added to the histograms.
static constexpr int T0_PAR_NR_A
static constexpr int TMAX_PAR_NR_T
static constexpr int N_TMAX_FIT_PAR
number of parameters for tmax fit
Double_t mt_tmax_fermi(Double_t *x, Double_t *par)
The fermi function to be fitted at the trailing slope of the spectrum.
static constexpr int TMAX_PAR_NR_TMAX
parameters numbers for tmax fit
void TopSlicing()
top slicing metyhod
static constexpr int TMAX_PAR_NR_BACK
bool NormalFit()
normal t0 fit