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