Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InttClusterizer.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InttClusterizer.h
1 #ifndef INTT_INTTCLUSTERIZER_H
2 #define INTT_INTTCLUSTERIZER_H
3 
4 #include <fun4all/SubsysReco.h>
5 
6 #include <trackbase/TrkrDefs.h>
7 
8 #include <climits>
9 #include <map>
10 #include <string>
11 #include <utility>
12 
13 class ClusHitsVerbosev1;
14 class PHCompositeNode;
19 class TrkrHit;
20 class RawHit;
21 class RawHitSetContainer;
22 
24 {
25  public:
26  InttClusterizer(const std::string &name = "InttClusterizer",
27  unsigned int min_layer = 0, unsigned int max_layer = UINT_MAX);
28  ~InttClusterizer() override {}
29 
31  int InitRun(PHCompositeNode *topNode) override;
32 
34  int process_event(PHCompositeNode *topNode) override;
35 
37  void set_threshold(const float fraction_of_mip)
38  {
39  _fraction_of_mip = fraction_of_mip;
40  }
41 
42  float get_threshold_by_layer(const int layer) const
43  {
44  if (_thresholds_by_layer.find(layer) == _thresholds_by_layer.end()) return 0.0;
45  return _thresholds_by_layer.find(layer)->second;
46  }
47 
49  void set_z_clustering(const int layer, const bool make_z_clustering)
50  {
51  _make_z_clustering.insert(std::make_pair(layer, make_z_clustering));
52  }
53 
54  bool get_z_clustering(const int layer) const
55  {
56  if (_make_z_clustering.find(layer) == _make_z_clustering.end()) return true;
57  return _make_z_clustering.find(layer)->second;
58  }
59 
61  void set_energy_weighting(const int layer, const bool make_e_weights)
62  {
63  _make_e_weights.insert(std::make_pair(layer, make_e_weights));
64  }
65 
66  bool get_energy_weighting(const int layer) const
67  {
68  if (_make_e_weights.find(layer) == _make_e_weights.end()) return false;
69  return _make_e_weights.find(layer)->second;
70  }
71 
72  void set_do_hit_association(bool do_assoc) { do_hit_assoc = do_assoc; }
73  void set_read_raw(bool read_raw) { do_read_raw = read_raw; }
74 
75  // for saving verbose clusters
76  void set_ClusHitsVerbose(bool set = true) { record_ClusHitsVerbose = set; };
78 
79  private:
81  bool ladder_are_adjacent(const std::pair<TrkrDefs::hitkey, TrkrHit *> &lhs, const std::pair<TrkrDefs::hitkey, TrkrHit *> &rhs, const int layer);
82  bool ladder_are_adjacent(RawHit *lhs, RawHit *rhs, const int layer);
83 
85  void ClusterLadderCells(PHCompositeNode *topNode);
87  void PrintClusters(PHCompositeNode *topNode);
88 
89  // node tree storage pointers
95 
96  // settings
97  float _fraction_of_mip = 0.5;
98  std::map<int, float> _thresholds_by_layer; // layer->threshold
99  std::map<int, bool> _make_z_clustering; // layer->z_clustering_option
100  std::map<int, bool> _make_e_weights; // layer->energy_weighting_option
101  bool do_hit_assoc = true;
102  bool do_read_raw = false;
103 };
104 
105 #endif