Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:59

0001 #ifndef PHHEPMC_FUN4ALLHEPMCOUTPUTMANAGER_H
0002 #define PHHEPMC_FUN4ALLHEPMCOUTPUTMANAGER_H
0003 
0004 #include <fun4all/Fun4AllOutputManager.h>
0005 
0006 #include <fstream>
0007 #include <string>
0008 
0009 namespace HepMC
0010 {
0011   class IO_GenEvent;
0012 }
0013 
0014 class PHCompositeNode;
0015 
0016 class Fun4AllHepMCOutputManager : public Fun4AllOutputManager
0017 {
0018  public:
0019   Fun4AllHepMCOutputManager(const std::string &myname = "HEPMCOUT",
0020                             const std::string &filename = "hepmcout.txt");
0021 
0022   ~Fun4AllHepMCOutputManager() override;
0023 
0024   int outfileopen(const std::string & /*fname*/) override { return 0; }
0025 
0026   void Print(const std::string &what = "ALL") const override;
0027 
0028   int Write(PHCompositeNode *startNode) override;
0029 
0030   int AddComment(const std::string &text);
0031 
0032   //! embedding ID for the sub-event to be output
0033   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0034   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0035   //! Usually, ID = 0 means the primary Au+Au collision background
0036   int get_embedding_id() const { return _embedding_id; }
0037   //
0038   //! embedding ID for the sub-event to be output
0039   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0040   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0041   //! Usually, ID = 0 means the primary Au+Au collision background
0042   void set_embedding_id(int id) { _embedding_id = id; }
0043 
0044  protected:
0045   std::string outfilename;
0046   HepMC::IO_GenEvent *ascii_out;
0047   std::string comment;
0048   int comment_written;
0049 
0050   // some pointers for use in compression handling
0051   std::ofstream *filestream;  // holds compressed filestream
0052   std::ostream *zipstream;    // feed into HepMC
0053 
0054   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0055   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0056   //! Usually, ID = 0 means the primary Au+Au collision background
0057   int _embedding_id;
0058 };
0059 
0060 #endif /* PHHEPMC_FUN4ALLHEPMCOUTPUTMANAGER_H */