Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawTowerCombiner.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawTowerCombiner.h
1 #ifndef CALORECO_RAWTOWERCOMBINER_H
2 #define CALORECO_RAWTOWERCOMBINER_H
3 
4 #include <fun4all/SubsysReco.h>
5 
6 #include <string>
7 
8 class PHCompositeNode;
10 
14 /*
15 ## Introduction
16 
17 A new tower analysis module to enable analysis of sPHENIX simulation to use multi-tower ganging of EMCal readout. For example 2x2-ganging as proposed for some CEMC de-scoping options.
18 
19 Technically, a new module ```RawTowerCombiner``` is introduced to combine MxN towers into one readout channel on an eta-phi tower grid exiting on the DST tree. Therefore, it needs to be called after ```RawTowerBuilder``` and before ```RawTowerDigitizer```. During the merging, truth structure (Cells and showers) is maintained. In the default mode, both RawTower and RawTowerGeometry are edited on the DST tree, rather than introducing a new node for combined towers. I found this is least intrusive to our analysis code base.
20 
21 If one need to use this module for ALD charge (e.g. photon position resolution, jet finding, etc.), please contact me directly, in order to speed up verification and feedback.
22 
23 ## Verification
24 
25 The single particle simulation in the 2016-02-01 Geant4 production (```/sphenix/sim/sim01/production/2016-02-01```) was used for testing.
26 
27 One example is distance between best CEMC cluster from the trajectory projection of 24 GeV/c electrons. Green reference plot is default towering and blue curve is after 2x2 ganging. The ganged distribution is roughly twice wider while the central value remain zeroed.
28 <img width="194" alt="2x2test" src="https://cloud.githubusercontent.com/assets/7947083/15116941/546e3fd2-15d3-11e6-8a19-3e720c302ddd.png">
29 Note: here cluster position is calculated with simple energy weighted average, without more sophisticated discretization corrections.
30 
31 ## Example macros
32 
33 By default, this new module is NOT used in analysis and no ganging is applied.
34 
35 Example macro to enabling 2x2 ganging as proposed for some de-scoping otpions: https://github.com/blackcathj/macros/blob/EMCal2x2/macros/g4simulations/G4_CEmc_Spacal.C
36 Or specifically these lines added:
37 
38 \code
39 
40 void CEMC_Towers(int verbosity = 0) {
41  ...
42  // TowerBuilder
43  ...
44 
45  // Make ganged output for CEMC
46  if (combin_CEMC_tower_2x2)
47  {
48  // group CEMC RawTower to CEMC2x2
49  RawTowerCombiner * TowerCombiner = new RawTowerCombiner("RawTowerCombiner_CEMC");
50  TowerCombiner->Detector("CEMC");
51  TowerCombiner->set_combine_eta(2);
52  TowerCombiner->set_combine_phi(2);
53 // TowerCombiner->Verbosity(RawTowerCombiner::VERBOSITY_SOME);
54  se->registerSubsystem( TowerCombiner );
55  }
56 
57  // TowerDigitizer
58  ...
59 }
60 
61 \endcode
62 
63  * */
64 
66 {
67  public:
68  RawTowerCombiner(const std::string &name = "RawTowerCombiner");
69 
70  ~RawTowerCombiner() override
71  {
72  }
73 
74  int InitRun(PHCompositeNode *topNode) override;
75  int process_event(PHCompositeNode *topNode) override;
76  int End(PHCompositeNode *topNode) override;
77 
78  void
80  {
81  detector = d;
82  }
83 
87  {
88  return _tower_node_prefix;
89  }
90 
92  void
93  set_tower_node_prefix(const std::string &simTowerNodePrefix)
94  {
95  _tower_node_prefix = simTowerNodePrefix;
96  }
97 
99  unsigned int
101  {
102  return _n_combine_eta;
103  }
104 
106  void
107  set_combine_eta(unsigned int combineEta)
108  {
109  _n_combine_eta = combineEta;
110  }
111 
113  unsigned int
115  {
116  return _n_combine_phi;
117  }
118 
120  void
121  set_combine_phi(unsigned int combinePhi)
122  {
123  _n_combine_phi = combinePhi;
124  }
125 
126  protected:
129 
131  unsigned int _n_combine_eta;
133  unsigned int _n_combine_phi;
134 
136  inline int get_output_bin_eta(int input_bin) const { return input_bin / _n_combine_eta; }
138  inline int get_output_bin_phi(int input_bin) const { return input_bin / _n_combine_phi; }
139 
140  void
141  CreateNodes(PHCompositeNode *topNode);
142 
144 
146 };
147 
148 #endif