ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibT0
exe
T0Fit.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <TString.h>
// for Form
6
7
#include "
MdtCalibT0/T0MTHistos.h
"
8
#include "TClass.h"
9
#include "TDirectory.h"
10
#include "TFile.h"
11
#include "TH1.h"
12
#include "TKey.h"
13
#include "TObject.h"
14
#include "TROOT.h"
15
#include <cstdlib>
16
#include <iostream>
17
#include <string>
18
19
using namespace
MuonCalib
;
20
21
int
main
(
int
argc,
char
*argv[]) {
22
// check command line arguments
23
if
(argc != 3) {
24
std::cerr << Form(
"File: %s, Line: %d\nT0Fit::main() - Usage: %s <input file> <output file>!"
, __FILE__, __LINE__, argv[0]);
25
return
1;
26
}
27
28
TROOT wurscht(
"wurscht"
,
"wurscht"
);
29
TFile infile(argv[1]);
30
TDirectory *dir = &infile;
31
TFile outfile(argv[2],
"RECREATE"
);
32
T0MTSettings
settings;
33
settings.
AddFitfun
() =
true
;
34
settings.
DrawDebugGraphs
() =
true
;
35
if
(!dir) {
36
throw
std::runtime_error(
37
Form(
"File: %s, Line: %d\nT0Fit::main() - Cannot find TDirectory 'MT_t0_fitter' in file %s!"
, __FILE__, __LINE__, argv[1]));
38
}
39
// loop on all histograms
40
TIter nextkey(dir->GetListOfKeys());
41
TKey *key;
42
int
n = 0;
43
while
((key = (TKey *)nextkey())) {
44
TObject *obj = key->ReadObj();
45
if
(obj->IsA()->InheritsFrom(
"TH1F"
)) {
46
TH1F *hist =
dynamic_cast<
TH1F *
>
(obj);
47
if
(hist == NULL)
continue
;
48
string
hname = hist->GetName();
49
if
(hname ==
"t_spec_Summary"
)
continue
;
50
hist->GetListOfFunctions()->Clear();
51
T0MTHistos
fitter;
52
fitter.SetTSpec(n, hist, &settings);
53
n++;
54
if
(fitter.FitT0()) { fitter.FitTmax(); }
55
}
56
}
57
outfile.Write();
58
}
T0MTHistos.h
MuonCalib::T0MTHistos
Histogram and fitter class for drift time and pulsehight spectra The rising slope is fitted by a ferm...
Definition
T0MTHistos.h:40
MuonCalib::T0MTSettings
Settings for the T0 calibration (histogram booking and fitting parameters) Parameters for pattern rec...
Definition
T0MTSettings.h:28
MuonCalib::T0MTSettings::AddFitfun
const bool & AddFitfun() const
If set to true the fitted functions are added to the histograms.
Definition
T0MTSettings.h:63
MuonCalib::T0MTSettings::DrawDebugGraphs
const bool & DrawDebugGraphs() const
If set to true for every tube a TDirectory will be created.
Definition
T0MTSettings.h:60
main
int main()
Definition
hello.cxx:18
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition
CscCalcPed.cxx:21
Generated on
for ATLAS Offline Software by
1.17.0