herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
Merger.h
1  //
5  //
8  //
9 #ifndef HERWIG_Merger_H
10 #define HERWIG_Merger_H
11  //
13  //
14 #include "MergingFactory.fh"
15 #include "Node.fh"
16 
17 
18 
19 #include "ThePEG/Handlers/HandlerBase.h"
20 #include "Herwig/Shower/Dipole/DipoleShowerHandler.h"
21  //#include "Herwig/Shower/Dipole/Base/DipoleSplittingGenerator.h"
22 #include "Herwig/MatrixElement/Matchbox/Base/MergerBase.h"
23 
24 #include "Herwig/MatrixElement/Matchbox/Phasespace/FFLightTildeKinematics.h"
25 #include "Herwig/MatrixElement/Matchbox/Phasespace/IFLightTildeKinematics.h"
26 #include "Herwig/MatrixElement/Matchbox/Phasespace/FFMassiveTildeKinematics.h"
27 #include "Herwig/MatrixElement/Matchbox/Phasespace/IFMassiveTildeKinematics.h"
28 #include "Herwig/MatrixElement/Matchbox/Phasespace/FILightTildeKinematics.h"
29 #include "Herwig/MatrixElement/Matchbox/Phasespace/IILightTildeKinematics.h"
30 #include "Herwig/MatrixElement/Matchbox/Phasespace/FIMassiveTildeKinematics.h"
31 
32 #include "ThePEG/Cuts/JetFinder.h"
33 #include "ThePEG/Cuts/Cuts.h"
34 
35 
36 
37 namespace Herwig {
38 
39  using namespace ThePEG;
40 
41 
42  class Merger;
43 
44  ThePEG_DECLARE_POINTERS(Merger , MergerPtr );
45 
46  typedef vector<NodePtr> NodePtrVec;
47  //definition of a history step
48  struct HistoryStep {
50  NodePtr node;
52  double weight;
54  Energy scale;
55  };
56 
57  typedef vector< HistoryStep > History;
58 
59  typedef multimap<DipoleIndex, Ptr<DipoleSplittingGenerator>::ptr> GeneratorMap2;
60 
70  class Merger: public MergerBase {
71 
72  friend class MergingFactory;
73  friend class Node;
74 
75  public:
76 
77  // define the ME region for a particle vector.
78  bool matrixElementRegion(PVector incoming,
80  Energy winnerScale = ZERO,
81  Energy cutscale = ZERO)const;
84  Energy mergingScale()const{return theMergePt;}
86  Energy mergePt()const {return theMergePt;}
88  int M()const;
90  int N()const;
92  int N0()const{return theN0;}
94  CrossSection MergingDSigDR();
97  void setXComb( tStdXCombPtr );
99  void setKinematics();
101  void clearKinematics();
103  bool generateKinematics( const double * );
105  void flushCaches();
107  size_t maxLegs() const {return theCurrentMaxLegs;}
109  void setME(MatchboxMEBasePtr me){
110  theCurrentME=me;
111  assert(theFirstNodeMap.count(theCurrentME));
112  theCurrentNode=theFirstNodeMap[theCurrentME];
113  }
115  double emissionProbability() const{ return theEmissionProbability; }
117  void setEmissionProbability(double x){theEmissionProbability=x;}
118 
119 
120  protected:
122  void N0(int n){ theN0=n;}
124  Ptr<ColourBasis>::ptr largeNBasis()const{return theLargeNBasis;}
126  void smearMergePt(){
127  const double factor = 1. + (-1. + 2.*UseRandom::rnd() ) * smear();
128  theMergePt = factor * centralMergePt();
129  }
131  int openZBoundaries()const{return DSH()->showerPhaseSpaceOption();}
133  MatchboxMEBasePtr currentME() const { return theCurrentME; }
135  NodePtr currentNode() const { return theCurrentNode; }
138  double gamma()const{return theGamma;}
139 
140  private:
142  double singlesudakov(Dipole, Energy, Energy, pair<bool, bool>);
145  bool dosudakov(NodePtr Born, Energy running, Energy next, double& sudakov0_n);
147  void cleanup(NodePtr);
150  bool isProjectorStage( NodePtr , int )const;
157  Energy CKKW_StartScale(NodePtr) const;
159  void CKKW_PrepareSudakov(NodePtr, Energy);
161  double Nf(Energy scale)const{return DSH()->Nf(scale);}
163  MergingFactoryPtr treefactory() const;
165  map<MatchboxMEBasePtr, NodePtr> firstNodeMap() const ;
167  void mergePt(Energy x) {theMergePt = x;}
169  Energy centralMergePt() const {return theCentralMergePt;}
170 
171  private:
173  CrossSection MergingDSigDRBornStandard();
179  CrossSection MergingDSigDRBornGamma();
181  CrossSection MergingDSigDRVirtualStandard();
186  CrossSection MergingDSigDRRealStandard();
190  CrossSection MergingDSigDRRealAllAbove();
194  CrossSection MergingDSigDRRealBelowSubReal();
198  CrossSection MergingDSigDRRealBelowSubInt();
200  size_t maxLegsLO() const {return N0()+N();}
203  CrossSection TreedSigDR(Energy startscale, double diffalpha=1.);
205  Energy fillProjector(int);
207  void fillHistory(Energy, NodePtr, NodePtr );
209  double pdfratio(NodePtr, Energy, Energy, int, bool fromIsME, bool toIsME);
211  double pdfReweight();
213  double alphaReweight(bool nocmw=false);
215  size_t maxLegsNLO()const {return N0()+M();}
217  CrossSection LoopdSigDR(Energy startscale );
219  double sumPdfReweightExpansion()const;
221  double sumAlphaSReweightExpansion()const;
223  double sumFillHistoryExpansion();
225  double alphasExpansion( Energy next, Energy fixedScale)const;
227  double pdfExpansion(NodePtr, int, Energy, Energy, double, int, Energy)const;
229  bool doHistExpansion(NodePtr Born, Energy running, Energy next, Energy fixedScale, double& HistExpansion);
231  double singleHistExpansion(Dipole, Energy, Energy, Energy, pair<bool, bool>);
232  //alpha_s as given in the shower
233  double as(Energy q)const{return DSH()->as(q);}
234  // set the pointer to the Mergingfactory.
235  void setFactory(MergingFactoryPtr f){theTreeFactory=f;}
236  // set the pointer to the DipoleShower.
237  void setDipoleShower(DipoleShowerHandlerPtr dsh){theDipoleShowerHandler=dsh;}
238  //return the dipole shower handler
239  DipoleShowerHandlerPtr DSH(){return theDipoleShowerHandler;}
240  //return the const dipole shower handler
241  cDipoleShowerHandlerPtr DSH()const{return theDipoleShowerHandler;}
243  void firstNodeMap(MatchboxMEBasePtr, NodePtr);
245  int chooseHistory()const {return theChooseHistory;}
247  double smear()const{return theSmearing;}
249  void largeNBasis(Ptr<ColourBasis>::ptr x){theLargeNBasis=x;}
251  bool notOnlyMulti()const;
253  double cmwAlphaS(Energy q)const;
255  void debugVirt(double, double, double, double, CrossSection,
256  double, double, double, NodePtr,CrossSection) const;
258  void debugReal( string, double, CrossSection, CrossSection) const;
259 
260 
261  private:
262 
264  unsigned int theShowerExpansionWeights = 2;
266  unsigned int theCMWScheme = 0;
268  bool projected = true;
270  bool isUnitarized = true;
272  bool isNLOUnitarized = true;
274  int theChooseHistory = 0;
276  int theN0 = 0;
278  int theOnlyN = -1;
280  int theCurrentMaxLegs = -1;
282  double weight = 1.0;
283  double weightCB = 1.0;
285  double theGamma = 1.0;
287  double theSmearing = 0.;
288 
293  bool emitDipoleMEDiff = false;
295  double theEmissionProbability = 0.;
297  Energy theIRSafePT = 1_GeV;
299  Energy theMergePt = 4_GeV;
301  Energy theCentralMergePt = 4_GeV;
304  double theRealSubtractionRatio=3.;
306  History history;
308  Ptr<ColourBasis>::ptr theLargeNBasis;
310  NodePtr theCurrentNode;
312  MatchboxMEBasePtr theCurrentME;
314  Ptr<FFLightTildeKinematics>::ptr FFLTK = new_ptr( FFLightTildeKinematics() );
315  Ptr<FILightTildeKinematics>::ptr FILTK = new_ptr( FILightTildeKinematics() );
316  Ptr<IFLightTildeKinematics>::ptr IFLTK = new_ptr( IFLightTildeKinematics() );
317  Ptr<IILightTildeKinematics>::ptr IILTK = new_ptr( IILightTildeKinematics() );
318  Ptr<FFMassiveTildeKinematics>::ptr FFMTK = new_ptr( FFMassiveTildeKinematics() );
319  Ptr<FIMassiveTildeKinematics>::ptr FIMTK = new_ptr( FIMassiveTildeKinematics() );
320  Ptr<IFMassiveTildeKinematics>::ptr IFMTK = new_ptr( IFMassiveTildeKinematics() );
321  //pointer to the shower handler
322  DipoleShowerHandlerPtr theDipoleShowerHandler;
324  MergingFactoryPtr theTreeFactory;
326  map<MatchboxMEBasePtr, NodePtr> theFirstNodeMap;
328  map<NodePtr, CrossSection> theHighMeWeightMap;
329 
330  protected:
331 
339  virtual void doinit();
340 
342 
343 
344  public:
345 
352  void persistentOutput(PersistentOStream & os) const;
353 
359  void persistentInput(PersistentIStream & is, int version);
361 
368  static void Init();
369 
370  protected:
371 
378  virtual IBPtr clone() const;
379 
384  virtual IBPtr fullclone() const;
386 
387 
388  // If needed, insert declarations of virtual function defined in the
389  // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
390 
391 
392  private:
393 
394 
395 
400  Merger & operator=(const Merger &) = delete;
401 
402  };
403 
404 }
405 
406 
407 
408 #endif /* HERWIG_Merger_H */
int chooseHistory() const
history choice: weighted history choice
Definition: Merger.h:245
void smearMergePt()
smear the merging pt
Definition: Merger.h:126
Ptr< ColourBasis >::ptr theLargeNBasis
pointer to the large-N basis
Definition: Merger.h:308
double smear() const
the smearing factor for the merging scale
Definition: Merger.h:247
size_t maxLegsNLO() const
max legssize the shower should veto for NLO
Definition: Merger.h:215
void N0(int n)
the merging factory needs to set the legsize of the production process
Definition: Merger.h:122
double gamma() const
the gamma parameter to subtract dipoles above a alpha parameter and subtract the corresponding IPK op...
Definition: Merger.h:138
MatchboxMEBasePtr theCurrentME
current ME
Definition: Merger.h:312
int N0() const
legsize of the production process
Definition: Merger.h:92
FFMassiveTildeKinematics implements the &#39;tilde&#39; kinematics for a final-final subtraction dipole...
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
Merger handles the Merger ....... //TODO .
Definition: Merger.h:70
void mergePt(Energy x)
set the current merging pt, smeared in generate kinematics
Definition: Merger.h:167
static double rnd()
NodePtr theCurrentNode
current Node
Definition: Merger.h:310
MergingFactory automatically sets up a NLO QCD merging.
double Nf(Energy scale) const
number of active flavours as given by the shower
Definition: Merger.h:161
map< MatchboxMEBasePtr, NodePtr > theFirstNodeMap
map from ME to first Node
Definition: Merger.h:326
void largeNBasis(Ptr< ColourBasis >::ptr x)
return the large-N colour basis
Definition: Merger.h:249
int openZBoundaries() const
true if the phase space for initial emissions should not be restricted in z.
Definition: Merger.h:131
IFLightTildeKinematics implements the &#39;tilde&#39; kinematics for a initial-final subtraction dipole...
History history
current cluster histoy including sudakov weights
Definition: Merger.h:306
The Dipole class is used by the dipole shower to represent a dipole of two coloured partons...
Definition: Dipole.h:30
size_t maxLegsLO() const
max legssize the shower should veto for LO
Definition: Merger.h:200
FILightTildeKinematics implements the &#39;tilde&#39; kinematics for a final-initial subtraction dipole...
double emissionProbability() const
allow emissions with a given probability.in the ME region
Definition: Merger.h:115
FFLightTildeKinematics implements the &#39;tilde&#39; kinematics for a final-final subtraction dipole...
FIMassiveTildeKinematics implements the &#39;tilde&#39; kinematics for a final-initial subtraction dipole...
IFMassiveTildeKinematics implements the &#39;tilde&#39; kinematics for a initial-final subtraction dipole...
NodePtr node
containing the full information
Definition: Merger.h:50
-*- C++ -*-
void setEmissionProbability(double x)
set a probability of allowed emission into ME region.
Definition: Merger.h:117
Ptr< ColourBasis >::ptr largeNBasis() const
return the large-N basis (TODO: implement check if born ME works with the choice) ...
Definition: Merger.h:124
MergingFactoryPtr theTreeFactory
pointer to the MergingFactory
Definition: Merger.h:324
double weight
current sudakov weight of the history
Definition: Merger.h:52
void setME(MatchboxMEBasePtr me)
set the current ME
Definition: Merger.h:109
NodePtr currentNode() const
return the current Node
Definition: Merger.h:135
vector< PPtr > PVector
Energy mergePt() const
return the current merging pt (should be unified with mergingScale)
Definition: Merger.h:86
MatchboxMEBasePtr currentME() const
return the current ME
Definition: Merger.h:133
size_t maxLegs() const
return the current maximum legs, the shower should veto
Definition: Merger.h:107
MergerBase is the base class MergingHelpers.
Definition: MergerBase.h:38
Energy scale
current scale of the history
Definition: Merger.h:54
Energy mergingScale() const
return the current merging scale, gets smeared around the central merging scale in generate kinematic...
Definition: Merger.h:84
constexpr ZeroUnit ZERO
map< NodePtr, CrossSection > theHighMeWeightMap
map from ME to highest ME weight so far
Definition: Merger.h:328
Energy centralMergePt() const
return the central merging pt
Definition: Merger.h:169
Here is the documentation of the Node class.
Definition: Node.h:38