Line data Source code
1 : // ProcessContainer.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 collected machinery of a process.
7 : // ProcessContainer: contains information on a particular process.
8 : // SetupContainers: administrates the selection/creation of processes.
9 :
10 : #ifndef Pythia8_ProcessContainer_H
11 : #define Pythia8_ProcessContainer_H
12 :
13 : #include "Pythia8/Basics.h"
14 : #include "Pythia8/BeamParticle.h"
15 : #include "Pythia8/Event.h"
16 : #include "Pythia8/Info.h"
17 : #include "Pythia8/ParticleData.h"
18 : #include "Pythia8/PartonDistributions.h"
19 : #include "Pythia8/PhaseSpace.h"
20 : #include "Pythia8/PythiaStdlib.h"
21 : #include "Pythia8/ResonanceDecays.h"
22 : #include "Pythia8/Settings.h"
23 : #include "Pythia8/SigmaProcess.h"
24 : #include "Pythia8/SigmaTotal.h"
25 : #include "Pythia8/SigmaOnia.h"
26 : #include "Pythia8/StandardModel.h"
27 : #include "Pythia8/SusyCouplings.h"
28 : #include "Pythia8/SLHAinterface.h"
29 : #include "Pythia8/UserHooks.h"
30 :
31 : namespace Pythia8 {
32 :
33 : //==========================================================================
34 :
35 : // The ProcessContainer class combines pointers to matrix element and
36 : // phase space generator with general generation info.
37 :
38 : class ProcessContainer {
39 :
40 : public:
41 :
42 : // Constructor.
43 0 : ProcessContainer(SigmaProcess* sigmaProcessPtrIn = 0,
44 : bool externalPtrIn = false, PhaseSpace* phaseSpacePtrIn = 0) :
45 0 : sigmaProcessPtr(sigmaProcessPtrIn),
46 0 : externalPtr(externalPtrIn), phaseSpacePtr(phaseSpacePtrIn) {}
47 :
48 : // Destructor. Do not destroy external sigmaProcessPtr.
49 0 : ~ProcessContainer() {delete phaseSpacePtr;
50 0 : if (!externalPtr) delete sigmaProcessPtr;}
51 :
52 : // Initialize phase space and counters.
53 : bool init(bool isFirst, Info* infoPtrIn, Settings& settings,
54 : ParticleData* particleDataPtrIn, Rndm* rndmPtrIn, BeamParticle* beamAPtr,
55 : BeamParticle* beamBPtr, Couplings* couplings, SigmaTotal* sigmaTotPtr,
56 : ResonanceDecays* resDecaysPtrIn, SLHAinterface* slhaInterfacePtr,
57 : UserHooks* userHooksPtr);
58 :
59 : // Store or replace Les Houches pointer.
60 : void setLHAPtr( LHAup* lhaUpPtrIn, ParticleData* particleDataPtrIn = 0)
61 0 : {lhaUpPtr = lhaUpPtrIn;
62 0 : if (particleDataPtrIn != 0) particleDataPtr = particleDataPtrIn;
63 0 : if (sigmaProcessPtr != 0) sigmaProcessPtr->setLHAPtr(lhaUpPtr);
64 0 : if (phaseSpacePtr != 0) phaseSpacePtr->setLHAPtr(lhaUpPtr);}
65 :
66 : // Update the CM energy of the event.
67 0 : void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
68 :
69 : // Generate a trial event; accepted or not.
70 : bool trialProcess();
71 :
72 : // Pick flavours and colour flow of process.
73 : bool constructState();
74 :
75 : // Give the hard subprocess (with option for a second hard subprocess).
76 : bool constructProcess( Event& process, bool isHardest = true);
77 :
78 : // Give the Les Houches decay chain for external resonance.
79 : bool constructDecays( Event& process);
80 :
81 : // Do resonance decays.
82 : bool decayResonances( Event& process);
83 :
84 : // Accumulate statistics after user veto.
85 : void accumulate();
86 :
87 : // Reset statistics on events generated so far.
88 : void reset();
89 :
90 : // Process name and code, and the number of final-state particles.
91 0 : string name() const {return sigmaProcessPtr->name();}
92 0 : int code() const {return sigmaProcessPtr->code();}
93 0 : int nFinal() const {return sigmaProcessPtr->nFinal();}
94 0 : bool isSUSY() const {return sigmaProcessPtr->isSUSY();}
95 :
96 : // Member functions for info on generation process.
97 0 : bool newSigmaMax() const {return newSigmaMx;}
98 0 : double sigmaMax() const {return sigmaMx;}
99 0 : long nTried() const {return nTry;}
100 0 : long nSelected() const {return nSel;}
101 0 : long nAccepted() const {return nAcc;}
102 0 : double weightSum() const {return wtAccSum;}
103 0 : double sigmaSelMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaAvg;}
104 0 : double sigmaMC() {if (nTry > nTryStat) sigmaDelta(); return sigmaFin;}
105 0 : double deltaMC() {if (nTry > nTryStat) sigmaDelta(); return deltaFin;}
106 :
107 : // Some kinematics quantities.
108 0 : int id1() const {return sigmaProcessPtr->id(1);}
109 0 : int id2() const {return sigmaProcessPtr->id(2);}
110 0 : double x1() const {return phaseSpacePtr->x1();}
111 0 : double x2() const {return phaseSpacePtr->x2();}
112 0 : double Q2Fac() const {return sigmaProcessPtr->Q2Fac();}
113 0 : double mHat() const {return sqrtpos(phaseSpacePtr->sHat());}
114 0 : double pTHat() const {return phaseSpacePtr->pTHat();}
115 :
116 : // Tell whether container is for Les Houches events.
117 : bool isLHAContainer() const {return isLHA;}
118 : int lhaStrategy() const {return lhaStrat;}
119 :
120 : // Info on Les Houches events.
121 0 : int codeLHASize() const {return codeLHA.size();}
122 0 : int subCodeLHA(int i) const {return codeLHA[i];}
123 0 : long nTriedLHA(int i) const {return nTryLHA[i];}
124 0 : long nSelectedLHA(int i) const {return nSelLHA[i];}
125 0 : long nAcceptedLHA(int i) const {return nAccLHA[i];}
126 :
127 : // When two hard processes set or get info whether process is matched.
128 0 : void isSame( bool isSameIn) { isSameSave = isSameIn;}
129 0 : bool isSame() const {return isSameSave;}
130 :
131 : private:
132 :
133 : // Constants: could only be changed in the code itself.
134 : static const int N12SAMPLE, N3SAMPLE;
135 :
136 : // Pointer to the subprocess matrix element. Mark if external.
137 : SigmaProcess* sigmaProcessPtr;
138 : bool externalPtr;
139 :
140 : // Pointer to the phase space generator.
141 : PhaseSpace* phaseSpacePtr;
142 :
143 : // Pointer to various information on the generation.
144 : Info* infoPtr;
145 :
146 : // Pointer to the particle data table.
147 : ParticleData* particleDataPtr;
148 :
149 : // Pointer to the random number generator.
150 : Rndm* rndmPtr;
151 :
152 : // Pointer to ResonanceDecays object for sequential resonance decays.
153 : ResonanceDecays* resDecaysPtr;
154 :
155 : // Pointer to userHooks object for user interaction with program.
156 : UserHooks* userHooksPtr;
157 :
158 : // Pointer to LHAup for generating external events.
159 : LHAup* lhaUpPtr;
160 :
161 : // Possibility to modify Les Houches input.
162 : bool matchInOut;
163 : int idRenameBeams, setLifetime, setLeptonMass, idLep[3];
164 : double mRecalculate, mLep[3];
165 :
166 : // Info on process.
167 : bool isLHA, isNonDiff, isResolved, isDiffA, isDiffB, isDiffC, isQCD3body,
168 : allowNegSig, isSameSave, increaseMaximum, canVetoResDecay;
169 : int lhaStrat, lhaStratAbs;
170 : bool useStrictLHEFscales;
171 :
172 : // Statistics on generation process. (Long integers just in case.)
173 : bool newSigmaMx;
174 : long nTry, nSel, nAcc, nTryStat;
175 : double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg,
176 : sigmaFin, deltaFin, weightNow, wtAccSum;
177 :
178 : // Statistics for Les Houches event classification.
179 : vector<int> codeLHA;
180 : vector<long> nTryLHA, nSelLHA, nAccLHA;
181 :
182 : // Estimate integrated cross section and its uncertainty.
183 : void sigmaDelta();
184 :
185 : };
186 :
187 : //==========================================================================
188 :
189 : // The SetupContainers class turns the list of user-requested processes
190 : // into a vector of ProcessContainer objects, each with a process.
191 :
192 0 : class SetupContainers {
193 :
194 : public:
195 :
196 : // Constructor.
197 0 : SetupContainers() {}
198 :
199 : // Initialization assuming all necessary data already read.
200 : bool init(vector<ProcessContainer*>& containerPtrs, Info* infoPtr,
201 : Settings& settings, ParticleData* particleDataPtr, Couplings* couplings);
202 :
203 : // Initialization of a second hard process.
204 : bool init2(vector<ProcessContainer*>& container2Ptrs, Settings& settings);
205 :
206 : private:
207 :
208 : // Methods to check that outgoing SUSY particles are allowed ones.
209 : void setupIdVecs( Settings& settings);
210 : bool allowIdVals( int idCheck1, int idCheck2);
211 :
212 : // Arrays of allowed outgoing SUSY particles and their lengths.
213 : vector<int> idVecA, idVecB;
214 : int nVecA, nVecB;
215 :
216 : // Helper class to setup onia production.
217 : SigmaOniaSetup charmonium, bottomonium;
218 :
219 : };
220 :
221 : //==========================================================================
222 :
223 : } // end namespace Pythia8
224 :
225 : #endif // Pythia8_ProcessContainer_H
|