]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8175/src/Info.cxx
CID 21256: Uninitialized pointer field (UNINIT_CTOR)
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8175 / src / Info.cxx
CommitLineData
c6b60c38 1// Info.cc is a part of the PYTHIA event generator.
2// Copyright (C) 2013 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// Function definitions (not found in the header) for the Info class.
7
8#include "Info.h"
9
10namespace Pythia8 {
11
12//==========================================================================
13
14// Info class.
15// This class contains a mixed bag of information on the event generation
16// activity, especially on the current subprocess properties.
17
18//--------------------------------------------------------------------------
19
20// Constants: could be changed here if desired, but normally should not.
21// These are of technical nature, as described for each.
22
23// Number of times the same error message will be repeated at most.
24const int Info::TIMESTOPRINT = 1;
25
26// LHA convention with cross section in pb may require conversion from mb.
27const double Info::CONVERTMB2PB = 1e9;
28
29//--------------------------------------------------------------------------
30
31// List (almost) all information currently set.
32
33void Info::list(ostream& os) const {
34
35 // Header and beam info.
36 os << "\n -------- PYTHIA Info Listing ------------------------"
37 << "---------------- \n \n"
38 << scientific << setprecision(3)
39 << " Beam A: id = " << setw(6) << idASave << ", pz = " << setw(10)
40 << pzASave << ", e = " << setw(10) << eASave << ", m = " << setw(10)
41 << mASave << ".\n"
42 << " Beam B: id = " << setw(6) << idBSave << ", pz = " << setw(10)
43 << pzBSave << ", e = " << setw(10) << eBSave << ", m = " << setw(10)
44 << mBSave << ".\n\n";
45
46 // Done if no subprocess has been defined.
47 if (codeSave == 0 && nFinalSave == 0) {
48 os << " No process has been set; something must have gone wrong! \n"
49 << "\n -------- End PYTHIA Info Listing --------------------"
50 << "----------------" << endl;
51 return;
52 }
53
54 // Colliding parton info.
55 if (isRes) {
56 os << " In 1: id = " << setw(4) << id1pdfSave[0] << ", x = "
57 << setw(10) << x1pdfSave[0] << ", pdf = " << setw(10) << pdf1Save[0]
58 << " at Q2 = " << setw(10) << Q2FacSave[0] << ".\n"
59 << " In 2: id = " << setw(4) << id2pdfSave[0] << ", x = "
60 << setw(10) << x2pdfSave[0] << ", pdf = " << setw(10) << pdf2Save[0]
61 << " at same Q2.\n";
62 bool matchIdX = true;
63 if (id1pdfSave[0] != id1Save[0] || id2pdfSave[0] != id2Save[0])
64 matchIdX = false;
65 if (abs(x1pdfSave[0] - x1Save[0]) > 1e-4 * x1Save[0]) matchIdX = false;
66 if (abs(x2pdfSave[0] - x2Save[0]) > 1e-4 * x2Save[0]) matchIdX = false;
67 if (!matchIdX) os << " Warning: above flavour/x info does not match"
68 << " incoming partons in event!\n";
69 os << "\n";
70 }
71
72 // Process name and code.
73 os << ((isRes && !hasSubSave[0]) ? " Subprocess " : " Process ") << nameSave
74 << " with code " << codeSave << " is 2 -> " << nFinalSave << ".\n";
75
76 // Subprocess name and code for minimum bias processes.
77 if (hasSubSave[0])
78 os << " Subprocess " << nameSubSave[0] << " with code " << codeSubSave[0]
79 << " is 2 -> " << nFinalSubSave[0] << ".\n";
80
81 // Process-type-specific kinematics information.
82 if ( isRes && nFinalSave == 1)
83 os << " It has sHat = " << setw(10) << sH[0] << ".\n";
84 else if ( isRes && nFinalSave == 2)
85 os << " It has sHat = " << setw(10) << sH[0] << ", tHat = "
86 << setw(10) << tH[0] << ", uHat = " << setw(10) << uH[0] << ",\n"
87 << " pTHat = " << setw(10) << pTH[0] << ", m3Hat = "
88 << setw(10) << m3H[0] << ", m4Hat = " << setw(10) << m4H[0] << ",\n"
89 << " thetaHat = " << setw(10) << thetaH[0] << ", phiHat = "
90 << setw(10) << phiH[0] << ".\n";
91 else if ( nFinalSave == 2)
92 os << " It has s = " << setw(10) << sH[0] << ", t = " << setw(10)
93 << tH[0] << ", u = " << setw(10) << uH[0] << ",\n"
94 << " pT = " << setw(10) << pTH[0] << ", m3 = " << setw(10)
95 << m3H[0] << ", m4 = " << setw(10) << m4H[0] << ",\n"
96 << " theta = " << setw(10) << thetaH[0] << ", phi = " << setw(10)
97 << phiH[0] << ".\n";
98 else if ( isRes && nFinalSave == 3)
99 os << " It has sHat = " << setw(10) << sH[0] << ", <pTHat> = "
100 << setw(10) << pTH[0] << ".\n";
101 else if ( nFinalSave == 3)
102 os << " It has s = " << setw(10) << sH[0] << ", t_A = " << setw(10)
103 << tH[0] << ", t_B = " << setw(10) << uH[0] << ",\n"
104 << " <pT> = " << setw(10) << pTH[0] << ".\n";
105
106 // Couplings.
107 if (isRes) os << " alphaEM = " << setw(10) << alphaEMSave[0]
108 << ", alphaS = " << setw(10) << alphaSSave[0] << " at Q2 = "
109 << setw(10) << Q2RenSave[0] << ".\n";
110
111 // Diffractive subsystems.
112 for (int iDS = 1; iDS < 4; ++iDS) if (id1Save[iDS] != 0) {
113 if (iDS == 1) os << "\n Diffractive system on side A: \n";
114 if (iDS == 2) os << "\n Diffractive system on side B: \n";
115 if (iDS == 3) os << "\n Central diffractive system: \n";
116 os << " In 1: id = " << setw(4) << id1pdfSave[iDS] << ", x = "
117 << setw(10) << x1pdfSave[iDS] << ", pdf = " << setw(10)
118 << pdf1Save[iDS] << " at Q2 = " << setw(10) << Q2FacSave[iDS]
119 << ".\n" << " In 2: id = " << setw(4) << id2pdfSave[iDS]
120 << ", x = " << setw(10) << x2pdfSave[iDS] << ", pdf = "
121 << setw(10) << pdf2Save[iDS] << " at same Q2.\n";
122 os << " Subprocess " << nameSubSave[iDS] << " with code "
123 << codeSubSave[iDS] << " is 2 -> " << nFinalSubSave[iDS] << ".\n";
124 if (nFinalSubSave[iDS] == 1)
125 os << " It has sHat = " << setw(10) << sH[iDS] << ".\n";
126 else if (nFinalSubSave[iDS] == 2)
127 os << " It has sHat = " << setw(10) << sH[iDS] << ", tHat = "
128 << setw(10) << tH[iDS] << ", uHat = " << setw(10) << uH[iDS]
129 << ",\n" << " pTHat = " << setw(10) << pTH[iDS]
130 << ", m3Hat = " << setw(10) << m3H[iDS] << ", m4Hat = "
131 << setw(10) << m4H[iDS] << ",\n" << " thetaHat = " << setw(10)
132 << thetaH[iDS] << ", phiHat = " << setw(10) << phiH[iDS] << ".\n";
133 os << " alphaEM = " << setw(10) << alphaEMSave[iDS]
134 << ", alphaS = " << setw(10) << alphaSSave[iDS] << " at Q2 = "
135 << setw(10) << Q2RenSave[iDS] << ".\n";
136 }
137
138 // Impact parameter.
139 if (bIsSet) os << "\n Impact parameter b = " << setw(10) << bMPISave
140 << " gives enhancement factor = " << setw(10) << enhanceMPISave
141 << ".\n";
142
143 // Multiparton interactions and shower evolution.
144 if (evolIsSet) os << " Max pT scale for MPI = " << setw(10) << pTmaxMPISave
145 << ", ISR = " << setw(10) << pTmaxISRSave << ", FSR = " << setw(10)
146 << pTmaxISRSave << ".\n Number of MPI = " << setw(5) << nMPISave
147 << ", ISR = " << setw(5) << nISRSave << ", FSRproc = " << setw(5)
148 << nFSRinProcSave << ", FSRreson = " << setw(5) << nFSRinResSave
149 << ".\n";
150
151 // Listing finished.
152 os << "\n -------- End PYTHIA Info Listing --------------------"
153 << "----------------" << endl;
154
155}
156
157//--------------------------------------------------------------------------
158
159// Event weight and accumulated weight.
160
161double Info::weight() const { return (abs(lhaStrategySave) == 4)
162 ? CONVERTMB2PB * weightSave : weightSave;
163}
164
165double Info::weightSum() const {return (abs(lhaStrategySave) == 4)
166 ? CONVERTMB2PB * wtAccSum : wtAccSum;
167}
168
169//--------------------------------------------------------------------------
170
171// Print a message the first few times. Insert in database.
172
173 void Info::errorMsg(string messageIn, string extraIn, bool showAlways,
174 ostream& os) {
175
176 // Recover number of times message occured. Also inserts new string.
177 int times = messages[messageIn];
178 ++messages[messageIn];
179
180 // Print message the first few times.
181 if (times < TIMESTOPRINT || showAlways) os << " PYTHIA "
182 << messageIn << " " << extraIn << endl;
183
184}
185
186//--------------------------------------------------------------------------
187
188// Provide total number of errors/aborts/warnings experienced to date.
189
190int Info::errorTotalNumber() {
191
192 int nTot = 0;
193 for ( map<string, int>::iterator messageEntry = messages.begin();
194 messageEntry != messages.end(); ++messageEntry)
195 nTot += messageEntry->second;
196 return nTot;
197
198}
199
200//--------------------------------------------------------------------------
201
202// Print statistics on errors/aborts/warnings.
203
204void Info::errorStatistics(ostream& os) {
205
206 // Header.
207 os << "\n *------- PYTHIA Error and Warning Messages Statistics "
208 << "----------------------------------------------------------* \n"
209 << " | "
210 << " | \n"
211 << " | times message "
212 << " | \n"
213 << " | "
214 << " | \n";
215
216 // Loop over all messages
217 map<string, int>::iterator messageEntry = messages.begin();
218 if (messageEntry == messages.end())
219 os << " | 0 no errors or warnings to report "
220 << " | \n";
221 while (messageEntry != messages.end()) {
222 // Message printout.
223 string temp = messageEntry->first;
224 int len = temp.length();
225 temp.insert( len, max(0, 102 - len), ' ');
226 os << " | " << setw(6) << messageEntry->second << " "
227 << temp << " | \n";
228 ++messageEntry;
229 }
230
231 // Done.
232 os << " | "
233 << " | \n"
234 << " *------- End PYTHIA Error and Warning Messages Statistics"
235 << " ------------------------------------------------------* "
236 << endl;
237
238}
239
240//==========================================================================
241
242} // end namespace Pythia8