Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:15:30

0001 #ifndef BUILDRESONANCEJETTAGGINGTREE_H__
0002 #define BUILDRESONANCEJETTAGGINGTREE_H__
0003 
0004 #include <resonancejettagging/ResonanceJetTagging.h>
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <jetbase/JetContainerv1.h>
0009 
0010 #pragma GCC diagnostic push
0011 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0012 #include <HepMC/GenEvent.h>
0013 #pragma GCC diagnostic pop
0014 
0015 #include <vector>
0016 
0017 /// Class declarations for use in the analysis module
0018 class PHCompositeNode;
0019 class TFile;
0020 class TTree;
0021 class TH1I;
0022 class PHG4Particle;
0023 class KFParticle_Container;
0024 class SvtxEvalStack;
0025 class SvtxTrackEval;
0026 
0027 /// Definition of this analysis module class
0028 class BuildResonanceJetTaggingTree : public SubsysReco
0029 {
0030  public:
0031 
0032   /// Constructor
0033   BuildResonanceJetTaggingTree(const std::string &name = "BuildResonanceJetTaggingTree", const std::string &fname = "BuildResonanceJetTaggingTree.root", const ResonanceJetTagging::TAG tag = ResonanceJetTagging::TAG::D0);
0034 
0035   // Destructor
0036   virtual ~BuildResonanceJetTaggingTree();
0037 
0038   /// SubsysReco initialize processing method
0039   int Init(PHCompositeNode *);
0040 
0041   /// SubsysReco event processing method
0042   int process_event(PHCompositeNode *);
0043 
0044   /// SubsysReco end processing method
0045   int End(PHCompositeNode *);
0046   int loopHFHadronic(PHCompositeNode *topNode);
0047   void findMatchedTruthD0(PHCompositeNode *topNode, Jet *&mcTagJet, HepMC::GenParticle *&mcTag, std::vector<int> decays);
0048   HepMC::GenParticle *getMother(PHCompositeNode *topNode, PHG4Particle *g4daughter);
0049   bool isReconstructed(int index, std::vector<int> indexRecVector);
0050 
0051   void initializeVariables();
0052   void initializeTrees();
0053   void resetTreeVariables();
0054 
0055   void setDoRecunstructed(bool b) { m_dorec = b; }
0056   bool getDoRecunstructed() { return m_dorec; }
0057   void setDoTruth(bool b) { m_dotruth = b; }
0058   bool getDoTruth() { return m_dotruth; }
0059   void setStableMother(bool b) { m_stable_mother = b; }
0060   bool getStableMother() { return m_stable_mother; }
0061 
0062   void setTagContainerName(const std::string &tagContName) { m_tagcontainer_name = tagContName; }
0063   std::string getTagContainerName() { return m_tagcontainer_name; }
0064   void setJetContainerName(const std::string &jetContName) { m_jetcontainer_name = jetContName; }
0065   std::string getJetContainerName() { return m_jetcontainer_name; }
0066   void setTruthJetContainerName(const std::string &jetContName) { m_truth_jetcontainer_name = jetContName; }
0067   std::string getTruthJetContainerName() { return m_truth_jetcontainer_name; }
0068 
0069  private:
0070 
0071   JetContainerv1* getJetContainerFromNode(PHCompositeNode *topNode, const std::string &name);
0072   KFParticle_Container* getKFParticleContainerFromNode(PHCompositeNode *topNode, const std::string &name);
0073   HepMC::GenEvent* getGenEventFromNode(PHCompositeNode *topNode, const std::string &name);
0074   /// String to contain the outfile name containing the trees
0075   std::string m_outfilename;
0076   std::string m_tagcontainer_name;
0077   std::string m_jetcontainer_name;
0078   std::string m_truth_jetcontainer_name;
0079   JetContainerv1* m_taggedJetContainer;
0080   JetContainerv1* m_truth_taggedJetContainer;
0081   bool m_dorec;
0082   bool m_dotruth;
0083   bool m_stable_mother;
0084   int m_nDaughters;
0085   SvtxEvalStack *m_svtx_evalstack = nullptr;
0086   SvtxTrackEval *m_trackeval = nullptr;
0087 
0088   std::vector<float> m_truthjet_const_px, m_truthjet_const_py,
0089     m_truthjet_const_pz, m_truthjet_const_e;
0090 
0091   ResonanceJetTagging::TAG m_tag_particle;
0092   int m_tag_pdg;
0093 
0094   /// TFile to hold the following TTrees and histograms
0095   TFile *m_outfile = nullptr;
0096   TH1I *m_eventcount_h = nullptr;
0097   TTree *m_taggedjettree = nullptr;
0098   TTree *m_runinfo = nullptr;
0099   // Tagged-Jet reconstructed variables
0100   float m_reco_tag_px = NAN;
0101   float m_reco_tag_py = NAN;
0102   float m_reco_tag_pz = NAN;
0103   float m_reco_tag_pt = NAN;
0104   float m_reco_tag_eta = NAN;
0105   float m_reco_tag_phi = NAN;
0106   float m_reco_tag_m = NAN;
0107   float m_reco_tag_e = NAN;
0108   float m_reco_jet_px = NAN;
0109   float m_reco_jet_py = NAN;
0110   float m_reco_jet_pz = NAN;
0111   float m_reco_jet_pt = NAN;
0112   float m_reco_jet_eta = NAN;
0113   float m_reco_jet_phi = NAN;
0114   float m_reco_jet_m = NAN;
0115   float m_reco_jet_e = NAN;
0116   //Truth info
0117   float m_truth_tag_px = NAN;
0118   float m_truth_tag_py = NAN;
0119   float m_truth_tag_pz = NAN;
0120   float m_truth_tag_pt = NAN;
0121   float m_truth_tag_eta = NAN;
0122   float m_truth_tag_phi = NAN;
0123   float m_truth_tag_m = NAN;
0124   float m_truth_tag_e = NAN;
0125   float m_truth_jet_px = NAN;
0126   float m_truth_jet_py = NAN;
0127   float m_truth_jet_pz = NAN;
0128   float m_truth_jet_pt = NAN;
0129   float m_truth_jet_eta = NAN;
0130   float m_truth_jet_phi = NAN;
0131   float m_truth_jet_m = NAN;
0132   float m_truth_jet_e = NAN;
0133 
0134   float m_intlumi = NAN;
0135   float m_nprocessedevents = NAN;
0136   float m_nacceptedevents = NAN;
0137   float m_xsecprocessedevents = NAN;
0138   float m_xsecacceptedevents = NAN;
0139 
0140 };
0141 
0142 #endif