Back to home page

EIC code displayed by LXR

 
 

    


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

0001   /// -*- C++ -*-
0002   //
0003   /// MergingFactory.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_MergingFactory_H
0010 #define HERWIG_MergingFactory_H
0011   //
0012   /// This is the declaration of the MergingFactory class.
0013   //
0014 
0015 #include "MergingFactory.fh"
0016 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h"
0017 #include "Node.fh"
0018 #include "Merger.h"
0019 #include "ThePEG/Persistency/PersistentOStream.h"
0020 #include "ThePEG/Persistency/PersistentIStream.h"
0021 namespace Herwig {
0022   
0023   using namespace ThePEG;
0024   
0025   /**
0026    * \ingroup Matchbox
0027    * \author Johannes Bellm
0028    *
0029    * \brief MergingFactory automatically sets up a NLO
0030    * QCD merging.
0031    *
0032    * @see \ref MergingFactoryInterfaces "The interfaces"
0033    * defined for MergeboxFactory.
0034    */
0035   class MergingFactory : public MatchboxFactory {
0036   public:
0037       ///Check consistency and switch to porduction mode.
0038     void productionMode();
0039       /// main method to setup the ME vector
0040     virtual void setup();
0041       /// fill all amplitudes, stored in pureMEsMap
0042     void fillMEsMap();
0043       /// prepare the Born and virtual matrix elements.
0044     void prepare_BV(int i);
0045       /// prepare the real emission matrix elements.
0046     void prepare_R(int i);
0047       /// push the born contributions to the ME vector.
0048     void pushB(MatchboxMEBasePtr, int);
0049       //push the virtual contributions to the ME vector.
0050     void pushV(MatchboxMEBasePtr, int);
0051       /// push the real contributions to the ME vector.
0052     void pushR(MatchboxMEBasePtr, int);
0053       /// order matrix elements from one loop provider.
0054     void orderOLPs();
0055       /// Debugging: push only multiplicities to the ME vector
0056       /// in range of specified mulltiplicity.
0057     int onlymulti()const {
0058       return theonlymulti==-1?-1:(theonlymulti+int(processMap.find(0)->second.size()));
0059     }
0060       /// pointer to the merging helper.
0061     MergerPtr MH() {return theMergingHelper;}
0062       /// maximal NLO mulitplicity: 0=NLO corrections to the productio process.
0063     int M() const {return theM-1;}
0064       /// leg size of highest multiplicity.
0065     int N() const {return theN;}
0066      /// Return the Map of matrix elements to be considered
0067      /// (the Key is the number of additional jets)
0068     const map<int, vector<MatchboxMEBasePtr> >& pureMEsMap() const {
0069       return thePureMEsMap;
0070     }
0071       /// Access the Map of matrix elements to be considered
0072       /// (the Key is the number of additional jets)
0073     map<int, vector<MatchboxMEBasePtr> >& pureMEsMap() {
0074       return thePureMEsMap;
0075     }
0076       //Parse a process description
0077     virtual vector<string> parseProcess(string);
0078       // fill the virtuals vector (these are IPK-operators)
0079     void getVirtuals(MatchboxMEBasePtr nlo, bool clone );
0080       // In the merged setup we only produce single phase space points. 
0081     bool subProcessGroups() const { return false;}
0082       // Cut on non-QCD observables. 
0083     Ptr<Cuts>::ptr nonQCDCuts(){return theNonQCDCuts;}
0084  
0085   public:
0086     
0087     /** @name Functions used by the persistent I/O system. */
0088       //@{
0089     /**
0090      * Function used to write out object persistently.
0091      * @param os the persistent output stream written to.
0092      */
0093     void persistentOutput(PersistentOStream & os) const;
0094     
0095     /**
0096      * Function used to read in object persistently.
0097      * @param is the persistent input stream read from.
0098      * @param version the version number of the object when written.
0099      */
0100     void persistentInput(PersistentIStream & is, int);
0101       //@}
0102     
0103     static void Init();
0104     
0105   protected:
0106     
0107     /** @name Standard Interfaced functions. */
0108       //@{
0109     /**
0110      * Initialize this object after the setup phase before saving an
0111      * EventGenerator to disk.
0112      * @throws InitException if object could not be initialized properly.
0113      */
0114     virtual void doinit();
0115     
0116       //@}
0117     
0118   protected:
0119     
0120     /** @name Clone Methods. */
0121       //@{
0122     /**
0123      * Make a simple clone of this object.
0124      * @return a pointer to the new object.
0125      */
0126     virtual IBPtr clone() const;
0127     
0128     /** 
0129      * Make a clone of this object, possibly modifying the cloned object
0130      * to make it sane.
0131      * @return a pointer to the new object.
0132      */
0133     virtual IBPtr fullclone() const;
0134       //@}
0135     
0136   private:
0137     
0138       /// unitarise the LO contributions.
0139     bool unitarized = true;
0140       /// did run setup.
0141     bool ransetup = false;
0142       /// Debugging: push only multiplicities to the ME vector
0143       /// in range of specified mulltiplicity.
0144     int theonlymulti = -1;
0145       /// maximal legsize for NLO corrections.
0146     int theM = -1;
0147       /// maximal legsize for LO contributions.
0148     int theN = -1;
0149       /// map for processes.
0150     map< int, vector<string> > processMap;
0151       //The matrix elements: int = number of additional jets
0152     map< int, vector<MatchboxMEBasePtr> > thePureMEsMap;
0153       /// the merging helper
0154     MergerPtr theMergingHelper;
0155       /// Cut on non-QCD modified observables. 
0156     Ptr<Cuts>::ptr theNonQCDCuts;
0157     
0158       /// For more complicated processes the number of subprocesses is large.
0159       /// This parameter allows to chunk the suprocesses into same sized cunks.
0160       /// It is in the responsibility of the user to add all chunk parts afterwards.
0161       /// The user also needs to take care that, e.g. output can be compined.
0162     int theChunk=0;
0163       /// This parameter selects a part chunkpart of the chunked subprocesses.
0164       /// The user needs to take care to sum all chunkparts afterwards.
0165     int theChunkPart=0;
0166     
0167     
0168     /**
0169      * The assignment operator is private and must never be called.
0170      * In fact, it should not even be implemented.
0171      */
0172     MergingFactory & operator=(const MergingFactory &) = delete;
0173 
0174     
0175   };
0176   
0177 }
0178 
0179 #endif /* HERWIG_MergingFactory_H */