Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // MatchboxFactory.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_MatchboxFactory_H
0010 #define HERWIG_MatchboxFactory_H
0011 //
0012 // This is the declaration of the MatchboxFactory class.
0013 //
0014 
0015 #include "ThePEG/Handlers/SubProcessHandler.h"
0016 
0017 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxAmplitude.h"
0018 #include "Herwig/MatrixElement/Matchbox/Utility/Tree2toNGenerator.h"
0019 #include "Herwig/MatrixElement/Matchbox/Utility/ProcessData.h"
0020 #include "Herwig/MatrixElement/Matchbox/Utility/MatchboxScaleChoice.h"
0021 #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
0022 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxMEBase.h"
0023 #include "Herwig/MatrixElement/Matchbox/Base/SubtractedME.h"
0024 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.fh"
0025 
0026 namespace Herwig {
0027 
0028 using namespace ThePEG;
0029 
0030 /**
0031  * \ingroup Matchbox
0032  * \author Simon Platzer
0033  *
0034  * \brief MatchboxFactory automatically sets up a NLO
0035  * QCD calculation carried out in dipole subtraction.
0036  *
0037  * @see \ref MatchboxFactoryInterfaces "The interfaces"
0038  * defined for MatchboxFactory.
0039  */
0040 class MatchboxFactory: public SubProcessHandler {
0041 
0042 public:
0043 
0044   /**
0045    * The default constructor.
0046    */
0047   MatchboxFactory();
0048 
0049 public:
0050 
0051   /**
0052    * Pointer to the current factory object
0053    */
0054   static const Ptr<MatchboxFactory>::tptr currentFactory() {
0055     assert(theCurrentFactory);
0056     return theCurrentFactory;
0057   }
0058 
0059 private:
0060 
0061   /**
0062    * Pointer to the current factory object
0063    */
0064   static Ptr<MatchboxFactory>::tptr theCurrentFactory;
0065 
0066 public:
0067 
0068   /**
0069    * Flag to indicate that at least one MatchboxFactory object is in action
0070    */
0071   static bool isMatchboxRun() {
0072     return theIsMatchboxRun();
0073   }
0074 
0075   /** @name Process and diagram information */
0076   //@{
0077 
0078   /**
0079    * Return the diagram generator.
0080    */
0081   Ptr<Tree2toNGenerator>::tptr diagramGenerator() const { return theDiagramGenerator; }
0082 
0083   /**
0084    * Set the diagram generator.
0085    */
0086   void diagramGenerator(Ptr<Tree2toNGenerator>::ptr dg) { theDiagramGenerator = dg; }
0087 
0088   /**
0089    * Return the process data.
0090    */
0091   Ptr<ProcessData>::tptr processData() const { return theProcessData; }
0092 
0093   /**
0094    * Set the process data.
0095    */
0096   void processData(Ptr<ProcessData>::ptr pd) { theProcessData = pd; }
0097 
0098   /**
0099    * Return the number of light flavours, this matrix
0100    * element is calculated for.
0101    */
0102   unsigned int nLight() const { return theNLight; }
0103 
0104   /**
0105    * Set the number of light flavours, this matrix
0106    * element is calculated for.
0107    */
0108   void nLight(unsigned int n) { theNLight = n; }
0109 
0110   /**
0111    * Return the vector that contains the PDG ids of 
0112    * the light flavours, which are contained in the
0113    * jet particle group.
0114    */
0115   vector<long> nLightJetVec() const { return theNLightJetVec; }
0116 
0117   /**
0118    * Set the elements of the vector that contains the PDG
0119    * ids of the light flavours, which are contained in the
0120    * jet particle group.
0121    */
0122   void nLightJetVec(long n) { theNLightJetVec.push_back(n); }
0123 
0124   /**
0125    * Return the vector that contains the PDG ids of 
0126    * the heavy flavours, which are contained in the
0127    * jet particle group.
0128    */
0129   vector<long> nHeavyJetVec() const { return theNHeavyJetVec; }
0130 
0131   /**
0132    * Set the elements of the vector that contains the PDG
0133    * ids of the heavy flavours, which are contained in the
0134    * jet particle group.
0135    */
0136   void nHeavyJetVec(long n) { theNHeavyJetVec.push_back(n); }
0137 
0138   /**
0139    * Return the vector that contains the PDG ids of 
0140    * the light flavours, which are contained in the
0141    * proton particle group.
0142    */
0143   vector<long> nLightProtonVec() const { return theNLightProtonVec; }
0144 
0145   /**
0146    * Set the elements of the vector that contains the PDG
0147    * ids of the light flavours, which are contained in the
0148    * proton particle group.
0149    */
0150   void nLightProtonVec(long n) { theNLightProtonVec.push_back(n); }
0151 
0152   /**
0153    * Return the order in \f$\alpha_S\f$.
0154    */
0155   unsigned int orderInAlphaS() const { return theOrderInAlphaS; }
0156 
0157   /**
0158    * Set the order in \f$\alpha_S\f$.
0159    */
0160   void orderInAlphaS(unsigned int o) { theOrderInAlphaS = o; }
0161 
0162   /**
0163    * Return the order in \f$\alpha_{EM}\f$.
0164    */
0165   unsigned int orderInAlphaEW() const { return theOrderInAlphaEW; }
0166 
0167   /**
0168    * Set the order in \f$\alpha_{EM}\f$.
0169    */
0170   void orderInAlphaEW(unsigned int o) { theOrderInAlphaEW = o; }
0171  
0172   /**
0173    * The multiplicity of legs with virtual contributions.
0174    */
0175   size_t highestVirt() const {return theHighestVirtualSize;}
0176 
0177   /**
0178    * Set the highest 
0179    **/
0180   void setHighestVirt(size_t n){theHighestVirtualSize=n;}
0181  
0182   /**
0183    * Access the processes vector.
0184    */
0185    const vector<vector<string> > getProcesses() const {return processes;}
0186 
0187   /**
0188    * Return true, if all processes up to a maximum order are considered
0189    */
0190   bool allProcesses() const { return theAllProcesses; }
0191 
0192   /**
0193    * Switch on/off inclusino off all processes up to a maximum order
0194    */
0195   void setAllProcesses(bool on = true) { theAllProcesses = on; }
0196 
0197   /**
0198    * Return true, if Born contributions should be included.
0199    */
0200   bool bornContributions() const { return theBornContributions; }
0201 
0202   /**
0203    * Switch on or off Born contributions
0204    */
0205   void setBornContributions(bool on = true) { theBornContributions = on; }
0206 
0207   /**
0208    * Return true, if virtual contributions should be included.
0209    */
0210   bool virtualContributions() const { return theVirtualContributions; }
0211 
0212   /**
0213    * Switch on or off virtual contributions
0214    */
0215   void setVirtualContributions(bool on = true) { theVirtualContributions = on; }
0216 
0217   /**
0218    * Produce matrix element corrections, but no NLO
0219    */
0220   bool meCorrectionsOnly() const { return theMECorrectionsOnly; }
0221 
0222   /**
0223    * Switch to produce matrix element corrections, but no NLO
0224    */
0225   void setMECorrectionsOnly(bool on = true) { theMECorrectionsOnly = on; }
0226 
0227   /**
0228    * Produce matrix element corrections, with LoopSim NLO
0229    */
0230   bool loopSimCorrections() const { return theLoopSimCorrections; }
0231 
0232   /**
0233    * Switch to produce matrix element corrections, with LoopSim NLO
0234    */
0235   void setLoopSimCorrections(bool on = true) { theLoopSimCorrections = on; }
0236 
0237   /**
0238    * Return true, if subtracted real emission contributions should be included.
0239    */
0240   bool realContributions() const { return theRealContributions; }
0241 
0242   /**
0243    * Switch on or off subtracted real emission contributions
0244    */
0245   void setRealContributions(bool on = true) { theRealContributions = on; }
0246 
0247   /**
0248    * Return true, if virtual contributions should be treated as independent subprocesses
0249    */
0250   bool independentVirtuals() const { return theIndependentVirtuals; }
0251 
0252   /**
0253    * Switch on/off virtual contributions should be treated as independent subprocesses
0254    */
0255   void setIndependentVirtuals(bool on = true) { theIndependentVirtuals = on; }
0256 
0257   /**
0258    * Return true, if PK operator contributions should be treated as independent subprocesses
0259    */
0260   bool independentPKs() const { return theIndependentPKs; }
0261 
0262   /**
0263    * Switch on/off PK operator contributions should be treated as independent subprocesses
0264    */
0265   void setIndependentPKs(bool on = true) { theIndependentPKs = on; }
0266 
0267   /**
0268    * Return true, if SubProcessGroups should be
0269    * setup from this MEGroup. If not, a single SubProcess
0270    * is constructed from the data provided by the
0271    * head matrix element.
0272    */
0273   virtual bool subProcessGroups() const { return !showerApproximation(); }
0274 
0275   /**
0276    * Return true, if subtraction scales should be caluclated from real emission kinematics
0277    */
0278   bool realEmissionScales() const { return theRealEmissionScales; }
0279 
0280   /**
0281    * Switch on/off that subtraction scales should be caluclated from real emission kinematics
0282    */
0283   void setRealEmissionScales(bool on = true) { theRealEmissionScales = on; }
0284 
0285   /**
0286    * Set the shower approximation.
0287    */
0288   void showerApproximation(Ptr<ShowerApproximation>::tptr app) { theShowerApproximation = app; }
0289 
0290   /**
0291    * Return the shower approximation.
0292    */
0293   Ptr<ShowerApproximation>::tptr showerApproximation() const { return theShowerApproximation; }
0294 
0295   //@}
0296 
0297   /** @name Phasespace generation and scale choice */
0298   //@{
0299 
0300   /**
0301    * Return the phase space generator to be used.
0302    */
0303   Ptr<MatchboxPhasespace>::tptr phasespace() const { return thePhasespace; }
0304 
0305   /**
0306    * Set the phase space generator to be used.
0307    */
0308   void phasespace(Ptr<MatchboxPhasespace>::ptr ps) { thePhasespace = ps; }
0309 
0310   /**
0311    * Set the scale choice object
0312    */
0313   void scaleChoice(Ptr<MatchboxScaleChoice>::ptr sc) { theScaleChoice = sc; }
0314 
0315   /**
0316    * Return the scale choice object
0317    */
0318   Ptr<MatchboxScaleChoice>::tptr scaleChoice() const { return theScaleChoice; }
0319 
0320   /**
0321    * Get the factorization scale factor
0322    */
0323   double factorizationScaleFactor() const { return theFactorizationScaleFactor; }
0324 
0325   /**
0326    * Set the factorization scale factor
0327    */
0328   void factorizationScaleFactor(double f) { theFactorizationScaleFactor = f; }
0329 
0330   /**
0331    * Get the renormalization scale factor
0332    */
0333   double renormalizationScaleFactor() const { return theRenormalizationScaleFactor; }
0334 
0335   /**
0336    * Set the renormalization scale factor
0337    */
0338   void renormalizationScaleFactor(double f) { theRenormalizationScaleFactor = f; }
0339 
0340   /**
0341    * Return true, if fixed couplings are used.
0342    */
0343   bool fixedCouplings() const { return theFixedCouplings; }
0344 
0345   /**
0346    * Switch on fixed couplings.
0347    */
0348   void setFixedCouplings(bool on = true) { theFixedCouplings = on; }
0349 
0350   /**
0351    * Return true, if fixed couplings are used.
0352    */
0353   bool fixedQEDCouplings() const { return theFixedQEDCouplings; }
0354 
0355   /**
0356    * Switch on fixed couplings.
0357    */
0358   void setFixedQEDCouplings(bool on = true) { theFixedQEDCouplings = on; }
0359 
0360   /**
0361    * Return true, if veto scales should be set
0362    * for the real emission
0363    */
0364   bool vetoScales() const { return theVetoScales; }
0365 
0366   /**
0367    * Switch on setting veto scales
0368    */
0369   void doVetoScales() { theVetoScales = true; }
0370 
0371   /**
0372    * Switch off setting veto scales
0373    */
0374   void noVetoScales() { theVetoScales = true; }
0375 
0376   //@}
0377 
0378   /** @name Amplitudes and caching */
0379   //@{
0380 
0381   /**
0382    * Return the amplitudes to be considered
0383    */
0384   const vector<Ptr<MatchboxAmplitude>::ptr>& amplitudes() const { return theAmplitudes; }
0385 
0386   /**
0387    * Access the amplitudes to be considered
0388    */
0389   vector<Ptr<MatchboxAmplitude>::ptr>& amplitudes() { return theAmplitudes; }
0390 
0391   //@}
0392 
0393   /** @name Matrix element objects. */
0394   //@{
0395 
0396   /**
0397    * Return the Born matrix elements to be considered
0398    */
0399   const vector<Ptr<MatchboxMEBase>::ptr>& bornMEs() const { return theBornMEs; }
0400 
0401   /**
0402    * Access the Born matrix elements to be considered
0403    */
0404   vector<Ptr<MatchboxMEBase>::ptr>& bornMEs() { return theBornMEs; }
0405 
0406   /**
0407    * Return the loop induced matrix elements to be considered
0408    */
0409   const vector<Ptr<MatchboxMEBase>::ptr>& loopInducedMEs() const { return theLoopInducedMEs; }
0410 
0411   /**
0412    * Access the loop induced matrix elements to be considered
0413    */
0414   vector<Ptr<MatchboxMEBase>::ptr>& loopInducedMEs() { return theLoopInducedMEs; }
0415 
0416   /**
0417    * Return the processes to be ordered from an OLP
0418    */
0419   const map<Ptr<MatchboxAmplitude>::tptr,
0420         map<pair<Process,int>,int> >&
0421   olpProcesses() const { return theOLPProcesses; }
0422 
0423   /**
0424    * Access the processes to be ordered from an OLP
0425    */
0426   map<Ptr<MatchboxAmplitude>::tptr,
0427       map<pair<Process,int>,int> >& 
0428   olpProcesses() { return theOLPProcesses; }
0429 
0430   /**
0431    * Order an OLP process and return its id
0432    */
0433   int orderOLPProcess(const Process& p,
0434               Ptr<MatchboxAmplitude>::tptr amp,
0435               int type);
0436 
0437   /**
0438    * Return the amplitudes which need external initialization
0439    */
0440   const set<Ptr<MatchboxAmplitude>::tptr>& externalAmplitudes() const {
0441     return theExternalAmplitudes;
0442   }
0443 
0444   /**
0445    * Access the amplitudes which need external initialization
0446    */
0447   set<Ptr<MatchboxAmplitude>::tptr>& externalAmplitudes() {
0448     return theExternalAmplitudes;
0449   }
0450 
0451   /**
0452    * Return the virtual corrections to be considered
0453    */
0454   const vector<Ptr<MatchboxInsertionOperator>::ptr>& virtuals() const { return theVirtuals; }
0455 
0456   /**
0457    * Access the virtual corrections to be considered
0458    */
0459   vector<Ptr<MatchboxInsertionOperator>::ptr>& virtuals() { return theVirtuals; }
0460 
0461   /**
0462    * Return the produced NLO matrix elements
0463    */
0464   const vector<Ptr<MatchboxMEBase>::ptr>& bornVirtualMEs() const { return theBornVirtualMEs; }
0465 
0466   /**
0467    * Access the produced NLO matrix elements
0468    */
0469   vector<Ptr<MatchboxMEBase>::ptr>& bornVirtualMEs() { return theBornVirtualMEs; }
0470 
0471   /**
0472    * Return the real emission matrix elements to be considered
0473    */
0474   const vector<Ptr<MatchboxMEBase>::ptr>& realEmissionMEs() const { return theRealEmissionMEs; }
0475 
0476   /**
0477    * Access the real emission matrix elements to be considered
0478    */
0479   vector<Ptr<MatchboxMEBase>::ptr>& realEmissionMEs() { return theRealEmissionMEs; }
0480 
0481   /**
0482    * Return, which set of dipoles should be considered
0483    */
0484   int dipoleSet() const { return theDipoleSet; }
0485 
0486   /**
0487    * Return, which set of dipoles should be considered
0488    */
0489   void dipoleSet(int s) { theDipoleSet = s; }
0490 
0491   /**
0492    * Return the produced subtracted matrix elements
0493    */
0494   const vector<Ptr<SubtractedME>::ptr>& subtractedMEs() const { return theSubtractedMEs; }
0495 
0496   /**
0497    * Access the produced subtracted matrix elements
0498    */
0499   vector<Ptr<SubtractedME>::ptr>& subtractedMEs() { return theSubtractedMEs; }
0500 
0501   /**
0502    * Return the produced finite real emission matrix elements
0503    */
0504   const vector<Ptr<MatchboxMEBase>::ptr>& finiteRealMEs() const { return theFiniteRealMEs; }
0505 
0506   /**
0507    * Access the produced finite real emission elements
0508    */
0509   vector<Ptr<MatchboxMEBase>::ptr>& finiteRealMEs() { return theFiniteRealMEs; }
0510 
0511   /**
0512    * Return the map of Born processes to splitting dipoles
0513    */
0514   const map<cPDVector,set<Ptr<SubtractionDipole>::ptr> >& splittingDipoles() const {
0515     return theSplittingDipoles;
0516   }
0517 
0518   /**
0519    * Identify a splitting channel
0520    */
0521   struct SplittingChannel {
0522 
0523     /**
0524      * The Born XComb
0525      */
0526     StdXCombPtr bornXComb;
0527 
0528     /**
0529      * The real XComb
0530      */
0531     StdXCombPtr realXComb;
0532 
0533     /**
0534      * The set of tilde XCombs to consider for the real xcomb
0535      */
0536     vector<StdXCombPtr> tildeXCombs;
0537 
0538     /**
0539      * The dipole in charge of the splitting
0540      */
0541     Ptr<SubtractionDipole>::ptr dipole;
0542 
0543     /**
0544      * Dump the setup
0545      */
0546     void print(ostream&) const;
0547 
0548   };
0549 
0550   /**
0551    * Generate all splitting channels for the Born process handled by
0552    * the given XComb
0553    */
0554   list<SplittingChannel> getSplittingChannels(tStdXCombPtr xc) const;
0555 
0556   /**
0557    * Return the reweight objects for matrix elements
0558    */
0559   const vector<ReweightPtr>& reweighters() const { return theReweighters; }
0560 
0561   /**
0562    * Access the reweight objects for matrix elements
0563    */
0564   vector<ReweightPtr>& reweighters() { return theReweighters; }
0565 
0566   /**
0567    * Return the preweight objects for matrix elements
0568    */
0569   const vector<ReweightPtr>& preweighters() const { return thePreweighters; }
0570 
0571   /**
0572    * Access the preweight objects for matrix elements
0573    */
0574   vector<ReweightPtr>& preweighters() { return thePreweighters; }
0575 
0576   //@}
0577 
0578   /** @name Setup the matrix elements */
0579   //@{
0580 
0581   /**
0582    * Return true if this object needs to be initialized before all
0583    * other objects (except those for which this function also returns
0584    * true).  This default version always returns false, but subclasses
0585    * may override it to return true.
0586    */
0587   virtual bool preInitialize() const { return true; }
0588 
0589   /**
0590    * Prepare a matrix element.
0591    */
0592   void prepareME(Ptr<MatchboxMEBase>::ptr);
0593 
0594   /**
0595    * Check consistency and switch to porduction mode.
0596    */
0597   virtual void productionMode();
0598 
0599   /**
0600    * Setup everything
0601    */
0602   virtual void setup();
0603   
0604    /**
0605    * The highest multiplicity of legs having virtual contributions.(needed for madgraph) 
0606    */
0607 
0608   size_t highestVirt(){return theHighestVirtualsize;}
0609 
0610   //@}
0611 
0612   /** @name Diagnostic information */
0613   //@{
0614 
0615   /**
0616    * Return true, if verbose
0617    */
0618   bool verbose() const { return theVerbose; }
0619 
0620   /**
0621    * Switch on diagnostic information.
0622    */
0623   void setVerbose(bool on = true) { theVerbose = on; }
0624   
0625   /**
0626    * Return true, if verbose while initializing
0627    */
0628   bool initVerbose() const { return theInitVerbose || verbose(); }
0629 
0630   /**
0631    * Switch on diagnostic information while initializing
0632    */
0633   void setInitVerbose(bool on = true) { theInitVerbose = on; }
0634 
0635   /**
0636    * Dump the setup
0637    */
0638   void print(ostream&) const;
0639 
0640   /**
0641    * Return the subtraction data prefix.
0642    */
0643   const string& subtractionData() const { return theSubtractionData; }
0644 
0645   /**
0646    * Set the subtraction data prefix.
0647    */
0648   void subtractionData(const string& s) { theSubtractionData = s; }
0649 
0650   /**
0651    * Return the subtraction plot type.
0652    */
0653   const int& subtractionPlotType() const { return theSubtractionPlotType; }
0654 
0655   /**
0656    * Set the subtraction plot type.
0657    */
0658   void subtractionPlotType(const int& t) { theSubtractionPlotType = t; }
0659   
0660   /**
0661    * Return whether subtraction data should be plotted for all phase space points individually
0662    */
0663   const bool& subtractionScatterPlot() const { return theSubtractionScatterPlot; }
0664   
0665   /**
0666    * Set whether subtraction data should be plotted for all phase space points individually
0667    */
0668   void subtractionScatterPlot(const bool& s) { theSubtractionScatterPlot = s; }
0669   
0670   /**
0671    * Return the pole data prefix.
0672    */
0673   const string& poleData() const { return thePoleData; }
0674 
0675   /**
0676    * Set the pole data prefix.
0677    */
0678   void poleData(const string& s) { thePoleData = s; }
0679 
0680   /**
0681    * Return true, if cancellationn of epsilon poles should be checked.
0682    */
0683   bool checkPoles() const { return poleData() != ""; }
0684 
0685   //@}
0686 
0687   /** @name Process generation */
0688   //@{
0689 
0690   /**
0691    * Return the particle groups.
0692    */
0693   const map<string,PDVector>& particleGroups() const { return theParticleGroups; }
0694 
0695   /**
0696    * Access the particle groups.
0697    */
0698   map<string,PDVector>& particleGroups() { return theParticleGroups; }
0699 
0700   /**
0701    * Return true, if the given particle is incoming
0702    */
0703   bool isIncoming(cPDPtr p) const {
0704     return theIncoming.find(p->id()) != theIncoming.end();
0705   }
0706 
0707   /**
0708    * Return true, if spin correlation information should be provided, if possible.
0709    */
0710   bool spinCorrelations() const { return theSpinCorrelations; }
0711 
0712   /**
0713    * Indicate that spin correlation information should be provided, if possible.
0714    */
0715   void setSpinCorrelations(bool yes) { theSpinCorrelations = yes; }
0716 
0717   //@}
0718 
0719   /** @name Truncated qtilde shower information */
0720   //@{
0721 
0722   /**
0723    * Return the subprocess of the real emission
0724    */
0725   tSubProPtr hardTreeSubprocess() { return theHardtreeSubprocess; }
0726 
0727   /**
0728    * Set the subprocess of the real emission for use in calculating the shower hardtree
0729    */
0730   void setHardTreeSubprocess(tSubProPtr hardTree) { theHardtreeSubprocess = hardTree; }
0731 
0732   /**
0733    * Return the born emitter 
0734    */
0735   int hardTreeEmitter() { return theHardtreeEmitter; }
0736 
0737   /**
0738    * Set the born emitter for use in calculating the shower hardtree
0739    */
0740   void setHardTreeEmitter(int emitter) { theHardtreeEmitter = emitter; }
0741 
0742   /**
0743    * Return the born spectator 
0744    */
0745   int hardTreeSpectator() { return theHardtreeSpectator; }
0746 
0747   /**
0748    * Set the born spectator for use in calculating the shower hardtree
0749    */
0750   void setHardTreeSpectator(int spectator) { theHardtreeSpectator = spectator; }
0751 
0752   //@}
0753 
0754   /** @name Data handling */
0755   //@{
0756   /**
0757    * Return (and possibly create) a directory to contain amplitude
0758    * information.
0759    */
0760   const string& buildStorage();
0761 
0762   /**
0763    * Return (and possibly create) a directory to contain integration grid
0764    * information.
0765    */
0766   const string& runStorage();
0767   
0768   /**
0769    *  alpha of http://arxiv.org/pdf/hep-ph/0307268v2.pdf to restrict 
0770    *  dipole phase space
0771    */
0772   double alphaParameter() const { return theAlphaParameter; }
0773   
0774   /**
0775    *  set the alpha parameter (needed for massive PK-Operator)
0776    */
0777   void setAlphaParameter(double a)const { theAlphaParameter = a; }
0778   
0779   //@}
0780 
0781 public:
0782 
0783   /**
0784    * Print a summary of the parameters used
0785    */
0786   void summary(ostream&) const;
0787 
0788 public:
0789 
0790   /** @name Functions used by the persistent I/O system. */
0791   //@{
0792   /**
0793    * Function used to write out object persistently.
0794    * @param os the persistent output stream written to.
0795    */
0796   void persistentOutput(PersistentOStream & os) const;
0797 
0798   /**
0799    * Function used to read in object persistently.
0800    * @param is the persistent input stream read from.
0801    * @param version the version number of the object when written.
0802    */
0803   void persistentInput(PersistentIStream & is, int version);
0804   //@}
0805 
0806   /**
0807    * The standard Init function used to initialize the interfaces.
0808    * Called exactly once for each class by the class description system
0809    * before the main function starts or
0810    * when this class is dynamically loaded.
0811    */
0812   static void Init();
0813 
0814 protected:
0815 
0816   /** @name Clone Methods. */
0817   //@{
0818   /**
0819    * Make a simple clone of this object.
0820    * @return a pointer to the new object.
0821    */
0822   virtual IBPtr clone() const;
0823 
0824   /** Make a clone of this object, possibly modifying the cloned object
0825    * to make it sane.
0826    * @return a pointer to the new object.
0827    */
0828   virtual IBPtr fullclone() const;
0829   //@}
0830 
0831 protected:
0832 
0833   /** @name Standard Interfaced functions. */
0834   //@{
0835   /**
0836    * Initialize this object after the setup phase before saving an
0837    * EventGenerator to disk.
0838    * @throws InitException if object could not be initialized properly.
0839    */
0840   virtual void doinit();
0841 
0842   /**
0843    * Initialize this object. Called in the run phase just before
0844    * a run begins.
0845    */
0846   virtual void doinitrun();
0847   //@}
0848 
0849 private:
0850 
0851   /**
0852    * Flag to indicate that at least one MatchboxFactory object is in action
0853    */
0854   static bool& theIsMatchboxRun();
0855 
0856   /**
0857    * The diagram generator.
0858    */
0859   Ptr<Tree2toNGenerator>::ptr theDiagramGenerator;
0860 
0861   /**
0862    * The process data object to be used
0863    */
0864   Ptr<ProcessData>::ptr theProcessData;
0865 
0866   /**
0867    * The number of light flavours, this matrix
0868    * element is calculated for.
0869    */
0870   unsigned int theNLight;
0871 
0872   /**
0873    * Vector with the PDG ids of the light quark flavours,
0874    * which are contained in the jet particle group.
0875    */
0876   vector<long> theNLightJetVec;
0877 
0878   /**
0879    * Vector with the PDG ids of the heavy quark flavours,
0880    * which are contained in the jet particle group.
0881    */
0882   vector<long> theNHeavyJetVec;
0883 
0884   /**
0885    * Vector with the PDG ids of the light quark flavours,
0886    * which are contained in the proton particle group.
0887    */
0888   vector<long> theNLightProtonVec;
0889 
0890   /**
0891    * The order in \f$\alpha_S\f$.
0892    */
0893   unsigned int theOrderInAlphaS;
0894 
0895   /**
0896    * The order in \f$\alpha_{EM}\f$.
0897    */
0898   unsigned int theOrderInAlphaEW;
0899 
0900   /**
0901    * The maximum number of legs with virtual corrections.
0902    **/
0903   unsigned int theHighestVirtualSize;
0904 
0905   /**
0906    * Switch on or off Born contributions
0907    */
0908   bool theBornContributions;
0909 
0910   /**
0911    * Switch on or off virtual contributions
0912    */
0913   bool theVirtualContributions;
0914 
0915   /**
0916    * Switch on or off subtracted real emission contributions should be included.
0917    */
0918   bool theRealContributions;
0919 
0920   /**
0921    * True if virtual contributions should be treated as independent subprocesses
0922    */
0923   bool theIndependentVirtuals;
0924 
0925   /**
0926    * True if PK operator contributions should be treated as independent subprocesses
0927    */
0928   bool theIndependentPKs;
0929 
0930   /**
0931    * The phase space generator to be used.
0932    */
0933   Ptr<MatchboxPhasespace>::ptr thePhasespace;
0934 
0935   /**
0936    * The scale choice object
0937    */
0938   Ptr<MatchboxScaleChoice>::ptr theScaleChoice;
0939 
0940   /**
0941    * The factorization scale factor.
0942    */
0943   double theFactorizationScaleFactor;
0944 
0945   /**
0946    * The renormalization scale factor.
0947    */
0948   double theRenormalizationScaleFactor;
0949 
0950   /**
0951    * Use non-running couplings.
0952    */
0953   bool theFixedCouplings;
0954 
0955   /**
0956    * Use non-running couplings.
0957    */
0958   bool theFixedQEDCouplings;
0959 
0960   /**
0961    * True, if veto scales should be set
0962    * for the real emission
0963    */
0964   bool theVetoScales;
0965 
0966   /**
0967    * The amplitudes to be considered
0968    */
0969   vector<Ptr<MatchboxAmplitude>::ptr> theAmplitudes;
0970 
0971   /**
0972    * The Born matrix elements to be considered
0973    */
0974   vector<Ptr<MatchboxMEBase>::ptr> theBornMEs;
0975 
0976   /**
0977    * The loop induced matrix elements to be considered
0978    */
0979   vector<Ptr<MatchboxMEBase>::ptr> theLoopInducedMEs;
0980 
0981   /**
0982    * The virtual corrections to be considered
0983    */
0984   vector<Ptr<MatchboxInsertionOperator>::ptr> theVirtuals;
0985 
0986   /**
0987    * The real emission matrix elements to be considered
0988    */
0989   vector<Ptr<MatchboxMEBase>::ptr> theRealEmissionMEs;
0990 
0991   /**
0992    * The produced NLO matrix elements
0993    */
0994   vector<Ptr<MatchboxMEBase>::ptr> theBornVirtualMEs;
0995 
0996   /**
0997    * The produced subtracted matrix elements
0998    */
0999   vector<Ptr<SubtractedME>::ptr> theSubtractedMEs;
1000 
1001   /**
1002    * The produced finite real emission matrix elements
1003    */
1004   vector<Ptr<MatchboxMEBase>::ptr> theFiniteRealMEs;
1005 
1006   /**
1007    * Which set of dipoles should be considered
1008    */
1009   int theDipoleSet;
1010 
1011   /**
1012    * Switch on or off verbosity
1013    */
1014   bool theVerbose;
1015   
1016   /**
1017    * True, if verbose while initializing
1018    */
1019   bool theInitVerbose;
1020 
1021   /**
1022    * Prefix for subtraction data
1023    */
1024   string theSubtractionData;
1025 
1026   /**
1027    * Set the type of plot that is to be generated for subtraction checking
1028    */
1029   int theSubtractionPlotType;
1030   
1031   /**
1032    * Set whether subtraction data should be plotted for all phase space points individually
1033    */
1034   bool theSubtractionScatterPlot;
1035   
1036   /**
1037    * Prefix for pole data.
1038    */
1039   string thePoleData;
1040 
1041   /**
1042    * Command to limit the real emission process to be considered.
1043    */
1044   string doSingleRealProcess(string);
1045 
1046   /**
1047    * The real emission process to be included; if empty, all possible
1048    * ones will be considered.
1049    */
1050   vector<vector<string> > realEmissionProcesses;
1051 
1052   /**
1053    * Particle groups.
1054    */
1055   map<string,PDVector> theParticleGroups;
1056 
1057   /**
1058    * Command to start a particle group.
1059    */
1060   string startParticleGroup(string);
1061 
1062   /**
1063    * The name of the particle group currently edited.
1064    */
1065   string particleGroupName;
1066 
1067   /**
1068    * The particle group currently edited.
1069    */
1070   PDVector particleGroup;
1071 
1072   /**
1073    * Command to end a particle group.
1074    */
1075   string endParticleGroup(string);
1076 
1077 protected:
1078   
1079   /**
1080    * Parse a process description
1081    */
1082   virtual vector<string> parseProcess(string);
1083 
1084 private:
1085   
1086   /**
1087    * Command to set the process.
1088    */
1089   string doProcess(string);
1090 
1091   /**
1092    * Command to set the process.
1093    */
1094   string doLoopInducedProcess(string);
1095 
1096   /**
1097    * The process to consider in terms of particle groups.
1098    */
1099   vector<vector<string> > processes;
1100 
1101   /**
1102    * The loop induced process to consider in terms of particle groups.
1103    */
1104   vector<vector<string> > loopInducedProcesses;
1105 
1106   /**
1107    * Generate subprocesses.
1108    */
1109   set<PDVector> makeSubProcesses(const vector<string>&) const;
1110 
1111  
1112 public: 
1113   
1114   /**
1115    * Generate matrix element objects for the given process.
1116    */
1117   vector<Ptr<MatchboxMEBase>::ptr> makeMEs(const vector<string>&, 
1118                        unsigned int orderas,
1119                        bool virt);
1120 
1121   
1122 private:
1123   /**
1124    * The shower approximation.
1125    */
1126   Ptr<ShowerApproximation>::ptr theShowerApproximation;
1127 
1128   /**
1129    * The map of Born processes to splitting dipoles
1130    */
1131   map<cPDVector,set<Ptr<SubtractionDipole>::ptr> > theSplittingDipoles;
1132 
1133   /**
1134    * True, if subtraction scales should be caluclated from real emission kinematics
1135    */
1136   bool theRealEmissionScales;
1137 
1138   /**
1139    * Consider all processes with order in couplings specifying the
1140    * maximum order.
1141    */
1142   bool theAllProcesses;
1143 
1144   /**
1145    * The processes to be ordered from an OLP
1146    */
1147   map<Ptr<MatchboxAmplitude>::tptr,map<pair<Process,int>,int> > theOLPProcesses;
1148 
1149   /**
1150    * Amplitudes which need external initialization
1151    */
1152   set<Ptr<MatchboxAmplitude>::tptr> theExternalAmplitudes;
1153 
1154   /**
1155    * Amplitudes to be selected on clashing responsibilities.
1156    */
1157   vector<Ptr<MatchboxAmplitude>::ptr> theSelectedAmplitudes;
1158 
1159   /**
1160    * Amplitudes to be deselected on clashing responsibilities.
1161    */
1162   vector<Ptr<MatchboxAmplitude>::ptr> theDeselectedAmplitudes;
1163 
1164   /**
1165    * Reweight objects for matrix elements
1166    */
1167   vector<ReweightPtr> theReweighters;
1168 
1169   /**
1170    * Preweight objects for matrix elements
1171    */
1172   vector<ReweightPtr> thePreweighters;
1173 
1174   /**
1175    * Produce matrix element corrections, but no NLO
1176    */
1177   bool theMECorrectionsOnly;
1178 
1179   /**
1180    * The highest multiplicity of legs having virtual contributions.(needed for madgraph) 
1181    */
1182   int theHighestVirtualsize;
1183 
1184   /**
1185    * Produce matrix element corrections, with LoopSim NLO
1186    */
1187   bool theLoopSimCorrections;
1188 
1189   /**
1190    * True, if the setup has already been run.
1191    */
1192   bool ranSetup;
1193 
1194   /**
1195    * PDG ids of incoming particles
1196    */
1197   set<long> theIncoming;
1198 
1199   /**
1200    * True, if first incoming partons originate from perturbative PDF
1201    */
1202   bool theFirstPerturbativePDF;
1203 
1204   /**
1205    * True, if second incoming partons originate from perturbative PDF
1206    */
1207   bool theSecondPerturbativePDF;
1208 
1209   /**
1210    * True, if this Factory is in production mode.
1211    */
1212   bool inProductionMode;
1213 
1214   /**
1215    * The real emission subprocess used when calculating the hardtree
1216    * in the truncated qtilde shower
1217    */
1218   tSubProPtr theHardtreeSubprocess;
1219 
1220   /**
1221    * The born emitter used when calculating the hardtree in
1222    * the truncated shower
1223    */
1224   int theHardtreeEmitter;
1225 
1226   /**
1227    * The born spectator used when calculating the hardtree in
1228    * the truncated shower
1229    */
1230   int theHardtreeSpectator;
1231 
1232   /**
1233    * True, if spin correlation information should be provided, if possible.
1234    */
1235   bool theSpinCorrelations;
1236 
1237   /**
1238    * The alpha parameter to be used for the dipole subtraction
1239    * JB: The parameter is muatble, since we need to be able to change it 
1240    * while calculating the difference of IPK with and without alpha.
1241    */  
1242   mutable double theAlphaParameter;
1243 
1244   /**
1245    * Wether or not charge conservation should be enforced for the processes
1246    * constructed.
1247    */
1248   bool theEnforceChargeConservation;
1249 
1250   /**
1251    * Wether or not colour conservation should be enforced for the processes
1252    * constructed.
1253    */
1254   bool theEnforceColourConservation;
1255 
1256   /**
1257    * Wether or not lepton number conservation should be enforced for the processes
1258    * constructed.
1259    */
1260   bool theEnforceLeptonNumberConservation;
1261 
1262   /**
1263    * Wether or not quark number conservation should be enforced for the processes
1264    * constructed.
1265    */
1266   bool theEnforceQuarkNumberConservation;
1267 
1268   /**
1269    * Assume flavour diagonal lepton interactions
1270    */
1271   bool theLeptonFlavourDiagonal;
1272 
1273   /**
1274    * Assume flavour diagonal quark interactions
1275    */
1276   bool theQuarkFlavourDiagonal;
1277 
1278   /**
1279    * Command for production mode
1280    */
1281   string doProductionMode(string) {
1282     productionMode(); return "";
1283   }
1284 
1285 private:
1286 
1287   /**
1288    * The assignment operator is private and must never be called.
1289    * In fact, it should not even be implemented.
1290    */
1291   MatchboxFactory & operator=(const MatchboxFactory &) = delete;
1292 
1293 };
1294 
1295 }
1296 
1297 #endif /* HERWIG_MatchboxFactory_H */