]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8145/include/ProcessContainer.h
New pythia8 version
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / include / ProcessContainer.h
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.
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 "Basics.h"
14 #include "BeamParticle.h"
15 #include "Event.h"
16 #include "Info.h"
17 #include "ParticleData.h"
18 #include "PartonDistributions.h"
19 #include "PhaseSpace.h"
20 #include "PythiaStdlib.h"
21 #include "ResonanceDecays.h"
22 #include "Settings.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"
29
30 namespace Pythia8 {
31
32 //==========================================================================
33
34 // The ProcessContainer class combines pointers to matrix element and 
35 // phase space generator with general generation info. 
36
37 class ProcessContainer {
38
39 public:
40
41   // Constructor. 
42   ProcessContainer(SigmaProcess* sigmaProcessPtrIn = 0, 
43     bool externalPtrIn = false) : sigmaProcessPtr(sigmaProcessPtrIn), 
44     externalPtr(externalPtrIn), phaseSpacePtr(0) {} 
45
46   // Destructor. Do not destroy external sigmaProcessPtr.
47   ~ProcessContainer() {delete phaseSpacePtr; 
48     if (!externalPtr) delete sigmaProcessPtr;}
49   
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); 
56
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);}
61
62   // Update the CM energy of the event.
63   void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
64
65   // Generate a trial event; accepted or not.
66   bool trialProcess(); 
67   
68   // Give the hard subprocess (with option for a second hard subprocess).
69   bool constructProcess( Event& process, bool isHardest = true); 
70
71   // Do resonance decays.
72   bool decayResonances( Event& process); 
73
74   // Accumulate statistics after user veto.
75   void accumulate() {++nAcc;}
76
77   // Reset statistics on events generated so far.
78   void reset();
79
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();}
85
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;} 
95
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();}
104  
105   // Tell whether container is for Les Houches events.
106   bool   isLHAContainer() const {return isLHA;}
107
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;}
111
112 private:
113
114   // Constants: could only be changed in the code itself.
115   static const int N12SAMPLE, N3SAMPLE;
116
117   // Pointer to the subprocess matrix element. Mark if external.
118   SigmaProcess*    sigmaProcessPtr;
119   bool             externalPtr;
120
121   // Pointer to the phase space generator.
122   PhaseSpace*      phaseSpacePtr;
123
124   // Pointer to various information on the generation.
125   Info*            infoPtr;
126
127   // Pointer to the particle data table.
128   ParticleData*    particleDataPtr;
129
130   // Pointer to the random number generator.
131   Rndm*            rndmPtr;
132
133   // Pointer to ResonanceDecays object for sequential resonance decays.
134   ResonanceDecays* resDecaysPtr;
135
136   // Pointer to LHAup for generating external events.
137   LHAup*           lhaUpPtr;
138
139   // Info on process.
140   bool   isLHA, isMinBias, isResolved, isDiffA, isDiffB, isQCD3body,
141          allowNegSig, hasOctetOnium, isSameSave, increaseMaximum;
142   int    lhaStrat, lhaStratAbs;
143
144   // Statistics on generation process. (Long integers just in case.)
145   bool   newSigmaMx;
146   long   nTry, nSel, nAcc, nTryStat;  
147   double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg, 
148          sigmaFin, deltaFin;
149
150   // Estimate integrated cross section and its uncertainty. 
151   void sigmaDelta();
152
153 };
154  
155 //==========================================================================
156
157 // The SetupContainers class turns the list of user-requested processes
158 // into a vector of ProcessContainer objects, each with a process.
159
160 class SetupContainers {
161
162 public:
163
164   // Constructor. 
165   SetupContainers() {} 
166  
167   // Initialization assuming all necessary data already read.
168   bool init(vector<ProcessContainer*>& containerPtrs, Settings& settings,
169     ParticleData* particleDataPtr, Couplings* couplings);
170  
171   // Initialization of a second hard process.
172   bool init2(vector<ProcessContainer*>& container2Ptrs, Settings& settings);
173
174 };
175
176 //==========================================================================
177
178 } // end namespace Pythia8
179
180 #endif // Pythia8_ProcessContainer_H