1 // ProcessContainer.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2008 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 "SusyLesHouches.h"
26 #include "UserHooks.h"
30 //**************************************************************************
32 // The ProcessContainer class combines pointers to matrix element and
33 // phase space generator with general generation info.
35 class ProcessContainer {
40 ProcessContainer(SigmaProcess* sigmaProcessPtrIn = 0)
41 : sigmaProcessPtr(sigmaProcessPtrIn), phaseSpacePtr(0) {}
44 ~ProcessContainer() {delete phaseSpacePtr; delete sigmaProcessPtr;}
46 // Initialize phase space and counters.
47 bool init(Info* infoPtrIn, BeamParticle* beamAPtr, BeamParticle* beamBPtr,
48 AlphaStrong* alphaSPtr, AlphaEM* alphaEMPtr, SigmaTotal* sigmaTotPtr,
49 ResonanceDecays* resDecaysPtrIn, SusyLesHouches* slhaPtr,
50 UserHooks* userHooksPtr);
52 // Store or replace Les Houches pointer.
53 void setLHAPtr( LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;
54 if (sigmaProcessPtr > 0) sigmaProcessPtr->setLHAPtr(lhaUpPtr);
55 if (phaseSpacePtr > 0) phaseSpacePtr->setLHAPtr(lhaUpPtr);}
57 // Update the CM energy of the event.
58 void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
60 // Generate a trial event; accepted or not.
63 // Give the hard subprocess (with option for a second hard subprocess).
64 bool constructProcess( Event& process, bool isHardest = true);
66 // Do resonance decays.
67 bool decayResonances( Event& process);
69 // Accumulate statistics after user veto.
70 void accumulate() {++nAcc;}
72 // Reset statistics on events generated so far.
75 // Process name and code, and the number of final-state particles.
76 string name() const {return sigmaProcessPtr->name();}
77 int code() const {return sigmaProcessPtr->code();}
78 int nFinal() const {return sigmaProcessPtr->nFinal();}
80 // Member functions for info on generation process.
81 bool newSigmaMax() const {return newSigmaMx;}
82 double sigmaMax() const {return sigmaMx;}
83 long nTried() const {return nTry;}
84 long nSelected() const {return nSel;}
85 long nAccepted() const {return nAcc;}
86 double sigmaSelMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaAvg;}
87 double sigmaMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaFin;}
88 double deltaMC() {if (nTry > nTryStat) sigmaDelta(); return deltaFin;}
90 // Some kinematics quantities.
91 int id1() const {return sigmaProcessPtr->id(1);}
92 int id2() const {return sigmaProcessPtr->id(2);}
93 double x1() const {return phaseSpacePtr->x1();}
94 double x2() const {return phaseSpacePtr->x2();}
95 double Q2Fac() const {return sigmaProcessPtr->Q2Fac();}
97 // Tell whether container is for Les Houches events.
98 bool isLHAContainer() const {return isLHA;}
100 // When two hard processes set or get info whether process is matched.
101 void isSame( bool isSameIn) { isSameSave = isSameIn;}
102 bool isSame() const {return isSameSave;}
106 // Constants: could only be changed in the code itself.
107 static const int N12SAMPLE, N3SAMPLE;
109 // Pointer to the subprocess matrix element.
110 SigmaProcess* sigmaProcessPtr;
112 // Pointer to the phase space generator.
113 PhaseSpace* phaseSpacePtr;
115 // Pointer to various information on the generation.
118 // Pointer to ResonanceDecays object for sequential resonance decays.
119 ResonanceDecays* resDecaysPtr;
121 // Pointer to LHAup for generating external events.
125 bool isMinBias, isResolved, isDiffA, isDiffB, isLHA, allowNegSig,
126 hasOctetOnium, isSameSave;
127 int lhaStrat, lhaStratAbs;
129 // Statistics on generation process. (Long integers just in case.)
131 long nTry, nSel, nAcc, nTryStat;
132 double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg,
135 // Estimate integrated cross section and its uncertainty.
140 //**************************************************************************
142 // The SetupContainers class turns the list of user-requested processes
143 // into a vector of ProcessContainer objects, each with a process.
145 class SetupContainers {
152 // Initialization assuming all necessary data already read.
153 bool init(vector<ProcessContainer*>& containerPtrs);
155 // Initialization of a second hard process.
156 bool init2(vector<ProcessContainer*>& container2Ptrs);
160 //**************************************************************************
162 } // end namespace Pythia8
164 #endif // Pythia8_ProcessContainer_H