Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:19:30

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 = default;
0025 
0026   int process_event(PHCompositeNode* topNode) override;
0027 
0028   /// Set the ID of the particle you want in your output.
0029   virtual void SetParticle(const int pid);
0030 
0031   /// Add an ancestor of the particle you want in your output.
0032   virtual void AddAncestor(const int pid);
0033 
0034   /// Add decay products of the particle you want in your output.
0035   virtual void AddDaughter(const int pid);
0036 
0037   //! embedding ID for the event to be processed
0038   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0039   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0040   //! Usually, ID = 0 means the primary Au+Au collision background
0041   int get_embedding_id() const { return _embedding_id; }
0042   //
0043   //! embedding ID for the event to be processed
0044   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0045   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0046   //! Usually, ID = 0 means the primary Au+Au collision background
0047   void set_embedding_id(int id) { _embedding_id = id; }
0048 
0049  protected:
0050   /// find out if a particle comes from one of _theAncestors
0051   HepMC::GenParticle* GetParent(HepMC::GenParticle* p, HepMC::GenEvent* event);
0052 
0053   /// The particle you want to have in your output
0054   int _theParticle{11};
0055   /// List of possible decay products of the particle you want in your output
0056   /// Ignored if empty
0057   std::vector<int> _theDaughters;
0058   /// List of possible ancestors of the particle you want in your output
0059   /// Ignored if empty
0060   std::vector<int> _theAncestors;
0061 
0062   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0063   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0064   //! Usually, ID = 0 means the primary Au+Au collision background
0065   int _embedding_id{0};
0066 };
0067 
0068 #endif