ATLAS Offline Software
Functions
T0Fit.cxx File Reference
#include <TString.h>
#include "MdtCalibT0/T0MTHistos.h"
#include "TClass.h"
#include "TDirectory.h"
#include "TFile.h"
#include "TH1.h"
#include "TKey.h"
#include "TObject.h"
#include "TROOT.h"
#include "cstdlib"
#include "iostream"
#include "string"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 21 of file T0Fit.cxx.

21  {
22  // check command line arguments
23  if (argc != 3) {
24  throw std::runtime_error(
25  Form("File: %s, Line: %d\nT0Fit::main() - Usage: %s <input file> <output file>!", __FILE__, __LINE__, argv[0]));
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();
52  fitter.SetTSpec(n, hist, &settings);
53  n++;
54  if (fitter.FitT0()) { fitter.FitTmax(); }
55  }
56  }
57  outfile.Write();
58 }
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
run.infile
string infile
Definition: run.py:13
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
plotmaker.hist
hist
Definition: plotmaker.py:148
MuonCalib::T0MTHistos
Definition: T0MTHistos.h:40
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
beamspotman.n
n
Definition: beamspotman.py:731
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
beamspotman.dir
string dir
Definition: beamspotman.py:623
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
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
python.PyAthena.obj
obj
Definition: PyAthena.py:132
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
MuonCalib::T0MTSettings
Definition: T0MTSettings.h:28
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37