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) 2012 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, 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 "Basics.h"
13 #include "BeamParticle.h"
14 #include "BeamRemnants.h"
15 #include "Event.h"
16 #include "Info.h"
17 #include "MergingHooks.h"
18 #include "MultipartonInteractions.h"
19 #include "ParticleData.h"
20 #include "PartonSystems.h"
21 #include "PythiaStdlib.h"
22 #include "RHadrons.h"
23 #include "Settings.h"
24 #include "SigmaTotal.h"
25 #include "SpaceShower.h"
26 #include "StandardModel.h"
27 #include "TimeShower.h"
28 #include "UserHooks.h"
29 
30 namespace Pythia8 {
31 
32 //==========================================================================
33 
34 // The PartonLevel class contains the top-level routines to generate
35 // the partonic activity of an event.
36 
37 class PartonLevel {
38 
39 public:
40 
41  // Constructor.
42  PartonLevel() : userHooksPtr(0) {}
43 
44  // Initialization of all classes at the parton level.
45  bool init( Info* infoPtrIn, Settings& settings,
46  ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
47  BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
48  BeamParticle* beamPomAPtrIn, BeamParticle* beamPomBPtrIn,
49  Couplings* couplingsPtrIn, PartonSystems* partonSystemsPtrIn,
50  SigmaTotal* sigmaTotPtr, TimeShower* timesDecPtrIn,
51  TimeShower* timesPtrIn, SpaceShower* spacePtrIn,
52  RHadrons* rHadronsPtrIn, UserHooks* userHooksPtrIn,
53  MergingHooks* mergingHooksPtr, bool useAsTrial);
54 
55  // Generate the next parton-level process.
56  bool next( Event& process, Event& event);
57 
58  // Perform showers in resonance decay chains. (For special cases.)
59  bool resonanceShowers( Event& process, Event& event, bool skipForR);
60 
61  // Tell whether failure was due to vetoing.
62  bool hasVetoed() const {return doVeto;}
63 
64  // Accumulate, print and reset statistics.
65  void accumulate() {multiPtr->accumulate();}
66  void statistics(bool reset = false) {
67  if (doMPI) multiMB.statistics(reset);}
68  // For now no separate statistics for diffraction??
69  //if (doMPISDA && doDiffraction) multiSDA.statistics(reset);
70  //if (doMPISDB && doDiffraction) multiSDB.statistics(reset);}
71  void resetStatistics() { if (doMPI) multiMB.resetStatistics(); }
72 
73  // Reset PartonLevel object for trial shower usage.
74  void resetTrial();
75  // Provide the pT scale of the last branching in the shower.
76  double pTLastInShower(){ return pTLastBranch; }
77  // Provide the type of the last branching in the shower.
78  int typeLastInShower(){ return typeLastBranch; }
79 
80 private:
81 
82  // Constants: could only be changed in the code itself.
83  static const int NTRY;
84 
85  // Initialization data, mainly read from Settings.
86  bool doMinBias, doDiffraction, doMPI, doMPIMB, doMPISDA, doMPISDB,
87  doMPIinit, doISR, doFSRduringProcess, doFSRafterProcess,
88  doFSRinResonances, doRemnants, doSecondHard, hasLeptonBeams,
89  hasPointLeptons, canVetoPT, canVetoStep, canVetoMPIStep,
90  canSetScale, allowRH;
91  double mMinDiff, mWidthDiff, pMaxDiff;
92 
93  // Event generation strategy. Number of steps. Maximum pT scales.
94  bool doVeto;
95  int nMPI, nISR, nFSRinProc, nFSRinRes, nISRhard, nFSRhard,
96  typeLatest, nVetoStep, typeVetoStep, nVetoMPIStep, iSysNow;
97  double pTsaveMPI, pTsaveISR, pTsaveFSR, pTvetoPT;
98 
99  // Current event properties.
100  bool isMinBias, isDiffA, isDiffB, isDiff, isSingleDiff, isDoubleDiff,
101  isResolved, isResolvedA, isResolvedB;
102  int sizeProcess, sizeEvent, nHardDone, nHardDoneRHad;
103  double eCMsave;
104  vector<bool> inRHadDecay;
105  vector<int> iPosBefShow;
106 
107  // Pointer to various information on the generation.
108  Info* infoPtr;
109 
110  // Pointer to the particle data table.
111  ParticleData* particleDataPtr;
112 
113  // Pointer to the random number generator.
114  Rndm* rndmPtr;
115 
116  // Pointers to the two incoming beams.
117  BeamParticle* beamAPtr;
118  BeamParticle* beamBPtr;
119 
120  // Spare copies of normal pointers. Pointers to Pomeron beam-inside-beam.
121  BeamParticle* beamHadAPtr;
122  BeamParticle* beamHadBPtr;
123  BeamParticle* beamPomAPtr;
124  BeamParticle* beamPomBPtr;
125 
126  // Pointers to Standard Model couplings.
127  Couplings* couplingsPtr;
128 
129  // Pointer to information on subcollision parton locations.
130  PartonSystems* partonSystemsPtr;
131 
132  // Pointer to userHooks object for user interaction with program.
133  UserHooks* userHooksPtr;
134 
135  // Pointers to timelike showers for resonance decays and the rest.
136  TimeShower* timesDecPtr;
137  TimeShower* timesPtr;
138 
139  // Pointer to spacelike showers.
140  SpaceShower* spacePtr;
141 
142  // The generator classes for multiparton interactions.
143  MultipartonInteractions multiMB;
144  MultipartonInteractions multiSDA;
145  MultipartonInteractions multiSDB;
146  MultipartonInteractions* multiPtr;
147 
148  // The generator class to construct beam-remnant kinematics.
149  BeamRemnants remnants;
150 
151  // The RHadrons class is used to fragment off and decay R-hadrons.
152  RHadrons* rHadronsPtr;
153 
154  // Resolved diffraction: find how many systems should have it.
155  int decideResolvedDiff( Event& process);
156 
157  // Set up an unresolved process, i.e. elastic or diffractive.
158  bool setupUnresolvedSys( Event& process, Event& event);
159 
160  // Set up the hard process, excluding subsequent resonance decays.
161  void setupHardSys( int iHardLoop, Event& process, Event& event);
162 
163  // Resolved diffraction: pick whether to have it and set up for it.
164  void setupResolvedDiff( int iHardLoop, Event& process);
165 
166  // Resolved diffraction: restore normal behaviour.
167  void leaveResolvedDiff( int iHardLoop, Event& event);
168 
169  // Pointer to MergingHooks object for user interaction with the merging.
170  MergingHooks* mergingHooksPtr;
171  // Parameters to specify trial shower usage
172  bool doTrial;
173  int nTrialEmissions;
174  // Parameters to store to veto trial showers
175  double pTLastBranch;
176  int typeLastBranch;
177  // Parameters to specify merging usage
178  bool doMerging;
179  bool doMergeFirstEmm;
180 
181 };
182 
183 //==========================================================================
184 
185 } // end namespace Pythia8
186 
187 #endif // Pythia8_PartonLevel_H