]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8170/include/ProcessContainer.h
Update to pythi8.170
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8170 / include / ProcessContainer.h
1 // ProcessContainer.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 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,  ParticleData* particleDataPtrIn = 0) 
59     {lhaUpPtr = lhaUpPtrIn; 
60     if (particleDataPtrIn != 0) particleDataPtr = particleDataPtrIn;
61     if (sigmaProcessPtr != 0) sigmaProcessPtr->setLHAPtr(lhaUpPtr); 
62     if (phaseSpacePtr != 0) phaseSpacePtr->setLHAPtr(lhaUpPtr);}
63
64   // Update the CM energy of the event.
65   void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
66
67   // Generate a trial event; accepted or not.
68   bool trialProcess(); 
69   
70   // Pick flavours and colour flow of process.
71   bool constructState(); 
72   
73   // Give the hard subprocess (with option for a second hard subprocess).
74   bool constructProcess( Event& process, bool isHardest = true); 
75   
76   // Give the Les Houches decay chain for external resonance.
77   bool constructDecays( Event& process); 
78
79   // Do resonance decays.
80   bool decayResonances( Event& process); 
81
82   // Accumulate statistics after user veto.
83   void accumulate() {++nAcc; wtAccSum += weightNow;}
84
85   // Reset statistics on events generated so far.
86   void reset();
87
88   // Process name and code, and the number of final-state particles.
89   string name()        const {return sigmaProcessPtr->name();}
90   int    code()        const {return sigmaProcessPtr->code();}
91   int    nFinal()      const {return sigmaProcessPtr->nFinal();}
92   bool   isSUSY()      const {return sigmaProcessPtr->isSUSY();}
93
94   // Member functions for info on generation process.
95   bool   newSigmaMax() const {return newSigmaMx;}
96   double sigmaMax()    const {return sigmaMx;}
97   long   nTried()      const {return nTry;}
98   long   nSelected()   const {return nSel;}
99   long   nAccepted()   const {return nAcc;}
100   double weightSum()   const {return wtAccSum;}
101   double sigmaSelMC()  {if (nTry > nTryStat) sigmaDelta(); return sigmaAvg;}
102   double sigmaMC()     {if (nTry > nTryStat) sigmaDelta(); return sigmaFin;}
103   double deltaMC()     {if (nTry > nTryStat) sigmaDelta(); return deltaFin;} 
104
105   // Some kinematics quantities.
106   int    id1()         const {return sigmaProcessPtr->id(1);}
107   int    id2()         const {return sigmaProcessPtr->id(2);}
108   double x1()          const {return phaseSpacePtr->x1();}
109   double x2()          const {return phaseSpacePtr->x2();}
110   double Q2Fac()       const {return sigmaProcessPtr->Q2Fac();}
111   double mHat()        const {return sqrtpos(phaseSpacePtr->sHat());}
112   double pTHat()       const {return phaseSpacePtr->pTHat();}
113  
114   // Tell whether container is for Les Houches events.
115   bool   isLHAContainer() const {return isLHA;}
116   int    lhaStrategy()    const {return lhaStrat;}
117
118   // When two hard processes set or get info whether process is matched.
119   void   isSame( bool isSameIn) { isSameSave = isSameIn;}
120   bool   isSame()      const {return isSameSave;}
121
122 private:
123
124   // Constants: could only be changed in the code itself.
125   static const int N12SAMPLE, N3SAMPLE;
126
127   // Pointer to the subprocess matrix element. Mark if external.
128   SigmaProcess*    sigmaProcessPtr;
129   bool             externalPtr;
130
131   // Pointer to the phase space generator.
132   PhaseSpace*      phaseSpacePtr;
133
134   // Pointer to various information on the generation.
135   Info*            infoPtr;
136
137   // Pointer to the particle data table.
138   ParticleData*    particleDataPtr;
139
140   // Pointer to the random number generator.
141   Rndm*            rndmPtr;
142
143   // Pointer to ResonanceDecays object for sequential resonance decays.
144   ResonanceDecays* resDecaysPtr;
145
146   // Pointer to userHooks object for user interaction with program.
147   UserHooks*       userHooksPtr;
148
149   // Pointer to LHAup for generating external events.
150   LHAup*           lhaUpPtr;
151
152   // Info on process.
153   bool   isLHA, isMinBias, isResolved, isDiffA, isDiffB, isDiffC, isQCD3body,
154          allowNegSig, hasOctetOnium, isSameSave, increaseMaximum, 
155          canVetoResDecay;
156   int    lhaStrat, lhaStratAbs;
157
158   // Statistics on generation process. (Long integers just in case.)
159   bool   newSigmaMx;
160   long   nTry, nSel, nAcc, nTryStat;  
161   double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg, 
162          sigmaFin, deltaFin, weightNow, wtAccSum;
163
164   // Estimate integrated cross section and its uncertainty. 
165   void sigmaDelta();
166
167 };
168  
169 //==========================================================================
170
171 // The SetupContainers class turns the list of user-requested processes
172 // into a vector of ProcessContainer objects, each with a process.
173
174 class SetupContainers {
175
176 public:
177
178   // Constructor. 
179   SetupContainers() {} 
180  
181   // Initialization assuming all necessary data already read.
182   bool init(vector<ProcessContainer*>& containerPtrs, Settings& settings,
183     ParticleData* particleDataPtr, Couplings* couplings);
184  
185   // Initialization of a second hard process.
186   bool init2(vector<ProcessContainer*>& container2Ptrs, Settings& settings);
187
188 };
189
190 //==========================================================================
191
192 } // end namespace Pythia8
193
194 #endif // Pythia8_ProcessContainer_H