Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:35

0001 #ifndef ANATUTORIAL_H__
0002 #define ANATUTORIAL_H__
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 /// Class declarations for use in the analysis module
0007 class Fun4AllHistoManager;
0008 class PHCompositeNode;
0009 class TFile;
0010 class TTree;
0011 class TH1;
0012 class TH2;
0013 class PHCompositeNode;
0014 class RawClusterContainer;
0015 class RawCluster;
0016 class SvtxTrackMap;
0017 class JetMap;
0018 class GlobalVertex;
0019 class PHHepMCGenEventMap;
0020 class JetEvalStack;
0021 class JetRecoEval;
0022 class SvtxTrackEval;
0023 class PHG4TruthInfoContainer;
0024 class PHHepMCGenEvent;
0025 class CaloTriggerInfo;
0026 class JetTruthEval;
0027 class SvtxEvalStack;
0028 class JetEvalStack;
0029 
0030 /// Definition of this analysis module class
0031 class AnaTutorial : public SubsysReco
0032 {
0033  public:
0034   /// Constructor
0035   AnaTutorial(const std::string &name = "AnaTutorial",
0036               const std::string &fname = "AnaTutorial.root");
0037 
0038   // Destructor
0039   virtual ~AnaTutorial();
0040 
0041   /// SubsysReco initialize processing method
0042   int Init(PHCompositeNode *);
0043 
0044   /// SubsysReco event processing method
0045   int process_event(PHCompositeNode *);
0046 
0047   /// SubsysReco end processing method
0048   int End(PHCompositeNode *);
0049 
0050   /// Set the minimum jet pT to cut on
0051   void setMinJetPt(float minjetpt) { m_minjetpt = minjetpt; }
0052 
0053   /// Set the minimum cluster pT to cut on
0054   void setMinClusPt(float mincluspt) { m_mincluspt = mincluspt; }
0055 
0056   /// Set things to analyze
0057   void analyzeTracks(bool analyzeTracks) { m_analyzeTracks = analyzeTracks; }
0058   void analyzeClusters(bool analyzeClusters) { m_analyzeClusters = analyzeClusters; }
0059   void analyzeJets(bool analyzeJets) { m_analyzeJets = analyzeJets; }
0060   void analyzeTruth(bool analyzeTruth) { m_analyzeTruth = analyzeTruth; }
0061 
0062  private:
0063   /// String to contain the outfile name containing the trees
0064   std::string m_outfilename;
0065 
0066   /// Fun4All Histogram Manager tool
0067   Fun4AllHistoManager *m_hm;
0068 
0069   /// A float for cutting on jet pt
0070   float m_minjetpt;
0071 
0072   /// A float for cutting on cluster pt
0073   float m_mincluspt;
0074 
0075   /// A boolean for running over tracks
0076   bool m_analyzeTracks;
0077 
0078   /// A boolean for running over clusters
0079   bool m_analyzeClusters;
0080 
0081   /// A boolean for running over jets
0082   bool m_analyzeJets;
0083 
0084   /// A boolean for collecting hepmc information
0085   bool m_analyzeTruth;
0086 
0087   /// TFile to hold the following TTrees and histograms
0088   TFile *m_outfile;
0089   TTree *m_clustertree;
0090   TTree *m_tracktree;
0091   TTree *m_hepmctree;
0092   TTree *m_truthtree;
0093   TTree *m_recojettree;
0094   TTree *m_truthjettree;
0095   TH1 *m_phi_h;
0096   TH2 *m_eta_phi_h;
0097 
0098   SvtxEvalStack *m_svtxEvalStack = nullptr;
0099   JetEvalStack *m_jetEvalStack = nullptr;
0100 
0101   /// Methods for grabbing the data
0102   void getTracks(PHCompositeNode *topNode);
0103   void getTruthJets(PHCompositeNode *topNode);
0104   void getReconstructedJets(PHCompositeNode *topNode);
0105   void getEMCalClusters(PHCompositeNode *topNode);
0106   void getHEPMCTruth(PHCompositeNode *topNode);
0107   void getPHG4Truth(PHCompositeNode *topNode);
0108 
0109   void initializeVariables();
0110   void initializeTrees();
0111 
0112   /**
0113    * Make variables for the relevant trees
0114    */
0115 
0116   /// HEPMC Tree variables
0117   int m_partid1;
0118   int m_partid2;
0119   double m_x1;
0120   double m_x2;
0121   int m_mpi;
0122   int m_process_id;
0123   double m_truthenergy;
0124   double m_trutheta;
0125   double m_truthphi;
0126   double m_truthpx;
0127   double m_truthpy;
0128   double m_truthpz;
0129   double m_truthpt;
0130   double m_truthp;
0131   int m_numparticlesinevent;
0132   int m_truthpid;
0133 
0134   /// Track variables
0135   double m_tr_px;
0136   double m_tr_py;
0137   double m_tr_pz;
0138   double m_tr_p;
0139   double m_tr_pt;
0140   double m_tr_phi;
0141   double m_tr_eta;
0142   int m_charge;
0143   double m_chisq;
0144   int m_ndf;
0145   double m_dca;
0146   double m_tr_x;
0147   double m_tr_y;
0148   double m_tr_z;
0149   int m_truth_is_primary;
0150   double m_truthtrackpx;
0151   double m_truthtrackpy;
0152   double m_truthtrackpz;
0153   double m_truthtrackp;
0154   double m_truthtracke;
0155   double m_truthtrackpt;
0156   double m_truthtrackphi;
0157   double m_truthtracketa;
0158   int m_truthtrackpid;
0159 
0160   /// Reconstructed jet variables
0161   double m_recojetpt;
0162   int m_recojetid;
0163   double m_recojetpx;
0164   double m_recojetpy;
0165   double m_recojetpz;
0166   double m_recojetphi;
0167   double m_recojetp;
0168   double m_recojetenergy;
0169   double m_recojeteta;
0170   int m_truthjetid;
0171   double m_truthjetp;
0172   double m_truthjetphi;
0173   double m_truthjeteta;
0174   double m_truthjetpt;
0175   double m_truthjetenergy;
0176   double m_truthjetpx;
0177   double m_truthjetpy;
0178   double m_truthjetpz;
0179   double m_dR;
0180 
0181   /// Cluster variables
0182   double m_clusenergy;
0183   double m_cluseta;
0184   double m_clustheta;
0185   double m_cluspt;
0186   double m_clusphi;
0187   double m_cluspx;
0188   double m_cluspy;
0189   double m_cluspz;
0190   double m_E_4x4;
0191 };
0192 
0193 #endif