herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
ShowerHandler.h
1 // -*- C++ -*-
2 //
3 // ShowerHandler.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_ShowerHandler_H
10 #define HERWIG_ShowerHandler_H
11 //
12 // This is the declaration of the ShowerHandler class.
13 //
14 
15 #include "ThePEG/Handlers/EventHandler.h"
16 #include "ThePEG/Handlers/CascadeHandler.h"
17 #include "ShowerVariation.h"
18 #include "Herwig/PDF/HwRemDecayer.fh"
19 #include "ThePEG/EventRecord/RemnantParticle.fh"
20 #include "UEBase.h"
21 #include "PerturbativeProcess.h"
22 #include "Herwig/MatrixElement/Matchbox/Matching/HardScaleProfile.h"
23 #include "ShowerHandler.fh"
24 
25 namespace Herwig {
26 using namespace ThePEG;
27 
41 
42 public:
43 
47  typedef pair<tRemPPtr, tRemPPtr> RemPair;
48 
49 public:
50 
54  ShowerHandler();
55 
59  virtual ~ShowerHandler();
60 
61 public:
62 
67  virtual void cascade();
68 
72  static const tShowerHandlerPtr currentHandler() {
73  assert(currentHandler_);
74  return currentHandler_;
75  }
76 
77 public:
78 
83  virtual bool showerHardProcessVeto() const { return false; }
84 
89  virtual bool isReshuffling() const { return true; }
90 
95  virtual bool retConstituentMasses() const { return useConstituentMasses_; }
96 
97 
98 
103  virtual bool canHandleMatchboxTrunc() const { return false; }
104 
108  Energy pdfFreezingScale() const { return pdfFreezingScale_; }
109 
113  PDFPtr getPDFA() const {return PDFA_;}
114 
118  PDFPtr getPDFB() const {return PDFB_;}
119 
123  bool firstInteraction() const {
124  if (!eventHandler()->currentCollision())return true;
125  return ( subProcess_ ==
126  eventHandler()->currentCollision()->primarySubProcess() );
127  }
128 
132  tHwRemDecPtr remnantDecayer() const { return remDec_; }
133 
140  void splitHardProcess(tPVector tagged, PerturbativeProcessPtr & hard,
141  DecayProcessMap & decay) const;
142 
146  bool doesSplitHardProcess()const {return splitHardProcess_;}
147 
154  tDMPtr decay(PerturbativeProcessPtr,
155  DecayProcessMap & decay,
156  bool radPhotons = false) const;
157 
158 
163  tDMPtr findDecayMode(const string & tag) const;
164 
165 
171 
172  bool operator() (tcPDPtr p1, tcPDPtr p2);
173 
174  };
175 
176 
181  typedef multiset<tcPDPtr,ParticleOrdering> OrderedParticles;
182 
183 
184 public:
185 
193  bool doRadiation() const {return doFSR_ || doISR_;}
194 
198  bool doFSR() const { return doFSR_;}
199 
203  bool doISR() const { return doISR_;}
205 
206 public:
207 
215  bool hardScaleIsMuF() const { return maxPtIsMuF_; }
216 
220  double factorizationScaleFactor() const {
221  return factorizationScaleFactor_;
222  }
223 
227  double renFac() const {
228  return renormalizationScaleFactor_;
229  }
230 
234  double facFac() const {
235  return factorizationScaleFactor_;
236  }
237 
241  double renormalizationScaleFactor() const {
242  return renormalizationScaleFactor_;
243  }
244 
248  double hardScaleFactor() const {
249  return hardScaleFactor_;
250  }
255  bool restrictPhasespace() const { return restrictPhasespace_; }
256 
260  Ptr<HardScaleProfile>::tptr profileScales() const { return hardScaleProfile_; }
261 
265  virtual Energy hardScale() const;
266 
270  virtual int showerPhaseSpaceOption() const {
271  assert(false && "not implemented in general");
272  return -1;
273  }
275 
276 public:
277 
281  map<string,ShowerVariation>& showerVariations() {
282  return showerVariations_;
283  }
284 
288  const map<string,ShowerVariation>& showerVariations() const {
289  return showerVariations_;
290  }
291 
295  map<string,double>& currentWeights() {
296  return currentWeights_;
297  }
298 
302  const map<string,double>& currentWeights() const {
303  return currentWeights_;
304  }
305 
309  void reweight(double w) {
310  reweight_ = w;
311  }
312 
316  double reweight() const {
317  return reweight_;
318  }
319 
320 public:
321 
326  struct ExtraScatterVeto {};
327 
335  const int tries;
336 
338  ShowerTriesVeto(int t) : tries(t) {}
339  };
340 
341 public:
342 
349  void persistentOutput(PersistentOStream & os) const;
350 
356  void persistentInput(PersistentIStream & is, int version);
358 
365  static void Init();
366 
367 protected:
368 
375  virtual tPPair cascade(tSubProPtr sub, XCPtr xcomb);
376 
381  current_ = currentStep();
382  subProcess_ = sub;
383  }
384 
389  void boostCollision(bool boost);
391 
392 protected:
393 
402  currentHandler_ = tShowerHandlerPtr(this);
403  }
404 
409  currentHandler_ = tShowerHandlerPtr();
410  }
412 
413 protected:
414 
423  bool isMPIOn() const {
424  return MPIHandler_ && MPIHandler_->beamOK();
425  }
426 
431  tUEBasePtr getMPIHandler() const {
432  assert(MPIHandler_);
433  return MPIHandler_;
434  }
435 
439  bool isResolvedHadron(tPPtr);
440 
445  RemPair getRemnants(PBIPair incbins);
446 
450  void setMPIPDFs();
452 
453 public:
454 
459  bool decaysInShower(long id) const {
460  return ( particlesDecayInShower_.find( abs(id) ) !=
461  particlesDecayInShower_.end() );
462  }
463 
464 protected:
465 
476  void findDecayProducts(PPtr parent, PerturbativeProcessPtr hard, DecayProcessMap & decay) const;
477 
484  void createDecayProcess(PPtr parent,PerturbativeProcessPtr hard, DecayProcessMap & decay) const;
486 
495  assert(subProcess_);
496  return subProcess_;
497  }
498 
503  return incoming_;
504  }
506 
507 protected:
508 
512  //@
516  void combineWeights();
517 
521  void initializeWeights();
522 
526  void resetWeights();
528 
529 protected:
530 
535  unsigned int maxtry() const { return maxtry_; }
536 
537 protected:
538 
545  virtual IBPtr clone() const;
546 
551  virtual IBPtr fullclone() const;
553 
554 protected:
555 
563  virtual void doinit();
564 
569  virtual void doinitrun();
570 
575  virtual void dofinish();
577 
578 private:
579 
584  ShowerHandler & operator=(const ShowerHandler &) = delete;
585 
586 private:
587 
591  static tShowerHandlerPtr currentHandler_;
592 
597  UEBasePtr MPIHandler_;
598 
602  HwRemDecPtr remDec_;
603 
604 private:
605 
614  unsigned int maxtry_;
615 
620  unsigned int maxtryMPI_;
621 
626  unsigned int maxtryDP_;
627 
631  unsigned int maxtryDecay_;
633 
634 private:
635 
644 
649 
654 
660 
665 
669  Ptr<HardScaleProfile>::ptr hardScaleProfile_;
671 
672 private:
673 
682 
687 
692 
698 
699 private:
700 
709 
718 
723 
728 
733 
737  pair <PDFPtr, PDFPtr> mpipdfs_;
738 
742  pair <PDFPtr, PDFPtr> rempdfs_;
743 
747  pair <PDFPtr, PDFPtr> remmpipdfs_;
749 
750 private:
751 
759  bool doFSR_;
760 
764  bool doISR_;
766 
767 private:
768 
777 
783 
790 
791 private:
792 
801 
805  Energy2 vMin_;
807 
808 
809 private:
810 
815  // True if shower should return constituent masses.
816  bool useConstituentMasses_=true;
818 private:
819 
827  map<string,ShowerVariation> showerVariations_;
828 
832  string doAddVariation(string);
833 
837  double reweight_;
838 
842  map<string,double> currentWeights_;
844 };
845 
846 }
847 
848 #endif /* HERWIG_ShowerHandler_H */
ThePEG::Ptr< Particle >::pointer PPtr
bool firstInteraction() const
Return true if currently the primary subprocess is showered.
pair< PDFPtr, PDFPtr > remmpipdfs_
The MPI PDF&#39;s to be used for secondary scatters.
double facFac() const
The factorization scale factor.
map< string, ShowerVariation > showerVariations_
Parameters relevant for reweight and variations.
bool doFSR() const
Switch on or off final state radiation.
tPPair incoming_
Storage of information about the current event.
HwRemDecPtr remDec_
Pointer to the HwRemDecayer.
pair< PDFPtr, PDFPtr > mpipdfs_
The MPI PDF&#39;s to be used for secondary scatters.
bool decaysInShower(long id) const
Check if a particle decays in the shower.
Definition: expm-1.h:45
pair< PDFPtr, PDFPtr > rempdfs_
The MPI PDF&#39;s to be used for secondary scatters.
void prepareCascade(tSubProPtr sub)
Set up for the cascade.
double factorizationScaleFactor() const
The factorization scale factor.
tHwRemDecPtr remnantDecayer() const
Return the remnant decayer.
void reweight(double w)
Change the current reweighting factor.
PDFPtr getPDFB() const
Get the local PDFs.
double renormalizationScaleFactor() const
The renormalization scale factor.
map< string, ShowerVariation > & showerVariations()
Access the shower variations.
PDFPtr PDFB_
The PDF for beam particle B.
Energy2 vMin_
The minimum virtuality for the space-time model.
double reweight() const
Return the current reweighting factor.
void setCurrentHandler()
Set/unset the current shower handler.
Energy pdfFreezingScale_
PDFs to be used for the various stages and related parameters.
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
virtual bool canHandleMatchboxTrunc() const
Return true, if the shower handler can generate a truncated shower for POWHEG style events generated ...
struct that is used to catch exceptions which are thrown due to fact that the Shower has been invoked...
tSubProPtr currentSubProcess() const
Return the currently used SubProcess.
virtual bool showerHardProcessVeto() const
Hook to allow vetoing of event after showering hard sub-process as in e.g.
Definition: ShowerHandler.h:83
map< string, double > currentWeights_
The shower variation weights.
tUEBasePtr getMPIHandler() const
Access function for the MPIHandler, it should only be called after checking with isMPIOn.
bool includeSpaceTime_
Parameters for the space-time model.
virtual bool retConstituentMasses() const
Return true, if this cascade handler will put the final state particles to their constituent mass...
Definition: ShowerHandler.h:95
bool restrictPhasespace() const
Return true, if the phase space restrictions of the dipole shower should be applied.
bool doesSplitHardProcess() const
Information if the Showerhandler splits the hard process.
tcStepPtr current_
Const pointer to the current step.
bool maxPtIsMuF_
True if maximum pt should be deduced from the factorization scale.
pair< tPPtr, tPPtr > tPPair
tSubProPtr subProcess_
Const pointer to the currently handeled ThePEG::SubProcess.
unsigned int maxtryMPI_
Maximum number of attempts for the regeneration of an additional scattering, before the number of sca...
Ptr< HardScaleProfile >::tptr profileScales() const
Return profile scales.
unsigned int maxtry_
Maximum tries for various stages of the showering process.
double renFac() const
The renormalization scale factor.
Energy pdfFreezingScale() const
Get the PDF freezing scale.
static tShowerHandlerPtr currentHandler_
pointer to "this", the current ShowerHandler.
const map< string, double > & currentWeights() const
Return the current Weights.
unsigned int maxtryDP_
Maximum number of attempts for the regeneration of an additional hard scattering, before this event i...
ThePEG::Ptr< Step >::transient_const_pointer tcStepPtr
ThePEG::Ptr< DecayMode >::transient_pointer tDMPtr
PDFPtr PDFARemnant_
The PDF for beam particle A for remnant splitting.
Ptr< HardScaleProfile >::ptr hardScaleProfile_
The profile scales.
bool doISR_
Switch on or off initial state radiation.
bool splitHardProcess_
Whether or not to split into hard and decay trees.
ThePEG::Ptr< ParticleData >::transient_const_pointer tcPDPtr
A struct to order the particles in the same way as in the DecayMode&#39;s.
bool doFSR_
Switch on or off final state radiation.
struct that is used to catch exceptions which are thrown due to energy conservation issues of additio...
pair< tRemPPtr, tRemPPtr > RemPair
Typedef for a pair of ThePEG::RemnantParticle pointers.
Definition: ShowerHandler.h:47
ThePEG::Ptr< SubProcess >::transient_pointer tSubProPtr
ThePEG::Ptr< XC >::pointer XCPtr
pair< PBIPtr, PBIPtr > PBIPair
bool doRadiation() const
Switch for any radiation.
UEBasePtr MPIHandler_
a MPIHandler to administer the creation of several (semihard) partonic interactions.
ThePEG::Ptr< Particle >::transient_pointer tPPtr
map< string, double > & currentWeights()
Access the current Weights.
virtual bool isReshuffling() const
Return true, if this cascade handler will perform reshuffling from hard process masses.
Definition: ShowerHandler.h:89
PDFPtr PDFA_
PDFs to be used for the various stages and related parameters.
PDFPtr getPDFA() const
Get the local PDFs.
bool hardScaleIsMuF() const
Return true if maximum pt should be deduced from the factorization scale.
void unSetCurrentHandler()
Unset the current handler.
static const tShowerHandlerPtr currentHandler()
pointer to "this", the current ShowerHandler.
Definition: ShowerHandler.h:72
double hardScaleFactor() const
The scale factor for the hard scale.
tPPair incomingBeams() const
Access to the incoming beam particles.
unsigned int maxtry() const
Return the maximum number of attempts for showering a given subprocess.
const map< string, ShowerVariation > & showerVariations() const
Return the shower variations.
-*- C++ -*-
bool restrictPhasespace_
True, if the phase space restrictions of the dipole shower should be applied.
ThePEG::Ptr< PDFBase >::pointer PDFPtr
double reweight_
A reweighting factor applied by the showering.
unsigned int maxtryDecay_
Maximum number of attempts to generate a decay.
multimap< Energy, PerturbativeProcessPtr, std::greater< Energy > > DecayProcessMap
Typedef for map of PerturbativeProcess for decays.
set< long > particlesDecayInShower_
PDG codes of the particles which decay during showering this is fast storage for use during running...
bool doISR() const
Switch on or off initial state radiation.
vector< long > inputparticlesDecayInShower_
PDG codes of the particles which decay during showering this is a vector that is interfaced so they c...
This class is the main driver of the shower: it is responsible for the proper handling of all other s...
Definition: ShowerHandler.h:40
vector< tPPtr > tPVector
multiset< tcPDPtr, ParticleOrdering > OrderedParticles
A container for ordered particles required for constructing tags for decay mode lookup.
PDFPtr PDFBRemnant_
The PDF for beam particle B for remnant splitting.
virtual int showerPhaseSpaceOption() const
Return information about shower phase space choices.
double renormalizationScaleFactor_
The renormalization scale factor.
double hardScaleFactor_
The scale factor for the hard scale.
bool isMPIOn() const
Return true if multiple parton interactions are switched on and can be used for this beam setup...
double factorizationScaleFactor_
Factors for the various scales.
LorentzRotation boost_
Boost to get back to the lab.
const int tries
variable to store the number of attempts