Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:42

0001 // Truth Calorimeter Calibration TreeMaker
0002 
0003 #ifndef __TRUTHCALOTREE_H__
0004 #define __TRUTHCALOTREE_H__
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <string>
0008 #include <vector>
0009 #include <map>
0010 #include "TTree.h"
0011 #include "TFile.h"
0012 #include "TH2.h"
0013 #include <set>
0014 
0015 #include <g4main/PHG4TruthInfoContainer.h>
0016 #include <phool/PHCompositeNode.h>
0017 #include <g4main/PHG4Hit.h>
0018 #include <g4main/PHG4HitContainer.h>
0019 
0020 #include <calobase/RawTowerGeomContainer_Cylinderv1.h>
0021 #include <calobase/RawTowerGeomContainer.h>
0022 #include <calobase/RawTowerContainer.h>
0023 
0024 class PHCompositeNode;
0025 class RawTowerContainer;
0026 class PHG4TruthInfoContainer;
0027 class RawTowerGeomContainer;
0028 class PHG4HitContainer;
0029 
0030 class TruthCaloTree: public SubsysReco {
0031  public:
0032   
0033   TruthCaloTree(const std::string &name = "TruthCaloTree.root");
0034   
0035   virtual ~TruthCaloTree() {}
0036   
0037   int Init(PHCompositeNode *);
0038   
0039   int reset_tree_vars();
0040 
0041   int GetNodes(PHCompositeNode *);
0042   
0043   int process_event(PHCompositeNode *);
0044   
0045   int End(PHCompositeNode *);
0046   
0047  private:
0048   std::string _foutname; // outfile name
0049   std::string _hcal_sim_name;
0050   std::string _hcalIN_sim_name;
0051   std::string _EMcal_sim_name;
0052 
0053   int _startingSector, _numSectors; 
0054   RawTowerContainer* _towersSimOH;
0055   RawTowerGeomContainer* _geomOH;
0056   RawTowerGeomContainer* _geomIH;
0057   RawTowerGeomContainer* _geomEM;
0058   PHG4HitContainer* blackhole;
0059   RawTowerContainer* _towersSimIH;
0060   RawTowerContainer* _towersSimEM;
0061   PHG4TruthInfoContainer *truthinfo;
0062 
0063   TTree* _tree;
0064   TFile* _file;
0065   
0066   int _ievent, _b_event;
0067 
0068   static const bool _debug = false;
0069   static const int nTowers = 10000;
0070   static const int nTruth = 100000;
0071   static const int nTruths = 100000;
0072   static const bool recursive_shower = false;
0073   
0074   // outer Hcal
0075   
0076   int _b_tower_sim_n;
0077   float _b_tower_sim_E[nTowers];
0078   float _b_tower_sim_eta[nTowers];
0079   float _b_tower_sim_phi[nTowers];
0080   int   _b_tower_sim_ieta[nTowers];
0081   int   _b_tower_sim_iphi[nTowers];
0082   
0083   // inner HCal
0084   
0085   int   _b_hcalIN_sim_n = 0;
0086   float _b_hcalIN_sim_E[nTowers];
0087   float _b_hcalIN_sim_eta[nTowers];
0088   float _b_hcalIN_sim_phi[nTowers];
0089   int   _b_hcalIN_sim_ieta[nTowers];
0090   int   _b_hcalIN_sim_iphi[nTowers];
0091 
0092   // EMCal
0093   
0094   int   _b_EMcal_sim_n = 0;
0095   float _b_EMcal_sim_E[nTowers];
0096   float _b_EMcal_sim_eta[nTowers];
0097   float _b_EMcal_sim_phi[nTowers];
0098   int   _b_EMcal_sim_ieta[nTowers];
0099   int   _b_EMcal_sim_iphi[nTowers];
0100 
0101   // Primary truth particles 
0102   
0103   int _b_n_truth = 0;
0104   float _b_truthenergy[nTruth];
0105   float _b_trutheta[nTruth];
0106   float _b_truthphi[nTruth];
0107   float _b_truthpt[nTruth];
0108   float _b_truthp[nTruth];
0109   int _b_truthpid[nTruth];
0110   int _b_truth_trackid[nTruth];
0111 
0112   // Secondary truth particles
0113 
0114   int n_child = 0;
0115   int child_pid[nTruth];
0116   int child_parent_id[nTruth];
0117   int child_vertex_id[nTruth];
0118   float child_px[nTruth];
0119   float child_py[nTruth];
0120   float child_pz[nTruth];
0121   float child_energy[nTruth];
0122 
0123   // Truth particle vertices 
0124 
0125   int n_vertex = 0;
0126   int vertex_id[nTruth];
0127   float vertex_x[nTruth];
0128   float vertex_y[nTruth];
0129   float vertex_z[nTruth];
0130 
0131   // BH particles
0132 
0133   int _nBH = 0;
0134   float _BH_e[nTruth];
0135   float _BH_px[nTruth];
0136   float _BH_py[nTruth];
0137   float _BH_pz[nTruth];
0138   int _BH_track_id[nTruth];
0139 
0140 };
0141 
0142 #endif