Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 09:05:02

0001 // -*- C++ -*-
0002 #ifndef RIVET_DecayedParticles_HH
0003 #define RIVET_DecayedParticles_HH
0004 
0005 #include "Rivet/Projections/ParticleFinder.hh"
0006 
0007 namespace Rivet {
0008 
0009 
0010   /// @brief Find the decay products of particles in the projection for subsquent analyses
0011   class DecayedParticles : public Projection {
0012   public:
0013 
0014     /// @name Standard constructors etc.
0015     /// @{
0016 
0017     /// Constructor.
0018     DecayedParticles() {}
0019 
0020     DecayedParticles(const ParticleFinder & particles) {
0021       setName("DecayedParticles");
0022       declare(particles, "PARTICLES");
0023     }
0024 
0025     /// Clone on the heap.
0026     RIVET_DEFAULT_PROJ_CLONE(DecayedParticles);
0027 
0028     /// Import to avoid warnings about overload-hiding
0029     using Projection::operator=;
0030 
0031     /// Virtual destructor.
0032     virtual ~DecayedParticles() { }
0033 
0034     ///@}
0035 
0036   public :
0037 
0038     /// Add a particle to be considered stable when finding the decay products
0039     DecayedParticles & addStable(PdgId pid) {
0040       _stable.insert(pid);
0041       return *this;
0042     }
0043 
0044     /**
0045      *  Access to the decaying particles
0046      */
0047     const Particles & decaying() const {return _decaying;}
0048 
0049     /**
0050      *  Access to the number of stable particles
0051      */
0052     const vector<unsigned int> & nStable() const {return _nStable;}
0053 
0054     /**
0055      *  Access to the decay products
0056      */
0057     const vector<map<PdgId,Particles> > & decayProducts() const {return _products;}
0058 
0059     /**
0060      *  Check the particles in the ith mode
0061      */
0062     bool modeMatches(size_t imode,unsigned int nstable, map<PdgId,unsigned int> prod) const {
0063       // same no of stable particles
0064       if (nstable!=_nStable[imode]) return false;
0065       for (const auto & kv : prod ) {
0066         // check if same decay products
0067         map<PdgId,Particles>::const_iterator iloc = _products[imode].find(kv.first);
0068         // same type of product
0069         if (iloc == _products[imode].end()) return false;
0070         // and same number
0071         if(iloc->second.size()!=kv.second) return false;
0072       }
0073       // pass all the tests
0074       return true;
0075     }
0076 
0077   protected:
0078 
0079     /// Apply the projection to the event.
0080     virtual void project(const Event& e);
0081 
0082     /// Compare projections.
0083     virtual CmpState compare(const Projection& p) const;
0084 
0085   private :
0086 
0087     /**
0088      * Recursive function to find the decay products
0089      */
0090     void findDecayProducts(const Particle & mother, unsigned int & nstable,
0091                map<PdgId,Particles> & products);
0092 
0093   private :
0094 
0095     /**
0096      *  Stable particles
0097      */
0098     set<PdgId> _stable;
0099 
0100     /**
0101      *  The decaying particles
0102      */
0103     Particles _decaying;
0104 
0105     /**
0106      *  The number of stable decay products
0107      */
0108     vector<unsigned int> _nStable;
0109 
0110     /**
0111      *  The decay products
0112      */
0113     vector<map<PdgId,Particles> > _products;
0114   };
0115 
0116 
0117 }
0118 
0119 #endif