]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8140/include/Info.h
d61b5c612cdb5be38673e25a67337c224f1db1ba
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8140 / include / Info.h
1 // Info.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 a class that keep track of generic event info.
7 // Info: contains information on the generation process and errors.
8
9 #ifndef Pythia8_Info_H
10 #define Pythia8_Info_H
11
12 #include "PythiaStdlib.h"
13
14 namespace Pythia8 {
15  
16 //==========================================================================
17
18 // The Info class contains a mixed bag of information on the event
19 // generation activity, especially on the current subprocess properties,
20 // and on the number of errors encountered. This is used by the 
21 // generation machinery, but can also be read by the user.
22 // Note: some methods that maybe should not be accessible to the user
23 // are still public, to work also for user-written FSR/ISR classes.
24
25 class Info {
26
27 public:
28
29   // Constructor. 
30   Info() {lowPTmin = false; for (int i = 0; i < 40; ++i) counters[i] = 0;} 
31
32   // Listing of most available information on current event.
33   void   list(ostream& os = cout) const;
34   
35   // Beam particles (in rest frame). CM energy of event.
36   int    idA()            const {return idASave;}
37   int    idB()            const {return idBSave;}
38   double pzA()            const {return pzASave;}
39   double pzB()            const {return pzBSave;}
40   double eA()             const {return eASave;}
41   double eB()             const {return eBSave;}
42   double mA()             const {return mASave;}
43   double mB()             const {return mBSave;}
44   double eCM()            const {return eCMSave;}
45   double s()              const {return sSave;}
46
47   // Warnings from initialization.
48   bool   tooLowPTmin()    const {return lowPTmin;}
49
50   // Process name and code, and the number of final-state particles.
51   string name()           const {return nameSave;}
52   int    code()           const {return codeSave;}    
53   int    nFinal()         const {return nFinalSave;}
54
55   // Are beam particles resolved, with pdf's? Are they diffractive? 
56   bool   isResolved()     const {return isRes;}
57   bool   isDiffractiveA() const {return isDiffA;} 
58   bool   isDiffractiveB() const {return isDiffB;} 
59   bool   isMinBias()      const {return isMB;}
60
61   // Information for Les Houches Accord and reading files.
62   bool   isLHA()          const {return isLH;}
63   bool   atEndOfFile()    const {return atEOF;}
64
65   // For minbias and Les Houches Accord identify hardest subprocess.
66   bool   hasSub()         const {return hasSubSave;}
67   string nameSub()        const {return nameSubSave;}
68   int    codeSub()        const {return codeSubSave;}    
69   int    nFinalSub()      const {return nFinalSubSave;}
70
71   // Incoming parton flavours and x values.
72   int    id1()            const {return id1Save;}
73   int    id2()            const {return id2Save;}
74   double x1()             const {return x1Save;}
75   double x2()             const {return x2Save;}
76   double y()              const {return 0.5 * log( x1Save / x2Save );}
77   double tau()            const {return x1Save * x2Save;}
78
79   // Incoming parton densities, hard process couplings, Q2 scales.
80   double pdf1()           const {return pdf1Save;}
81   double pdf2()           const {return pdf2Save;}
82   double QFac()           const {return sqrtpos(Q2FacSave);}
83   double Q2Fac()          const {return Q2FacSave;}
84   bool   isValence1()     const {return isVal1;}
85   bool   isValence2()     const {return isVal2;}
86   double alphaS()         const {return alphaSSave;}
87   double alphaEM()        const {return alphaEMSave;}
88   double QRen()           const {return sqrtpos(Q2RenSave);}
89   double Q2Ren()          const {return Q2RenSave;}
90
91   // Mandelstam variables (notation as if subcollision).
92   double mHat()           const {return sqrt(sH);}   
93   double sHat()           const {return sH;}   
94   double tHat()           const {return tH;}   
95   double uHat()           const {return uH;}   
96   double pTHat()          const {return pTH;} 
97   double pT2Hat()         const {return pTH*pTH;} 
98   double m3Hat()          const {return m3H;}   
99   double m4Hat()          const {return m4H;} 
100   double thetaHat()       const {return thetaH;}   
101   double phiHat()         const {return phiH;}   
102
103   // Weight of current event; normally 1, but used for Les Houches events.
104   double weight()         const {return weightSave;}   
105
106   // Number of times other steps have been carried out.
107   int    nISR()           const {return nISRSave;}
108   int    nFSRinProc()     const {return nFSRinProcSave;}
109   int    nFSRinRes()      const {return nFSRinResSave;}
110
111   // Maximum pT scales for MI, ISR and FSR (in hard process).
112   double pTmaxMI()        const {return pTmaxMISave;}
113   double pTmaxISR()       const {return pTmaxISRSave;}
114   double pTmaxFSR()       const {return pTmaxFSRSave;}
115
116   // Current evolution scale (for UserHooks).
117   double pTnow()          const {return pTnowSave;}
118
119   // Impact parameter picture.
120   double bMI()            const {return (bIsSet) ? bMISave : 1.;}
121   double enhanceMI()      const {return (bIsSet) ? enhanceMISave : 1.;}
122
123   // Number of multiple interactions, with code and pT for them.
124   int    nMI()            const {return nMISave;}
125   int    codeMI(int i)    const {return codeMISave[i];} 
126   double pTMI(int i)      const {return pTMISave[i];} 
127   int    iAMI(int i)      const {return iAMISave[i];} 
128   int    iBMI(int i)      const {return iBMISave[i];} 
129
130   // Cross section estimate.
131   long   nTried()         const {return nTry;}
132   long   nSelected()      const {return nSel;}
133   long   nAccepted()      const {return nAcc;}
134   double sigmaGen()       const {return sigGen;}
135   double sigmaErr()       const {return sigErr;}
136
137   // Counters for number of loops in various places.
138   int    getCounter( int i)  const {return counters[i];}    
139
140   // Set or increase the value stored in a counter.
141   void   setCounter( int i, int value = 0) {counters[i]  = value;}
142   void   addCounter( int i, int value = 1) {counters[i] += value;}
143
144   // Reset to empty map of error messages.
145   void   errorReset() {messages.clear();}
146   
147   // Print a message the first few times. Insert in database.
148   void   errorMsg(string messageIn, string extraIn = " ", 
149     bool showAlways = false, ostream& os = cout);
150
151   // Provide total number of errors/aborts/warnings experienced to date.
152   int    errorTotalNumber();
153
154   // Print statistics on errors/aborts/warnings.
155   void   errorStatistics(ostream& os = cout);
156
157   // Set initialization warning flag when too low pTmin in ISR/FSR/MI.
158   void   setTooLowPTmin(bool lowPTminIn) {lowPTmin = lowPTminIn;} 
159
160 private:
161
162   // Number of times the same error message is repeated, unless overridden.
163   static const int TIMESTOPRINT;
164
165   // Store common beam quantities. 
166   int    idASave, idBSave;
167   double pzASave, eASave,mASave, pzBSave, eBSave, mBSave, eCMSave, sSave;
168
169   // Store initialization information.
170   bool   lowPTmin;
171
172   // Store common integrated cross section quantities.
173   long   nTry, nSel, nAcc;
174   double sigGen, sigErr;
175
176   // Store current-event quantities.
177   bool   isRes, isDiffA, isDiffB, isMB, isLH, hasSubSave, bIsSet, evolIsSet,
178          atEOF, isVal1, isVal2;  
179   int    codeSave, codeSubSave, nFinalSave, nFinalSubSave, nTotal, 
180          id1Save, id2Save, nMISave, nISRSave, nFSRinProcSave, nFSRinResSave;
181   double x1Save, x2Save, pdf1Save, pdf2Save, Q2FacSave, alphaEMSave, 
182          alphaSSave, Q2RenSave, sH, tH, uH, pTH, m3H, m4H, thetaH, phiH, 
183          weightSave, bMISave, enhanceMISave, pTmaxMISave, pTmaxISRSave, 
184          pTmaxFSRSave, pTnowSave;
185   string nameSave, nameSubSave;
186   vector<int>    codeMISave, iAMISave, iBMISave;
187   vector<double> pTMISave;
188
189   // Vector of various loop counters.
190   int    counters[50];
191
192   // Map for all error messages.
193   map<string, int> messages;
194
195   // Friend classes allowed to set info.
196   friend class Pythia;
197   friend class ProcessLevel;
198   friend class ProcessContainer;
199   friend class PartonLevel;
200   friend class MultipleInteractions;
201
202   // Set info on the two incoming beams: only from Pythia class.
203   void setBeamA( int idAin, double pzAin, double eAin, double mAin) {
204     idASave = idAin; pzASave = pzAin; eASave = eAin; mASave = mAin;}
205   void setBeamB( int idBin, double pzBin, double eBin, double mBin) {
206     idBSave = idBin; pzBSave = pzBin; eBSave = eBin; mBSave = mBin;}
207   void setECM( double eCMin) {eCMSave = eCMin; sSave = eCMSave * eCMSave;}
208
209   // Reset info for current event: only from Pythia class.
210   void clear() { isRes = isDiffA = isDiffB = isMB = isLH = atEOF = bIsSet 
211     = isVal1 =isVal2 = false; codeSave = nFinalSave = nTotal = id1Save 
212     = id2Save = nMISave = nISRSave = nFSRinProcSave = nFSRinResSave = 0; 
213     x1Save = x2Save = pdf1Save = pdf2Save = Q2FacSave = alphaEMSave 
214     = alphaSSave = Q2RenSave = sH = tH = uH = pTH = m3H = m4H = thetaH 
215     = phiH = 0.; nameSave = " "; weightSave = bMISave = enhanceMISave = 1.; 
216     codeMISave.resize(0); pTMISave.resize(0); iAMISave.resize(0);
217     iBMISave.resize(0); }
218
219   // Set info on the (sub)process: from ProcessLevel, ProcessContainer or 
220   // MultipleInteractions classes.
221   void setType( string nameIn, int codeIn, int nFinalIn,  
222     bool isMinBiasIn = false, bool isResolvedIn = true, 
223     bool isDiffractiveAin = false, bool isDiffractiveBin = false,
224     bool isLHAin = false) {nameSave = nameIn; codeSave = codeIn; 
225     nFinalSave = nFinalIn; isMB = isMinBiasIn; isRes = isResolvedIn; 
226     isDiffA = isDiffractiveAin; isDiffB = isDiffractiveBin; isLH = isLHAin;
227     nTotal = 2 + nFinalSave; bIsSet = false; hasSubSave = false; 
228     nameSubSave = " "; codeSubSave = 0; nFinalSubSave = 0; evolIsSet = false;}
229   void setSubType( string nameSubIn, int codeSubIn, int nFinalSubIn) {  
230     hasSubSave = true; nameSubSave = nameSubIn; codeSubSave = codeSubIn; 
231     nFinalSubSave = nFinalSubIn;}
232   void setPDFalpha( int id1In, int id2In,  double pdf1In, double pdf2In, 
233     double Q2FacIn, double alphaEMIn, double alphaSIn, double Q2RenIn) 
234     {id1Save = id1In; id2Save = id2In; pdf1Save = pdf1In; pdf2Save = pdf2In; 
235     Q2FacSave = Q2FacIn; alphaEMSave = alphaEMIn; alphaSSave = alphaSIn; 
236     Q2RenSave = Q2RenIn;}
237   void setKin( double x1In, double x2In, double sHatIn, double tHatIn, 
238     double uHatIn, double pTHatIn, double m3HatIn, double m4HatIn, 
239     double thetaHatIn, double phiHatIn) {x1Save = x1In; x2Save = x2In; 
240     sH = sHatIn; tH = tHatIn; uH = uHatIn; pTH = pTHatIn; m3H = m3HatIn; 
241     m4H = m4HatIn; thetaH = thetaHatIn; phiH = phiHatIn;}
242   void setTypeMI( int codeMIIn, double pTMIIn, int iAMIIn = 0, int iBMIIn = 0) {
243     codeMISave.push_back(codeMIIn); pTMISave.push_back(pTMIIn);
244     iAMISave.push_back(iAMIIn); iBMISave.push_back(iBMIIn);}
245
246   // Set info on cross section: from ProcessLevel.
247   void setSigma( long nTryIn, long nSelIn, long nAccIn, double sigGenIn, 
248     double sigErrIn) { nTry = nTryIn; nSel = nSelIn; nAcc = nAccIn; 
249     sigGen = sigGenIn; sigErr = sigErrIn;} 
250
251   // Set info on valence character of hard collision partons: from PartonLevel.
252   void setValence( bool isVal1In, bool isVal2In) {isVal1 = isVal1In; 
253     isVal2 = isVal2In;}
254
255   // Set info on impact parameter: from PartonLevel.
256   void setImpact( double bMIIn, double enhanceMIIn) {bMISave = bMIIn;
257     enhanceMISave = enhanceMIIn, bIsSet = true;} 
258
259   // Set info on pTmax scales and number of evolution steps: from PartonLevel.
260   void setPartEvolved( int nMIIn, int nISRIn) {
261     nMISave = nMIIn; nISRSave = nISRIn;} 
262   void setEvolution( double pTmaxMIIn, double pTmaxISRIn, double pTmaxFSRIn, 
263     int nMIIn, int nISRIn, int nFSRinProcIn, int nFSRinResIn) { 
264     pTmaxMISave = pTmaxMIIn; pTmaxISRSave = pTmaxISRIn; 
265     pTmaxFSRSave = pTmaxFSRIn; nMISave = nMIIn; nISRSave = nISRIn; 
266     nFSRinProcSave = nFSRinProcIn; nFSRinResSave = nFSRinResIn; 
267     evolIsSet = true;}
268
269   // Set current pT evolution scale for MI/ISR/FSR; from PartonLevel.
270   void setPTnow( double pTnowIn) {pTnowSave = pTnowIn;}
271
272   // Set info whether reading of Les Houches Accord file at end.
273   void setEndOfFile( bool atEOFin) {atEOF = atEOFin;}
274
275   // Set event weight; currently only for Les Houches description.
276   void setWeight( double weightIn) {weightSave = weightIn;}
277
278 };
279  
280 //==========================================================================
281
282 } // end namespace Pythia8
283
284 #endif // Pythia8_Info_H