]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8145/src/Info.cxx
o automatic detection of 11a pass4 (Alla)
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / src / Info.cxx
CommitLineData
9419eeef 1// Info.cc 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// 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//--------------------------------------------------------------------------
27
28// List (almost) all information currently set.
29
30void Info::list(ostream& os) const {
31
32 // Header and beam info.
33 os << "\n -------- PYTHIA Info Listing ------------------------"
34 << "---------------- \n \n"
35 << scientific << setprecision(3)
36 << " Beam A: id = " << setw(6) << idASave << ", pz = " << setw(10)
37 << pzASave << ", e = " << setw(10) << eASave << ", m = " << setw(10)
38 << mASave << ".\n"
39 << " Beam B: id = " << setw(6) << idBSave << ", pz = " << setw(10)
40 << pzBSave << ", e = " << setw(10) << eBSave << ", m = " << setw(10)
41 << mBSave << ".\n\n";
42
43 // Done if no subprocess has been defined.
44 if (codeSave == 0 && nFinalSave == 0) {
45 os << " No process has been set; something must have gone wrong! \n"
46 << "\n -------- End PYTHIA Info Listing --------------------"
47 << "----------------" << endl;
48 return;
49 }
50
51 // Colliding parton info.
52 if (isRes)
53 os << " In 1: id = " << setw(4) << id1Save << ", x = " << setw(10)
54 << x1Save << ", pdf = " << setw(10) << pdf1Save << " at Q2 = "
55 << setw(10) << Q2FacSave << ".\n"
56 << " In 2: id = " << setw(4) << id2Save << ", x = " << setw(10)
57 << x2Save << ", pdf = " << setw(10) << pdf2Save << " at same Q2.\n\n";
58
59 // Process name and code.
60 os << ((isRes && !hasSubSave) ? " Subprocess " : " Process ") << nameSave
61 << " with code " << codeSave << " is 2 -> " << nFinalSave << ".\n";
62
63 // Subprocess name and code for minimum bias processes.
64 if (hasSubSave)
65 os << " Subprocess " << nameSubSave << " with code " << codeSubSave
66 << " is 2 -> " << nFinalSubSave << ".\n";
67
68 // Process-type-specific kinematics information.
69 if (isRes && nFinalSave == 1)
70 os << " It has sHat = " << setw(10) << sH << ".\n";
71 else if ( isRes && nFinalSave == 2)
72 os << " It has sHat = " << setw(10) << sH << ", tHat = "
73 << setw(10) << tH << ", uHat = " << setw(10) << uH << ",\n"
74 << " pTHat = " << setw(10) << pTH << ", m3Hat = "
75 << setw(10) << m3H << ", m4Hat = " << setw(10) << m4H << ",\n"
76 << " thetaHat = " << setw(10) << thetaH << ", phiHat = "
77 << setw(10) << phiH << ".\n";
78 else if ( nFinalSave == 2)
79 os << " It has s = " << setw(10) << sH << ", t = " << setw(10)
80 << tH << ", u = " << setw(10) << uH << ",\n"
81 << " pT = " << setw(10) << pTH << ", m3 = " << setw(10)
82 << m3H << ", m4 = " << setw(10) << m4H << ",\n"
83 << " theta = " << setw(10) << thetaH << ", phi = " << setw(10)
84 << phiH << ".\n";
85 else if ( isRes && nFinalSave == 3)
86 os << " It has sHat = " << setw(10) << sH << ", <pTHat> = "
87 << setw(10) << pTH << ".\n";
88
89 // Couplings.
90 if (isRes) os << " alphaEM = " << setw(10) << alphaEMSave
91 << ", alphaS = " << setw(10) << alphaSSave << " at Q2 = "
92 << setw(10) << Q2RenSave << ".\n";
93
94 // Impact parameter.
95 if (bIsSet) os << "\n Impact parameter b =" << setw(10) << bMISave
96 << " gives enhancement factor = " << setw(10) << enhanceMISave
97 << ".\n";
98
99 // Multiple interactions and shower evolution.
100 if (evolIsSet) os << " Max pT scale for MI = " << setw(10) << pTmaxMISave
101 << ", ISR = " << setw(10) << pTmaxISRSave << ", FSR = " << setw(10)
102 << pTmaxISRSave << ".\n Number of MI = " << setw(5) << nMISave
103 << ", ISR = " << setw(5) << nISRSave << ", FSRproc = " << setw(5)
104 << nFSRinProcSave << ", FSRreson = " << setw(5) << nFSRinResSave
105 << ".\n";
106
107 // Listing finished.
108 os << "\n -------- End PYTHIA Info Listing --------------------"
109 << "----------------" << endl;
110
111}
112
113//--------------------------------------------------------------------------
114
115// Print a message the first few times. Insert in database.
116
117 void Info::errorMsg(string messageIn, string extraIn, bool showAlways,
118 ostream& os) {
119
120 // Recover number of times message occured. Also inserts new string.
121 int times = messages[messageIn];
122 ++messages[messageIn];
123
124 // Print message the first few times.
125 if (times < TIMESTOPRINT || showAlways) os << " PYTHIA "
126 << messageIn << " " << extraIn << endl;
127
128}
129
130//--------------------------------------------------------------------------
131
132// Provide total number of errors/aborts/warnings experienced to date.
133
134int Info::errorTotalNumber() {
135
136 int nTot = 0;
137 for ( map<string, int>::iterator messageEntry = messages.begin();
138 messageEntry != messages.end(); ++messageEntry)
139 nTot += messageEntry->second;
140 return nTot;
141
142}
143
144//--------------------------------------------------------------------------
145
146// Print statistics on errors/aborts/warnings.
147
148void Info::errorStatistics(ostream& os) {
149
150 // Header.
151 os << "\n *------- PYTHIA Error and Warning Messages Statistics "
152 << "----------------------------------------------------------* \n"
153 << " | "
154 << " | \n"
155 << " | times message "
156 << " | \n"
157 << " | "
158 << " | \n";
159
160 // Loop over all messages
161 map<string, int>::iterator messageEntry = messages.begin();
162 if (messageEntry == messages.end())
163 os << " | 0 no errors or warnings to report "
164 << " | \n";
165 while (messageEntry != messages.end()) {
166 // Message printout.
167 string temp = messageEntry->first;
168 int len = temp.length();
169 temp.insert( len, max(0, 102 - len), ' ');
170 os << " | " << setw(6) << messageEntry->second << " "
171 << temp << " | \n";
172 ++messageEntry;
173 }
174
175 // Done.
176 os << " | "
177 << " | \n"
178 << " *------- End PYTHIA Error and Warning Messages Statistics"
179 << " ------------------------------------------------------* "
180 << endl;
181
182}
183
184//==========================================================================
185
186} // end namespace Pythia8
187