Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef HERWIG_HardProcessConstructor_H
0003 #define HERWIG_HardProcessConstructor_H
0004 //
0005 // This is the declaration of the HardProcessConstructor class.
0006 //
0007 
0008 #include "ThePEG/Interface/Interfaced.h"
0009 #include "HPDiagram.h"
0010 #include "Herwig/Models/StandardModel/StandardModel.h"
0011 #include "ThePEG/Handlers/SubProcessHandler.h"
0012 #include "ThePEG/Repository/EventGenerator.h"
0013 #include "ThePEG/Handlers/StandardEventHandler.h"
0014 #include "Herwig/MatrixElement/General/GeneralHardME.h"
0015 #include "HardProcessConstructor.fh"
0016 
0017 namespace Herwig {
0018 
0019 using namespace ThePEG;
0020 
0021 /**
0022  * Here is the documentation of the HardProcessConstructor class.
0023  *
0024  * @see \ref HardProcessConstructorInterfaces "The interfaces"
0025  * defined for HardProcessConstructor.
0026  */
0027 class HardProcessConstructor: public Interfaced {
0028 
0029 public:
0030 
0031   /** Vector of HPDiagrams. */
0032   typedef vector<HPDiagram> HPDVector;
0033 
0034 public:
0035 
0036   /** @name Standard constructors and destructors. */
0037   //@{
0038   /**
0039    * The default constructor.
0040    */
0041   HardProcessConstructor() : debug_(false) {}
0042   //@}
0043 
0044   /**
0045    * The main function to create diagrams etc for the processes
0046    */
0047   virtual void constructDiagrams() = 0;
0048 
0049 public:
0050 
0051   /** @name Functions used by the persistent I/O system. */
0052   //@{
0053   /**
0054    * Function used to write out object persistently.
0055    * @param os the persistent output stream written to.
0056    */
0057   void persistentOutput(PersistentOStream & os) const;
0058 
0059   /**
0060    * Function used to read in object persistently.
0061    * @param is the persistent input stream read from.
0062    * @param version the version number of the object when written.
0063    */
0064   void persistentInput(PersistentIStream & is, int version);
0065   //@}
0066 
0067   /**
0068    * The standard Init function used to initialize the interfaces.
0069    * Called exactly once for each class by the class description system
0070    * before the main function starts or
0071    * when this class is dynamically loaded.
0072    */
0073   static void Init();
0074 
0075 protected:
0076 
0077   /** Functions to set up colour flows and matrix elements. */
0078   //@{
0079   /**
0080    * Determine whether the ordering of the outgoing states is the same
0081    * as the ordering in the matrix elements
0082    * @param diag The diagram to question
0083    */
0084   void fixFSOrder(HPDiagram & diag);
0085 
0086   /**
0087    * Assign a diagram to the appropriate colour flow(s).
0088    * @param diag The diagram to assign
0089    */
0090   void assignToCF(HPDiagram & diag);
0091 
0092   /**
0093    * Assign a $s$-channel diagram to the appropriate colour flow(s).
0094    * @param diag The diagram to assign
0095    */
0096   void sChannelCF(HPDiagram & diag);
0097 
0098   /**
0099    * Assign a $t$-channel diagram to the appropriate colour flow(s).
0100    * @param diag The diagram to assign
0101    */
0102   void tChannelCF(HPDiagram & diag);
0103 
0104   /**
0105    * Assign a $u$-channel diagram to the appropriate colour flow(s).
0106    * @param diag The diagram to assign
0107    */
0108   void uChannelCF(HPDiagram & diag);
0109 
0110   /**
0111    * Assign a $u$-channel diagram to the appropriate colour flow(s).
0112    * @param diag The diagram to assign
0113    */
0114   void fourPointCF(HPDiagram & diag);
0115   //@}
0116 
0117   /**
0118    * Pointer to the model being used
0119    */
0120   tHwSMPtr model() const {return model_;}
0121   
0122   /**
0123    * Pointer to the sub process handler
0124    */
0125   tSubHdlPtr subProcess() const {return subProcess_;}
0126 
0127   /**
0128    * Whether to print the debug information with the matrix 
0129    * element. This is here solely so it can be passed to 
0130    * a matrix element that is created here.
0131    */
0132   bool debug() const {return debug_;}
0133 
0134   /**
0135    * Get the correct colour factor matrix.
0136    * @param extpart Vector of external ParticleData pointers
0137    */
0138   GeneralHardME::ColourStructure colourFlow(const tcPDVector & extpart) const;
0139 
0140   /**
0141    * Search for a diagram that has already been created
0142    * @param diagram The diagram to search for
0143    * @param group The group of diagrams to search through 
0144    */
0145   bool duplicate(const HPDiagram & diagram, 
0146          const HPDVector & group) const;
0147 
0148   /**
0149    *  check the order of a diagram
0150    */
0151   bool checkOrder(const HPDiagram & diag) const;
0152 
0153 protected:
0154 
0155   /** @name Standard Interfaced functions. */
0156   //@{
0157   /**
0158    * Initialize this object after the setup phase before saving an
0159    * EventGenerator to disk.
0160    * @throws InitException if object could not be initialized properly.
0161    */
0162   virtual void doinit();
0163   //@}
0164 
0165 private:
0166 
0167   /**
0168    * The assignment operator is private and must never be called.
0169    * In fact, it should not even be implemented.
0170    */
0171   HardProcessConstructor & operator=(const HardProcessConstructor &) = delete;
0172 
0173 private:
0174 
0175   /**
0176    * Pointer to the model being used
0177    */
0178   tHwSMPtr model_;
0179   
0180   /**
0181    * Pointer to the sub process handler
0182    */
0183    tSubHdlPtr subProcess_;
0184 
0185   /**
0186    * Whether to print the debug information with the matrix 
0187    * element. This is here solely so it can be passed to 
0188    * a matrix element that is created here.
0189    */
0190   bool debug_;
0191 
0192 };
0193 
0194 namespace HPC_helper {
0195   // Helper functor for find_if in duplicate function.
0196   class SameIncomingAs {
0197   public:
0198     SameIncomingAs(tPDPair in) : a(in.first->id()), b(in.second->id())  {}
0199     bool operator()(tPDPair ppair) const {
0200       long id1(ppair.first->id()), id2(ppair.second->id());
0201       return ( id1 == a && id2 == b ) || ( id1 == b && id2 == a );
0202     }
0203   private:
0204     long a, b;
0205   };
0206 
0207   inline bool duplicateIncoming(tPDPair ppair,const vector<tPDPair> &incPairs) {
0208     vector<tPDPair>::const_iterator it = 
0209       find_if( incPairs.begin(), incPairs.end(), SameIncomingAs(ppair) );
0210     return it != incPairs.end(); 
0211   }
0212 }
0213 
0214 }
0215 
0216 #endif /* HERWIG_HardProcessConstructor_H */