herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
DipoleEventRecord.h
1 // -*- C++ -*-
2 //
3 // DipoleEventRecord.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_DipoleEventRecord_H
10 #define HERWIG_DipoleEventRecord_H
11 //
12 // This is the declaration of the DipoleEventRecord class.
13 //
14 
15 #include "Herwig/Shower/ShowerEventRecord.h"
16 #include "Herwig/Shower/PerturbativeProcess.h"
17 #include "ThePEG/PDF/PDF.h"
18 #include "Dipole.h"
19 #include "DipoleChain.h"
20 #include "Herwig/MatrixElement/Matchbox/Utility/DensityOperator.h"
21 
22 #include <tuple>
23 
24 namespace Herwig {
25 
26 using namespace ThePEG;
27 
36  : public DipoleSplittingInfo {
37 
38 public:
39 
44  : DipoleSplittingInfo() {}
45 
49  list<DipoleChain>::iterator emitterChain() const { return theEmitterChain; }
50 
54  list<Dipole>::iterator emitterDipole() const { return theEmitterDipole; }
55 
59  list<DipoleChain>::iterator spectatorChain() const { return theSpectatorChain; }
60 
64  list<Dipole>::iterator spectatorDipole() const { return theSpectatorDipole; }
65 
69  Energy startScale() const { return theStartScale; }
70 
74  void emitterChain(list<DipoleChain>::iterator it) { theEmitterChain = it; }
75 
79  void emitterDipole(list<Dipole>::iterator it) { theEmitterDipole = it; }
80 
84  void spectatorChain(list<DipoleChain>::iterator it) { theSpectatorChain = it; }
85 
89  void spectatorDipole(list<Dipole>::iterator it) { theSpectatorDipole = it; }
90 
94  void startScale(Energy s) { theStartScale = s; }
95 
96 private:
97 
101  list<DipoleChain>::iterator theEmitterChain;
102 
106  list<Dipole>::iterator theEmitterDipole;
107 
111  list<DipoleChain>::iterator theSpectatorChain;
112 
116  list<Dipole>::iterator theSpectatorDipole;
117 
122 
123 };
124 
133 
134 public:
135 
140 
144  ~DipoleEventRecord() { clear(); }
145 
146 public:
147 
152  PList& hard() { return theHard; }
153 
158  const PList& hard() const { return theHard; }
159 
163  const Lorentz5Momentum& pX() const { return thePX; }
164 
168  cPDVector& particlesAfter() { return theParticlesAfter; }
169 
173  const cPDVector& particlesAfter() const { return theParticlesAfter; }
174 
178  cPDVector& particlesBefore() { return theParticlesBefore; }
179 
183  const cPDVector& particlesBefore() const { return theParticlesBefore; }
184 
188  vector<Lorentz5Momentum>& momentaAfter() { return theMomentaAfter; }
189 
193  const vector<Lorentz5Momentum>& momentaAfter() const { return theMomentaAfter; }
194 
198  map<PPtr,size_t>& particleIndices() { return theParticleIndices; }
199 
203  const map<PPtr,size_t>& particleIndices() const { return theParticleIndices; }
204 
208  DensityOperator& densityOperator() { return theDensityOperator; }
209 
213  const DensityOperator& densityOperator() const { return theDensityOperator; }
214 
219  void setSubleadingNc( bool doSub, size_t emissionsLimit ) {
220  doSubleadingNc = doSub;
221  continueSubleadingNc = doSub;
222  subleadingNcEmissionsLimit = emissionsLimit;
223  }
224 
228  bool getContinueSubleadingNc() const { return continueSubleadingNc; }
229 
233  void setDensityOperatorEvolution( int scheme, Energy2 cutoff ) {
234  densityOperatorEvolution = scheme;
235  densityOperatorCutoff = cutoff;
236  }
237 
242  double dipoleKernelForEvolution(size_t em, size_t spec,
243  Energy2 pEmitpSpec, Energy2 pEmitpEmis,
244  Energy2 pEmispSpec);
245 
251  void transform(const LorentzRotation& rot);
252 
253 public:
254 
258  const list<DipoleChain>& chains() const { return theChains; }
259 
263  list<DipoleChain>& chains() { return theChains; }
264 
268  const list<DipoleChain>& doneChains() const { return theDoneChains; }
269 
273  list<DipoleChain>& doneChains() { return theDoneChains; }
274 
279  bool haveChain() const { return !theChains.empty(); }
280 
284  DipoleChain& currentChain() { assert(haveChain()); return theChains.front(); }
285 
289  void popChain();
290 
294  void popChain(list<DipoleChain>::iterator);
295 
299  void popChains(const list<list<DipoleChain>::iterator>&);
300 
305  DipoleIndex
306  mergeIndex(list<Dipole>::iterator firstDipole, const pair<bool,bool>& whichFirst,
307  list<Dipole>::iterator secondDipole, const pair<bool,bool>& whichSecond) const;
308 
314  mergeSplittingInfo(list<DipoleChain>::iterator firstChain, list<Dipole>::iterator firstDipole,
315  const pair<bool,bool>& whichFirst,
316  list<DipoleChain>::iterator secondChain, list<Dipole>::iterator secondDipole,
317  const pair<bool,bool>& whichSecond) const;
318 
322  void getSubleadingSplittings(list<SubleadingSplittingInfo>&);
323 
324 public:
325 
333  void split(list<Dipole>::iterator dip,
334  DipoleSplittingInfo& dsplit,
335  pair<list<Dipole>::iterator,list<Dipole>::iterator>& childIterators,
336  DipoleChain*& firstChain, DipoleChain*& secondChain) {
337  split(dip,theChains.begin(),dsplit,childIterators,firstChain,secondChain,false);
338  }
339 
348  void split(list<Dipole>::iterator dip,
349  list<DipoleChain>::iterator ch,
350  DipoleSplittingInfo& dsplit,
351  pair<list<Dipole>::iterator,list<Dipole>::iterator>& childIterators,
352  DipoleChain*& firstChain, DipoleChain*& secondChain,
353  bool colourSpectator = true);
354 
359  pair<PVector,PVector> tmpsplit(list<Dipole>::iterator dip,
360  DipoleSplittingInfo& dsplit,
361  pair<list<Dipole>::iterator,list<Dipole>::iterator>& childIterators,
362  DipoleChain*& firstChain, DipoleChain*& secondChain) {
363  return tmpsplit(dip,theChains.begin(),dsplit,childIterators,firstChain,secondChain,false);
364  }
365 
369  pair<PVector,PVector> tmpsplit(list<Dipole>::iterator dip,
370  list<DipoleChain>::iterator ch,
371  DipoleSplittingInfo& dsplit,
372  pair<list<Dipole>::iterator,list<Dipole>::iterator>& childIterators,
373  DipoleChain*& firstChain, DipoleChain*& secondChain,
374  bool colourSpectator = true);
375 
376 
381  void recoil(list<Dipole>::iterator dip,
382  list<DipoleChain>::iterator ch,
383  DipoleSplittingInfo& dsplit);
384 
388  void splitSubleading(SubleadingSplittingInfo& dsplit,
389  pair<list<Dipole>::iterator,list<Dipole>::iterator>& childIterators,
390  DipoleChain*& firstChain, DipoleChain*& secondChain);
391 
396  void update(DipoleSplittingInfo& dsplit);
397 
401  pair<PVector,PVector> tmpupdate(DipoleSplittingInfo& dsplit);
402 
407  void updateInverse(DipoleSplittingInfo& dsplit);
408 
415  list<pair<list<Dipole>::iterator,list<DipoleChain>::iterator> >
416  inDipoles();
417 
421  tPPair fillEventRecord(StepPtr step, bool firstInteraction, bool realigned);
422 
423 public:
424 
429  const map<PPtr,PPtr>& prepare(tSubProPtr subpro,
430  tStdXCombPtr xc,
431  StepPtr step,
432  const pair<PDF,PDF>& pdf,
433  tPPair beam,
434  bool firstInteraction,
435  const set<long>& offShellPartons,
436  bool dipoles = true);
441  void slimprepare(tSubProPtr subpro,
442  tStdXCombPtr xc,
443  const pair<PDF,PDF>& pdf,tPPair beam,
444  const set<long>& offShellPartons,
445  bool dipoles = true);
446 
451  virtual void clear();
452 
457  void prepareChainsSubleading(const bool decay) {
458  static set<long> empty;
459  continueSubleadingNc = false;
460  PList cordered = colourOrdered(incoming(),outgoing());
461  findChains(cordered,empty,decay);
462  }
463 
464 public:
465 
469  void debugLastEvent(ostream&) const;
470 
471 public:
472 
476  map<PPtr,PerturbativeProcessPtr> & decays() {return theDecays;}
477 
484  void fillFromDecays(PerturbativeProcessPtr decayProc, vector<PPtr>& original);
485 
493  void separateDecay(PerturbativeProcessPtr decayProc);
494 
498  Energy decay(PPtr incoming, bool& powhegEmission);
499 
504  bool prepareDecay(PerturbativeProcessPtr decayProc,
505  const set<long>& offShellPartons);
506 
511  void updateDecayMom(PPtr decayParent, PerturbativeProcessPtr decayProc);
512 
518  void updateDecayChainMom(PPtr decayParent, PerturbativeProcessPtr decayProc);
519 
526  void updateDecays(PerturbativeProcessPtr decayProc, bool iterate = true);
527 
531  PerturbativeProcessPtr currentDecay() {return theCurrentDecay;}
532 
536  void currentDecay(PerturbativeProcessPtr in) {theCurrentDecay=in;}
537 
542  if ( !theNextDecays.empty() )
543  return theNextDecays.back();
544  else
545  return PPtr();
546  }
547 
548 
549  // SW - Changed from protected to public so that functions can be used in DipoleShowerHandler
550 public:
551 
556  void findChains(const PList& ordered,
557  const set<long>& offShellpartons,
558  const bool decay = false);
559 
563  PList colourOrdered(PPair & in,PList & out);
564 
565 
566 private:
567 
568  struct getMomentum {
569  const Lorentz5Momentum& operator() (PPtr particle) const {
570  return particle->momentum();
571  }
572  };
573 
577  Lorentz5Momentum thePX;
578 
584 
588  map<PPtr,PPtr> theOriginals;
589 
593  list<DipoleChain> theChains;
594 
598  list<DipoleChain> theDoneChains;
599 
604 
609 
613  vector<Lorentz5Momentum> theMomentaAfter;
614 
620  pair<size_t,pair<size_t,size_t> > theEmitterEmissionIndices;
621 
625  pair<size_t,size_t> theSpectatorIndices;
626 
631 
636 
642 
647 
651  size_t subEmDone;
652 
653 
657  map<PPtr,size_t> theParticleIndices;
658 
668 
674 
683  map<std::tuple<size_t,size_t,size_t>,map<size_t,size_t> > theEmissionsMap;
684 
692 private:
693 
697  map<PPtr,PerturbativeProcessPtr> theDecays;
698 
702  PerturbativeProcessPtr theCurrentDecay;
703 
713 
714 };
715 
716 
717 }
718 
719 #endif /* HERWIG_DipoleEventRecord_H */
DipoleChain & currentChain()
Return the current dipole chain.
map< PPtr, PPtr > theOriginals
Map originals to copies.
map< PPtr, size_t > & particleIndices()
Return the dictionary for the particles.
ThePEG::Ptr< Particle >::pointer PPtr
const PList & hard() const
Return any non-coloured outgoing particles in the current subprocess.
map< PPtr, size_t > theParticleIndices
Dictionary for particles before emission.
Generalized dipole splitting info to deal with subleading-N splittings.
cPDVector theParticlesAfter
Particles after the emission.
list< DipoleChain >::iterator theEmitterChain
Iterator of the emitter dipole chain.
void currentDecay(PerturbativeProcessPtr in)
Set current decay process.
void spectatorDipole(list< Dipole >::iterator it)
Set the iterator of the spectator dipole.
size_t subEmDone
Current number of subleading emissions.
Here is the documentation of the DensityOperator class.
PerturbativeProcessPtr currentDecay()
Access current decay process.
cPDVector & particlesBefore()
Return the particles before emission.
list< DipoleChain > & chains()
Access the dipole chains to be showered.
list< DipoleChain >::iterator emitterChain() const
Get the iterator of the emitter dipole chain.
list< Dipole >::iterator theEmitterDipole
Iterator of the emitter dipole.
DipoleIndex is used to index splitting generators for a particular dipole.
DensityOperator & densityOperator()
Return the density operator.
bool doSubleadingNc
Switch on or off for subleading Nc corrections.
bool continueSubleadingNc
Flag to keep track of when to stop calculating colour matrix element corrections. ...
void startScale(Energy s)
Set the starting scale.
pair< PVector, PVector > tmpsplit(list< Dipole >::iterator dip, DipoleSplittingInfo &dsplit, pair< list< Dipole >::iterator, list< Dipole >::iterator > &childIterators, DipoleChain *&firstChain, DipoleChain *&secondChain)
As split, but not touching the acctual event record.
cPDVector theParticlesBefore
Particles before the emission.
list< DipoleChain >::iterator spectatorChain() const
Get the iterator of the spectator dipole chain.
list< DipoleChain > theChains
The dipole chains currently showered.
Energy theStartScale
The starting scale.
void emitterDipole(list< Dipole >::iterator it)
Set the iterator of the emitter dipole.
const cPDVector & particlesAfter() const
Return the particles after emission.
const map< PPtr, size_t > & particleIndices() const
Return the dictionary for the particles.
map< PPtr, PerturbativeProcessPtr > & decays()
Get the decays.
PList theHard
Any non-coloured outgoing particles in the current subprocess.
pair< tPPtr, tPPtr > tPPair
pair< size_t, pair< size_t, size_t > > theEmitterEmissionIndices
Pair of the emitters index before emission and both the emitters and the emissions indices after emis...
bool haveChain() const
Return true, if there are chains to be showered.
void setDensityOperatorEvolution(int scheme, Energy2 cutoff)
Set the scheme and cutoff for the density operator evolution.
void emitterChain(list< DipoleChain >::iterator it)
Set the iterator of the emitter dipole chain.
map< std::tuple< size_t, size_t, size_t >, map< size_t, size_t > > theEmissionsMap
Dictionary for emissions, maps the three indices.
PPtr nextDecay()
Return the next particle to be decayed.
const DensityOperator & densityOperator() const
Return the density operator.
list< Dipole >::iterator spectatorDipole() const
Get the iterator of the spectator dipole.
bool getContinueSubleadingNc() const
Get the continue subleading Nc flag.
const vector< Lorentz5Momentum > & momentaAfter() const
Return the momenta after emission.
DipoleEventRecord()
The default constructor.
Energy startScale() const
Get the starting scale.
pair< size_t, size_t > theSpectatorIndices
Pair of the spectators index before and after emission.
ThePEG::Ptr< SubProcess >::transient_pointer tSubProPtr
const Lorentz5Momentum & pX() const
Return the momentum of the hard system.
pair< PPtr, PPtr > PPair
~DipoleEventRecord()
The default destructor just cleans up.
const cPDVector & particlesBefore() const
Return the particles before emission.
vector< Lorentz5Momentum > & momentaAfter()
Return the momenta after emission.
vector< cPDPtr > cPDVector
Here is the documentation of the ShowerEventRecord class.
vector< Lorentz5Momentum > theMomentaAfter
Momenta of the particles after emission.
PList theNextDecays
List of unstable particles, the decay to be performed and/or showered next is always at the back...
void setSubleadingNc(bool doSub, size_t emissionsLimit)
Set the subleading Nc flag and the number of emissions to calculate subleading Nc corrections for...
list< Dipole >::iterator theSpectatorDipole
Iterator of the spectator dipole.
list< DipoleChain > & doneChains()
Access the dipole chains which ceased evolving.
SubleadingSplittingInfo()
Default constructor.
int densityOperatorEvolution
Integer used to set which method of evolving the density operator to use: 0 - Vijk is Eikonal but the...
cPDVector & particlesAfter()
Return the particles after emission.
size_t subleadingNcEmissionsLimit
Number of emissions to calculate subleading Nc corrections for.
-*- C++ -*-
PList & hard()
Return any non-coloured outgoing particles in the current subprocess.
const list< DipoleChain > & doneChains() const
Return the dipole chains which ceased evolving.
void split(list< Dipole >::iterator dip, DipoleSplittingInfo &dsplit, pair< list< Dipole >::iterator, list< Dipole >::iterator > &childIterators, DipoleChain *&firstChain, DipoleChain *&secondChain)
Split the dipole pointed to by the given iterator.
Energy2 densityOperatorCutoff
Cutoff scale for the invariants (e.g.
list< DipoleChain > theDoneChains
The dipole chains which ceased evolving.
void prepareChainsSubleading(const bool decay)
Prepare the dipole chains for the eventRecord after the subleading shower.
The DipoleEventRecord class is used internally by the dipole shower.
DensityOperator theDensityOperator
The density operator.
map< PPtr, PerturbativeProcessPtr > theDecays
The coloured partons that can be off-shell To only be filled by DipoleShowerHandler.
DipoleSplittingInfo contains all parameters to generate a full dipole splitting.
Lorentz5Momentum thePX
The momentum of the hard system.
list< DipoleChain >::iterator theSpectatorChain
Iterator of the spectator dipole chain.
const list< DipoleChain > & chains() const
Return the dipole chains to be showered.
The DipoleChain class is used by the dipole shower to represent a chain of dipoles.
Definition: DipoleChain.h:29
list< Dipole >::iterator emitterDipole() const
Get the iterator of the emitter dipole.
ThePEG::Ptr< Step >::pointer StepPtr
void spectatorChain(list< DipoleChain >::iterator it)
Set the iterator of the spectator dipole chain.
list< PPtr > PList