ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawClusterBuilderTopo.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawClusterBuilderTopo.h
1 #ifndef CALORECO_RAWCLUSTERTOPO_H
2 #define CALORECO_RAWCLUSTERTOPO_H
3 
4 //===========================================================
8 //===========================================================
9 
10 #include <fun4all/SubsysReco.h>
11 
12 #include <string>
13 #include <vector>
14 #include <map>
15 #include <utility> // for pair
16 
17 class PHCompositeNode;
20 
22 {
23  public:
24  RawClusterBuilderTopo(const std::string &name = "RawClusterBuilderTopo");
25  ~RawClusterBuilderTopo() override {}
26 
27  int InitRun(PHCompositeNode *topNode) override;
28  int process_event(PHCompositeNode *topNode) override;
29  int End(PHCompositeNode *topNode) override;
30 
31  void set_nodename( const std::string &nodename ) {
32 
33  ClusterNodeName = nodename;
34 
35  }
36 
37  void set_noise( float noise_0 = 0.0025, float noise_1 = 0.006, float noise_2 = 0.03) {
38 
39  _noise_LAYER[ 0 ] = noise_0;
40  _noise_LAYER[ 1 ] = noise_1;
41  _noise_LAYER[ 2 ] = noise_2;
42 
43  }
44 
45  void set_significance( float seed, float grow, float peri ) {
46 
47  _sigma_seed = seed;
48  _sigma_grow = grow;
49  _sigma_peri = peri;
50 
51  }
52 
53  void allow_corner_neighbor( bool allow ) {
54 
55  _allow_corner_neighbor = allow;
56 
57  }
58 
59  void set_enable_HCal( bool enable_HCal ) {
60 
61  _enable_HCal = enable_HCal;
62 
63  }
64 
65  void set_enable_EMCal( bool enable_EMCal ) {
66 
67  _enable_EMCal = enable_EMCal;
68 
69  }
70 
71  void set_do_split( bool do_split ) {
72 
73  _do_split = do_split;
74 
75  }
76 
77  void set_minE_local_max( float minE_0 = 1, float minE_1 = 1, float minE_2 = 1) {
78 
79  _local_max_minE_LAYER[0] = minE_0;
80  _local_max_minE_LAYER[1] = minE_1;
81  _local_max_minE_LAYER[2] = minE_2;
82 
83  }
84 
85  void set_R_shower( float R_shower ) {
86 
87  _R_shower = R_shower;
88 
89  }
90 
91  private:
92 
93  void CreateNodes(PHCompositeNode *topNode);
94 
95  std::vector< std::vector< std::vector<float> > > _TOWERMAP_E_LAYER_ETA_PHI;
96  std::vector< std::vector< std::vector<int> > > _TOWERMAP_KEY_LAYER_ETA_PHI;
97  std::vector< std::vector< std::vector<int> > > _TOWERMAP_STATUS_LAYER_ETA_PHI;
98 
99  std::vector< std::vector<float> > _EMTOWERMAP_E_ETA_PHI;
100  std::vector< std::vector<int> > _EMTOWERMAP_KEY_ETA_PHI;
101  std::vector< std::vector<int> > _EMTOWERMAP_STATUS_ETA_PHI;
102 
103  // geometric constants to express IHCal<->EMCal overlap in eta
105 
107 
109 
110  // geometric parameters defined at runtime
113 
116 
117  // utility functions to express IHCal<->EMCal overlap in phi
118  int get_first_matching_EMCal_phi_from_IHCal( int index_hcal_phi ) {
119  return ( (68 + 4 * ( index_hcal_phi - 32) + _EMCAL_NPHI ) % _EMCAL_NPHI );
120  }
121 
122  int get_matching_HCal_phi_from_EMCal( int index_emcal_phi ) {
123  return ( (32 + ( index_emcal_phi - 68 + _EMCAL_NPHI ) / 4 ) % _HCAL_NPHI );
124  }
125 
126  std::vector<int> get_adjacent_towers_by_ID( int ID );
127 
128  float calculate_dR( float, float, float, float );
129 
130  void export_single_cluster(std::vector<int>);
131 
132  void export_clusters(std::vector<int>, std::map< int, std::pair<int,int> >, unsigned int, std::vector<float>, std::vector<float>, std::vector<float> );
133 
134  int get_ID( int ilayer, int ieta, int iphi ) {
135  if ( ilayer < 2 ) return ilayer * _HCAL_NETA * _HCAL_NPHI + ieta * _HCAL_NPHI + iphi;
136  else return _EMCAL_NPHI * _EMCAL_NETA + ieta * _EMCAL_NPHI + iphi;
137  }
138 
139  int get_ilayer_from_ID( int ID ) {
140  if ( ID < _EMCAL_NPHI * _EMCAL_NETA ) return ( (int) ( ID / ( _HCAL_NETA * _HCAL_NPHI ) ) );
141  else return 2;
142  }
143 
144  int get_ieta_from_ID( int ID ) {
145  if ( ID < _EMCAL_NPHI * _EMCAL_NETA ) return ( (int) ( ( ID % ( _HCAL_NETA * _HCAL_NPHI ) ) / ( _HCAL_NPHI ) ) );
146  else return ( (int) ( ( ID - _EMCAL_NPHI * _EMCAL_NETA ) / _EMCAL_NPHI ) );
147  }
148 
149  int get_iphi_from_ID( int ID ) {
150  if ( ID < _EMCAL_NPHI * _EMCAL_NETA ) return ( (int) ( ID % _HCAL_NPHI ) );
151  else return ( (int) ( ( ID - _EMCAL_NPHI * _EMCAL_NETA ) % _EMCAL_NPHI ) );
152  }
153 
154  int get_status_from_ID( int ID ) {
156  else return _EMTOWERMAP_STATUS_ETA_PHI[ get_ieta_from_ID( ID ) ][ get_iphi_from_ID( ID ) ];
157  }
158 
159  float get_E_from_ID( int ID ) {
161  else return _EMTOWERMAP_E_ETA_PHI[ get_ieta_from_ID( ID ) ][ get_iphi_from_ID( ID ) ];
162  }
163 
164  void set_status_by_ID( int ID , int status ) {
166  else _EMTOWERMAP_STATUS_ETA_PHI[ get_ieta_from_ID( ID ) ][ get_iphi_from_ID( ID ) ] = status;
167  }
168 
170 
172 
173  float _noise_LAYER[3];
174 
175  float _sigma_seed;
176  float _sigma_grow;
177  float _sigma_peri;
178 
180 
183 
184  bool _do_split;
186  float _R_shower;
187 
188  std::string ClusterNodeName;
189 };
190 
191 #endif