EIC 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>
8 
9 #include <climits>
10 #include <map>
11 #include <string>
12 #include <utility>
13 
14 class PHCompositeNode;
18 class TrkrHit;
19 
21 {
22  public:
23  InttClusterizer(const std::string &name = "InttClusterizer",
24  unsigned int min_layer = 0, unsigned int max_layer = UINT_MAX);
25  ~InttClusterizer() override {}
26 
28  int Init(PHCompositeNode */*topNode*/) override { return 0; }
29 
31  int InitRun(PHCompositeNode *topNode) override;
32 
34  int process_event(PHCompositeNode *topNode) override;
35 
37  int End(PHCompositeNode */*topNode*/) override { return 0; }
38 
40  void set_threshold(const float fraction_of_mip)
41  {
42  _fraction_of_mip = fraction_of_mip;
43  }
44  float get_threshold_by_layer(const int layer) const
45  {
46  if (_thresholds_by_layer.find(layer) == _thresholds_by_layer.end()) return 0.0;
47  return _thresholds_by_layer.find(layer)->second;
48  }
49 
51  void set_z_clustering(const int layer, const bool make_z_clustering)
52  {
53  _make_z_clustering.insert(std::make_pair(layer, make_z_clustering));
54  }
55  bool get_z_clustering(const int layer) const
56  {
57  if (_make_z_clustering.find(layer) == _make_z_clustering.end()) return true;
58  return _make_z_clustering.find(layer)->second;
59  }
60 
62  void set_energy_weighting(const int layer, const bool make_e_weights)
63  {
64  _make_e_weights.insert(std::make_pair(layer, make_e_weights));
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  private:
73  bool ladder_are_adjacent(const std::pair<TrkrDefs::hitkey, TrkrHit*> &lhs, const std::pair<TrkrDefs::hitkey, TrkrHit*> &rhs, const int layer);
74 
76  void ClusterLadderCells(PHCompositeNode *topNode);
77  void PrintClusters(PHCompositeNode *topNode);
78 
79  // node tree storage pointers
83 
84  // settings
86  std::map<int, float> _thresholds_by_layer; // layer->threshold
87  std::map<int, bool> _make_z_clustering; // layer->z_clustering_option
88  std::map<int, bool> _make_e_weights; // layer->energy_weighting_option
89 
90 };
91 
92 #endif