![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/MsgStream.h"
34 const std::vector<int> &adc_sort_by) :
41 m_adc_sort_by(adc_sort_by),
42 m_delete_settings(false) {
48 std::string HistoFileName =
"T0MT_" +
m_name +
".root";
49 m_file = std::make_unique<TFile>(HistoFileName.c_str(),
"recreate");
70 int nML =
id.mdtMultilayer();
71 int nL =
id.mdtTubeLayer();
72 int nT =
id.mdtTube();
76 std::map<NtupleStationId, MdtTubeFitContainer *>::const_iterator res_it(
m_result.find(sid));
78 const MdtIdHelper& idHelper{res_it->second->idHelperSvc()->mdtIdHelper()};
79 const Identifier tubeId = idHelper.channelID(
id.stationNameString(),
80 id.
eta(),
id.
phi(), nML, nL, nT);
81 stc = res_it->second->getCalib(tubeId);
88 log << MSG::WARNING <<
"no Single Tube Calib info found for ML=" << nML <<
" L=" << nL <<
" T=" << nT <<
endmsg;
94 histos->GetTSpec()->Fill(hit->driftTime() + oldT0 + hit->tubeT0());
98 adc_histos->
GetADCSpec()->Fill(hit->adcCount());
108 std::map<int, MdtTubeFitContainer::SingleTubeFit>
full;
109 std::map<int, MdtTubeFitContainer::SingleTubeCalib> st;
110 std::map<int, std::string> fit_by;
116 if (
it.first == 0)
continue;
122 fi.group_by = fit_by[
it.first];
128 fId.
eta(), fId.
phi(), nML, nL, nT);
130 bool setInfo =
m_result[sid]->setCalib(std::move(stc), tubeId,
log);
132 log << MSG::WARNING <<
"T0CalibrationMT::PROBLEM! could not set SingleTubeCalib info" <<
endmsg;
139 log << MSG::WARNING <<
"T0CalibrationMT::PROBLEM! could not set SingleTubeFit info" <<
endmsg;
149 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st, std::map<int, std::string> &fit_by_map) {
154 std::string fit_by(
"UNKNOWN");
172 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st) {
186 std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
187 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm, std::map<int, std::string> &fit_by_map,
188 const std::string &fit_by) {
193 if (fit_by ==
"CHAMBER")
195 else if (fit_by ==
"MULTILAYER")
197 else if (fit_by ==
"LAYER")
199 else if (fit_by ==
"MEZZ_CARD")
203 for (
auto tube_id : tube_ids) {
204 if (
tube_id.getIdInt() == 0)
continue;
212 fi.statistics =
static_cast<int>(T0h->
GetTSpec()->GetEntries());
223 fit_by_map[
tube_id.getIdInt()] = fit_by;
229 for (
auto tube_id : tube_ids) {
230 if (
tube_id.getIdInt() == 0)
continue;
235 fi.chi2TdcEnd =
fun->GetChisquare() /
fun->GetNDF();
242 std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
243 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm) {
246 if (
fun ==
nullptr)
return;
247 for (
auto tube_id : tube_ids) {
248 if (
tube_id.getIdInt() == 0)
continue;
253 for (
int i = 0; (
i <
fun->GetNpar() &&
i < 4);
i++) {
254 fi.adc_par[
i] =
fun->GetParameter(
i);
255 fi.adc_err[
i] =
fun->GetParError(
i);
257 fi.adc_chi2 =
fun->GetChisquare() /
fun->GetNDF();
283 m_histos[nr][
id] = std::make_unique<T0MTHistos>(
id.getIdInt(),
m_settings,
id.HistogramName().c_str());
298 if (!calib_in || !t0Input)
return;
301 it.second->setImplementation(
"T0CalibrationMT");
JetConstituentVector::iterator iterator
float t0
< relative t0 in chamber (ns)
std::shared_ptr< IMdtCalibrationOutput > MdtCalibOutputPtr
std::map< NtupleStationId, MdtTubeFitContainer * > m_result
tube constants
std::unique_ptr< TFile > m_file
pointer to the histogram file
void SetMultilayer(const int &ml)
std::vector< std::map< HistogramId, std::set< MuonFixedId > > > m_adc_tube_ids
const double & T0Chi2() const
returns t0 chi2
const int & MinEntriesADC() const
Scalar phi() const
phi method
singleton-like access to IMessageSvc via open function and helper
int m_currentItnum
current iteration (always 1?)
const int & MinEntriesTime() const
Scalar eta() const
pseudorapidity method
~T0CalibrationMT()
destructor
const bool & CorrectRelT0s() const
int mdtMultilayer() const
Mdt specific:
virtual IMdtCalibration::MdtCalibOutputPtr getResults() const override
const TF1 * GetT0Function() const
returns function fitted to the riding edge of the spectrum
std::map< int, int > m_nhits_per_tube
number of hits per tube
const T0MTSettingsT0 * T0Settings() const
get settings for the t0-fit
bool analyse_adc(const int &nr, std::map< int, MdtTubeFitContainer::SingleTubeFit > &full, std::map< int, MdtTubeFitContainer::SingleTubeCalib > &st)
int StatusCode() const
returns status code - the status code applies only to the t0 fit
TH1F * GetTSpec() const
get drift time spectrum
IMessageSvc * getMessageSvc(bool quiet=false)
void doAdcFit(ADCMTHistos *T0h, const std::set< MuonFixedId > &tube_ids, std::map< int, MdtTubeFitContainer::SingleTubeFit > &fim, std::map< int, MdtTubeFitContainer::SingleTubeCalib > &stcm)
fit adc spectrum
std::string stationNameString() const
const std::vector< int > & m_sort_by
static constexpr int T0_PAR_NR_T
bool FitTmax()
Performs tmax-fit Returns true if fit is successfull.
bool handleSegment(MuonCalibSegment &seg)
fill tube spectra
T0CalibrationMT(const std::string &name, const T0MTSettings *settings, const std::vector< int > &sort_by, const std::vector< int > &adc_sort_by)
constructor
void doTimeFit(T0MTHistos *T0h, const std::set< MuonFixedId > &tube_ids, std::map< int, MdtTubeFitContainer::SingleTubeFit > &fim, std::map< int, MdtTubeFitContainer::SingleTubeCalib > &stcm, std::map< int, std::string > &fit_by_map, const std::string &fit_by)
fit time spectrum
static constexpr int T0_PAR_NR_BACK
std::vector< std::map< HistogramId, std::unique_ptr< ADCMTHistos > > > m_adc_histos
vector of pointers tube histograms
const bool & FitADC() const
if true fit adc spectrum
static const int MEZZ_CARD
const int & VerboseLevel() const
verbose level 0: no output 1: Fitter output
unsigned int getIdInt() const
bool converged() const
return m_converged
std::vector< std::map< HistogramId, std::set< MuonFixedId > > > m_tube_ids
ADCMTHistos * getADCHistos(const MuonFixedId &idtube, unsigned int nr)
retrieve pointer for tube idtube histograms
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
const std::vector< int > & m_adc_sort_by
virtual IMdtCalibration::MdtCalibOutputPtr analyseSegments(const MuonSegVec &segs) override
new interface function
std::map< NtupleStationId, MdtTubeFitContainer * > & GetMap()
std::vector< std::map< HistogramId, std::unique_ptr< T0MTHistos > > > m_histos
vector of pointers tube histograms
const bool & FitTime() const
if true fit drift time spectrum
static constexpr int T0_PAR_NR_T0
parameter numbers in t0 fit
float adcCal
quality flag for the SingleTubeCalib constants: 0 all ok, 1 no hits found, 2 too few hits,...
std::string m_name
calibration region name
static const int TUBE
valid values of the sort_by argument of the Initialize function
TH1F * GetADCSpec()
get adc spectrum
T0MTHistos * getHistos(const MuonFixedId &idtube, unsigned int nr)
retrieve pointer for tube idtube histograms
const TF1 * GetTMaxFunction() const
returns function fitted to the riding edge of the spectrum
void setInput(const IMdtCalibrationOutput *input) override
unused
bool FitT0()
Perform t0-fit Returns true if fit is successfull.
bool analyse()
extract parameters from spectra
TDirectory * m_regiondir
pointer to the ROOT directory
std::map< NtupleStationId, MdtRelativeTubeT0 > m_rel_tube_t0s
TF1 * GetAdcFunction() const
returnd function fitted to adc-spectrum
static const int MULTILAYER
bool analyse_tdc(const int &nr, std::map< int, MdtTubeFitContainer::SingleTubeFit > &full, std::map< int, MdtTubeFitContainer::SingleTubeCalib > &st, std::map< int, std::string > &fit_by_map)
static constexpr int TMAX_PAR_NR_TMAX
parameters numbers for tmax fit
int mdtTube() const
Mdt specific:
std::vector< std::shared_ptr< MuonCalibSegment > > MuonSegVec
const MdtHitVec & mdtHOT() const
retrieve the full set of MdtCalibHitBase s assigned to this segment
const T0MTSettings * m_settings
pointer to the settings
bool m_converged
convergence status
int mdtTubeLayer() const
Mdt specific:
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s