File indexing completed on 2026-08-31 08:20:41
0001
0002
0003 #ifndef CALOTOWERTIMECALIBRATION_H
0004 #define CALOTOWERTIMECALIBRATION_H
0005
0006 #include <caloreco/CaloTowerDefs.h>
0007
0008 #include <fun4all/SubsysReco.h>
0009
0010 #include <string>
0011 #include <vector>
0012
0013 class CDBTTree;
0014 class PHCompositeNode;
0015 class TH1;
0016 class TH2;
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 class CaloTowerTimeCalibration : public SubsysReco
0058 {
0059 public:
0060 explicit CaloTowerTimeCalibration(
0061 const std::string &name = "CaloTowerTimeCalibration");
0062 ~CaloTowerTimeCalibration() override;
0063
0064 CaloTowerTimeCalibration(const CaloTowerTimeCalibration &) = delete;
0065
0066 CaloTowerTimeCalibration &operator=(const CaloTowerTimeCalibration &) = delete;
0067
0068 CaloTowerTimeCalibration(CaloTowerTimeCalibration &&) = delete;
0069
0070 CaloTowerTimeCalibration &operator=(CaloTowerTimeCalibration &&) = delete;
0071
0072
0073 int InitRun(PHCompositeNode *topNode) override;
0074 int process_event(PHCompositeNode *topNode) override;
0075
0076 void set_detector_type(CaloTowerDefs::DetectorSystem detector)
0077 {
0078 m_detectorType = detector;
0079 }
0080
0081 void set_inputNodePrefix(const std::string &prefix)
0082 {
0083 m_inputNodePrefix = prefix;
0084 }
0085
0086 void set_outputNodePrefix(const std::string &prefix)
0087 {
0088 m_outputNodePrefix = prefix;
0089 }
0090
0091 void set_inputNodeName(const std::string &name)
0092 {
0093 m_inputNodeName = name;
0094 }
0095
0096 void set_outputNodeName(const std::string &name)
0097 {
0098 m_outputNodeName = name;
0099 }
0100
0101 void set_meanTimeCalibName(const std::string &name)
0102 {
0103 m_meanTimeCalibName = name;
0104 }
0105
0106 void set_timeCorrectionCalibName(const std::string &name)
0107 {
0108 m_timeCorrectionCalibName = name;
0109 }
0110
0111 void set_directURL_timeCorrection(const std::string &url)
0112 {
0113 m_directTimeCorrectionURL = url;
0114 }
0115
0116 void set_directURL_meanTime(const std::string &url)
0117 {
0118 m_directMeanTimeURL = url;
0119 }
0120
0121 void set_doQA(bool value = true)
0122 {
0123 m_doQA = value;
0124 }
0125
0126
0127 void set_qaEnergyThreshold(float value)
0128 {
0129 m_qaEnergyThreshold = value;
0130 }
0131
0132 private:
0133 struct TimingInfo
0134 {
0135 float meanTime{0.0F};
0136 float phase1Shift{0.0F};
0137 float sectorOffset{0.0F};
0138 float towerOffset{0.0F};
0139 float slewP0{0.0F};
0140 float slewP1{0.0F};
0141 float slewP2{0.0F};
0142 bool valid{false};
0143 };
0144
0145 struct TowerQASet
0146 {
0147 TH1 *hStandardTime{nullptr};
0148 TH1 *hCorrectedTime{nullptr};
0149 TH2 *hStandardEnergyVsTime{nullptr};
0150 TH2 *hCorrectedEnergyVsTime{nullptr};
0151 };
0152
0153 bool ResolveDetector();
0154 void ResolveNames();
0155 void CreateNodeTree(PHCompositeNode *topNode);
0156 void LoadCalibration(PHCompositeNode *topNode);
0157 void CreateQAHistograms();
0158
0159 CaloTowerDefs::DetectorSystem m_detectorType{CaloTowerDefs::HCALOUT};
0160 std::string m_detector{"HCALOUT"};
0161
0162 std::string m_inputNodePrefix{"TOWERINFO_CALIB_"};
0163 std::string m_outputNodePrefix{"TOWERINFO_CALIB_TIMING_"};
0164 std::string m_inputNodeName;
0165 std::string m_outputNodeName;
0166
0167 std::string m_meanTimeCalibName;
0168 std::string m_timeCorrectionCalibName;
0169
0170 std::string m_directMeanTimeURL;
0171 std::string m_directTimeCorrectionURL;
0172
0173 bool m_calibrationAvailable{false};
0174
0175 CDBTTree *m_meanTimeCDB{nullptr};
0176 CDBTTree *m_timeCorrectionCDB{nullptr};
0177 std::vector<TimingInfo> m_timingInfo;
0178
0179 bool m_doQA{false};
0180 bool m_qaHistogramsInitialized{false};
0181 float m_qaEnergyThreshold;
0182
0183
0184 TH1 *m_hZSTime{nullptr};
0185 TH1 *m_hZSEnergy{nullptr};
0186 TH2 *m_hZSEnergyVsTime{nullptr};
0187
0188
0189 TowerQASet m_qaAllTowers;
0190
0191
0192 TowerQASet m_qaGoodTowers;
0193 };
0194
0195 #endif