1 // ProcessContainer.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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.
6 // This file contains the collected machinery of a process.
7 // ProcessContainer: contains information on a particular process.
8 // SetupContainers: administrates the selection/creation of processes.
10 #ifndef Pythia8_ProcessContainer_H
11 #define Pythia8_ProcessContainer_H
14 #include "BeamParticle.h"
17 #include "ParticleData.h"
18 #include "PartonDistributions.h"
19 #include "PhaseSpace.h"
20 #include "PythiaStdlib.h"
21 #include "ResonanceDecays.h"
23 #include "SigmaProcess.h"
24 #include "SigmaTotal.h"
25 #include "StandardModel.h"
26 #include "SusyCouplings.h"
27 #include "SusyLesHouches.h"
28 #include "UserHooks.h"
32 //==========================================================================
34 // The ProcessContainer class combines pointers to matrix element and
35 // phase space generator with general generation info.
37 class ProcessContainer {
42 ProcessContainer(SigmaProcess* sigmaProcessPtrIn = 0,
43 bool externalPtrIn = false) : sigmaProcessPtr(sigmaProcessPtrIn),
44 externalPtr(externalPtrIn), phaseSpacePtr(0) {}
46 // Destructor. Do not destroy external sigmaProcessPtr.
47 ~ProcessContainer() {delete phaseSpacePtr;
48 if (!externalPtr) delete sigmaProcessPtr;}
50 // Initialize phase space and counters.
51 bool init(bool isFirst, Info* infoPtrIn, Settings& settings,
52 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn, BeamParticle* beamAPtr,
53 BeamParticle* beamBPtr, Couplings* couplings, SigmaTotal* sigmaTotPtr,
54 ResonanceDecays* resDecaysPtrIn, SusyLesHouches* slhaPtr,
55 UserHooks* userHooksPtr);
57 // Store or replace Les Houches pointer.
58 void setLHAPtr( LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;
59 if (sigmaProcessPtr > 0) sigmaProcessPtr->setLHAPtr(lhaUpPtr);
60 if (phaseSpacePtr > 0) phaseSpacePtr->setLHAPtr(lhaUpPtr);}
62 // Update the CM energy of the event.
63 void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
65 // Generate a trial event; accepted or not.
68 // Give the hard subprocess (with option for a second hard subprocess).
69 bool constructProcess( Event& process, bool isHardest = true);
71 // Do resonance decays.
72 bool decayResonances( Event& process);
74 // Accumulate statistics after user veto.
75 void accumulate() {++nAcc;}
77 // Reset statistics on events generated so far.
80 // Process name and code, and the number of final-state particles.
81 string name() const {return sigmaProcessPtr->name();}
82 int code() const {return sigmaProcessPtr->code();}
83 int nFinal() const {return sigmaProcessPtr->nFinal();}
84 bool isSUSY() const {return sigmaProcessPtr->isSUSY();}
86 // Member functions for info on generation process.
87 bool newSigmaMax() const {return newSigmaMx;}
88 double sigmaMax() const {return sigmaMx;}
89 long nTried() const {return nTry;}
90 long nSelected() const {return nSel;}
91 long nAccepted() const {return nAcc;}
92 double sigmaSelMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaAvg;}
93 double sigmaMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaFin;}
94 double deltaMC() {if (nTry > nTryStat) sigmaDelta(); return deltaFin;}
96 // Some kinematics quantities.
97 int id1() const {return sigmaProcessPtr->id(1);}
98 int id2() const {return sigmaProcessPtr->id(2);}
99 double x1() const {return phaseSpacePtr->x1();}
100 double x2() const {return phaseSpacePtr->x2();}
101 double Q2Fac() const {return sigmaProcessPtr->Q2Fac();}
102 double mHat() const {return sqrtpos(phaseSpacePtr->sHat());}
103 double pTHat() const {return phaseSpacePtr->pTHat();}
105 // Tell whether container is for Les Houches events.
106 bool isLHAContainer() const {return isLHA;}
108 // When two hard processes set or get info whether process is matched.
109 void isSame( bool isSameIn) { isSameSave = isSameIn;}
110 bool isSame() const {return isSameSave;}
114 // Constants: could only be changed in the code itself.
115 static const int N12SAMPLE, N3SAMPLE;
117 // Pointer to the subprocess matrix element. Mark if external.
118 SigmaProcess* sigmaProcessPtr;
121 // Pointer to the phase space generator.
122 PhaseSpace* phaseSpacePtr;
124 // Pointer to various information on the generation.
127 // Pointer to the particle data table.
128 ParticleData* particleDataPtr;
130 // Pointer to the random number generator.
133 // Pointer to ResonanceDecays object for sequential resonance decays.
134 ResonanceDecays* resDecaysPtr;
136 // Pointer to LHAup for generating external events.
140 bool isLHA, isMinBias, isResolved, isDiffA, isDiffB, isQCD3body,
141 allowNegSig, hasOctetOnium, isSameSave, increaseMaximum;
142 int lhaStrat, lhaStratAbs;
144 // Statistics on generation process. (Long integers just in case.)
146 long nTry, nSel, nAcc, nTryStat;
147 double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg,
150 // Estimate integrated cross section and its uncertainty.
155 //==========================================================================
157 // The SetupContainers class turns the list of user-requested processes
158 // into a vector of ProcessContainer objects, each with a process.
160 class SetupContainers {
167 // Initialization assuming all necessary data already read.
168 bool init(vector<ProcessContainer*>& containerPtrs, Settings& settings,
169 ParticleData* particleDataPtr, Couplings* couplings);
171 // Initialization of a second hard process.
172 bool init2(vector<ProcessContainer*>& container2Ptrs, Settings& settings);
176 //==========================================================================
178 } // end namespace Pythia8
180 #endif // Pythia8_ProcessContainer_H