|
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/MsgStream.h"
33 std::shared_ptr<const T0MTSettings> settings,
34 const std::vector<int> &sort_by,
35 const std::vector<int> &adc_sort_by) :
42 m_adc_sort_by(adc_sort_by) {
44 std::string HistoFileName =
"T0MT_" +
m_name +
".root";
45 m_file = std::make_unique<TFile>(HistoFileName.c_str(),
"recreate");
65 int nML =
id.mdtMultilayer();
66 int nL =
id.mdtTubeLayer();
67 int nT =
id.mdtTube();
71 std::map<NtupleStationId, MdtTubeFitContainer *>::const_iterator res_it(
m_result.find(sid));
73 const MdtIdHelper& idHelper{res_it->second->idHelperSvc()->mdtIdHelper()};
74 const Identifier tubeId = idHelper.channelID(
id.stationNameString(),
75 id.eta(),
id.phi(), nML, nL, nT);
76 stc = res_it->second->getCalib(tubeId);
83 log << MSG::WARNING <<
"no Single Tube Calib info found for ML=" << nML <<
" L=" << nL <<
" T=" << nT <<
endmsg;
89 histos->GetTSpec()->Fill(hit->driftTime() + oldT0 + hit->tubeT0());
93 adc_histos->
GetADCSpec()->Fill(hit->adcCount());
103 std::map<int, MdtTubeFitContainer::SingleTubeFit>
full;
104 std::map<int, MdtTubeFitContainer::SingleTubeCalib> st;
105 std::map<int, std::string> fit_by;
111 if (
it.first == 0)
continue;
117 fi.group_by = fit_by[
it.first];
123 fId.
eta(), fId.
phi(), nML, nL, nT);
125 bool setInfo =
m_result[sid]->setCalib(std::move(stc), tubeId,
log);
127 log << MSG::WARNING <<
"T0CalibrationMT::PROBLEM! could not set SingleTubeCalib info" <<
endmsg;
134 log << MSG::WARNING <<
"T0CalibrationMT::PROBLEM! could not set SingleTubeFit info" <<
endmsg;
144 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st, std::map<int, std::string> &fit_by_map) {
149 std::string fit_by(
"UNKNOWN");
167 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st) {
181 std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
182 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm, std::map<int, std::string> &fit_by_map,
183 const std::string &fit_by) {
188 if (fit_by ==
"CHAMBER")
190 else if (fit_by ==
"MULTILAYER")
192 else if (fit_by ==
"LAYER")
194 else if (fit_by ==
"MEZZ_CARD")
198 for (
auto tube_id : tube_ids) {
199 if (
tube_id.getIdInt() == 0)
continue;
207 fi.statistics =
static_cast<int>(T0h->
GetTSpec()->GetEntries());
218 fit_by_map[
tube_id.getIdInt()] = fit_by;
224 for (
auto tube_id : tube_ids) {
225 if (
tube_id.getIdInt() == 0)
continue;
230 fi.chi2TdcEnd =
fun->GetChisquare() /
fun->GetNDF();
237 std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
238 std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm) {
241 if (
fun ==
nullptr)
return;
242 for (
auto tube_id : tube_ids) {
243 if (
tube_id.getIdInt() == 0)
continue;
248 for (
int i = 0; (
i <
fun->GetNpar() &&
i < 4);
i++) {
249 fi.adc_par[
i] =
fun->GetParameter(
i);
250 fi.adc_err[
i] =
fun->GetParError(
i);
252 fi.adc_chi2 =
fun->GetChisquare() /
fun->GetNDF();
278 m_histos[nr][
id] = std::make_unique<T0MTHistos>(
id.getIdInt(),
m_settings.get(),
id.HistogramName().c_str());
293 if (!calib_in || !t0Input)
return;
296 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
singleton-like access to IMessageSvc via open function and helper
int m_currentItnum
current iteration (always 1?)
std::shared_ptr< const T0MTSettings > m_settings
pointer to the settings
~T0CalibrationMT()
destructor
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
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
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
static const int MEZZ_CARD
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()
double T0Chi2() const
returns t0 chi2
std::vector< std::map< HistogramId, std::unique_ptr< T0MTHistos > > > m_histos
vector of pointers tube histograms
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
T0CalibrationMT(const std::string &name, std::shared_ptr< const T0MTSettings > settings, const std::vector< int > &sort_by, const std::vector< int > &adc_sort_by)
constructor
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
bool m_converged
convergence status
int mdtTubeLayer() const
Mdt specific:
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s