File indexing completed on 2025-08-06 08:17:40
0001 #ifndef INTT_INTTCLUSTERIZER_H
0002 #define INTT_INTTCLUSTERIZER_H
0003
0004 #include <fun4all/SubsysReco.h>
0005
0006 #include <trackbase/TrkrDefs.h>
0007
0008 #include <limits>
0009 #include <map>
0010 #include <string>
0011 #include <utility>
0012
0013 class ClusHitsVerbosev1;
0014 class PHCompositeNode;
0015 class TrkrHitSetContainer;
0016 class TrkrClusterContainer;
0017 class TrkrClusterHitAssoc;
0018 class TrkrClusterCrossingAssoc;
0019 class TrkrHit;
0020 class RawHit;
0021 class RawHitSetContainer;
0022
0023 class InttClusterizer : public SubsysReco
0024 {
0025 public:
0026 InttClusterizer(const std::string &name = "InttClusterizer",
0027 unsigned int min_layer = 0, unsigned int max_layer = std::numeric_limits<unsigned int>::max());
0028 ~InttClusterizer() override {}
0029
0030
0031 int InitRun(PHCompositeNode *topNode) override;
0032
0033
0034 int process_event(PHCompositeNode *topNode) override;
0035
0036
0037 void set_threshold(const float fraction_of_mip)
0038 {
0039 _fraction_of_mip = fraction_of_mip;
0040 }
0041
0042 float get_threshold_by_layer(const int layer) const
0043 {
0044 if (_thresholds_by_layer.find(layer) == _thresholds_by_layer.end()) return 0.0;
0045 return _thresholds_by_layer.find(layer)->second;
0046 }
0047
0048
0049 void set_z_clustering(const int layer, const bool make_z_clustering)
0050 {
0051 _make_z_clustering.insert(std::make_pair(layer, make_z_clustering));
0052 }
0053
0054 bool get_z_clustering(const int layer) const
0055 {
0056 if (_make_z_clustering.find(layer) == _make_z_clustering.end()) return true;
0057 return _make_z_clustering.find(layer)->second;
0058 }
0059
0060
0061 void set_energy_weighting(const int layer, const bool make_e_weights)
0062 {
0063 _make_e_weights.insert(std::make_pair(layer, make_e_weights));
0064 }
0065
0066 bool get_energy_weighting(const int layer) const
0067 {
0068 if (_make_e_weights.find(layer) == _make_e_weights.end()) return false;
0069 return _make_e_weights.find(layer)->second;
0070 }
0071
0072 void set_do_hit_association(bool do_assoc) { do_hit_assoc = do_assoc; }
0073 void set_read_raw(bool read_raw) { do_read_raw = read_raw; }
0074
0075
0076 void set_ClusHitsVerbose(bool set = true) { record_ClusHitsVerbose = set; };
0077 ClusHitsVerbosev1 *mClusHitsVerbose{nullptr};
0078
0079 private:
0080 bool record_ClusHitsVerbose{false};
0081 bool ladder_are_adjacent(const std::pair<TrkrDefs::hitkey, TrkrHit *> &lhs, const std::pair<TrkrDefs::hitkey, TrkrHit *> &rhs, const int layer);
0082 bool ladder_are_adjacent(RawHit *lhs, RawHit *rhs, const int layer);
0083
0084 void CalculateLadderThresholds(PHCompositeNode *topNode);
0085 void ClusterLadderCells(PHCompositeNode *topNode);
0086 void ClusterLadderCellsRaw(PHCompositeNode *topNode);
0087 void PrintClusters(PHCompositeNode *topNode);
0088
0089
0090 TrkrHitSetContainer *m_hits = nullptr;
0091 RawHitSetContainer *m_rawhits = nullptr;
0092 TrkrClusterContainer *m_clusterlist = nullptr;
0093 TrkrClusterHitAssoc *m_clusterhitassoc = nullptr;
0094 TrkrClusterCrossingAssoc *m_clustercrossingassoc = nullptr;
0095
0096
0097 float _fraction_of_mip = 0.5;
0098 std::map<int, float> _thresholds_by_layer;
0099 std::map<int, bool> _make_z_clustering;
0100 std::map<int, bool> _make_e_weights;
0101 bool do_hit_assoc = true;
0102 bool do_read_raw = false;
0103 };
0104
0105 #endif