Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:00

0001 #ifndef PHHEPMC_PHHEPMCPARTICLESELECTORDECAYPRODUCTCHAIN_H
0002 #define PHHEPMC_PHHEPMCPARTICLESELECTORDECAYPRODUCTCHAIN_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <string>                // for string
0007 #include <vector>
0008 
0009 class PHCompositeNode;
0010 
0011 namespace HepMC
0012 {
0013 class GenParticle;
0014 class GenEvent;
0015 }  // namespace HepMC
0016 /// Particle selector for HepMC based events
0017 /// Will write out only _theParticle and _theDaughters (if specified)
0018 /// Special case:  when _theParticle=0, all particles in _theDaughers list
0019 /// will be written out no matter where they come from
0020 class PHHepMCParticleSelectorDecayProductChain : public SubsysReco
0021 {
0022  public:
0023   PHHepMCParticleSelectorDecayProductChain(const std::string& name = "PARTICLESELECTOR");
0024   ~PHHepMCParticleSelectorDecayProductChain() override {}
0025 
0026   int InitRun(PHCompositeNode* topNode) override;
0027   int process_event(PHCompositeNode* topNode) override;
0028 
0029   /// Set the ID of the particle you want in your output.
0030   virtual void SetParticle(const int pid);
0031 
0032   /// Add an ancestor of the particle you want in your output.
0033   virtual void AddAncestor(const int pid);
0034 
0035   /// Add decay products of the particle you want in your output.
0036   virtual void AddDaughter(const int pid);
0037 
0038   //! embedding ID for the event to be processed
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   int get_embedding_id() const { return _embedding_id; }
0043   //
0044   //! embedding ID for the event to be processed
0045   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0046   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0047   //! Usually, ID = 0 means the primary Au+Au collision background
0048   void set_embedding_id(int id) { _embedding_id = id; }
0049 
0050  protected:
0051   /// find out if a particle comes from one of _theAncestors
0052   HepMC::GenParticle* GetParent(HepMC::GenParticle* p, HepMC::GenEvent* event);
0053 
0054   /// The particle you want to have in your output
0055   int _theParticle;
0056   /// List of possible decay products of the particle you want in your output
0057   /// Ignored if empty
0058   std::vector<int> _theDaughters;
0059   /// List of possible ancestors of the particle you want in your output
0060   /// Ignored if empty
0061   std::vector<int> _theAncestors;
0062 
0063   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0064   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0065   //! Usually, ID = 0 means the primary Au+Au collision background
0066   int _embedding_id;
0067 };
0068 
0069 #endif