Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // TwoToTwoProcessConstructor.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_TwoToTwoProcessConstructor_H
0010 #define HERWIG_TwoToTwoProcessConstructor_H
0011 //
0012 // This is the declaration of the TwoToTwoProcessConstructor class.
0013 //
0014 
0015 #include "HardProcessConstructor.h"
0016 #include "ThePEG/Utilities/Exception.h"
0017 #include "TwoToTwoProcessConstructor.fh"
0018 
0019 namespace Herwig {
0020 using namespace ThePEG;
0021 
0022 /**
0023  * The TwoToTwoProcessConstructor is designed to construct the diagrams that are 
0024  * possible for a given set of incoming and outgoing particles.
0025  *
0026  * @see \ref TwoToTwoProcessConstructorInterfaces "The interfaces"
0027  * defined for TwoToTwoProcessConstructor.
0028  * @see HardProcessConstructor
0029  */
0030 class TwoToTwoProcessConstructor: public HardProcessConstructor {
0031 
0032 public:
0033 
0034   /** Set of ParticleData pointers */
0035   typedef set<tPDPtr> tPDSet;
0036 
0037   /** Map of HPDiagrams. */
0038   typedef multimap<HPDiagram, HPDiagram> HPDMap;
0039 
0040   /** Enumeration for the direction */
0041   enum direction {incoming, outgoing};
0042 
0043 public:
0044 
0045   /**
0046    * The default constructor.
0047    */
0048   TwoToTwoProcessConstructor();
0049 
0050 public:
0051 
0052   /** @name Functions used by the persistent I/O system. */
0053   //@{
0054   /**
0055    * Function used to write out object persistently.
0056    * @param os the persistent output stream written to.
0057    */
0058   void persistentOutput(PersistentOStream & os) const;
0059 
0060   /**
0061    * Function used to read in object persistently.
0062    * @param is the persistent input stream read from.
0063    * @param version the version number of the object when written.
0064    */
0065   void persistentInput(PersistentIStream & is, int version);
0066   //@}
0067 
0068   /**
0069    * The standard Init function used to initialize the interfaces.
0070    * Called exactly once for each class by the class description system
0071    * before the main function starts or
0072    * when this class is dynamically loaded.
0073    */
0074   static void Init();
0075 
0076 public:
0077 
0078   /**
0079    * Main function called to start constructing the diagrams for 
0080    * the 2->2 process
0081    */
0082   void constructDiagrams();  
0083 
0084 protected:
0085 
0086   /** @name Clone Methods. */
0087   //@{
0088   /**
0089    * Make a simple clone of this object.
0090    * @return a pointer to the new object.
0091    */
0092   virtual IBPtr clone() const;
0093 
0094   /** Make a clone of this object, possibly modifying the cloned object
0095    * to make it sane.
0096    * @return a pointer to the new object.
0097    */
0098   virtual IBPtr fullclone() const;
0099   //@}
0100 
0101 
0102 protected:
0103 
0104   /** @name Standard HardProcessConstructor functions. */
0105   //@{
0106   /**
0107    * Initialize this object after the setup phase before saving an
0108    * EventGenerator to disk.
0109    * @throws InitException if object could not be initialized properly.
0110    */
0111   virtual void doinit();
0112   //@}
0113 
0114 private:
0115 
0116   /**
0117    * The assignment operator is private and must never be called.
0118    * In fact, it should not even be implemented.
0119    */
0120   TwoToTwoProcessConstructor & operator=(const TwoToTwoProcessConstructor &) = delete;
0121 
0122 private:
0123 
0124   /** Functions to create the diagrams.*/
0125   //@{
0126   /**
0127    * Given a vertex and 2 particle id's find the possible states
0128    * that can be the 3rd external particle
0129    * @param vertex Pointer to the vertex
0130    * @param part1 id of first particle
0131    * @param d1 direction of particle one
0132    * @param part2 id of other particle
0133    * @param d2 direction of particle two
0134    * @param d3 required direction of 3rd state (default = outgoing)
0135    * @return container of third particles
0136    */
0137   tPDSet search(VertexBasePtr vertex, long part1, direction d1, 
0138            long part2, direction d2, direction d3 = outgoing);    
0139 
0140   /**
0141    * Given a vertex and 3 particle id's find the possible states
0142    * that can be the 4th external particle
0143    * @param vertex Pointer to the vertex
0144    * @param part1 id of first particle
0145    * @param d1 direction of particle one
0146    * @param part2 id of second particle
0147    * @param d2 direction of particle two
0148    * @param part3 id of third particle
0149    * @param d3 direction of particle three
0150    * @param d4 Required direction of fourth state (default = outgoing)
0151    * @return container of fourth particles
0152    */
0153   tPDSet search(VertexBasePtr vertex, long part1, direction d1, long part2,
0154            direction d2, long part3, direction d3, 
0155            direction d4 = outgoing);
0156   
0157   /**
0158    * Create the resonance diagrams.
0159    * @param inpp The incoming pair of particles.
0160    * @param fs A possible final state.
0161    * @param vertex The possible interaction vertex for the incoming pair
0162    */
0163   void createSChannels(tcPDPair inpp, long fs, tVertexBasePtr vertex);
0164 
0165  /**
0166    * Create the scattering diagrams.
0167    * @param inpp The incoming pair of particles.
0168    * @param fs A possible final state.
0169    * @param vertex The first vertex
0170    */
0171   void createTChannels(tPDPair inpp, long fs, tVertexBasePtr vertex);
0172 
0173   /**
0174    * Populate the diagram structure
0175    * @param in Pair of incoming particle id's
0176    * @param out1 first outgoing particle
0177    * @param out2 set of second outgoing particles
0178    * @param inter pointer to particle data for intermediate
0179    * @param chan the channel type 
0180    * @param vertices pair of vertices for the diagram
0181    * @param order The order
0182    */
0183   void makeDiagrams(IDPair in, long out1, const tPDSet & out2, PDPtr inter,
0184             HPDiagram::Channel chan, VBPair vertices, BPair order);
0185 
0186   /**
0187    * Create diagrams from 4 point vertices
0188    * @param parta id of first incoming particle
0189    * @param partb id of second incoming particle
0190    * @param partc id of first outgoing particle
0191    * @param vert pointer to the vertex
0192    */
0193   void makeFourPointDiagrams(long parta,long partb,long partc,
0194                  VertexBasePtr vert);
0195     
0196   /**
0197    * Create the matrix element that will calculate me2() for this
0198    * process
0199    * @param process vector of HardPrcoessDiagrams structs that store 
0200    * the information about the diagrams
0201    */  
0202   void createMatrixElement(const HPDVector & process) const;
0203    //@}
0204   
0205 
0206   /**
0207    * Contruct the classname and object name for the matrix element
0208    * @param extpart vector containing incoming and outgoing particle data pointers
0209    * @param objname a string containing the default path of the ME object
0210    */  
0211   string MEClassname(const vector<tcPDPtr> & extpart, 
0212              string & objname) const;
0213  
0214 private:
0215 
0216   /**
0217    * Required initial state particles
0218    */
0219   PDVector incoming_;
0220 
0221   /**
0222    * Pairs of particles for initial state, ordered by spin or id.
0223    * If both are of differing spin then lowest is first and if the spin is
0224    * equal the particle goes first then the anti-particle. This is setup
0225    * in the doinit() member.
0226    */
0227   vector<tPDPair> incPairs_;
0228   
0229   /**
0230    * Required final state particles
0231    */
0232   PDVector outgoing_;
0233 
0234   /**
0235    * Number of incoming particles
0236    */
0237   unsigned int Nout_;
0238 
0239   /**
0240    * Number of vertices in the model
0241    */
0242   unsigned int nv_;
0243 
0244   /**
0245    *  The vertices
0246    */
0247   vector<VertexBasePtr> vertices_;
0248 
0249   /**
0250    * Store the configuration of the diagrams
0251    */
0252   HPDVector processes_;
0253 
0254   /**
0255    * Whether to include all diagrams or just those with strong
0256    * coupling in them
0257    */
0258   bool allDiagrams_;
0259 
0260   /**
0261    * Which types of processes to generate
0262    */
0263   unsigned int processOption_;
0264 
0265   /**
0266    *  Option for the scales
0267    */
0268   unsigned int scaleChoice_;
0269 
0270   /**
0271    *  Prefactor for the scale calculation
0272    */
0273   double scaleFactor_;
0274 
0275   /**
0276    *  Option to exclude certain intermediates
0277    */
0278   vector<PDPtr> excluded_;
0279 
0280   /**
0281    *  Option to exclude certain external particles
0282    */
0283   vector<PDPtr> excludedExternal_;
0284 
0285   /**
0286    *  Excluded Vertices
0287    */
0288   vector<VertexBasePtr> excludedVertexVector_;
0289 
0290   /**
0291    *  Excluded Vertices
0292    */
0293   set<VertexBasePtr> excludedVertexSet_;
0294 };
0295 
0296   /** Exception class indicating setup problem. */
0297   class TwoToTwoProcessConstructorError : public Exception {
0298 
0299   public:
0300 
0301     /**
0302      * Exception for error handling
0303      * @param str Error message
0304      * @param sev Severity
0305      */
0306     TwoToTwoProcessConstructorError(const string & str, Severity sev) 
0307       : Exception(str,sev) {}
0308 
0309   };
0310 
0311 }
0312 
0313 #endif /* HERWIG_TwoToTwoProcessConstructor_H */