ATLAS Offline Software
Loading...
Searching...
No Matches
T0CalibrationClassic.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#ifndef T0CALIBRATIONCLASSIC_H
6#define T0CALIBRATIONCLASSIC_H
7
8#include <TF1.h>
9#include <TFile.h>
10#include <TH1.h>
11#include <TH2.h>
12
13#include <iostream>
14#include <vector>
15
17#include "GaudiKernel/MsgStream.h"
21
22namespace MuonCalib {
23
24 class MuonCalibSegment;
26
31 public:
33 T0ClassicSettings(double minAdc, double maxAdc, int adcBins, double minTime, double maxTime, int timeBins, bool fitTime,
34 int minEntries, int initParam, int numParams, std::array<double, 8> fitParams, double chiMax, int printLevel) :
37 m_binAdc(adcBins),
40 m_binTime(timeBins),
42 m_entries(minEntries),
43 m_initParamFlag(initParam),
45 m_params(fitParams),
46 m_chi2max(chiMax),
48
50 double minAdc() const { return m_minAdc; };
52 double maxAdc() const { return m_maxAdc; };
54 int binAdc() const { return m_binAdc; };
56 double minTime() const { return m_minTime; };
58 double maxTime() const { return m_maxTime; };
60 int binTime() const { return m_binTime; };
62 bool fitTime() const { return m_fitTime; };
64 int entries() const { return m_entries; };
67 int initParamFlag() const { return m_initParamFlag; };
69 int numParams() const { return m_numParams; };
71 const std::array<double, 8>& params() const { return m_params; };
73 double chi2max() const { return m_chi2max; };
75 int printLevel() const { return m_printLevel; };
77 void print() const {
78 MsgStream log(Athena::getMessageSvc(), "T0ClassicSettings");
79 log << MSG::INFO << "T0ClassicSettings: " << endmsg;
80 log << MSG::INFO << "booking of Adc histos: min max bins " << minAdc() << " " << maxAdc() << " " << binAdc() << endmsg;
81 log << MSG::INFO << "booking of Time histos: min max bins " << minTime() << " " << maxTime() << " " << binTime() << endmsg;
82 log << MSG::INFO << "fitting of Time histos: active minentries paramflag chi2cut nparams" << fitTime() << " " << entries()
83 << " " << initParamFlag() << " " << chi2max() << " " << numParams() << endmsg;
84 log << MSG::INFO << "Parameters: " << endmsg;
85 for (int i = 0; i < numParams(); i++) { log << MSG::INFO << m_params[i] << endmsg; }
86 };
87
88 private:
90 double m_minAdc;
91 double m_maxAdc;
93 double m_minTime;
94 double m_maxTime;
96 bool m_fitTime;
100 std::array<double, 8> m_params;
101 double m_chi2max;
103 }; // end class T0ClassicSettings
104
109 public:
110 std::unique_ptr<TH1> time{nullptr};
111 std::unique_ptr<TH1> adc{nullptr};
112 // TH2* adc_vs_time;
113 int id;
114 };
115
120 public:
125 T0CalibrationClassic(const std::string& name, const T0ClassicSettings* settings);
128
130 void setInput(const IMdtCalibrationOutput* input) override;
131 bool analyse();
132 bool converged() const;
133
135 virtual MdtCalibOutputPtr getResults() const override;
136 virtual MdtCalibOutputPtr analyseSegments(const MuonSegVec& segs) override;
137
138 private:
139 T0ClassicHistos* bookHistos(unsigned int idtube);
140 T0ClassicHistos* getHistos(unsigned int idtube);
144 void searchParams(TH1* h, double* p, int np);
147 std::string m_name;
149 std::unique_ptr<TFile> m_file{};
150 TDirectory* m_regiondir;
151
152 std::vector<std::unique_ptr<T0ClassicHistos>> m_histos;
153 std::unique_ptr<MdtTubeFitContainer> m_result;
155
156 // hidden assignment operator and copy constructor
159 }; // end class T0CalibrationClassic
160} // namespace MuonCalib
161
162#endif
#define endmsg
Header file for AthHistogramAlgorithm.
Interface to pass calibration output during calibration.
IMdtCalibration(const std::string &name)
constructor, string used to identify the instance
virtual std::string name() const
returns name (region) of instance
std::shared_ptr< IMdtCalibrationOutput > MdtCalibOutputPtr
std::vector< std::shared_ptr< MuonCalibSegment > > MuonSegVec
A MuonCalibSegment is a reconstructed three dimensional track segment in the MuonSpectrometer.
std::string m_name
calibration region name
int m_currentItnum
current iteration (always 1?)
std::unique_ptr< TFile > m_file
pointer to the histogram file
virtual MdtCalibOutputPtr analyseSegments(const MuonSegVec &segs) override
new interface function
bool handleSegment(MuonCalibSegment &seg)
fill tube spectra
virtual MdtCalibOutputPtr getResults() const override
void setInput(const IMdtCalibrationOutput *input) override
unused
void searchParams(TH1 *h, double *p, int np)
estimate initial parameters for time spectrum fit from the spectrum itself
const T0ClassicSettings * m_settings
pointer to the settings
std::unique_ptr< MdtTubeFitContainer > m_result
tube constants
T0CalibrationClassic(const T0CalibrationClassic &)=delete
bool converged() const
return m_converged (always false?)
TDirectory * m_regiondir
pointer to the ROOT directory
std::vector< std::unique_ptr< T0ClassicHistos > > m_histos
vector of pointers to tube histograms
void doAdcFit(T0ClassicHistos &, MdtTubeFitContainer::SingleTubeFit &, MdtTubeFitContainer::SingleTubeCalib &)
fit adc spectrum
void doTimeFit(T0ClassicHistos &, MdtTubeFitContainer::SingleTubeFit &, MdtTubeFitContainer::SingleTubeCalib &)
fit time spectrum
T0ClassicHistos * getHistos(unsigned int idtube)
retrieve pointer for tube idtube histograms
T0CalibrationClassic(const std::string &name, const T0ClassicSettings *settings)
constructor
T0ClassicHistos * bookHistos(unsigned int idtube)
booking of histograms
bool analyse()
extract parameters from spectra
T0CalibrationClassic & operator=(const T0CalibrationClassic &right)=delete
Tube histograms used in T0 calibration.
std::unique_ptr< TH1 > adc
adc spectrum
std::unique_ptr< TH1 > time
time spectrum
Settings for the T0 calibration (histogram booking and fitting parameters)
double m_maxAdc
Adc spectrum high edge.
const std::array< double, 8 > & params() const
int m_numParams
number of paramaters for spectrum fit
int m_initParamFlag
fix or search initial parameters for spectrum fit
int m_entries
minimum number of entries per spectrum fitting
double m_maxTime
Time spectrum high edge.
T0ClassicSettings(double minAdc, double maxAdc, int adcBins, double minTime, double maxTime, int timeBins, bool fitTime, int minEntries, int initParam, int numParams, std::array< double, 8 > fitParams, double chiMax, int printLevel)
constructor
std::array< double, 8 > m_params
initial parameters for spectrum fit
void print() const
a method to dump all the settings
bool m_fitTime
flag to select or deselect the fit to Time Spectra
int m_binAdc
Adc spectrum number of bins.
double m_minAdc
Private settings.
double m_minTime
Time spectrum low edge.
int m_printLevel
output level flag (1 for verbose)
double m_chi2max
normalized chi2 cut
int m_binTime
Time spectrum number of bins.
double minAdc() const
Access functions to values of private settings.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.