ATLAS Offline Software
T0CalibrationMT.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef T0CALIBRATIONMT_H
6 #define T0CALIBRATIONMT_H
7 
8 #include <iostream>
9 #include <map>
10 #include <set>
11 #include <string>
12 #include <vector>
13 #include <memory>
17 
18 class TH1;
19 class TFile;
20 class TDirectory;
21 
22 namespace MuonCalib {
23 
24  class MuonCalibSegment;
25  class IMdtCalibrationOutput;
26  class MuonFixedId;
27  class T0MTSettings;
28  class T0MTHistos;
29  class T0ADCHistos;
30  class ADCMTHistos;
31  class HistogramId;
32  class MdtRelativeTubeT0;
33 
41  public:
48  T0CalibrationMT(const std::string& name,
49  std::shared_ptr<const T0MTSettings> settings,
50  const std::vector<int> &sort_by,
51  const std::vector<int> &adc_sort_by);
52 
55 
56  bool handleSegment(MuonCalibSegment &seg);
57 
58  void setInput(const IMdtCalibrationOutput *input) override;
59 
60  bool analyse();
61 
62  bool converged() const;
63 
66  virtual IMdtCalibration::MdtCalibOutputPtr getResults() const override;
67 
68  virtual IMdtCalibration::MdtCalibOutputPtr analyseSegments(const MuonSegVec &segs) override;
69 
70  private:
71  T0MTHistos *getHistos(const MuonFixedId &idtube, unsigned int nr);
72  ADCMTHistos *getADCHistos(const MuonFixedId &idtube, unsigned int nr);
73  bool analyse_tdc(const int &nr, std::map<int, MdtTubeFitContainer::SingleTubeFit> &full,
74  std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st, std::map<int, std::string> &fit_by_map);
75  bool analyse_adc(const int &nr, std::map<int, MdtTubeFitContainer::SingleTubeFit> &full,
76  std::map<int, MdtTubeFitContainer::SingleTubeCalib> &st);
77 
78  void doTimeFit(T0MTHistos *T0h, const std::set<MuonFixedId> &tube_ids, std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
79  std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm, std::map<int, std::string> &fit_by_map,
80  const std::string &fit_by);
81 
82  void doAdcFit(ADCMTHistos *T0h, const std::set<MuonFixedId> &tube_ids, std::map<int, MdtTubeFitContainer::SingleTubeFit> &fim,
83  std::map<int, MdtTubeFitContainer::SingleTubeCalib> &stcm);
84 
85  std::shared_ptr<const T0MTSettings> m_settings;
86  bool m_converged;
87  std::string m_name;
89  std::unique_ptr<TFile> m_file;
90  TDirectory *m_regiondir;
91 
92  std::vector<std::map<HistogramId, std::unique_ptr<T0MTHistos>>> m_histos;
93  std::vector<std::map<HistogramId, std::unique_ptr<ADCMTHistos>>> m_adc_histos;
94  std::vector<std::map<HistogramId, std::set<MuonFixedId>>> m_tube_ids;
95  std::vector<std::map<HistogramId, std::set<MuonFixedId>>> m_adc_tube_ids;
96  std::map<int, int> m_nhits_per_tube;
97  std::map<NtupleStationId, MdtTubeFitContainer *> m_result;
98  std::map<NtupleStationId, MdtRelativeTubeT0> m_rel_tube_t0s;
99  const std::vector<int> &m_sort_by;
100  const std::vector<int> &m_adc_sort_by;
101 
102  // hidden assignment operator and copy constructor
103  T0CalibrationMT &operator=(const T0CalibrationMT &right) = delete;
104  T0CalibrationMT(const T0CalibrationMT &) = delete;
105  };
106 } // namespace MuonCalib
107 
108 #endif
MuonCalib::IMdtCalibration::MdtCalibOutputPtr
std::shared_ptr< IMdtCalibrationOutput > MdtCalibOutputPtr
Definition: IMdtCalibration.h:30
MuonCalib::T0CalibrationMT::m_result
std::map< NtupleStationId, MdtTubeFitContainer * > m_result
tube constants
Definition: T0CalibrationMT.h:97
MuonCalib::T0CalibrationMT::m_file
std::unique_ptr< TFile > m_file
pointer to the histogram file
Definition: T0CalibrationMT.h:89
MuonCalib::T0CalibrationMT::m_adc_tube_ids
std::vector< std::map< HistogramId, std::set< MuonFixedId > > > m_adc_tube_ids
Definition: T0CalibrationMT.h:95
MuonCalib::T0CalibrationMT::m_currentItnum
int m_currentItnum
current iteration (always 1?)
Definition: T0CalibrationMT.h:88
MuonCalib::T0CalibrationMT::m_settings
std::shared_ptr< const T0MTSettings > m_settings
pointer to the settings
Definition: T0CalibrationMT.h:85
MuonCalib::T0CalibrationMT::~T0CalibrationMT
~T0CalibrationMT()
destructor
Definition: T0CalibrationMT.cxx:55
MuonCalib::IMdtCalibration
Definition: IMdtCalibration.h:25
MuonCalib::MuonCalibSegment
Definition: MuonCalibSegment.h:39
MuonCalib::T0CalibrationMT::getResults
virtual IMdtCalibration::MdtCalibOutputPtr getResults() const override
Definition: T0CalibrationMT.cxx:257
MdtTubeFitContainer.h
MuonCalib::T0CalibrationMT::m_nhits_per_tube
std::map< int, int > m_nhits_per_tube
number of hits per tube
Definition: T0CalibrationMT.h:96
MuonCalib::T0CalibrationMT::analyse_adc
bool analyse_adc(const int &nr, std::map< int, MdtTubeFitContainer::SingleTubeFit > &full, std::map< int, MdtTubeFitContainer::SingleTubeCalib > &st)
Definition: T0CalibrationMT.cxx:166
NtupleStationId.h
MuonCalib::T0CalibrationMT::doAdcFit
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
Definition: T0CalibrationMT.cxx:236
MuonCalib::T0CalibrationMT::m_sort_by
const std::vector< int > & m_sort_by
Definition: T0CalibrationMT.h:99
MuonCalib::T0CalibrationMT::operator=
T0CalibrationMT & operator=(const T0CalibrationMT &right)=delete
MuonCalib::T0CalibrationMT::handleSegment
bool handleSegment(MuonCalibSegment &seg)
fill tube spectra
Definition: T0CalibrationMT.cxx:60
MuonCalib::T0MTHistos
Definition: T0MTHistos.h:40
MuonCalib::T0CalibrationMT::doTimeFit
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
Definition: T0CalibrationMT.cxx:180
MuonCalib::T0CalibrationMT::m_adc_histos
std::vector< std::map< HistogramId, std::unique_ptr< ADCMTHistos > > > m_adc_histos
vector of pointers tube histograms
Definition: T0CalibrationMT.h:93
MuonCalib::T0CalibrationMT::converged
bool converged() const
return m_converged
Definition: T0CalibrationMT.cxx:299
MuonCalib::T0CalibrationMT::m_tube_ids
std::vector< std::map< HistogramId, std::set< MuonFixedId > > > m_tube_ids
Definition: T0CalibrationMT.h:94
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
MuonCalib::T0CalibrationMT::getADCHistos
ADCMTHistos * getADCHistos(const MuonFixedId &idtube, unsigned int nr)
retrieve pointer for tube idtube histograms
Definition: T0CalibrationMT.cxx:259
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::T0CalibrationMT::m_adc_sort_by
const std::vector< int > & m_adc_sort_by
Definition: T0CalibrationMT.h:100
MuonCalib::T0CalibrationMT::analyseSegments
virtual IMdtCalibration::MdtCalibOutputPtr analyseSegments(const MuonSegVec &segs) override
new interface function
Definition: T0CalibrationMT.cxx:174
MuonCalib::T0CalibrationMT::m_histos
std::vector< std::map< HistogramId, std::unique_ptr< T0MTHistos > > > m_histos
vector of pointers tube histograms
Definition: T0CalibrationMT.h:92
MuonCalib::ADCMTHistos
Definition: ADCMTHistos.h:44
MuonCalib::IMdtCalibration::name
virtual std::string name() const
returns name (region) of instance
Definition: IMdtCalibration.h:49
MuonCalib::T0CalibrationMT::m_name
std::string m_name
calibration region name
Definition: T0CalibrationMT.h:87
MuonCalib::T0CalibrationMT::T0CalibrationMT
T0CalibrationMT(const T0CalibrationMT &)=delete
MuonCalib::T0CalibrationMT::getHistos
T0MTHistos * getHistos(const MuonFixedId &idtube, unsigned int nr)
retrieve pointer for tube idtube histograms
Definition: T0CalibrationMT.cxx:272
MuonCalib::T0CalibrationMT::setInput
void setInput(const IMdtCalibrationOutput *input) override
unused
Definition: T0CalibrationMT.cxx:285
IMdtCalibration.h
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
MuonCalib::T0CalibrationMT::T0CalibrationMT
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
Definition: T0CalibrationMT.cxx:32
MuonCalib::IMdtCalibrationOutput
Definition: IMdtCalibrationOutput.h:28
find_data.full
full
Definition: find_data.py:27
MuonCalib::T0CalibrationMT::analyse
bool analyse()
extract parameters from spectra
Definition: T0CalibrationMT.cxx:101
MuonCalib::T0CalibrationMT
Definition: T0CalibrationMT.h:40
MuonCalib::T0CalibrationMT::m_regiondir
TDirectory * m_regiondir
pointer to the ROOT directory
Definition: T0CalibrationMT.h:90
MuonCalib::T0CalibrationMT::m_rel_tube_t0s
std::map< NtupleStationId, MdtRelativeTubeT0 > m_rel_tube_t0s
Definition: T0CalibrationMT.h:98
MuonCalib::T0CalibrationMT::analyse_tdc
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)
Definition: T0CalibrationMT.cxx:143
MuonCalib::IMdtCalibration::MuonSegVec
std::vector< std::shared_ptr< MuonCalibSegment > > MuonSegVec
Definition: IMdtCalibration.h:27
MuonCalib::T0CalibrationMT::m_converged
bool m_converged
convergence status
Definition: T0CalibrationMT.h:86