herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.4
MatchboxAmplitude.h
1 // -*- C++ -*-
2 //
3 // MatchboxAmplitude.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2017 The Herwig Collaboration
5 //
6 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef HERWIG_MatchboxAmplitude_H
10 #define HERWIG_MatchboxAmplitude_H
11 //
12 // This is the declaration of the MatchboxAmplitude class.
13 //
14 
15 #include "ThePEG/MatrixElement/Amplitude.h"
16 #include "ThePEG/Handlers/LastXCombInfo.h"
17 #include "Herwig/MatrixElement/Matchbox/Utility/ColourBasis.h"
18 #include "Herwig/MatrixElement/Matchbox/Utility/SpinCorrelationTensor.h"
19 #include "Herwig/MatrixElement/Matchbox/Utility/LastMatchboxXCombInfo.h"
20 #include "Herwig/MatrixElement/Matchbox/Utility/MatchboxXComb.h"
21 #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
22 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxMEBase.fh"
23 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.fh"
24 #include "ThePEG/Persistency/PersistentOStream.h"
25 #include "ThePEG/Persistency/PersistentIStream.h"
26 
27 namespace Herwig {
28 
29 using namespace ThePEG;
30 
37 struct Process {
38 
39  PDVector legs;
40  unsigned int orderInAlphaS;
41  unsigned int orderInAlphaEW;
42 
43  Process()
44  : orderInAlphaS(0), orderInAlphaEW(0) {}
45 
46  Process(const PDVector& p,
47  unsigned int oas,
48  unsigned int oae)
49  : legs(p), orderInAlphaS(oas), orderInAlphaEW(oae) {}
50 
51  bool operator==(const Process& other) const {
52  return
53  legs == other.legs &&
54  orderInAlphaS == other.orderInAlphaS &&
55  orderInAlphaEW == other.orderInAlphaEW;
56  }
57 
58  bool operator<(const Process& other) const {
59  if ( orderInAlphaS != other.orderInAlphaS )
60  return orderInAlphaS < other.orderInAlphaS;
61  if ( orderInAlphaEW != other.orderInAlphaEW )
62  return orderInAlphaEW < other.orderInAlphaEW;
63  return legs < other.legs;
64  }
65 
66  void persistentOutput(PersistentOStream & os) const {
67  os << legs << orderInAlphaS << orderInAlphaEW;
68  }
69 
70  void persistentInput(PersistentIStream & is) {
71  is >> legs >> orderInAlphaS >> orderInAlphaEW;
72  }
73 
74 };
75 
82 namespace ProcessType {
83 
84  enum Types {
85 
86  treeME2 = 0,
87  colourCorrelatedME2,
88  spinColourCorrelatedME2,
89  oneLoopInterference,
90  loopInducedME2,
91  spinCorrelatedME2
92 
93  };
94 
95 }
96 
97 
109  public Amplitude,
110  public LastXCombInfo<StandardXComb>,
111  public LastMatchboxXCombInfo {
112 
113 public:
114 
121 
125  virtual ~MatchboxAmplitude();
127 
128 public:
129 
136  virtual Complex value(const tcPDVector & particles,
137  const vector<Lorentz5Momentum> & momenta,
138  const vector<int> & helicities);
139 
143  Ptr<MatchboxFactory>::tptr factory() const;
144 
148  virtual void factory(Ptr<MatchboxFactory>::tptr f);
149 
152 
156  virtual bool canHandle(const PDVector& p,
157  Ptr<MatchboxFactory>::tptr,
158  bool) const { return canHandle(p); }
159 
163  virtual bool canHandle(const PDVector&) const { return false; }
164 
169  virtual int nDimAdditional() const { return 0; }
170 
175  virtual Ptr<MatchboxMEBase>::ptr makeME(const PDVector&) const;
176 
181  virtual void orderInGs(unsigned int) {}
182 
187  virtual unsigned int orderInGs() const = 0;
188 
193  virtual void orderInGem(unsigned int) {}
194 
199  virtual unsigned int orderInGem() const = 0;
200 
204  Ptr<StandardModel>::tcptr standardModel() {
205  if ( !hwStandardModel() )
206  hwStandardModel(dynamic_ptr_cast<Ptr<StandardModel>::tcptr>(HandlerBase::standardModel()));
207  return hwStandardModel();
208  }
209 
214  virtual bool hasInitialAverage() const { return false; }
215 
220  virtual bool hasFinalStateSymmetry() const { return false; }
221 
225  virtual bool isOLPTree() const { return false; }
226 
230  virtual bool isOLPLoop() const { return false; }
231 
236  virtual bool needsOLPCorrelators() const { return true; }
237 
241  virtual void olpOrderFileHeader(ostream&) const;
242 
246  virtual void olpOrderFileProcesses(ostream&,
247  const map<pair<Process,int>,int>& procs) const;
248 
253  virtual void signOLP(const string&, const string&) { }
254 
258  virtual void startOLP(const string&, int& status) { status = -1; }
259 
264  virtual bool startOLP(const map<pair<Process,int>,int>& procs);
265 
270  virtual bool isExternal() const { return false; }
271 
275  virtual bool initializeExternal() { return false; }
276 
280  virtual int externalId(const cPDVector&) { return 0; }
281 
285  const map<long,Energy>& reshuffleMasses() const { return theReshuffleMasses; }
286 
290  void checkReshuffling(Ptr<MatchboxPhasespace>::tptr);
291 
293 
296 
300  virtual Ptr<ColourBasis>::tptr colourBasis() const { return theColourBasis; }
301 
306  virtual bool haveColourFlows() const {
307  return colourBasis() ? colourBasis()->haveColourFlows() : false;
308  }
309 
314  virtual Selector<const ColourLines *> colourGeometries(tcDiagPtr diag) const;
315 
320  const string& colourOrderingString(size_t id) const;
321 
326  const set<vector<size_t> >& colourOrdering(size_t id) const;
327 
329 
332 
336  virtual void setXComb(tStdXCombPtr xc);
337 
341  Lorentz5Momentum amplitudeMomentum(int) const;
342 
349  virtual void fillCrossingMap(size_t shift = 0);
350 
354  virtual set<vector<int> > generateHelicities() const;
355 
360  virtual vector<unsigned int> physicalHelicities(const vector<int>&) const;
361 
363 
366 
371  virtual void prepareAmplitudes(Ptr<MatchboxMEBase>::tcptr);
372 
376  virtual double me2() const;
377 
381  double colourCharge(tcPDPtr) const;
382 
386  double largeNColourCharge(tcPDPtr) const;
387 
391  virtual double largeNME2(Ptr<ColourBasis>::tptr largeNBasis) const;
392 
396  virtual double colourCorrelatedME2(pair<int,int> ij) const;
397 
401  virtual double largeNColourCorrelatedME2(pair<int,int> ij,
402  Ptr<ColourBasis>::tptr largeNBasis) const;
403 
407  bool trivialColourLegs() const { return theTrivialColourLegs; }
408 
413  virtual bool canFillRhoMatrix() const { return false; }
414 
420  virtual LorentzVector<Complex> plusPolarization(const Lorentz5Momentum& p,
421  const Lorentz5Momentum& n,
422  int id = -1) const;
423 
427  virtual double spinColourCorrelatedME2(pair<int,int> emitterSpectator,
428  const SpinCorrelationTensor& c) const;
429 
433  virtual double spinCorrelatedME2(pair<int,int> emitterSpectator,
434  const SpinCorrelationTensor& c) const;
435 
436 
440  virtual bool treeAmplitudes() const { return true; }
441 
446  virtual Complex evaluate(size_t, const vector<int>&, Complex&) { return 0.; }
447 
449 
452 
456  virtual Ptr<MatchboxAmplitude>::tptr oneLoopAmplitude() const {
457  return Ptr<MatchboxAmplitude>::tptr();
458  }
459 
463  virtual void disableOneLoop() {}
464 
469  virtual bool haveOneLoop() const { return false; }
470 
475  virtual bool onlyOneLoop() const { return false; }
476 
480  virtual bool oneLoopAmplitudes() const { return true; }
481 
488  virtual bool isDR() const { return false; }
489 
494  virtual bool isDRbar() const { return true; }
495 
500  virtual bool isCS() const { return false; }
501 
506  virtual bool isBDK() const { return false; }
507 
512  virtual bool isExpanded() const { return false; }
513 
519  virtual Energy2 mu2() const { return 0.*GeV2; }
520 
524  virtual bool hasRunningAlphaS() const { return false; }
525 
529  virtual bool hasRunningAlphaEW() const { return false; }
530 
534  virtual double oneLoopDoublePole() const { return 0.; }
535 
539  virtual double oneLoopSinglePole() const { return 0.; }
540 
545  virtual void prepareOneLoopAmplitudes(Ptr<MatchboxMEBase>::tcptr);
546 
550  virtual double oneLoopInterference() const;
551 
556  virtual Complex evaluateOneLoop(size_t, const vector<int>&) { return 0.; }
557 
559 
562 
566  virtual void flushCaches() {}
567 
571  Ptr<MatchboxAmplitude>::ptr cloneMe() const {
572  return dynamic_ptr_cast<Ptr<MatchboxAmplitude>::ptr>(clone());
573  }
574 
578  virtual void cloneDependencies(const std::string& prefix="" , bool slim=false);
579 
581 
582 public:
583 
590  void persistentOutput(PersistentOStream & os) const;
591 
597  void persistentInput(PersistentIStream & is, int version);
599 
606  static void Init();
607 
608 // If needed, insert declarations of virtual function defined in the
609 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
610 
611 protected:
612 
615 
621  virtual void doinit();
622 
627  virtual void doinitrun();
629 
630 private:
631 
635  Ptr<MatchboxFactory>::tptr theFactory;
636 
640  void doGenerateHelicities(set<vector<int> >& res,
641  vector<int>& current,
642  size_t pos) const;
643 
647  Ptr<ColourBasis>::ptr theColourBasis;
648 
654 
660 
666 
670  map<long,Energy> theReshuffleMasses;
671 
676 
680  string doReshuffle(string);
681 
685  string doMassless(string);
686 
690  string doOnShell(string);
691 
695  string doClearReshuffling(string);
696 
701  MatchboxAmplitude & operator=(const MatchboxAmplitude &);
702 
703 };
704 
706  const Process& h) {
707  h.persistentOutput(os);
708  return os;
709 }
710 
712  Process& h) {
713  h.persistentInput(is);
714  return is;
715 }
716 
717 }
718 
719 #endif /* HERWIG_MatchboxAmplitude_H */
Ptr< ColourBasis >::ptr theColourBasis
The colour basis implementation to be used.
virtual double oneLoopSinglePole() const
If defined, return the coefficient of the pole in epsilon.
const map< long, Energy > & reshuffleMasses() const
Return the map with masses to be used for amplitude evaluation.
virtual void signOLP(const string &, const string &)
Start the one loop provider, if appropriate, giving order and contract files.
std::complex< double > Complex
virtual bool canHandle(const PDVector &) const
Return true, if this amplitude can handle the given process.
virtual bool isOLPTree() const
Return true, if this amplitude is handled by a BLHA one-loop provider.
vector< tcPDPtr > tcPDVector
virtual bool hasFinalStateSymmetry() const
Return true, if this amplitude already includes symmetry factors for identical outgoing particles...
virtual bool onlyOneLoop() const
Return true, if this amplitude only provides one-loop (QCD) corrections.
virtual double oneLoopDoublePole() const
If defined, return the coefficient of the pole in epsilon^2.
virtual Energy2 mu2() const
Return the value of the dimensional regularization parameter.
virtual Ptr< ColourBasis >::tptr colourBasis() const
Return the colour basis.
bool operator==(const HPDiagram &x, const HPDiagram &y)
Test whether two diagrams are identical.
Definition: HPDiagram.h:98
virtual Complex evaluate(size_t, const vector< int > &, Complex &)
Evaluate the amplitude for the given colour tensor id and helicity assignment.
virtual bool isDR() const
Return true, if one loop corrections have been calculated in dimensional reduction.
virtual int externalId(const cPDVector &)
Return a generic process id for the given process.
MatchboxAmplitude is the base class for amplitude implementations inside Matchbox.
virtual bool needsOLPCorrelators() const
Return true, if colour and spin correlated matrix elements should be ordered from the OLP...
bool operator<(const HPDiagram &x, const HPDiagram &y)
Test whether one diagram is &#39;less&#39; than another.
Definition: HPDiagram.h:163
bool theTrivialColourLegs
True if trivial colour configuration.
virtual bool isExpanded() const
Return true, if one loop corrections are given in the conventions of everything expanded.
virtual void orderInGs(unsigned int)
Set the (tree-level) order in in which this matrix element should be evaluated.
virtual void startOLP(const string &, int &status)
Start the one loop provider, if appropriate.
ostream & operator<<(ostream &, const DecayIntegrator &)
Output information on the DecayIntegrator for debugging purposes.
virtual bool hasInitialAverage() const
Return true, if this amplitude already includes averaging over incoming parton&#39;s quantum numbers...
virtual bool canFillRhoMatrix() const
Return true, if this amplitude is capable of consistently filling the rho matrices for the spin corre...
int treeLevelHelicityPoints
The number of points that are calculated before a certain helicity is excluded.
virtual int nDimAdditional() const
Return the number of random numbers required to evaluate this amplitude at a fixed phase space point...
map< long, Energy > theReshuffleMasses
The map with masses to be used for amplitude evaluation.
virtual bool isOLPLoop() const
Return true, if this amplitude is handled by a BLHA one-loop provider.
virtual bool hasRunningAlphaS() const
Indicate that this amplitude is running alphas by itself.
Process information with coupling order.
bool trivialColourLegs() const
Return true if trivial colour configuration.
virtual bool haveColourFlows() const
Return true, if the colour basis is capable of assigning colour flows.
Ptr< MatchboxFactory >::tptr theFactory
The factory which produced this matrix element.
Provide easy access to MatchboxXComb XComb extensions.
int oneLoopHelicityPoints
The number of points that are calculated before a certain helicity is excluded.
int theCleanupAfter
The number of points after which helicity combinations wil be cleaned up.
vector< T > & operator>>(vector< T > &tv, U &u)
ThePEG::Ptr< ParticleData >::transient_const_pointer tcPDPtr
virtual bool canHandle(const PDVector &p, Ptr< MatchboxFactory >::tptr, bool) const
Return true, if this amplitude can handle the given process.
virtual bool isCS() const
Return true, if one loop corrections are given in the conventions of the integrated dipoles...
virtual bool haveOneLoop() const
Return true, if this amplitude is capable of calculating one-loop (QCD) corrections.
virtual void flushCaches()
Flush all cashes.
virtual bool isBDK() const
Return true, if one loop corrections are given in the conventions of BDK.
vector< cPDPtr > cPDVector
virtual bool initializeExternal()
Initialize this amplitude.
virtual bool treeAmplitudes() const
Return true, if tree-level contributions will be evaluated at amplitude level.
virtual bool hasRunningAlphaEW() const
Indicate that this amplitude is running alphaew by itself.
Ptr< MatchboxAmplitude >::ptr cloneMe() const
Clone this amplitude.
-*- C++ -*-
virtual void orderInGem(unsigned int)
Set the (tree-level) order in in which this matrix element should be evaluated.
virtual Ptr< MatchboxAmplitude >::tptr oneLoopAmplitude() const
Return the one-loop amplitude, if applicable.
virtual bool isDRbar() const
Return true, if the amplitude is DRbar renormalized, otherwise MSbar is assumed.
vector< PDPtr > PDVector
virtual Complex evaluateOneLoop(size_t, const vector< int > &)
Evaluate the amplitude for the given colour tensor id and helicity assignment.
virtual bool isExternal() const
Return true, if this amplitude needs to initialize an external code.
virtual bool oneLoopAmplitudes() const
Return true, if one-loop contributions will be evaluated at amplitude level.
tSMPtr standardModel() const
Ptr< StandardModel >::tcptr standardModel()
Return the Herwig StandardModel object.
SpinCorrelationTensor represents a spin correlation tensor of the form.
virtual void disableOneLoop()
Diasble one-loop functionality if not needed.