Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:06

0001 // $Id: $
0002 
0003 /*!
0004  * \file JetHepMCLoader.h
0005  * \brief
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 #ifndef G4JET_JETHEPMCLOADER_H
0012 #define G4JET_JETHEPMCLOADER_H
0013 
0014 #include <jetbase/Jet.h>
0015 
0016 #include <fun4all/SubsysReco.h>
0017 #include <string>
0018 #include <vector>
0019 
0020 class Fun4AllHistoManager;
0021 class PHCompositeNode;
0022 
0023 /*!
0024  * \brief JetHepMCLoader loads special jet objects encoded in HepMC records to DST Jet nodes. Example use are loading sHijing HIJFRG jets
0025  *
0026  * Example use for readback HIJFRAG truth jets from the sHijing HepMC records:
0027  *
0028  * \code{.cpp}
0029 
0030     JetHepMCLoader * hepmcjet = new JetHepMCLoader("sHijing_HIJFRG");
0031 
0032     hepmcjet->saveQAPlots();
0033     hepmcjet->addJet("AntiKt_sHijing_HIJFRG_r02",0,Jet::ANTIKT,0.2,2000000,103);
0034     hepmcjet->addJet("AntiKt_sHijing_HIJFRG_r04",0,Jet::ANTIKT,0.4,4000000,103);
0035     hepmcjet->addJet("AntiKt_sHijing_HIJFRG_r06",0,Jet::ANTIKT,0.6,6000000,103);
0036 
0037     se->registerSubsystem(hepmcjet);
0038 
0039  * \endcode
0040  *
0041  */
0042 class JetHepMCLoader : public SubsysReco
0043 {
0044  public:
0045   //! \param[in] jetInputCategory is the DST PHCompositeNode name that list the output jet maps, e.g. sHijing_HIJFRG for sHijing HIJFRG truth jets
0046   JetHepMCLoader(const std::string &jetInputCategory);
0047   ~JetHepMCLoader() override = default;
0048 
0049   int InitRun(PHCompositeNode *topNode) override;
0050   int process_event(PHCompositeNode *topNode) override;
0051   int End(PHCompositeNode *topNode) override;
0052 
0053   //! \brief addJet add HepMC entries for a particular type of jets
0054   //! Example of adding sHijing HIJFRG truth jets with R=0.4:
0055   //!   \code{.cpp}
0056   //!     addJet("AntiKt_sHijing_HIJFRG_r04",0,"ANTIKT",0.4,4000000,103);
0057   //!   \endcode
0058   //! \param[in] name name of the jet category
0059   //! \param[in] embeddingID hepmc event's embedding ID
0060   //! \param[in] algorithm pick one from Jet::ALGO
0061   //! \param[in] parameter jet parameter, e.g. radius
0062   //! \param[in] tagPID HepMC entry identifying tag on PID
0063   //! \param[in] tagStatus HepMC entry identifying tag on status
0064   void addJet(
0065       const std::string &name,
0066       int embeddingID,
0067       Jet::ALGO algorithm,
0068       double parameter,
0069       int tagPID,
0070       int tagStatus);
0071 
0072   void saveQAPlots(bool b = true) { m_saveQAPlots = b; }
0073 
0074  private:
0075   int CreateNodes(PHCompositeNode *topNode);
0076   Fun4AllHistoManager *getHistoManager();
0077 
0078   std::string m_jetInputCategory;
0079 
0080   bool m_saveQAPlots = false;
0081 
0082   struct hepmc_jet_src
0083   {
0084     //! name
0085     std::string m_name;
0086 
0087     //! hepmc event's embedding ID
0088     int m_embeddingID;
0089 
0090     //! Name of jet algorithm
0091     std::string m_algorithmName;
0092 
0093     Jet::ALGO m_algorithmID;
0094 
0095     //! jet parameter, e.g. radius
0096     double m_parameter;
0097 
0098     //! HepMC entry identifying tag on PID
0099     int m_tagPID;
0100 
0101     //! HepMC entry identifying tag on status
0102     int m_tagStatus;
0103   };
0104 
0105   std::vector<hepmc_jet_src> m_jetSrc;
0106 };
0107 
0108 #endif /* JETHEPMCLOADER_H_ */