source: HiSusy/trunk/Pythia8/pythia8170/include/Pythia.h @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

File size: 11.4 KB
Line 
1// Pythia.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 event generation.
7// Pythia: provide the main user interface to everything else.
8
9#ifndef Pythia8_Pythia_H
10#define Pythia8_Pythia_H
11
12#include "Analysis.h"
13#include "Basics.h"
14#include "BeamParticle.h"
15#include "BeamShape.h"
16#include "Event.h"
17#include "FragmentationFlavZpT.h"
18#include "HadronLevel.h"
19#include "History.h"
20#include "Info.h"
21#include "LesHouches.h"
22#include "MergingHooks.h"
23#include "PartonLevel.h"
24#include "ParticleData.h"
25#include "PartonDistributions.h"
26#include "PartonSystems.h"
27#include "ProcessLevel.h"
28#include "PythiaStdlib.h"
29#include "ResonanceWidths.h"
30#include "RHadrons.h"
31#include "Settings.h"
32#include "SigmaTotal.h"
33#include "SpaceShower.h"
34#include "StandardModel.h"
35#include "SusyLesHouches.h"
36#include "TimeShower.h"
37#include "UserHooks.h"
38
39namespace Pythia8 {
40 
41//==========================================================================
42
43// The Pythia class contains the top-level routines to generate an event.
44
45class Pythia {
46
47public:
48
49  // Constructor. (See Pythia.cc file.)
50  Pythia(string xmlDir = "../xmldoc");
51
52  // Destructor. (See Pythia.cc file.)
53  ~Pythia();
54
55  // Read in one update for a setting or particle data from a single line.
56  bool readString(string, bool warn = true); 
57 
58  // Read in updates for settings or particle data from user-defined file.
59  bool readFile(string fileName, bool warn = true, 
60    int subrun = SUBRUNDEFAULT);
61  bool readFile(string fileName, int subrun) {
62    return readFile(fileName, true, subrun);}
63  bool readFile(istream& is = cin, bool warn = true, 
64    int subrun = SUBRUNDEFAULT);
65  bool readFile(istream& is, int subrun) {
66    return readFile(is, true, subrun);}
67
68  // Possibility to pass in pointers to PDF's.
69  bool setPDFPtr( PDF* pdfAPtrIn, PDF* pdfBPtrIn, PDF* pdfHardAPtrIn = 0, 
70    PDF* pdfHardBPtrIn = 0, PDF* pdfPomAPtrIn = 0, PDF* pdfPomBPtrIn = 0);
71
72  // Possibility to pass in pointer to external LHA-interfaced generator.
73  bool setLHAupPtr( LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn; return true;}
74
75  // Possibility to pass in pointer for external handling of some decays.
76  bool setDecayPtr( DecayHandler* decayHandlePtrIn, 
77    vector<int> handledParticlesIn) {decayHandlePtr = decayHandlePtrIn; 
78    handledParticles.resize(0); 
79    for(int i = 0; i < int(handledParticlesIn.size()); ++i)
80    handledParticles.push_back( handledParticlesIn[i] ); return true;} 
81
82  // Possibility to pass in pointer for external random number generation.
83  bool setRndmEnginePtr( RndmEngine* rndmEnginePtrIn) 
84    { return rndm.rndmEnginePtr( rndmEnginePtrIn);} 
85
86  // Possibility to pass in pointer for user hooks.
87  bool setUserHooksPtr( UserHooks* userHooksPtrIn) 
88    { userHooksPtr = userHooksPtrIn; return true;} 
89
90  // Possibility to pass in pointer for merging hooks.
91  bool setMergingHooksPtr( MergingHooks* mergingHooksPtrIn) 
92    { mergingHooksPtr = mergingHooksPtrIn; return true;} 
93
94  // Possibility to pass in pointer for beam shape.
95  bool setBeamShapePtr( BeamShape* beamShapePtrIn) 
96    { beamShapePtr = beamShapePtrIn; return true;} 
97
98  // Possibility to pass in pointer(s) for external cross section.
99  bool setSigmaPtr( SigmaProcess* sigmaPtrIn) 
100    { sigmaPtrs.push_back( sigmaPtrIn); return true;} 
101
102  // Possibility to pass in pointer(s) for external resonance.
103  bool setResonancePtr( ResonanceWidths* resonancePtrIn) 
104    { resonancePtrs.push_back( resonancePtrIn); return true;} 
105
106  // Possibility to pass in pointer for external showers.
107  bool setShowerPtr( TimeShower* timesDecPtrIn, 
108    TimeShower* timesPtrIn = 0, SpaceShower* spacePtrIn = 0) 
109    { timesDecPtr = timesDecPtrIn; timesPtr = timesPtrIn;
110    spacePtr = spacePtrIn; return true;} 
111
112  // Initialization using the Beams variables.
113  bool init();
114
115  // Deprecated: initialization in the CM frame.
116  bool init( int idAin, int idBin, double eCMin);
117
118  // Deprecated: initialization with two collinear beams, e.g. fixed target.
119  bool init( int idAin, int idBin, double eAin, double eBin);
120
121  // Deprecated: initialization with two acollinear beams.
122  bool init( int idAin, int idBin, double pxAin, double pyAin, 
123    double pzAin, double pxBin, double pyBin, double pzBin);
124
125  // Deprecated: initialization by a Les Houches Event File.
126  bool init( string LesHouchesEventFile, bool skipInit = false);
127
128  // Deprecated: initialization according to the Les Houches Accord.
129  bool init( LHAup* lhaUpPtrIn);
130
131  // Generate the next event.
132  bool next(); 
133
134  // Generate only a single timelike shower as in a decay.
135  int forceTimeShower( int iBeg, int iEnd, double pTmax, int nBranchMax = 0)
136    { return timesDecPtr->shower( iBeg, iEnd, event, pTmax, nBranchMax); }
137
138  // Generate only the hadronization/decay stage.
139  bool forceHadronLevel( bool findJunctions = true);
140
141  // Special routine to allow more decays if on/off switches changed.
142  bool moreDecays() {return hadronLevel.moreDecays(event);}
143
144  // Special routine to force R-hadron decay when not done before.
145  bool forceRHadronDecays() {return doRHadronDecays();}
146
147  // List the current Les Houches event.
148  void LHAeventList(ostream& os = cout) {
149    if (lhaUpPtr != 0) lhaUpPtr->listEvent(os);}
150
151  // Skip a number of Les Houches events at input.
152  bool LHAeventSkip(int nSkip) {
153    if (lhaUpPtr != 0) return lhaUpPtr->skipEvent(nSkip); return false;}
154
155  // Main routine to provide final statistics on generation.
156  void stat();
157
158  // Deprecated: alternative to provide final statistics on generation.
159  void statistics(bool all = false, bool reset = false);
160
161  // Read in settings values: shorthand, not new functionality.
162  bool   flag(string key) {return settings.flag(key);}
163  int    mode(string key) {return settings.mode(key);} 
164  double parm(string key) {return settings.parm(key);}
165  string word(string key) {return settings.word(key);}
166
167  // The event record for the parton-level central process.
168  Event          process;
169
170  // The event record for the complete event history.
171  Event          event;
172
173  // Information on the generation: current subprocess and error statistics.
174  Info           info;
175
176  // Settings: databases of flags/modes/parms/words to control run.
177  Settings       settings;
178
179  // ParticleData: the particle data table/database.
180  ParticleData   particleData;
181
182  // Random number generator.
183  Rndm           rndm;
184
185  // Standard Model couplings, including alphaS and alphaEM.
186  Couplings     couplings;
187  CoupSUSY      coupSUSY;
188  Couplings*    couplingsPtr;
189
190  // SusyLesHouches - SLHA object for interface to SUSY spectra.
191  SusyLesHouches slha;
192
193  // The partonic content of each subcollision system (auxiliary to event).
194  PartonSystems  partonSystems; 
195
196private: 
197
198  // Constants: could only be changed in the code itself.
199  static const double VERSIONNUMBERCODE;
200  static const int    NTRY, SUBRUNDEFAULT;
201
202  // Initialization data, extracted from database.
203  string xmlPath;
204  bool   doProcessLevel, doPartonLevel, doHadronLevel, doDiffraction, 
205         doResDec, doFSRinRes, decayRHadrons, abortIfVeto, checkEvent, 
206         checkHistory;
207  int    nErrList;
208  double epTolErr, epTolWarn;
209
210  // Initialization data, extracted from init(...) call.
211  bool   isConstructed, isInit, isUnresolvedA, isUnresolvedB, showSaV, 
212         showMaD;
213  int    idA, idB, frameType, boostType, nCount, nShowLHA, nShowInfo,
214         nShowProc, nShowEvt; 
215  double mA, mB, pxA, pxB, pyA, pyB, pzA, pzB, eA, eB, 
216         pzAcm, pzBcm, eCM, betaZ, gammaZ;
217  Vec4   pAinit, pBinit, pAnow, pBnow;
218  RotBstMatrix MfromCM, MtoCM;
219
220  // information for error checkout.
221  int    nErrEvent;
222  vector<int> iErrId, iErrCol, iErrNan, iErrNanVtx;
223
224  // Pointers to the parton distributions of the two incoming beams.
225  PDF* pdfAPtr; 
226  PDF* pdfBPtr; 
227
228  // Extra PDF pointers to be used in hard processes only.
229  PDF* pdfHardAPtr; 
230  PDF* pdfHardBPtr; 
231
232  // Extra Pomeron PDF pointers to be used in diffractive processes only.
233  PDF* pdfPomAPtr; 
234  PDF* pdfPomBPtr; 
235
236  // Keep track when "new" has been used and needs a "delete" for PDF's. 
237  bool useNewPdfA, useNewPdfB, useNewPdfHard, useNewPdfPomA, useNewPdfPomB;
238
239  // The two incoming beams.
240  BeamParticle beamA;
241  BeamParticle beamB;
242
243  // Alternative Pomeron beam-inside-beam.
244  BeamParticle beamPomA;
245  BeamParticle beamPomB;
246
247  // LHAup object for generating external events.
248  bool   doLHA, useNewLHA;
249  LHAup* lhaUpPtr;
250
251  // Pointer to external decay handler and list of particles it handles.
252  DecayHandler* decayHandlePtr;
253  vector<int>   handledParticles;
254
255  // Pointer to UserHooks object for user interaction with program.
256  UserHooks* userHooksPtr;
257  bool       hasUserHooks, doVetoProcess, doVetoPartons;
258
259  // Pointer to BeamShape object for beam momentum and interaction vertex.
260  BeamShape* beamShapePtr;
261  bool       useNewBeamShape, doMomentumSpread, doVertexSpread;
262
263  // Pointers to external processes derived from the Pythia base classes.
264  vector<SigmaProcess*> sigmaPtrs; 
265
266  // Pointers to external calculation of resonance widths.
267  vector<ResonanceWidths*> resonancePtrs;
268
269  // Pointers to timelike and spacelike showers.
270  TimeShower*  timesDecPtr;
271  TimeShower*  timesPtr;
272  SpaceShower* spacePtr;
273  bool         useNewTimes, useNewSpace;
274
275  // The main generator class to define the core process of the event.
276  ProcessLevel processLevel;
277
278  // The main generator class to produce the parton level of the event.
279  PartonLevel partonLevel;
280
281  // The main generator class to perform trial showers of the event.
282  PartonLevel trialPartonLevel;
283
284  // Pointer to MergingHooks object for user interaction with the merging.
285  MergingHooks* mergingHooksPtr;
286  bool       hasMergingHooks, hasOwnMergingHooks, doUserMerging, 
287             doMGMerging, doKTMerging, doMerging, doPTLundMerging,
288             doCutBasedMerging;
289  // The main generator class to produce the hadron level of the event.
290  HadronLevel hadronLevel;
291
292  // The total cross section class is used both on process and parton level.
293  SigmaTotal sigmaTot; 
294
295  // The RHadrons class is used both at PartonLevel and HadronLevel.
296  RHadrons   rHadrons;
297
298  // Write the Pythia banner, with symbol and version information.
299  void banner(ostream& os = cout);
300
301  // Check for lines in file that mark the beginning of new subrun.
302  int readSubrun(string line, bool warn = true, ostream& os = cout);
303
304  // Check that combinations of settings are allowed; change if not.
305  void checkSettings();
306
307  // Check that beams and beam combination can be handled.
308  bool checkBeams();
309
310  // Calculate kinematics at initialization.
311  bool initKinematics();
312
313  // Set up pointers to PDFs.
314  bool initPDFs();
315
316  // Recalculate kinematics for each event when beam momentum has a spread.
317  void nextKinematics();
318
319  // Boost from CM frame to lab frame, or inverse. Set production vertex.
320  void boostAndVertex(bool toLab, bool setVertex);
321
322  // Perform R-hadron decays.
323  bool doRHadronDecays();
324
325  // Check that the final event makes sense.
326  bool check(ostream& os = cout);
327
328  // Auxiliary to set parton densities among list of possibilities.
329  PDF* getPDFPtr(int idIn, int sequence = 1);
330
331  // Initialization of SLHA data.
332  bool initSLHA ();
333
334  // Function to perform CKKW-L merging of the history.
335  bool mergeProcess();
336
337};
338 
339//==========================================================================
340
341} // end namespace Pythia8
342
343#endif // Pythia8_Pythia_H
Note: See TracBrowser for help on using the repository browser.