Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // OpenLoopsAmplitude.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_OpenLoopsAmplitude_H
0010 #define Herwig_OpenLoopsAmplitude_H
0011 //
0012 // This is the declaration of the OpenLoopsAmplitude class.
0013 //
0014 
0015 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxOLPME.h"
0016 
0017 namespace Herwig {
0018 
0019 using namespace ThePEG;
0020 
0021 /**
0022  * \ingroup Matchbox
0023  * \author Johannes Bellm, Simon Platzer
0024  *
0025  * \brief Process information for OpenLoops
0026  */
0027 class OpenLoopsProcInfo{
0028 
0029 public:
0030 
0031   /**
0032    * Default constructor
0033    */
0034   OpenLoopsProcInfo() {}
0035 
0036   /**
0037    * Construct giving data
0038    */
0039   OpenLoopsProcInfo(int HID,int GID, string procstr,string typestr)
0040     : theHOlpId(HID), theGOlpId(GID), theProcstr(procstr), theTypestr(typestr) {}
0041 
0042   /**
0043    * Document me
0044    */
0045   int HID() const { return theHOlpId; }
0046 
0047   /**
0048    * Document me
0049    */
0050   int GID() const { return theGOlpId; }
0051 
0052   /**
0053    * Document me
0054    */
0055   const string& Pstr() const { return theProcstr; }
0056 
0057   /**
0058    * Document me
0059    */
0060   const string& Tstr() const { return theTypestr; }
0061 
0062   /**
0063    * Document me
0064    */
0065   void setGID(int g) { theGOlpId=g; }
0066 
0067   /**
0068    * Document me
0069    */
0070   void setOAs(int i) { orderAlphas=i; }
0071 
0072   /**
0073    * Document me
0074    */
0075   int orderAs() { return orderAlphas; }
0076 
0077 private:
0078 
0079   /**
0080    * Document me
0081    */
0082   int theHOlpId;
0083 
0084   /**
0085    * Document me
0086    */
0087   int theGOlpId;
0088 
0089   /**
0090    * Document me
0091    */
0092   string theProcstr;
0093 
0094   /**
0095    * Document me
0096    */
0097   string theTypestr;
0098 
0099   /**
0100    * Document me
0101    */
0102   int orderAlphas;
0103 
0104 public:
0105 
0106   /**
0107    * Write to persistent stream
0108    */
0109   void persistentOutput(PersistentOStream & os) const{
0110     os << theHOlpId << theGOlpId << theProcstr << theTypestr << orderAlphas;
0111   }
0112 
0113   /**
0114    * Read from persistent stream
0115    */
0116   void persistentInput(PersistentIStream &is) {
0117     is >> theHOlpId >> theGOlpId >> theProcstr >> theTypestr >> orderAlphas;
0118   }
0119 
0120 };
0121 
0122 /**
0123  * \ingroup Matchbox
0124  * \author Johannes Bellm, Simon Platzer
0125  *
0126  * \brief OpenLoopsAmplitude implements an interface to OpenLoops
0127  */
0128 class OpenLoopsAmplitude: public MatchboxOLPME {
0129 
0130 public:
0131 
0132   /** @name Standard constructors and destructors. */
0133   //@{
0134   /**
0135    * The default constructor.
0136    */
0137   OpenLoopsAmplitude();
0138 
0139   /**
0140    * The destructor.
0141    */
0142   virtual ~OpenLoopsAmplitude();
0143   //@}
0144 
0145 public:
0146 
0147   virtual void fillOrderFile(const map<pair<Process,int>,int>& procs);
0148 
0149 
0150   virtual bool isCS() const { return false; }
0151   virtual bool isExpanded() const { return true; }
0152   virtual bool isBDK() const { return false; }
0153   //virtual bool isDR() const { return true; }
0154   /**
0155    * Start the one loop provider, if appropriate, giving order and
0156    * contract files
0157    */
0158 
0159   virtual bool checkOLPContract();
0160 
0161   /**
0162    * Start the one loop provider, if appropriate
0163    */
0164   virtual void startOLP(const string&, int& status);
0165 
0166   /**
0167    * Return the value of the dimensional regularization
0168    * parameter. Note that renormalization scale dependence is fully
0169    * restored in DipoleIOperator.
0170    */
0171   // virtual Energy2 mu2() const { return lastSHat(); }
0172 
0173   /**
0174    * Start the one loop provider, if appropriate. This default
0175    * implementation writes an BLHA 2.0 order file and starts the OLP
0176    */
0177   virtual bool startOLP(const map<pair<Process,int>,int>& procs);
0178 
0179 
0180     /**
0181    * Return true, if this amplitude already includes averaging over
0182    * incoming parton's quantum numbers.
0183    */
0184   virtual bool hasInitialAverage() const { return true; }
0185 
0186   /**
0187    * Return true, if this amplitude already includes symmetry factors
0188    * for identical outgoing particles.
0189    */
0190   virtual bool hasFinalStateSymmetry() const { return true; }
0191 
0192   /**
0193    * Call OLP_EvalSubProcess and fill in the results
0194    */
0195    void evalSubProcess() const;
0196 
0197   /**
0198    * Fill in results for the given colour correlator
0199    */
0200   virtual void evalColourCorrelator(pair<int,int> ij) const;
0201 
0202 
0203   /**
0204    * Fill in results for the given colour/spin correlator
0205    */
0206   virtual void evalSpinColourCorrelator(pair<int,int> ij) const;
0207 
0208 
0209   /**
0210    * Return the colour and spin correlated matrix element.
0211    */
0212   virtual double spinColourCorrelatedME2(pair<int,int> ij,
0213                      const SpinCorrelationTensor& c) const;
0214 
0215 
0216 public:
0217 
0218   /** @name Functions used by the persistent I/O system. */
0219   //@{
0220   /**
0221    * Function used to write out object persistently.
0222    * @param os the persistent output stream written to.
0223    */
0224   void persistentOutput(PersistentOStream & os) const;
0225 
0226   /**
0227    * Function used to read in object persistently.
0228    * @param is the persistent input stream read from.
0229    * @param version the version number of the object when written.
0230    */
0231   void persistentInput(PersistentIStream & is, int version);
0232   //@}
0233 
0234   /**
0235    * The standard Init function used to initialize the interfaces.
0236    * Called exactly once for each class by the class description system
0237    * before the main function starts or
0238    * when this class is dynamically loaded.
0239    */
0240   static void Init();
0241 
0242 protected:
0243 
0244   /** @name Clone Methods. */
0245   //@{
0246   /**
0247    * Make a simple clone of this object.
0248    * @return a pointer to the new object.
0249    */
0250   virtual IBPtr clone() const;
0251 
0252   /** Make a clone of this object, possibly modifying the cloned object
0253    * to make it sane.
0254    * @return a pointer to the new object.
0255    */
0256   virtual IBPtr fullclone() const;
0257   //@}
0258 
0259   virtual void doinitrun();
0260 
0261 
0262 // If needed, insert declarations of virtual function defined in the
0263 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0264 
0265 
0266 private:
0267 
0268   /**
0269    * The assignment operator is private and must never be called.
0270    * In fact, it should not even be implemented.
0271    */
0272   OpenLoopsAmplitude & operator=(const OpenLoopsAmplitude &) = delete;
0273 
0274   /**
0275    * Store colour correlator results
0276    */
0277   mutable vector<double> colourCorrelatorResults;
0278 
0279   /**
0280    * Store spin colour correlator results
0281    */
0282   mutable vector<double> spinColourCorrelatorResults;
0283 
0284 
0285   /**
0286    * first is the olp id from herwig, second the answer from openloops
0287    */
0288   static vector< int > idpair;
0289 
0290   
0291   /**
0292    * Helper map to store information in different procs.
0293    */
0294   
0295   map<int , OpenLoopsProcInfo > processmap;
0296   
0297   
0298   /**
0299    * Interface for Higgs Effective
0300    */
0301   bool theHiggsEff;
0302   
0303   /**
0304    * Complex Mass Scheme.
0305    */
0306   
0307   bool use_cms;
0308   
0309  
0310   /**
0311    * Use of Collier Lib (arXiv:1604.06792), available since OpenLoops 1.3.0.
0312    */
0313   bool theCollierLib=true; 
0314  
0315   /**
0316    * parameter to set Phase space tolerance for massiv particles.
0317    * Should not be used. Better: set Openloops:Massless 11
0318    */
0319   
0320   int psp_tolerance;
0321 
0322   /**
0323    *   Location of the OpenLoops libraries
0324    */
0325   static string OpenLoopsLibs_;
0326 
0327   /**
0328    *   Location of the OpenLoops
0329    */
0330   static string OpenLoopsPrefix_;
0331   
0332   
0333   /**
0334    *  Helper functions to make long strings static
0335    */
0336   
0337   void setOpenLoopsLibs(string p);
0338   string getOpenLoopsLibs() const;
0339   
0340   void setOpenLoopsPrefix(string p);
0341   string getOpenLoopsPrefix() const;
0342 
0343   
0344   
0345   
0346 };
0347 
0348 }
0349 
0350 #endif /* Herwig_OpenLoopsAmplitude_H */