Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:17

0001 // -*- C++ -*-
0002 //
0003 // NBodyDecayConstructorBase.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef HERWIG_NBodyDecayConstructorBase_H
0010 #define HERWIG_NBodyDecayConstructorBase_H
0011 //
0012 // This is the declaration of the NBodyDecayConstructorBase class.
0013 //
0014 
0015 #include "ThePEG/Interface/Interfaced.h"
0016 #include "ThePEG/Utilities/Exception.h"
0017 #include "ThePEG/PDT/ParticleData.h"
0018 #include "NBodyDecayConstructorBase.fh"
0019 #include "PrototypeVertex.h"
0020 #include "DecayConstructor.fh"
0021 
0022 namespace Herwig {
0023 
0024 using namespace ThePEG;
0025 
0026 /**
0027  * This is the base class for NBodyDecayConstructors. An N-body 
0028  * decay constructor should inherit from this and implement the 
0029  * DecayList virtual funtcion to create the decays and decayers.  
0030  *
0031  * @see \ref NBodyDecayConstructorBaseInterfaces "The interfaces"
0032  * defined for NBodyDecayConstructor. 
0033  */
0034 class NBodyDecayConstructorBase: public Interfaced {
0035 
0036 public:
0037 
0038   struct MassOrdering {
0039     bool operator()(PDPtr p1, PDPtr p2) const {
0040       return p1->mass() < p2->mass() || (p1->mass()==p2->mass() && p1->id()>p2->id());
0041     }
0042   };
0043   
0044 public:
0045 
0046   /**
0047    * The default constructor.
0048    */
0049   NBodyDecayConstructorBase() : 
0050     init_(true),iteration_(1), points_(1000), info_(false), 
0051     createModes_(true), removeOnShell_(1), excludeEffective_(true), 
0052     minReleaseFraction_(1e-3), maxBoson_(1), maxList_(1),
0053     includeTopOnShell_(false ), removeFlavourChangingVertices_(false),
0054     removeSmallVertices_(false), minVertexNorm_(1e-8) 
0055   {}
0056 
0057   /**
0058    * Function used to determine allowed decaymodes, to be implemented
0059    * in derived class.
0060    * @param particles vector of ParticleData pointers containing 
0061    * particles in model
0062    */
0063   virtual void DecayList(const set<PDPtr,MassOrdering> & particles);
0064 
0065   /**
0066    * Number of outgoing lines. Required for correct ordering.
0067    */
0068   virtual unsigned int numBodies() const = 0;
0069 
0070   /**
0071    * Set the pointer to the DecayConstrcutor
0072    */
0073   void decayConstructor(tDecayConstructorPtr d) { 
0074     decayConstructor_ = d;
0075   }
0076 
0077   /**
0078    *  Remove flavour changing vertices ?
0079    */
0080   bool removeFlavourChangingVertices() const {
0081     return removeFlavourChangingVertices_;
0082   }
0083 
0084   /**
0085    *  Remove small vertices ?
0086    */
0087   bool removeSmallVertices() const {
0088     return removeSmallVertices_;
0089   }
0090 
0091   /**
0092    *  Minimum norm for vertex removal
0093    */
0094   double minVertexNorm() const {
0095     return minVertexNorm_;
0096   }
0097 
0098 protected:
0099   
0100   /**
0101    *  Method to set up the decay mode, should be overidden in inheriting class
0102    */
0103   virtual void createDecayMode(vector<NBDiagram> & mode,
0104                    bool possibleOnShell,
0105                    double symfac);
0106   
0107 
0108   /**
0109    * Set the branching ratio of this mode. This requires 
0110    * calculating a new width for the decaying particle and reweighting
0111    * the current branching fractions.
0112    * @param dm The decaymode for which to set the branching ratio
0113    * @param pwidth The calculated width of the mode
0114    */
0115   void setBranchingRatio(tDMPtr dm, Energy pwidth);
0116 
0117   /**
0118    * Set the interfaces of the decayers depending on the flags stored.
0119    * @param name Fullname of the decayer in the EventGenerator
0120    * including the path
0121    */
0122   void setDecayerInterfaces(string name) const;
0123 
0124   /**
0125    * Whether to initialize decayers or not
0126    */
0127   bool initialize() const { return init_; }
0128   
0129   /**
0130    * Number of iterations if initializing (default 1)
0131    */
0132   int iteration() const { return iteration_; }
0133 
0134   /**
0135    * Number of points to do in initialization
0136    */
0137   int points() const { return points_; }
0138 
0139   /**
0140    * Whether to output information on the decayers 
0141    */
0142   bool info() const { return info_; }
0143 
0144   /**
0145    * Whether to create the DecayModes as well as the Decayer objects 
0146    */
0147   bool createDecayModes() const { return createModes_; }
0148 
0149   /**
0150    *  Maximum number of electroweak gauge bosons
0151    */
0152   unsigned int maximumGaugeBosons() const { return maxBoson_;}
0153 
0154   /**
0155    *  Maximum number of particles from the list whose decays we are calculating
0156    */
0157   unsigned int maximumList() const { return maxList_;}
0158 
0159   /**
0160    *  Minimum energy release fraction
0161    */ 
0162   double minimumReleaseFraction() const {return minReleaseFraction_;}
0163 
0164   /**
0165    * Get the pointer to the DecayConstructor object
0166    */
0167   tDecayConstructorPtr decayConstructor() const { 
0168     return decayConstructor_;
0169   }
0170 
0171   /**
0172    *  Option for on-shell particles
0173    */
0174   unsigned int removeOnShell() const { return removeOnShell_; }
0175 
0176   /**
0177    *  Check if a vertex is excluded
0178    */
0179   bool excluded(VertexBasePtr vertex) const {
0180     // skip an effective vertex
0181     if( excludeEffective_ &&
0182     vertex->orderInAllCouplings() != int(vertex->getNpoint())-2)
0183       return true;
0184     // check if explicitly forbidden
0185     return excludedVerticesSet_.find(vertex)!=excludedVerticesSet_.end();
0186   }
0187 
0188 public:
0189 
0190   /** @name Functions used by the persistent I/O system. */
0191   //@{
0192   /**
0193    * Function used to write out object persistently.
0194    * @param os the persistent output stream written to.
0195    */
0196   void persistentOutput(PersistentOStream & os) const;
0197 
0198   /**
0199    * Function used to read in object persistently.
0200    * @param is the persistent input stream read from.
0201    * @param version the version number of the object when written.
0202    */
0203   void persistentInput(PersistentIStream & is, int version);
0204   //@}
0205 
0206   /**
0207    * The standard Init function used to initialize the interfaces.
0208    * Called exactly once for each class by the class description system
0209    * before the main function starts or
0210    * when this class is dynamically loaded.
0211    */
0212   static void Init();
0213 
0214 protected:
0215 
0216   /** @name Standard Interfaced functions. */
0217   //@{
0218   /**
0219    * Initialize this object after the setup phase before saving an
0220    * EventGenerator to disk.
0221    * @throws InitException if object could not be initialized properly.
0222    */
0223   virtual void doinit();
0224   //@}
0225 
0226 private:
0227 
0228   /**
0229    * The assignment operator is private and must never be called.
0230    * In fact, it should not even be implemented.
0231    */
0232   NBodyDecayConstructorBase & operator=(const NBodyDecayConstructorBase &) = delete;
0233 
0234 private:
0235 
0236   /**
0237    * Whether to initialize decayers or not
0238    */
0239   bool init_;
0240   
0241   /**
0242    * Number of iterations if initializing (default 1)
0243    */
0244   int iteration_;
0245 
0246   /**
0247    * Number of points to do in initialization
0248    */
0249   int points_;
0250 
0251   /**
0252    * Whether to output information on the decayers 
0253    */
0254   bool info_;
0255 
0256   /**
0257    * Whether to create the DecayModes as well as the Decayer objects 
0258    */
0259   bool createModes_;
0260 
0261   /**
0262    *  Whether or not to remove on-shell diagrams
0263    */
0264   unsigned int removeOnShell_;
0265 
0266   /**
0267    *  Excluded Vertices
0268    */
0269   vector<VertexBasePtr> excludedVerticesVector_;
0270 
0271   /**
0272    *  Excluded Vertices
0273    */
0274   set<VertexBasePtr> excludedVerticesSet_;
0275 
0276   /**
0277    *  Excluded Particles
0278    */
0279   vector<PDPtr> excludedParticlesVector_;
0280 
0281   /**
0282    *  Excluded Particles
0283    */
0284   set<PDPtr> excludedParticlesSet_;
0285 
0286   /**
0287    *  Whether or not to exclude effective vertices
0288    */
0289   bool excludeEffective_;
0290   
0291   /**
0292    * A pointer to the DecayConstructor object 
0293    */
0294   tDecayConstructorPtr decayConstructor_;
0295 
0296   /**
0297    * The minimum energy release for a three-body decay as a 
0298    * fraction of the parent mass
0299    */
0300   double minReleaseFraction_;
0301 
0302   /**
0303    *  Maximum number of EW gauge bosons
0304    */
0305   unsigned int maxBoson_;
0306 
0307   /**
0308    *  Maximum number of particles from the decaying particle list
0309    */
0310   unsigned int maxList_;
0311 
0312   /**
0313    *  Include on-shell for \f$t\to b W\f$
0314    */
0315   bool includeTopOnShell_;
0316 
0317   /**
0318    *  Remove flavour changing vertices ?
0319    */
0320   bool removeFlavourChangingVertices_;
0321 
0322   /**
0323    *  Remove small vertices ?
0324    */
0325   bool removeSmallVertices_;
0326 
0327   /**
0328    *  Minimum norm for vertex removal
0329    */
0330   double minVertexNorm_;
0331 };
0332 
0333   /** An Exception class that can be used by all inheriting classes to
0334    * indicate a setup problem. */
0335   class NBodyDecayConstructorError : public Exception {
0336 
0337   public:
0338 
0339     NBodyDecayConstructorError() : Exception() {}
0340     
0341     NBodyDecayConstructorError(const string & str,
0342                    Severity sev) : Exception(str,sev)
0343     {}
0344   };
0345 
0346 }
0347 
0348 #endif /* HERWIG_NBodyDecayConstructorBase_H */