File indexing completed on 2025-12-17 09:19:57
0001
0002
0003 #ifndef CALOTOWERSTATUS_H
0004 #define CALOTOWERSTATUS_H
0005
0006 #include "CaloTowerDefs.h"
0007
0008 #include <calobase/TowerInfoContainer.h> // for TowerInfoContainer, TowerIn...
0009
0010 #include <fun4all/SubsysReco.h>
0011
0012 #include <iostream>
0013 #include <string>
0014 #include <vector>
0015
0016 class CDBTTree;
0017 class PHCompositeNode;
0018 class TowerInfoContainer;
0019
0020 class CaloTowerStatus : public SubsysReco
0021 {
0022 public:
0023 CaloTowerStatus(const std::string &name = "CaloTowerStatus");
0024
0025 ~CaloTowerStatus() override;
0026
0027 int InitRun(PHCompositeNode *topNode) override;
0028 int process_event(PHCompositeNode *topNode) override;
0029 void CreateNodeTree(PHCompositeNode *topNode);
0030
0031 void set_detector_type(CaloTowerDefs::DetectorSystem dettype)
0032 {
0033 m_dettype = dettype;
0034 return;
0035 }
0036 void set_inputNodePrefix(const std::string &name)
0037 {
0038 m_inputNodePrefix = name;
0039 return;
0040 }
0041 void set_badChi2_const_threshold(float threshold)
0042 {
0043 badChi2_treshold_const = threshold;
0044 return;
0045 }
0046 void set_badChi2_quadratic_threshold(float threshold)
0047 {
0048 badChi2_treshold_quadratic = threshold;
0049 return;
0050 }
0051 void set_fraction_badChi2_threshold(float threshold)
0052 {
0053 fraction_badChi2_threshold = threshold;
0054 return;
0055 }
0056 void set_badChi2_max_threshold(float threshold)
0057 {
0058 badChi2_treshold_max = threshold;
0059 return;
0060 }
0061 void set_z_score_threshold(float threshold)
0062 {
0063 z_score_threshold = threshold;
0064 return;
0065 }
0066 void set_time_cut(float threshold)
0067 {
0068 time_cut = threshold;
0069 return;
0070 }
0071 void set_directURL_hotMap(const std::string &str)
0072 {
0073 m_directURL_hotMap = str;
0074 use_directURL_hotMap = true;
0075 return;
0076 }
0077 void set_directURL_time(const std::string &str)
0078 {
0079 m_directURL_time = str;
0080 use_directURL_time = true;
0081 return;
0082 }
0083 void set_directURL_chi2(const std::string &str)
0084 {
0085 m_directURL_chi2 = str;
0086 use_directURL_chi2 = true;
0087 return;
0088 }
0089 void set_doAbortNoHotMap(bool status = true)
0090 {
0091 m_doAbortNoHotMap = status;
0092 return;
0093 }
0094
0095 private:
0096 TowerInfoContainer *m_raw_towers{nullptr};
0097
0098 CDBTTree *m_cdbttree_chi2{nullptr};
0099 CDBTTree *m_cdbttree_time{nullptr};
0100 CDBTTree *m_cdbttree_hotMap{nullptr};
0101
0102 bool m_doHotChi2{true};
0103 bool m_doTime{true};
0104 bool m_doHotMap{true};
0105 bool m_doAbortNoHotMap{false};
0106
0107 CaloTowerDefs::DetectorSystem m_dettype{CaloTowerDefs::DETECTOR_INVALID};
0108
0109 std::string m_detector;
0110 std::string m_fieldname_time;
0111 std::string m_calibName_time;
0112 std::string m_fieldname_chi2;
0113 std::string m_calibName_chi2;
0114 std::string m_fieldname_hotMap;
0115 std::string m_fieldname_z_score;
0116 std::string m_calibName_hotMap;
0117 std::string m_inputNodePrefix{"TOWERS_"};
0118
0119 std::string m_directURL_time;
0120 std::string m_directURL_hotMap;
0121 std::string m_directURL_chi2;
0122 bool use_directURL_time{false};
0123 bool use_directURL_hotMap{false};
0124 bool use_directURL_chi2{false};
0125
0126 float badChi2_treshold_const = {1e4};
0127 float badChi2_treshold_quadratic = {1./100};
0128 float badChi2_treshold_max = {1e8};
0129 float fraction_badChi2_threshold = {0.01};
0130 float z_score_threshold = {5};
0131 float z_score_threshold_default = {5};
0132 float time_cut = 2;
0133
0134 void LoadCalib();
0135
0136 struct CDBInfo
0137 {
0138 float fraction_badChi2{0};
0139 float mean_time{0};
0140 float z_score{0};
0141 int hotMap_val{0};
0142 };
0143
0144 std::vector<CDBInfo> m_cdbInfo_vec;
0145 };
0146
0147 #endif