herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
DipoleShowerHandler.h
1 // -*- C++ -*-
2 //
3 // DipoleShowerHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2019 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_DipoleShowerHandler_H
10 #define HERWIG_DipoleShowerHandler_H
11 //
12 // This is the declaration of the DipoleShowerHandler class.
13 //
14 
15 #include "Herwig/Shower/ShowerHandler.h"
16 
17 #include "Herwig/Shower/Dipole/DipoleShowerHandler.fh"
18 #include "Herwig/Shower/Dipole/Base/DipoleSplittingInfo.h"
19 #include "Herwig/Shower/Dipole/Base/DipoleSplittingReweight.h"
20 #include "Herwig/Shower/Dipole/Kernels/DipoleSplittingKernel.h"
21 #include "Herwig/Shower/Dipole/Base/DipoleSplittingGenerator.h"
22 #include "Herwig/Shower/Dipole/Base/DipoleEventRecord.h"
23 #include "Herwig/Shower/Dipole/Base/DipoleEvolutionOrdering.h"
24 #include "Herwig/Shower/Dipole/Base/DipoleEventReweight.h"
25 #include "Herwig/Shower/Dipole/Utility/ConstituentReshuffler.h"
26 #include "Herwig/Shower/Dipole/Utility/IntrinsicPtGenerator.h"
27 #include "Herwig/MatrixElement/Matchbox/Base/MergerBase.h"
28 #include "Herwig/MatrixElement/Matchbox/Matching/ShowerApproximation.h"
29 
30 #include "Herwig/Shower/Dipole/SpinCorrelations/DipoleVertexRecord.h"
31 #include "Herwig/MatrixElement/Matchbox/Utility/DensityOperator.h"
32 
33 #include <tuple>
34 
35 namespace Herwig {
36 
37 using namespace ThePEG;
38 
50 
51 
52  friend class Merger;
53 
54 public:
55 
62 
66  virtual ~DipoleShowerHandler();
68 
69 public:
70 
71 
72  inline void colourPrint();
73 
77  struct RedoShower {};
78 
82  void addSplitting(Ptr<DipoleSplittingKernel>::ptr sp) {
83  kernels.push_back(sp);
84  }
85 
89  void resetAlphaS(Ptr<AlphaSBase>::tptr);
90 
91 
92  virtual void cascade(tPVector);
93 
97  void resetReweight(Ptr<DipoleSplittingReweight>::tptr);
98 
103  virtual bool canHandleMatchboxTrunc() const { return false; }
104 
109  virtual bool isReshuffling() const { return false; }
110 
114  virtual Energy hardScale() const {
115  return muPt;
116  }
117 
122  double as(Energy Q)const{return theGlobalAlphaS->value(sqr(Q));}
123 
129  double Nf(Energy Q)const{return theGlobalAlphaS->Nf(sqr(Q));}
130 
131  /*
132  * Access the vertex record
133  */
134  DipoleVertexRecord& vertexRecord() { return theVertexRecord; }
135 
139  const DipoleVertexRecord& vertexRecord() const { return theVertexRecord; }
140 
141 
146  void setMerger(Ptr<MergerBase>::ptr mh){theMergingHelper=mh;}
147 
148 
149 
150 public:
151 
156  const map<PPtr,size_t>& particleIndices() const { return eventRecord().particleIndices(); }
157 
162  const cPDVector& particlesAfter() const { return eventRecord().particlesAfter(); }
163 
167  DensityOperator& densityOperator() { return eventRecord().densityOperator(); }
168 
173  const map<pair<vector<PDT::Colour>,pair<size_t,size_t> >,double>& correlatorMap() const {
174  return eventRecord().densityOperator().correlatorMap();
175  }
176 
180  Ptr<ColourBasis>::tptr colourBasis() {
181  return eventRecord().densityOperator().colourBasis();
182  }
183 
187  bool continueSubleadingNc() const { return eventRecord().getContinueSubleadingNc(); }
188 
189 protected:
190 
194  void addCandidates(PPair particles, list<DipoleSplittingInfo>& clist) const;
195 
199  void getCandidates(list<DipoleSplittingInfo>& clist) const;
200 
204  void performSplitting(DipoleSplittingInfo&) const;
205 
209  Energy nextSubleadingSplitting(Energy hardPt,
210  Energy optHardPt, Energy optCutoff,
211  const bool decay);
212 
213 protected:
214 
215  typedef multimap<DipoleIndex,Ptr<DipoleSplittingGenerator>::ptr> GeneratorMap;
216 
220  virtual tPPair cascade(tSubProPtr sub, XCombPtr xcomb) {
221  return cascade(sub,xcomb,ZERO,ZERO);
222  }
223 
227  tPPair cascade(tSubProPtr sub, XCombPtr xcomb,
228  Energy optHardPt, Energy optCutoff);
229 
234  void getGenerators(const DipoleIndex&,
235  Ptr<DipoleSplittingReweight>::tptr rw =
236  Ptr<DipoleSplittingReweight>::tptr());
237 
241  void hardScales(Energy2 scale);
242 
246  void hardScalesSubleading(list<DipoleSplittingInfo> candidates,Energy hardPt);
247 
251  Ptr<DipoleEvolutionOrdering>::tptr evolutionOrdering() const { return theEvolutionOrdering; }
252 
256  void constituentReshuffle();
257 
261  void decayConstituentReshuffle( PerturbativeProcessPtr decayProc);
262 
266  GeneratorMap& generators() { return theGenerators; }
267 
271  DipoleEventRecord& eventRecord() { return theEventRecord; }
272 
276  const DipoleEventRecord& eventRecord() const { return theEventRecord; }
277 
281  const vector<Ptr<DipoleSplittingKernel>::ptr>& splittingKernels() const {
282  return kernels;
283  }
284 
288  const set<long>& offShellPartons() { return theColouredOffShellInShower; }
289 
294  bool realign();
295 
299  virtual int showerPhaseSpaceOption() const {
300  return theZBoundaries;
301  }
302 
303 protected:
304 
308  void doCascade(unsigned int& emDone,
309  Energy optHardPt = ZERO,
310  Energy optCutoff = ZERO,
311  const bool decay = false);
315  void setNEmissions(unsigned int n){nEmissions=n;}
316 
317 
322  Energy getWinner(DipoleSplittingInfo& winner,
323  const Dipole& dip,
324  pair<bool,bool> conf,
325  Energy optHardPt = ZERO,
326  Energy optCutoff = ZERO);
327 
332  Energy getWinner(DipoleSplittingInfo& winner,
333  Energy optHardPt = ZERO,
334  Energy optCutoff = ZERO);
335 
340  Energy getWinner(SubleadingSplittingInfo& winner,
341  Energy optHardPt = ZERO,
342  Energy optCutoff = ZERO);
343 
348  Energy getWinner(DipoleSplittingInfo& winner,
349  const DipoleIndex& index,
350  double emitterX, double spectatorX,
351  pair<bool,bool> conf,
352  tPPtr emitter, tPPtr spectator,
353  Energy startScale,
354  Energy optHardPt = ZERO,
355  Energy optCutoff = ZERO);
356 
357 public:
358 
365  void persistentOutput(PersistentOStream & os) const;
366 
372  void persistentInput(PersistentIStream & is, int version);
374 
381  static void Init();
382 
383 protected:
384 
391  virtual IBPtr clone() const;
392 
397  virtual IBPtr fullclone() const;
399 
400 
401 // If needed, insert declarations of virtual function defined in the
402 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
403 
404 
405 protected:
406 
414  virtual void doinit();
415 
420  virtual void doinitrun();
421 
426  virtual void dofinish();
428 
429 
430 private:
431 
435  vector<Ptr<DipoleSplittingKernel>::ptr> kernels;
436 
440  Ptr<DipoleEvolutionOrdering>::ptr theEvolutionOrdering;
441 
445  Ptr<ConstituentReshuffler>::ptr constituentReshuffler;
446 
450  Ptr<IntrinsicPtGenerator>::ptr intrinsicPtGenerator;
451 
456 
462 
467  unsigned int nEmissions;
468 
473 
478 
483 
488  //bool theAnalyseSpinCorrelations;
489 
494 
499 
504 
510 
520 
526 
531 
536 
541 
546 
551 
552 private:
553 
564 
569 
570 private:
571 
576  GeneratorMap theGenerators;
577 
582 
587 
591  unsigned int nTries;
592 
597 
602 
608  vector<vector<std::tuple<Energy,double,bool> > > theWeightsVector;
609 
613  size_t winnerIndex;//debug
614  size_t kernelIndex;//debug
615  size_t winningKernelIndex;//debug
616  vector<Energy> scales;//debug
617 
618 private:
619 
624 
629 
633  Ptr<ShowerApproximation>::tptr theShowerApproximation;
634 
639 
644  unsigned long theFreezeGrid;
645 
649  double theDetuning;
650 
654  Ptr<DipoleEventReweight>::ptr theEventReweight;
655 
659  Ptr<DipoleSplittingReweight>::ptr theSplittingReweight;
660 
664  static bool firstWarn;
665 
669  Energy maxPt;
670 
674  Energy muPt;
675 
676 
683  Ptr<MergerBase>::ptr theMergingHelper;
684 
685 
691 
697 
702 
703 private:
704 
710 
715  DipoleShowerHandler & operator=(const DipoleShowerHandler &) = delete;
716 
717 };
718 
719 }
720 
721 #include "ThePEG/Utilities/ClassTraits.h"
722 
723 namespace ThePEG {
724 
729 template <>
730 struct BaseClassTrait<Herwig::DipoleShowerHandler,1> {
732  typedef Herwig::ShowerHandler NthBase;
733 };
734 
737 template <>
738 struct ClassTraits<Herwig::DipoleShowerHandler>
739  : public ClassTraitsBase<Herwig::DipoleShowerHandler> {
741  static string className() { return "Herwig::DipoleShowerHandler"; }
749  static string library() { return "HwDipoleShower.so"; }
750 };
751 
754 }
755 
756 #endif /* HERWIG_DipoleShowerHandler_H */
static ClassDescription< DipoleShowerHandler > initDipoleShowerHandler
The static object used to initialize the description of this class.
ThePEG::Ptr< XComb >::pointer XCombPtr
Ptr< ColourBasis >::tptr colourBasis()
Return the colour basis used in the density operator.
Energy theFactorizationScaleFreeze
A freezing value for the factorization scale.
Generalized dipole splitting info to deal with subleading-N splittings.
virtual bool isReshuffling() const
Return true, if this cascade handler will perform reshuffling from hard process masses.
int realignmentScheme
Switch to record information required for the nearest neighbour analysis.
Energy muPt
The shower hard scale for the last event encountered.
bool didRadiate
Whether or not we did radiate anything.
transient_pointer tptr
GeneratorMap & generators()
Access the generator map.
bool thePowhegDecayEmission
True if powheg style emissions are to be used in the decays.
const set< long > & offShellPartons()
Return the set of offshell parton ids.
Ptr< ConstituentReshuffler >::ptr constituentReshuffler
The ConstituentReshuffler to be used.
double as(Energy Q) const
Calculate the alpha_s value the shower uses for Q.
int currentReferenceWeight
Current reference weight used for partial unweighting of the subleading colour shower (updated each e...
Here is the documentation of the DensityOperator class.
Ptr< DipoleEvolutionOrdering >::tptr evolutionOrdering() const
Return the evolution ordering.
bool didRealign
Whether or not we did realign the event.
size_t subleadingNcEmissionsLimit
Number of emissions to do subleading Nc corrections to.
const DipoleEventRecord & eventRecord() const
Return the event record.
void setMerger(Ptr< MergerBase >::ptr mh)
Set the pointer to the Merging Helper.
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
DipoleIndex is used to index splitting generators for a particular dipole.
int densityOperatorEvolution
Integer used to set which method of evolving the density operator to use: 0 - Vijk is Eikonal but the...
constexpr auto sqr(const T &x) -> decltype(x *x)
Indicate a problem in the shower.
vector< Ptr< DipoleSplittingKernel >::ptr > kernels
The splitting kernels to be used.
Merger handles the Merger ....... //TODO .
Definition: Merger.h:70
bool theDoCompensate
True, if sampler should apply compensation.
Ptr< IntrinsicPtGenerator >::ptr intrinsicPtGenerator
The intrinsic pt generator to be used.
Ptr< DipoleEventReweight >::ptr theEventReweight
A pointer to the dipole event reweight object.
DipoleVertexRecord theVertexRecord
The vertex record.
Here is the documentation of the DipoleVertexRecord class.
bool doPartialUnweightingAtEmission
Switch on or off partial unweighting in after each subleading emission.
const cPDVector & particlesAfter() const
Return the particle data vector of the particles in the event, will be empty if subleading Nc is turn...
const DipoleVertexRecord & vertexRecord() const
Return the event record.
double cmecReweightFactor
Factor changing the acceptance probability for the veto algorithm.
bool continueSubleadingNc() const
Return the continue subleading Nc flag from the event record.
pair< tPPtr, tPPtr > tPPair
vector< vector< std::tuple< Energy, double, bool > > > theWeightsVector
Vector of candidate splittings containing a vector of the weights, scale and a bool for every step in...
bool doPartialUnweighting
Switch on or off partial unweighting in the splitting generator.
int theZBoundaries
The choice of z boundaries; 0 = restricted, 1 = open, 2 = mixed/other.
int verbosity
The verbosity level.
virtual tPPair cascade(tSubProPtr sub, XCombPtr xcomb)
The main method which manages the showering of a subprocess.
Ptr< DipoleSplittingReweight >::ptr theSplittingReweight
A pointer to a global dipole splitting reweight.
virtual bool canHandleMatchboxTrunc() const
Return true, if the shower handler can generate a truncated shower for POWHEG style events generated ...
Energy maxPt
The shower starting scale for the last event encountered.
The DipoleShowerHandler class manages the showering using the dipole shower algorithm.
Energy theRenormalizationScaleFreeze
A freezing value for the renormalization scale.
ThePEG::Ptr< SubProcess >::transient_pointer tSubProPtr
DipoleEventRecord theEventRecord
The evnt record used.
set< long > theColouredOffShellInShower
PDG codes of the partons which can have an off-shell mass, this is fast storage for use during runnin...
vector< long > theInputColouredOffShellInShower
PDG codes of the partons which can have an off-shell mass, this is a vector that is interfaced so the...
pair< PPtr, PPtr > PPair
void addSplitting(Ptr< DipoleSplittingKernel >::ptr sp)
Insert an additional splitting kernel.
GeneratorMap theGenerators
The splitting generators indexed by the dipole indices they can work on.
Ptr< MergerBase >::ptr theMergingHelper
The merging helper takes care of merging multiple LO and NLO cross sections.
The Dipole class is used by the dipole shower to represent a dipole of two coloured partons...
Definition: Dipole.h:30
ThePEG::Ptr< Particle >::transient_pointer tPPtr
unsigned long theFreezeGrid
Return the number of accepted points after which the grid should be frozen.
vector< cPDPtr > cPDVector
void setNEmissions(unsigned int n)
Set the number of emissions.
unsigned int nEmissions
Limit the number of emissions.
double theDetuning
The detuning factor applied to the sampling overestimate kernel.
double referenceWeight
Reference weight for the partial unweighting.
const map< pair< vector< PDT::Colour >, pair< size_t, size_t > >, double > & correlatorMap() const
Return the colour matrix element correction map, will be empty if subleading Nc is turned off...
bool doSubleadingNc
Switch on or off subleading Nc corrections.
const map< PPtr, size_t > & particleIndices() const
Return the dictionary for the incoming particles and outgoing partons in the event, will be empty if subleading Nc is turned off.
Ptr< DipoleEvolutionOrdering >::ptr theEvolutionOrdering
The evolution ordering considered.
-*- C++ -*-
bool firstMCatNLOEmission
Perform the first MC emission only.
double negCMECScaling
Scaling factor for the negative colour matrix element corrections.
double Nf(Energy Q) const
Return the number of scale dependent active flavours from the alpha_s object.
bool discardNoEmissions
Discard events which did not radiate.
Ptr< AlphaSBase >::ptr theGlobalAlphaS
A global alpha_s to be used for all splitting kernels.
The DipoleEventRecord class is used internally by the dipole shower.
static bool firstWarn
True if no warnings have been issued yet.
Ptr< ShowerApproximation >::tptr theShowerApproximation
The matching subtraction, if appropriate.
Energy2 densityOperatorCutoff
Cutoff scale for the invariants (e.g.
DipoleSplittingInfo contains all parameters to generate a full dipole splitting.
unsigned int nTries
The number of shoer tries so far.
This class is the main driver of the shower: it is responsible for the proper handling of all other s...
Definition: ShowerHandler.h:40
size_t winnerIndex
Winning candidate index.
vector< tPPtr > tPVector
const vector< Ptr< DipoleSplittingKernel >::ptr > & splittingKernels() const
Return the splitting kernels.
constexpr ZeroUnit ZERO
bool chainOrderVetoScales
Apply chain ordering to events from matrix element corrections.
DipoleEventRecord & eventRecord()
Access the event record.
DensityOperator & densityOperator()
Return the density operator from the event record.
virtual Energy hardScale() const
Return the relevant hard scale to be used in the profile scales.
virtual int showerPhaseSpaceOption() const
The choice of z boundaries; 0 = restricted, 1 = open, 2 = mixed/other.