Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
caloTreeGen.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file caloTreeGen.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef CALOTREEGEN_H
4 #define CALOTREEGEN_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <string>
9 #include <vector>
10 #include <TTree.h>
11 #include <fstream>
12 
13 class TTree;
14 class PHCompositeNode;
16 class TFile;
17 class RawCluster;
18 class TowerInfoContainer;
19 
20 class caloTreeGen : public SubsysReco
21 {
22  public:
23 
24  caloTreeGen(const std::string &name="caloTreeGen",
25  const std::string &eventFile="test.json",
26  const int eventNumber = 0,
27  const int runid = 0,
28  const float tow_cemc_min = 0,
29  const float tow_hcalin_min = 0,
30  const float tow_hcalout_min = 0);
31 
32  ~caloTreeGen() override;
33 
39  int Init(PHCompositeNode *topNode) override;
40 
46  int InitRun(PHCompositeNode *topNode) override;
47 
51  int process_event(PHCompositeNode *topNode) override;
52 
54  int ResetEvent(PHCompositeNode *topNode) override;
55 
57  int EndRun(const int runnumber) override;
58 
60  int End(PHCompositeNode *topNode) override;
61 
63  int Reset(PHCompositeNode * /*topNode*/) override;
64 
65  void Print(const std::string &what = "ALL") const override;
66 
67  private:
68 
69  TTree *T;
70 
71  std::vector<float> m_emcTowPhi;
72  std::vector<float> m_emcTowEta;
73  std::vector<float> m_emcTowE;
74  std::vector<float> m_emcTiming;
75  std::vector<float> m_emciEta;
76  std::vector<float> m_emciPhi;
77 
78  std::vector<float> m_ohciTowPhi;
79  std::vector<float> m_ohciTowEta;
80  std::vector<float> m_ohcTowE;
81 
82  std::vector<float> m_ihciTowPhi;
83  std::vector<float> m_ihciTowEta;
84  std::vector<float> m_ihcTowE;
85 
86  TFile *out;
87  //Fun4AllHistoManager *hm = nullptr;
88  std::string Outfile = "commissioning.root";
89  std::string eventFile = "test.json";
90 
91  unsigned int getCaloTowerPhiBin(const unsigned int key);
92  unsigned int getCaloTowerEtaBin(const unsigned int key);
93  float getMaxTowerE(RawCluster *cluster, TowerInfoContainer *towerContainer);
94  std::vector<float> returnClusterTowE(RawCluster *cluster, TowerInfoContainer *towerContainer);
95  std::vector<int> returnClusterTowPhi(RawCluster *cluster, TowerInfoContainer *towerContainer);
96  std::vector<int> returnClusterTowEta(RawCluster *cluster, TowerInfoContainer *towerContainer);
97 
98  float totalCaloE;
99  int iEvent;
101  int runid;
105 
106  std::ofstream eventOutput;
107 
108  const float eta_map[24] = {-1.05417, -0.9625, -0.870833, -0.779167, -0.6875, -0.595833, -0.504167, -0.4125, -0.320833, -0.229167, -0.1375, -0.0458333,
109  0.0458333, 0.1375, 0.229167, 0.320833, 0.4125, 0.504167, 0.595833, 0.6875, 0.779167, 0.870833, 0.9625, 1.05417};
110 
111  const float phi_map[64] = {0.0490874, 0.147262, 0.245437, 0.343612, 0.441786, 0.539961, 0.638136, 0.736311,
112  0.834486, 0.93266, 1.03084, 1.12901, 1.22718, 1.32536, 1.42353, 1.52171,
113  1.61988, 1.71806, 1.81623, 1.91441, 2.01258, 2.11076, 2.20893, 2.30711,
114  2.40528, 2.50346, 2.60163, 2.69981, 2.79798, 2.89616, 2.99433, 3.09251,
115  3.19068, 3.28885, 3.38703, 3.4852, 3.58338, 3.68155, 3.77973, 3.8779,
116  3.97608, 4.07425, 4.17243, 4.2706, 4.36878, 4.46695, 4.56513, 4.6633,
117  4.76148, 4.85965, 4.95783, 5.056, 5.15418, 5.25235, 5.35052, 5.4487,
118  5.54687, 5.64505, 5.74322, 5.8414, 5.93957, 6.03775, 6.13592, 6.2341};
119 };
120 
121 #endif