]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8130/include/ProcessContainer.h
pythia8130 distributed with AliRoot
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8130 / include / ProcessContainer.h
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.
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 "SusyLesHouches.h"
26 #include "UserHooks.h"
27
28 namespace Pythia8 {
29
30 //**************************************************************************
31
32 // The ProcessContainer class combines pointers to matrix element and 
33 // phase space generator with general generation info. 
34
35 class ProcessContainer {
36
37 public:
38
39   // Constructor. 
40   ProcessContainer(SigmaProcess* sigmaProcessPtrIn = 0) 
41     : sigmaProcessPtr(sigmaProcessPtrIn), phaseSpacePtr(0) {} 
42
43   // Destructor.
44   ~ProcessContainer() {delete phaseSpacePtr; delete sigmaProcessPtr;}
45   
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); 
51
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);}
56
57   // Update the CM energy of the event.
58   void newECM(double eCM) {phaseSpacePtr->newECM(eCM);}
59
60   // Generate a trial event; accepted or not.
61   bool trialProcess(); 
62   
63   // Give the hard subprocess (with option for a second hard subprocess).
64   bool constructProcess( Event& process, bool isHardest = true); 
65
66   // Do resonance decays.
67   bool decayResonances( Event& process); 
68
69   // Accumulate statistics after user veto.
70   void accumulate() {++nAcc;}
71
72   // Reset statistics on events generated so far.
73   void reset();
74
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();}
79
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;} 
89
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();}
96
97   // Tell whether container is for Les Houches events.
98   bool   isLHAContainer() const {return isLHA;}
99
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;}
103
104 private:
105
106   // Constants: could only be changed in the code itself.
107   static const int N12SAMPLE, N3SAMPLE;
108
109   // Pointer to the subprocess matrix element.
110   SigmaProcess*    sigmaProcessPtr;
111
112   // Pointer to the phase space generator.
113   PhaseSpace*      phaseSpacePtr;
114
115   // Pointer to various information on the generation.
116   Info*            infoPtr;
117
118   // Pointer to ResonanceDecays object for sequential resonance decays.
119   ResonanceDecays* resDecaysPtr;
120
121   // Pointer to LHAup for generating external events.
122   LHAup*           lhaUpPtr;
123
124   // Info on process.
125   bool   isMinBias, isResolved, isDiffA, isDiffB, isLHA, allowNegSig,
126          hasOctetOnium, isSameSave;
127   int    lhaStrat, lhaStratAbs;
128
129   // Statistics on generation process. (Long integers just in case.)
130   int    newSigmaMx;
131   long   nTry, nSel, nAcc, nTryStat;  
132   double sigmaMx, sigmaSgn, sigmaSum, sigma2Sum, sigmaNeg, sigmaAvg, 
133          sigmaFin, deltaFin;
134
135   // Estimate integrated cross section and its uncertainty. 
136   void sigmaDelta();
137
138 };
139  
140 //**************************************************************************
141
142 // The SetupContainers class turns the list of user-requested processes
143 // into a vector of ProcessContainer objects, each with a process.
144
145 class SetupContainers {
146
147 public:
148
149   // Constructor. 
150   SetupContainers() {} 
151  
152   // Initialization assuming all necessary data already read.
153   bool init(vector<ProcessContainer*>& containerPtrs);
154  
155   // Initialization of a second hard process.
156   bool init2(vector<ProcessContainer*>& container2Ptrs);
157
158 };
159
160 //**************************************************************************
161
162 } // end namespace Pythia8
163
164 #endif // Pythia8_ProcessContainer_H