StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PartonLevel.h
1 // PartonLevel.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // This file contains the main class for parton-level event generation
7 // PartonLevel: administrates showers, multiparton interactions and remnants.
8 
9 #ifndef Pythia8_PartonLevel_H
10 #define Pythia8_PartonLevel_H
11 
12 #include "Pythia8/Basics.h"
13 #include "Pythia8/BeamParticle.h"
14 #include "Pythia8/BeamRemnants.h"
15 #include "Pythia8/Event.h"
16 #include "Pythia8/HardDiffraction.h"
17 #include "Pythia8/Info.h"
18 #include "Pythia8/JunctionSplitting.h"
19 #include "Pythia8/MergingHooks.h"
20 #include "Pythia8/MultipartonInteractions.h"
21 #include "Pythia8/ParticleData.h"
22 #include "Pythia8/PartonSystems.h"
23 #include "Pythia8/PartonVertex.h"
24 #include "Pythia8/PhysicsBase.h"
25 #include "Pythia8/PythiaStdlib.h"
26 #include "Pythia8/ResonanceDecays.h"
27 #include "Pythia8/RHadrons.h"
28 #include "Pythia8/Settings.h"
29 #include "Pythia8/Settings.h"
30 #include "Pythia8/SharedPointers.h"
31 #include "Pythia8/SigmaTotal.h"
32 #include "Pythia8/SpaceShower.h"
33 #include "Pythia8/StandardModel.h"
34 #include "Pythia8/StringLength.h"
35 #include "Pythia8/TimeShower.h"
36 #include "Pythia8/UserHooks.h"
37 
38 namespace Pythia8 {
39 
40 //==========================================================================
41 
42 // The PartonLevel class contains the top-level routines to generate
43 // the partonic activity of an event.
44 
45 class PartonLevel : public PhysicsBase {
46 
47 public:
48 
49  // Constructor.
50  PartonLevel() = default;
51 
52  // Initialization of all classes at the parton level.
53  bool init( TimeShowerPtr timesDecPtrIn, TimeShowerPtr timesPtrIn,
54  SpaceShowerPtr spacePtrIn, RHadrons* rHadronsPtrIn,
55  MergingHooksPtr mergingHooksPtr, PartonVertexPtr partonVertexPtrIn,
56  StringIntPtr stringInteractionPtrIn,
57  bool useAsTrial);
58 
59  // Generate the next parton-level process.
60  bool next( Event& process, Event& event);
61 
62  // Perform showers in resonance decay chains. (For special cases.)
63  void setupShowerSys( Event& process, Event& event);
64  bool resonanceShowers( Event& process, Event& event, bool skipForR);
65 
66  // Perform decays and showers of W and Z emitted in shower.
67  bool wzDecayShowers( Event& event);
68 
69  // Tell whether failure was due to vetoing.
70  bool hasVetoed() const {return doVeto;}
71  bool hasVetoedDiff() const {return doDiffVeto;}
72 
73  // Accumulate, print and reset statistics.
74  void accumulate() {if (isResolved && !isDiff) multiPtr->accumulate();}
75  void statistics(bool reset = false) {
76  if (doMPI) multiMB.statistics(reset);}
77  void resetStatistics() { if (doMPI) multiMB.resetStatistics(); }
78 
79  // Reset PartonLevel object for trial shower usage.
80  void resetTrial();
81  // Provide the pT scale of the last branching in the shower.
82  double pTLastInShower() { return pTLastBranch; }
83  // Provide the type of the last branching in the shower.
84  int typeLastInShower() { return typeLastBranch; }
85 
86  // Check of any trial emissions could have been enhanced.
87  bool canEnhanceTrial() {
88  if (userHooksPtr) return userHooksPtr->canEnhanceTrial();
89  return false;
90  }
91  // Get enhanced trial emission evolution variable.
92  double getEnhancedTrialPT() {
93  if (canEnhanceTrial()) return userHooksPtr->getEnhancedTrialPT();
94  return 0.;
95  }
96  // Get enhanced trial emission weight.
97  double getEnhancedTrialWeight() {
98  if (canEnhanceTrial()) return userHooksPtr->getEnhancedTrialWeight();
99  return 1.;
100  }
101 
102  // Spare copies of normal beam pointers.
103  BeamParticle* beamHadAPtr{};
104  BeamParticle* beamHadBPtr{};
105 
106  // Pointers to timelike showers for resonance decays and the rest.
107  TimeShowerPtr timesDecPtr{};
108  TimeShowerPtr timesPtr{};
109 
110  // Pointer to spacelike showers.
111  SpaceShowerPtr spacePtr{};
112 
113 protected:
114 
115  virtual void onInitInfoPtr() override {
116  registerSubObject(multiMB);
117  registerSubObject(multiSDA);
118  registerSubObject(multiSDB);
119  registerSubObject(multiCD);
120  registerSubObject(multiGmGm);
121  registerSubObject(remnants);
122  registerSubObject(resonanceDecays);
123  registerSubObject(junctionSplitting);
124  registerSubObject(hardDiffraction);
125  }
126 
127 private:
128 
129  // Constants: could only be changed in the code itself.
130  static const int NTRY;
131 
132  // Initialization data, mainly read from Settings.
133  bool doNonDiff{}, doDiffraction{}, doMPI{}, doMPIMB{}, doMPISDA{},
134  doMPISDB{}, doMPICD{}, doMPIinit{}, doISR{}, doFSRduringProcess{},
135  doFSRafterProcess{}, doFSRinResonances{}, doRemnants{},
136  doSecondHard{}, hasOneLeptonBeam{}, hasTwoLeptonBeams{},
137  hasPointLeptons{}, canVetoPT{}, canVetoStep{}, canVetoMPIStep{},
138  canVetoEarly{}, canSetScale{}, allowRH{}, earlyResDec{},
139  vetoWeakJets{}, canReconResSys{}, doReconnect{}, doHardDiff{},
140  forceResonanceCR{}, doNDgamma{}, doMPIgmgm{}, showUnresGamma{};
141  int pTmaxMatchMPI;
142  double mMinDiff{}, mWidthDiff{}, pMaxDiff{}, vetoWeakDeltaR2{};
143 
144  // Event generation strategy. Number of steps. Maximum pT scales.
145  bool doVeto{};
146  int nMPI{}, nISR{}, nFSRinProc{}, nFSRinRes{}, nISRhard{}, nFSRhard{},
147  typeLatest{}, nVetoStep{}, typeVetoStep{}, nVetoMPIStep{}, iSysNow{},
148  reconnectMode{}, hardDiffSide{}, sampleTypeDiff{};
149  double pTsaveMPI{}, pTsaveISR{}, pTsaveFSR{}, pTvetoPT{};
150 
151  // Current event properties.
152  bool isNonDiff{}, isDiffA{}, isDiffB{}, isDiffC{}, isDiff{},
153  isSingleDiff{}, isDoubleDiff{}, isCentralDiff{},
154  isResolved{}, isResolvedA{}, isResolvedB{}, isResolvedC{},
155  isHardDiffA{}, isHardDiffB{}, isHardDiff{}, doDiffVeto{},
156  hardDiffSet{}, isElastic{}, twoHard{};
157  int sizeProcess{}, sizeEvent{}, nHardDone{}, nHardDoneRHad{}, iDS{};
158  double eCMsave;
159  vector<bool> inRHadDecay;
160  vector<int> iPosBefShow;
161 
162  // Variables for photon inside electron.
163  bool hasGammaA{}, hasGammaB{}, beamHasGamma{}, beamAisGamma{},
164  beamBisGamma{}, beamAhasGamma{}, beamBhasGamma{}, beamAhasResGamma{},
165  beamBhasResGamma{}, beamHasResGamma{}, isGammaHadronDir{},
166  sampleQ2gamma{};
167  int gammaMode{}, gammaModeEvent{}, gammaOffset{};
168  double eCMsaveGamma{};
169 
170  // Pointer to assign space-time vertices during parton evolution.
171  PartonVertexPtr partonVertexPtr{};
172 
173  // The generator classes for multiparton interactions.
174  MultipartonInteractions multiMB;
175  MultipartonInteractions multiSDA;
176  MultipartonInteractions multiSDB;
177  MultipartonInteractions multiCD;
178  MultipartonInteractions* multiPtr{};
179  MultipartonInteractions multiGmGm;
180 
181  // The generator class to construct beam-remnant kinematics.
182  BeamRemnants remnants;
183 
184  // The RHadrons class is used to fragment off and decay R-hadrons.
185  RHadrons* rHadronsPtr{};
186 
187  // ResonanceDecay object does sequential resonance decays.
188  ResonanceDecays resonanceDecays;
189 
190  // The Colour reconnection class used to do colour reconnection.
191  ColRecPtr colourReconnectionPtr{};
192 
193  // The Junction splitting class used to split junctions systems.
194  JunctionSplitting junctionSplitting;
195 
196  // The Diffraction class is for hard diffraction selection.
197  HardDiffraction hardDiffraction;
198 
199  // Resolved diffraction: find how many systems should have it.
200  int decideResolvedDiff( Event& process);
201 
202  // Set up an unresolved process, i.e. elastic or diffractive.
203  bool setupUnresolvedSys( Event& process, Event& event);
204 
205  // Set up the hard process, excluding subsequent resonance decays.
206  void setupHardSys( Event& process, Event& event);
207 
208  // Resolved diffraction: pick whether to have it and set up for it.
209  void setupResolvedDiff( Event& process);
210 
211  // Resolved diffraction: restore normal behaviour.
212  void leaveResolvedDiff( int iHardLoop, Event& process, Event& event);
213 
214  // Hard diffraction: set up the process record.
215  void setupHardDiff( Event& process);
216 
217  // Hard diffraction: leave the process record.
218  void leaveHardDiff( Event& process, Event& event, bool physical = true);
219 
220  // Photon beam inside lepton beam: set up the parton level generation.
221  bool setupResolvedLeptonGamma( Event& process);
222 
223  // Photon beam inside lepton beam: recover the whole event and
224  // add scattered leptons.
225  void leaveResolvedLeptonGamma( Event& process, Event& event,
226  bool physical = true);
227 
228  // Photon beam inside lepton beam: set up the parton level generation.
229  void cleanEventFromGamma( Event& event);
230 
231  // Pointer to MergingHooks object for user interaction with the merging.
232  MergingHooksPtr mergingHooksPtr{};
233  // Parameters to specify trial shower usage.
234  bool doTrial{};
235  int nTrialEmissions{};
236  // Parameters to store to veto trial showers.
237  double pTLastBranch{};
238  int typeLastBranch{};
239  // Parameters to specify merging usage.
240  bool canRemoveEvent{}, canRemoveEmission{};
241 
242 };
243 
244 //==========================================================================
245 
246 } // end namespace Pythia8
247 
248 #endif // Pythia8_PartonLevel_H
Definition: AgUStep.h:26