LCOV - code coverage report
Current view: top level - PYTHIA8/pythia8/include/Pythia8 - Pythia.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 1 0.0 %

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

Generated by: LCOV version 1.11