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) 2018 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/ColourReconnection.h"
16 #include "Pythia8/Event.h"
17 #include "Pythia8/HardDiffraction.h"
18 #include "Pythia8/Info.h"
19 #include "Pythia8/JunctionSplitting.h"
20 #include "Pythia8/MergingHooks.h"
21 #include "Pythia8/MultipartonInteractions.h"
22 #include "Pythia8/ParticleData.h"
23 #include "Pythia8/PartonSystems.h"
24 #include "Pythia8/PartonVertex.h"
25 #include "Pythia8/PythiaStdlib.h"
26 #include "Pythia8/ResonanceDecays.h"
27 #include "Pythia8/RHadrons.h"
28 #include "Pythia8/Settings.h"
29 #include "Pythia8/SigmaTotal.h"
30 #include "Pythia8/SpaceShower.h"
31 #include "Pythia8/StandardModel.h"
32 #include "Pythia8/StringLength.h"
33 #include "Pythia8/TimeShower.h"
34 #include "Pythia8/UserHooks.h"
35 
36 namespace Pythia8 {
37 
38 //==========================================================================
39 
40 // The PartonLevel class contains the top-level routines to generate
41 // the partonic activity of an event.
42 
43 class PartonLevel {
44 
45 public:
46 
47  // Constructor.
48  PartonLevel() : userHooksPtr(0) {}
49 
50  // Initialization of all classes at the parton level.
51  bool init( Info* infoPtrIn, Settings& settings,
52  ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
53  BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
54  BeamParticle* beamPomAPtrIn, BeamParticle* beamPomBPtrIn,
55  BeamParticle* beamGamAPtrIn, BeamParticle* beamGamBPtrIn,
56  BeamParticle* beamVMDAPtrIn, BeamParticle* beamVMDBPtrIn,
57  Couplings* couplingsPtrIn, PartonSystems* partonSystemsPtrIn,
58  SigmaTotal* sigmaTotPtr, TimeShower* timesDecPtrIn,
59  TimeShower* timesPtrIn, SpaceShower* spacePtrIn,
60  RHadrons* rHadronsPtrIn, UserHooks* userHooksPtrIn,
61  MergingHooks* mergingHooksPtr, PartonVertex* partonVertexPtrIn,
62  bool useAsTrial);
63 
64  // Generate the next parton-level process.
65  bool next( Event& process, Event& event);
66 
67  // Perform showers in resonance decay chains. (For special cases.)
68  void setupShowerSys( Event& process, Event& event);
69  bool resonanceShowers( Event& process, Event& event, bool skipForR);
70 
71  // Perform decays and showers of W and Z emitted in shower.
72  bool wzDecayShowers( Event& event);
73 
74  // Tell whether failure was due to vetoing.
75  bool hasVetoed() const {return doVeto;}
76  bool hasVetoedDiff() const {return doDiffVeto;}
77 
78  // Accumulate, print and reset statistics.
79  void accumulate() {if (isResolved && !isDiff) multiPtr->accumulate();}
80  void statistics(bool reset = false) {
81  if (doMPI) multiMB.statistics(reset);}
82  // For now no separate statistics for diffraction??
83  //if (doMPISDA && doDiffraction) multiSDA.statistics(reset);
84  //if (doMPISDB && doDiffraction) multiSDB.statistics(reset);}
85  void resetStatistics() { if (doMPI) multiMB.resetStatistics(); }
86 
87  // Reset PartonLevel object for trial shower usage.
88  void resetTrial();
89  // Provide the pT scale of the last branching in the shower.
90  double pTLastInShower() { return pTLastBranch; }
91  // Provide the type of the last branching in the shower.
92  int typeLastInShower() { return typeLastBranch; }
93 
94  // Make History and MergingHooks friends for access to private functions.
95  // This is helpful when merging with an external shower plugin.
96  friend class History;
97  friend class MergingHooks;
98 
99  // Pointers to timelike showers for resonance decays and the rest.
100  TimeShower* timesDecPtr;
101  TimeShower* timesPtr;
102 
103  // Pointer to spacelike showers.
104  SpaceShower* spacePtr;
105 
106  // Pointer to userHooks object for user interaction with program.
107  UserHooks* userHooksPtr;
108 
109 private:
110 
111  // Constants: could only be changed in the code itself.
112  static const int NTRY;
113 
114  // Initialization data, mainly read from Settings.
115  bool doNonDiff, doDiffraction, doMPI, doMPIMB, doMPISDA, doMPISDB,
116  doMPICD, doMPIinit, doISR, doFSRduringProcess, doFSRafterProcess,
117  doFSRinResonances, doRemnants, doSecondHard, hasOneLeptonBeam,
118  hasTwoLeptonBeams, hasPointLeptons, canVetoPT, canVetoStep,
119  canVetoMPIStep, canVetoEarly, canSetScale, allowRH, earlyResDec,
120  vetoWeakJets, canReconResSys, doReconnect, doHardDiff,
121  forceResonanceCR, doNDgamma, doMPIgmgm, showUnresGamma;
122  int pTmaxMatchMPI;
123  double mMinDiff, mWidthDiff, pMaxDiff, vetoWeakDeltaR2;
124 
125  // Event generation strategy. Number of steps. Maximum pT scales.
126  bool doVeto;
127  int nMPI, nISR, nFSRinProc, nFSRinRes, nISRhard, nFSRhard,
128  typeLatest, nVetoStep, typeVetoStep, nVetoMPIStep, iSysNow,
129  reconnectMode, sampleTypeDiff;
130  double pTsaveMPI, pTsaveISR, pTsaveFSR, pTvetoPT;
131 
132  // Current event properties.
133  bool isNonDiff, isDiffA, isDiffB, isDiffC, isDiff, isSingleDiff,
134  isDoubleDiff, isCentralDiff, isResolved, isResolvedA,
135  isResolvedB, isResolvedC, isHardDiffA, isHardDiffB, isHardDiff,
136  doDiffVeto, hardDiffSet;
137  int sizeProcess, sizeEvent, nHardDone, nHardDoneRHad, iDS;
138  double eCMsave;
139  vector<bool> inRHadDecay;
140  vector<int> iPosBefShow;
141 
142  // Variables for photon inside electron.
143  bool hasGammaA, hasGammaB, beamHasGamma, beamAisGamma, beamBisGamma,
144  beamAhasGamma, beamBhasGamma, beamAhasResGamma, beamBhasResGamma,
145  beamHasResGamma, isGammaHadronDir;
146  int gammaMode, gammaModeEvent, gammaOffset;
147  double eCMsaveGamma;
148 
149  // Pointer to various information on the generation.
150  Info* infoPtr;
151 
152  // Pointer to the particle data table.
153  ParticleData* particleDataPtr;
154 
155  // Pointer to the random number generator.
156  Rndm* rndmPtr;
157 
158  // Pointers to the two incoming beams.
159  BeamParticle* beamAPtr;
160  BeamParticle* beamBPtr;
161 
162  // Spare copies of normal pointers. Pointers to Pomeron beam-inside-beam.
163  BeamParticle* beamHadAPtr;
164  BeamParticle* beamHadBPtr;
165  BeamParticle* beamPomAPtr;
166  BeamParticle* beamPomBPtr;
167 
168  // Pointers to photon beams inside lepton beams.
169  BeamParticle* beamGamAPtr;
170  BeamParticle* beamGamBPtr;
171  // Pointers to VMD beams inside gamma beams.
172  BeamParticle* beamVMDAPtr;
173  BeamParticle* beamVMDBPtr;
174 
175  // Pointers to Standard Model couplings.
176  Couplings* couplingsPtr;
177 
178  // Pointer to information on subcollision parton locations.
179  PartonSystems* partonSystemsPtr;
180 
181  // Pointer to assign space-time vertices during parton evolution.
182  PartonVertex* partonVertexPtr;
183 
184  // The generator classes for multiparton interactions.
185  MultipartonInteractions multiMB;
186  MultipartonInteractions multiSDA;
187  MultipartonInteractions multiSDB;
188  MultipartonInteractions multiCD;
189  MultipartonInteractions* multiPtr;
190  MultipartonInteractions multiGmGm;
191 
192  // The generator class to construct beam-remnant kinematics.
193  BeamRemnants remnants;
194 
195  // The RHadrons class is used to fragment off and decay R-hadrons.
196  RHadrons* rHadronsPtr;
197 
198  // ResonanceDecay object does sequential resonance decays.
199  ResonanceDecays resonanceDecays;
200 
201  // The Colour reconnection class used to do colour reconnection.
202  ColourReconnection colourReconnection;
203 
204  // The Junction splitting class used to split junctions systems.
205  JunctionSplitting junctionSplitting;
206 
207  // The Diffraction class is for hard diffraction selection.
208  HardDiffraction hardDiffraction;
209 
210  // Resolved diffraction: find how many systems should have it.
211  int decideResolvedDiff( Event& process);
212 
213  // Set up an unresolved process, i.e. elastic or diffractive.
214  bool setupUnresolvedSys( Event& process, Event& event);
215 
216  // Set up the hard process, excluding subsequent resonance decays.
217  void setupHardSys( Event& process, Event& event);
218 
219  // Resolved diffraction: pick whether to have it and set up for it.
220  void setupResolvedDiff( Event& process);
221 
222  // Resolved diffraction: restore normal behaviour.
223  void leaveResolvedDiff( int iHardLoop, Event& process, Event& event);
224 
225  // Hard diffraction: set up the process record.
226  void setupHardDiff( Event& process);
227 
228  // Hard diffraction: leave the process record.
229  void leaveHardDiff( Event& process, Event& event);
230 
231  // Photon beam inside lepton beam: set up the parton level generation.
232  bool setupResolvedLeptonGamma( Event& process);
233 
234  // Photon beam inside lepton beam: recover the whole event and
235  // add scattered leptons.
236  void leaveResolvedLeptonGamma( Event& process, Event& event,
237  bool physical = true);
238 
239  // Photon beam inside lepton beam: set up the parton level generation.
240  void cleanEventFromGamma( Event& event);
241 
242  // Pointer to MergingHooks object for user interaction with the merging.
243  MergingHooks* mergingHooksPtr;
244  // Parameters to specify trial shower usage.
245  bool doTrial;
246  int nTrialEmissions;
247  // Parameters to store to veto trial showers.
248  double pTLastBranch;
249  int typeLastBranch;
250  // Parameters to specify merging usage.
251  bool canRemoveEvent, canRemoveEmission;
252 
253 };
254 
255 //==========================================================================
256 
257 } // end namespace Pythia8
258 
259 #endif // Pythia8_PartonLevel_H
Definition: AgUStep.h:26