1 | // ParticleData.h is a part of the PYTHIA event generator. |
---|
2 | // Copyright (C) 2012 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 | // Header file for the classes containing particle data. |
---|
7 | // DecayChannel contains info on a single decay channel. |
---|
8 | // ParticleDataEntry contains info on a single particle species. |
---|
9 | // ParticleData collects info on all particles as a map. |
---|
10 | |
---|
11 | #ifndef Pythia8_ParticleData_H |
---|
12 | #define Pythia8_ParticleData_H |
---|
13 | |
---|
14 | #include "Basics.h" |
---|
15 | #include "Info.h" |
---|
16 | #include "PythiaStdlib.h" |
---|
17 | #include "ResonanceWidths.h" |
---|
18 | #include "Settings.h" |
---|
19 | #include "StandardModel.h" |
---|
20 | |
---|
21 | namespace Pythia8 { |
---|
22 | |
---|
23 | //========================================================================== |
---|
24 | |
---|
25 | // Forward reference to some classes. |
---|
26 | class ParticleData; |
---|
27 | class ResonanceWidths; |
---|
28 | class Couplings; |
---|
29 | class CoupSUSY; |
---|
30 | class SUSYResonanceWidths; |
---|
31 | |
---|
32 | //========================================================================== |
---|
33 | |
---|
34 | // This class holds info on a single decay channel. |
---|
35 | |
---|
36 | class DecayChannel { |
---|
37 | |
---|
38 | public: |
---|
39 | // Constructor. |
---|
40 | DecayChannel(int onModeIn = 0, double bRatioIn = 0., int meModeIn = 0, |
---|
41 | int prod0 = 0, int prod1 = 0, int prod2 = 0, int prod3 = 0, |
---|
42 | int prod4 = 0, int prod5 = 0, int prod6 = 0, int prod7 = 0) |
---|
43 | : onModeSave(onModeIn), bRatioSave(bRatioIn), currentBRSave(0.), |
---|
44 | onShellWidthSave(0.), openSecPos(1.), openSecNeg(1.), |
---|
45 | meModeSave(meModeIn), nProd(0), hasChangedSave(true) { |
---|
46 | prod[0] = prod0; prod[1] = prod1; prod[2] = prod2; prod[3] = prod3; |
---|
47 | prod[4] = prod4; prod[5] = prod5; prod[6] = prod6; prod[7] = prod7; |
---|
48 | for (int j = 0; j < 8; ++j) if (prod[j] != 0 && j == nProd) ++nProd; } |
---|
49 | |
---|
50 | // Member functions for input. |
---|
51 | void onMode(int onModeIn) {onModeSave = onModeIn; hasChangedSave = true;} |
---|
52 | void bRatio(double bRatioIn, bool countAsChanged = true) { |
---|
53 | bRatioSave = bRatioIn; if (countAsChanged) hasChangedSave = true;} |
---|
54 | void rescaleBR(double fac) {bRatioSave *= fac; hasChangedSave = true;} |
---|
55 | void meMode(int meModeIn) {meModeSave = meModeIn; hasChangedSave = true;} |
---|
56 | void multiplicity(int multIn) {nProd = multIn; hasChangedSave = true;} |
---|
57 | void product(int i, int prodIn) {prod[i] = prodIn; nProd = 0; |
---|
58 | for (int j = 0; j < 8; ++j) if (prod[j] != 0 && j == nProd) ++nProd; |
---|
59 | hasChangedSave = true;} |
---|
60 | void setHasChanged(bool hasChangedIn) {hasChangedSave = hasChangedIn;} |
---|
61 | |
---|
62 | // Member functions for output. |
---|
63 | int onMode() const {return onModeSave;} |
---|
64 | double bRatio() const {return bRatioSave;} |
---|
65 | int meMode() const {return meModeSave;} |
---|
66 | int multiplicity() const {return nProd;} |
---|
67 | int product(int i) const {return (i >= 0 && i < nProd) ? prod[i] : 0;} |
---|
68 | bool hasChanged() const { return hasChangedSave;} |
---|
69 | |
---|
70 | // Check for presence of particles anywhere in decay list. |
---|
71 | bool contains(int id1) const; |
---|
72 | bool contains(int id1, int id2) const; |
---|
73 | bool contains(int id1, int id2, int id3) const; |
---|
74 | |
---|
75 | // Input/output for current selection of decay modes. |
---|
76 | // Takes into account on/off switches and dynamic width for resonances. |
---|
77 | void currentBR(double currentBRIn) {currentBRSave = currentBRIn;} |
---|
78 | double currentBR() const {return currentBRSave;} |
---|
79 | |
---|
80 | // Input/output for nominal partial width; used by resonances. |
---|
81 | void onShellWidth(double onShellWidthIn) { |
---|
82 | onShellWidthSave = onShellWidthIn;} |
---|
83 | double onShellWidth() const {return onShellWidthSave;} |
---|
84 | void onShellWidthFactor(double factor) {onShellWidthSave *= factor;} |
---|
85 | |
---|
86 | // Input/output for fraction of secondary open widths; used by resonances. |
---|
87 | void openSec(int idSgn, double openSecIn) { |
---|
88 | if (idSgn > 0) openSecPos = openSecIn; else openSecNeg = openSecIn;} |
---|
89 | double openSec(int idSgn) const { |
---|
90 | return (idSgn > 0) ? openSecPos : openSecNeg;} |
---|
91 | |
---|
92 | private: |
---|
93 | |
---|
94 | // Decay channel info. |
---|
95 | int onModeSave; |
---|
96 | double bRatioSave, currentBRSave, onShellWidthSave, openSecPos, |
---|
97 | openSecNeg; |
---|
98 | int meModeSave, nProd, prod[8]; |
---|
99 | bool hasChangedSave; |
---|
100 | |
---|
101 | }; |
---|
102 | |
---|
103 | //========================================================================== |
---|
104 | |
---|
105 | // This class holds info on a single particle species. |
---|
106 | |
---|
107 | class ParticleDataEntry { |
---|
108 | |
---|
109 | public: |
---|
110 | |
---|
111 | // Constructors: for antiparticle exists or not. |
---|
112 | ParticleDataEntry(int idIn = 0, string nameIn = " ", |
---|
113 | int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0, |
---|
114 | double m0In = 0., double mWidthIn = 0., double mMinIn = 0., |
---|
115 | double mMaxIn = 0., double tau0In = 0.) : idSave(abs(idIn)), |
---|
116 | nameSave(nameIn), antiNameSave("void"), spinTypeSave(spinTypeIn), |
---|
117 | chargeTypeSave(chargeTypeIn), colTypeSave(colTypeIn), m0Save(m0In), |
---|
118 | mWidthSave (mWidthIn), mMinSave(mMinIn), mMaxSave(mMaxIn), |
---|
119 | tau0Save(tau0In), hasAntiSave(false), hasChangedSave(true), |
---|
120 | resonancePtr(0) {setDefaults();} |
---|
121 | ParticleDataEntry(int idIn, string nameIn, string antiNameIn, |
---|
122 | int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0, |
---|
123 | double m0In = 0., double mWidthIn = 0., double mMinIn = 0., |
---|
124 | double mMaxIn = 0., double tau0In = 0.) : idSave(abs(idIn)), |
---|
125 | nameSave(nameIn), antiNameSave(antiNameIn), spinTypeSave(spinTypeIn), |
---|
126 | chargeTypeSave(chargeTypeIn), colTypeSave(colTypeIn), m0Save(m0In), |
---|
127 | mWidthSave (mWidthIn), mMinSave(mMinIn), mMaxSave(mMaxIn), |
---|
128 | tau0Save(tau0In), hasAntiSave(true), hasChangedSave(true), |
---|
129 | resonancePtr(0) {setDefaults(); |
---|
130 | if (toLower(antiNameIn) == "void") hasAntiSave = false;} |
---|
131 | |
---|
132 | // Destructor: delete any ResonanceWidths object. |
---|
133 | ~ParticleDataEntry(); |
---|
134 | |
---|
135 | // Initialization of some particle flags. |
---|
136 | void setDefaults(); |
---|
137 | |
---|
138 | // Store pointer to whole particle data table/database. |
---|
139 | void initPtr( ParticleData* particleDataPtrIn) { |
---|
140 | particleDataPtr = particleDataPtrIn;} |
---|
141 | |
---|
142 | // Reset all the properties of an existing particle. |
---|
143 | void setAll(string nameIn, string antiNameIn, int spinTypeIn = 0, |
---|
144 | int chargeTypeIn = 0, int colTypeIn = 0, double m0In = 0., |
---|
145 | double mWidthIn = 0., double mMinIn = 0., double mMaxIn = 0., |
---|
146 | double tau0In = 0.) |
---|
147 | {nameSave = nameIn; antiNameSave = antiNameIn; hasAntiSave = true; |
---|
148 | if (toLower(antiNameIn) == "void") hasAntiSave = false; |
---|
149 | spinTypeSave = spinTypeIn; chargeTypeSave = chargeTypeIn; |
---|
150 | colTypeSave = colTypeIn; m0Save = m0In; mWidthSave = mWidthIn; |
---|
151 | mMinSave = mMinIn; mMaxSave = mMaxIn; tau0Save = tau0In; |
---|
152 | setDefaults(); hasChangedSave = true;} |
---|
153 | |
---|
154 | // Change current values one at a time (or set if not set before). |
---|
155 | // (Must use set here since else name+signature clash with get methods.) |
---|
156 | void setName(string nameIn) {nameSave = nameIn; hasChangedSave = true;} |
---|
157 | void setAntiName(string antiNameIn) {antiNameSave = antiNameIn; |
---|
158 | hasChangedSave = true;} |
---|
159 | void setNames(string nameIn, string antiNameIn) {nameSave = nameIn; |
---|
160 | antiNameSave = antiNameIn; hasAntiSave = true; if (toLower(antiNameIn) |
---|
161 | == "void") hasAntiSave = false; hasChangedSave = true;} |
---|
162 | void setSpinType(int spinTypeIn) {spinTypeSave = spinTypeIn; |
---|
163 | hasChangedSave = true;} |
---|
164 | void setChargeType(int chargeTypeIn) {chargeTypeSave = chargeTypeIn; |
---|
165 | hasChangedSave = true;} |
---|
166 | void setColType(int colTypeIn) {colTypeSave = colTypeIn; |
---|
167 | hasChangedSave = true;} |
---|
168 | void setM0(double m0In) {m0Save = m0In; setConstituentMass(); |
---|
169 | hasChangedSave = true;} |
---|
170 | void setMWidth(double mWidthIn, bool countAsChanged = true) { |
---|
171 | mWidthSave = mWidthIn; if (countAsChanged) hasChangedSave = true;} |
---|
172 | void setMMin(double mMinIn) {mMinSave = mMinIn; hasChangedSave = true;} |
---|
173 | void setMMax(double mMaxIn) {mMaxSave = mMaxIn; hasChangedSave = true;} |
---|
174 | // Special options specifically when cutting wings of Breit-Wigners. |
---|
175 | void setMMinNoChange(double mMinIn) {mMinSave = mMinIn;} |
---|
176 | void setMMaxNoChange(double mMaxIn) {mMaxSave = mMaxIn;} |
---|
177 | void setTau0(double tau0In) {tau0Save = tau0In; hasChangedSave = true;} |
---|
178 | void setIsResonance(bool isResonanceIn) {isResonanceSave = isResonanceIn; |
---|
179 | hasChangedSave = true;} |
---|
180 | void setMayDecay(bool mayDecayIn, bool countAsChanged = true) { |
---|
181 | mayDecaySave = mayDecayIn; if (countAsChanged) hasChangedSave = true;} |
---|
182 | void setDoExternalDecay(bool doExternalDecayIn) |
---|
183 | {doExternalDecaySave = doExternalDecayIn; hasChangedSave = true;} |
---|
184 | void setIsVisible(bool isVisibleIn) {isVisibleSave = isVisibleIn; |
---|
185 | hasChangedSave = true;} |
---|
186 | void setDoForceWidth(bool doForceWidthIn) {doForceWidthSave = doForceWidthIn; |
---|
187 | hasChangedSave = true;} |
---|
188 | void setHasChanged(bool hasChangedIn) {hasChangedSave = hasChangedIn; |
---|
189 | for (int i = 0; i < int(channels.size()); ++i) |
---|
190 | channels[i].setHasChanged(hasChangedIn);} |
---|
191 | |
---|
192 | // Give back current values. |
---|
193 | int id() const { return idSave; } |
---|
194 | bool hasAnti() const { return hasAntiSave; } |
---|
195 | string name(int idIn = 1) const { |
---|
196 | return (idIn > 0) ? nameSave : antiNameSave; } |
---|
197 | int spinType() const {return spinTypeSave; } |
---|
198 | int chargeType(int idIn = 1) const { |
---|
199 | return (idIn > 0) ? chargeTypeSave : -chargeTypeSave; } |
---|
200 | double charge(int idIn = 1) const { |
---|
201 | return (idIn > 0) ? chargeTypeSave / 3. : -chargeTypeSave / 3.; } |
---|
202 | int colType(int idIn = 1) const { |
---|
203 | if (colTypeSave == 2) return colTypeSave; |
---|
204 | return (idIn > 0) ? colTypeSave : -colTypeSave; } |
---|
205 | double m0() const { return m0Save; } |
---|
206 | double mWidth() const { return mWidthSave; } |
---|
207 | double mMin() const { return mMinSave; } |
---|
208 | double mMax() const { return mMaxSave; } |
---|
209 | double m0Min() const { |
---|
210 | return (modeBWnow == 0) ? m0Save : mMinSave; } |
---|
211 | double m0Max() const { |
---|
212 | return (modeBWnow == 0) ? m0Save : mMaxSave; } |
---|
213 | double tau0() const { return tau0Save; } |
---|
214 | bool isResonance() const { return isResonanceSave; } |
---|
215 | bool mayDecay() const { return mayDecaySave; } |
---|
216 | bool doExternalDecay() const { return doExternalDecaySave; } |
---|
217 | bool isVisible() const { return isVisibleSave; } |
---|
218 | bool doForceWidth() const { return doForceWidthSave; } |
---|
219 | bool hasChanged() const { if (hasChangedSave) return true; |
---|
220 | for (int i = 0; i < int(channels.size()); ++i) |
---|
221 | if (channels[i].hasChanged()) return true; return false;} |
---|
222 | |
---|
223 | // Set and give back several mass-related quantities. |
---|
224 | void initBWmass(); |
---|
225 | double constituentMass() const { return constituentMassSave; } |
---|
226 | double mass(); |
---|
227 | double mRun(double mH); |
---|
228 | |
---|
229 | // Give back other quantities. |
---|
230 | bool useBreitWigner() const { return (modeBWnow > 0); } |
---|
231 | bool canDecay() const { return (channels.size() > 0);} |
---|
232 | bool isLepton() const { return (idSave > 10 && idSave < 19);} |
---|
233 | bool isQuark() const { return (idSave != 0 && idSave < 9);} |
---|
234 | bool isGluon() const { return (idSave == 21);} |
---|
235 | bool isDiquark() const { return (idSave > 1000 && idSave < 10000 |
---|
236 | && (idSave/10)%10 == 0);} |
---|
237 | bool isParton() const { return ( idSave == 21 |
---|
238 | || (idSave != 0 && idSave < 6) |
---|
239 | || (idSave > 1000 && idSave < 5510 && (idSave/10)%10 == 0) );} |
---|
240 | bool isHadron() const; |
---|
241 | bool isMeson() const; |
---|
242 | bool isBaryon() const; |
---|
243 | |
---|
244 | // Intermediate octet ccbar or bbar states in colour-octet model. |
---|
245 | bool isOctetHadron() const {return (idSave == 9900441 |
---|
246 | || idSave == 9900443 || idSave == 9900551 || idSave == 9900553 |
---|
247 | || idSave == 9910441 || idSave == 9910551); } |
---|
248 | int heaviestQuark(int idIn = 1) const; |
---|
249 | int baryonNumberType(int idIn = 1) const; |
---|
250 | |
---|
251 | // Reset to empty decay table. |
---|
252 | void clearChannels() {channels.resize(0);} |
---|
253 | |
---|
254 | // Add a decay channel to the decay table. |
---|
255 | void addChannel(int onMode = 0, double bRatio = 0., int meMode = 0, |
---|
256 | int prod0 = 0, int prod1 = 0, int prod2 = 0, int prod3 = 0, |
---|
257 | int prod4 = 0, int prod5 = 0, int prod6 = 0, int prod7 = 0) { |
---|
258 | channels.push_back( DecayChannel( onMode, bRatio, meMode, prod0, |
---|
259 | prod1, prod2, prod3, prod4, prod5, prod6, prod7) ); } |
---|
260 | |
---|
261 | // Decay table size. |
---|
262 | int sizeChannels() const {return channels.size();} |
---|
263 | |
---|
264 | // Gain access to a channel in the decay table. |
---|
265 | DecayChannel& channel(int i){return channels[i];} |
---|
266 | const DecayChannel& channel(int i) const {return channels[i];} |
---|
267 | |
---|
268 | // Rescale sum of branching ratios to unity. |
---|
269 | void rescaleBR(double newSumBR = 1.); |
---|
270 | |
---|
271 | // Random choice of decay channel according to branching ratios. |
---|
272 | bool preparePick(int idSgn, double mHat = 0., int idInFlav = 0); |
---|
273 | DecayChannel& pickChannel(); |
---|
274 | |
---|
275 | // Access methods stored in ResonanceWidths. |
---|
276 | void setResonancePtr(ResonanceWidths* resonancePtrIn); |
---|
277 | ResonanceWidths* getResonancePtr() {return resonancePtr;} |
---|
278 | void resInit(Info* infoPtrIn, Settings* settingsPtrIn, |
---|
279 | ParticleData* particleDataPtrIn, Couplings* couplingsPtrIn); |
---|
280 | double resWidth(int idSgn, double mHat, int idIn = 0, |
---|
281 | bool openOnly = false, bool setBR = false); |
---|
282 | double resWidthOpen(int idSgn, double mHat, int idIn = 0); |
---|
283 | double resWidthStore(int idSgn, double mHat, int idIn = 0); |
---|
284 | double resOpenFrac(int idSgn); |
---|
285 | double resWidthRescaleFactor(); |
---|
286 | double resWidthChan(double mHat, int idAbs1 = 0, int idAbs2 = 0); |
---|
287 | |
---|
288 | private: |
---|
289 | |
---|
290 | // Constants: could only be changed in the code itself. |
---|
291 | static const int INVISIBLENUMBER, INVISIBLETABLE[50], KNOWNNOWIDTH[3]; |
---|
292 | static const double MAXTAU0FORDECAY,MINMASSRESONANCE, NARROWMASS, |
---|
293 | CONSTITUENTMASSTABLE[10]; |
---|
294 | |
---|
295 | // Particle data. |
---|
296 | int idSave; |
---|
297 | string nameSave, antiNameSave; |
---|
298 | int spinTypeSave, chargeTypeSave, colTypeSave; |
---|
299 | double m0Save, mWidthSave, mMinSave, mMaxSave, tau0Save, |
---|
300 | constituentMassSave; |
---|
301 | bool hasAntiSave, isResonanceSave, mayDecaySave, doExternalDecaySave, |
---|
302 | isVisibleSave, doForceWidthSave, hasChangedSave; |
---|
303 | |
---|
304 | // Extra data for mass selection according to a Breit-Wigner. |
---|
305 | int modeBWnow; |
---|
306 | double atanLow, atanDif, mThr; |
---|
307 | |
---|
308 | // A vector containing all the decay channels of the particle. |
---|
309 | vector<DecayChannel> channels; |
---|
310 | |
---|
311 | // Summed branching ratio of currently open channels. |
---|
312 | double currentBRSum; |
---|
313 | |
---|
314 | // Pointer to ResonanceWidths object; only used for some particles. |
---|
315 | ResonanceWidths* resonancePtr; |
---|
316 | |
---|
317 | // Pointer to the full particle data table. |
---|
318 | ParticleData* particleDataPtr; |
---|
319 | |
---|
320 | // Set constituent mass. |
---|
321 | void setConstituentMass(); |
---|
322 | |
---|
323 | // Useful functions for string handling. |
---|
324 | string toLower(const string& nameConv); |
---|
325 | |
---|
326 | }; |
---|
327 | |
---|
328 | //========================================================================== |
---|
329 | |
---|
330 | // This class holds a map of all ParticleDataEntries. |
---|
331 | |
---|
332 | class ParticleData { |
---|
333 | |
---|
334 | public: |
---|
335 | |
---|
336 | // Constructor. |
---|
337 | ParticleData() : infoPtr(0), settingsPtr(0), rndmPtr(0), couplingsPtr(0), |
---|
338 | particlePtr(0), isInit(false) {} |
---|
339 | |
---|
340 | // Initialize pointers. |
---|
341 | void initPtr(Info* infoPtrIn, Settings* settingsPtrIn, Rndm* rndmPtrIn, |
---|
342 | Couplings* couplingsPtrIn) {infoPtr = infoPtrIn; |
---|
343 | settingsPtr = settingsPtrIn; rndmPtr = rndmPtrIn; |
---|
344 | couplingsPtr = couplingsPtrIn;} |
---|
345 | |
---|
346 | // Read in database from specific file. |
---|
347 | bool init(string startFile = "../xmldoc/ParticleData.xml") { |
---|
348 | initCommon(); return readXML(startFile);} |
---|
349 | |
---|
350 | // Overwrite existing database by reading from specific file. |
---|
351 | bool reInit(string startFile, bool xmlFormat = true) { initCommon(); |
---|
352 | return (xmlFormat) ? readXML(startFile) : readFF(startFile);} |
---|
353 | |
---|
354 | // Initialize pointers, normal Breit-Wigners and special resonances. |
---|
355 | void initWidths(vector<ResonanceWidths*> resonancePtrs); |
---|
356 | |
---|
357 | // Read or list whole (or part of) database from/to an XML file. |
---|
358 | bool readXML(string inFile, bool reset = true) ; |
---|
359 | void listXML(string outFile); |
---|
360 | |
---|
361 | // Read or list whole (or part of) database from/to a free format file. |
---|
362 | bool readFF(string inFile, bool reset = true) ; |
---|
363 | void listFF(string outFile); |
---|
364 | |
---|
365 | // Read in one update from a single line. |
---|
366 | bool readString(string lineIn, bool warn = true, ostream& os = cout) ; |
---|
367 | |
---|
368 | // Print out table of whole database, or of only part of it. |
---|
369 | void listAll(ostream& os = cout) {list(false, true, os);} |
---|
370 | void listChanged(ostream& os = cout) {list(true, false, os);} |
---|
371 | void listChanged(bool changedRes, ostream& os = cout) { |
---|
372 | list(true, changedRes, os);} |
---|
373 | void list(bool changedOnly = false, bool changedRes = true, |
---|
374 | ostream& os = cout); |
---|
375 | |
---|
376 | // Print out specified particles. |
---|
377 | void list(int idList, ostream& os = cout) {vector<int> idListTemp; |
---|
378 | idListTemp.push_back(idList); list( idListTemp, os);} |
---|
379 | void list(vector<int> idList, ostream& os = cout); |
---|
380 | |
---|
381 | // Check that table makes sense, especially for decays. |
---|
382 | void checkTable(ostream& os = cout) {checkTable(1, os);}; |
---|
383 | void checkTable(int verbosity, ostream& os = cout) ; |
---|
384 | |
---|
385 | // Add new entry. |
---|
386 | void addParticle(int idIn, string nameIn = " ", int spinTypeIn = 0, |
---|
387 | int chargeTypeIn = 0, int colTypeIn = 0, double m0In = 0., |
---|
388 | double mWidthIn = 0., double mMinIn = 0., double mMaxIn = 0., |
---|
389 | double tau0In = 0.) { pdt[abs(idIn)] = ParticleDataEntry(idIn, |
---|
390 | nameIn, spinTypeIn, chargeTypeIn, colTypeIn, m0In, mWidthIn, |
---|
391 | mMinIn, mMaxIn, tau0In); } |
---|
392 | void addParticle(int idIn, string nameIn, string antiNameIn, |
---|
393 | int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0, |
---|
394 | double m0In = 0., double mWidthIn = 0., double mMinIn = 0., |
---|
395 | double mMaxIn = 0., double tau0In = 0.) { pdt[abs(idIn)] |
---|
396 | = ParticleDataEntry(idIn, nameIn, antiNameIn, spinTypeIn, |
---|
397 | chargeTypeIn, colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In); } |
---|
398 | |
---|
399 | // Reset all the properties of an entry in one go. |
---|
400 | void setAll(int idIn, string nameIn, string antiNameIn, |
---|
401 | int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0, |
---|
402 | double m0In = 0., double mWidthIn = 0., double mMinIn = 0., |
---|
403 | double mMaxIn = 0.,double tau0In = 0.) { if (isParticle(idIn)) |
---|
404 | pdt[abs(idIn)].setAll( nameIn, antiNameIn, spinTypeIn, chargeTypeIn, |
---|
405 | colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In); } |
---|
406 | |
---|
407 | // Query existence of an entry. |
---|
408 | bool isParticle(int idIn) { |
---|
409 | if (pdt.find(abs(idIn)) == pdt.end()) return false; |
---|
410 | if (idIn > 0 || pdt[abs(idIn)].hasAnti()) return true; |
---|
411 | return false; } |
---|
412 | |
---|
413 | // Return the id of the sequentially next particle stored in table. |
---|
414 | int nextId(int idIn) ; |
---|
415 | |
---|
416 | // Change current values one at a time (or set if not set before). |
---|
417 | void name(int idIn, string nameIn) { |
---|
418 | if (isParticle(idIn)) pdt[abs(idIn)].setName(nameIn); } |
---|
419 | void antiName(int idIn, string antiNameIn) { |
---|
420 | if (isParticle(idIn)) pdt[abs(idIn)].setAntiName(antiNameIn); } |
---|
421 | void names(int idIn, string nameIn, string antiNameIn) { |
---|
422 | if (isParticle(idIn)) pdt[abs(idIn)].setNames(nameIn, antiNameIn); } |
---|
423 | void spinType(int idIn, int spinTypeIn) { |
---|
424 | if (isParticle(idIn)) pdt[abs(idIn)].setSpinType(spinTypeIn); } |
---|
425 | void chargeType(int idIn, int chargeTypeIn) { |
---|
426 | if (isParticle(idIn)) pdt[abs(idIn)].setChargeType(chargeTypeIn); } |
---|
427 | void colType(int idIn, int colTypeIn) { |
---|
428 | if (isParticle(idIn)) pdt[abs(idIn)].setColType(colTypeIn); } |
---|
429 | void m0(int idIn, double m0In) { |
---|
430 | if (isParticle(idIn)) pdt[abs(idIn)].setM0(m0In); } |
---|
431 | void mWidth(int idIn, double mWidthIn) { |
---|
432 | if (isParticle(idIn)) pdt[abs(idIn)].setMWidth(mWidthIn); } |
---|
433 | void mMin(int idIn, double mMinIn) { |
---|
434 | if (isParticle(idIn)) pdt[abs(idIn)].setMMin(mMinIn); } |
---|
435 | void mMax(int idIn, double mMaxIn) { |
---|
436 | if (isParticle(idIn)) pdt[abs(idIn)].setMMax(mMaxIn); } |
---|
437 | void tau0(int idIn, double tau0In) { |
---|
438 | if (isParticle(idIn)) pdt[abs(idIn)].setTau0(tau0In); } |
---|
439 | void isResonance(int idIn, bool isResonanceIn) { |
---|
440 | if (isParticle(idIn)) pdt[abs(idIn)].setIsResonance(isResonanceIn); } |
---|
441 | void mayDecay(int idIn, bool mayDecayIn) { |
---|
442 | if (isParticle(idIn)) pdt[abs(idIn)].setMayDecay(mayDecayIn); } |
---|
443 | void doExternalDecay(int idIn, bool doExternalDecayIn) { |
---|
444 | if (isParticle(idIn)) |
---|
445 | pdt[abs(idIn)].setDoExternalDecay(doExternalDecayIn); } |
---|
446 | void isVisible(int idIn, bool isVisibleIn) { |
---|
447 | if (isParticle(idIn)) pdt[abs(idIn)].setIsVisible(isVisibleIn); } |
---|
448 | void doForceWidth(int idIn, bool doForceWidthIn) { |
---|
449 | if (isParticle(idIn)) pdt[abs(idIn)].setDoForceWidth(doForceWidthIn); } |
---|
450 | void hasChanged(int idIn, bool hasChangedIn) { |
---|
451 | if (isParticle(idIn)) pdt[abs(idIn)].setHasChanged(hasChangedIn); } |
---|
452 | |
---|
453 | // Give back current values. |
---|
454 | bool hasAnti(int idIn) { |
---|
455 | return isParticle(idIn) ? pdt[abs(idIn)].hasAnti() : false ; } |
---|
456 | string name(int idIn) { |
---|
457 | return (isParticle(abs(idIn))) ? pdt[abs(idIn)].name(idIn) : " "; } |
---|
458 | int spinType(int idIn) { |
---|
459 | return isParticle(idIn) ? pdt[abs(idIn)].spinType() : 0 ; } |
---|
460 | int chargeType(int idIn) { |
---|
461 | return isParticle(idIn) ? pdt[abs(idIn)].chargeType(idIn) : 0 ; } |
---|
462 | double charge(int idIn) { |
---|
463 | return isParticle(idIn) ? pdt[abs(idIn)].charge(idIn) : 0 ; } |
---|
464 | int colType(int idIn) { |
---|
465 | return isParticle(idIn) ? pdt[abs(idIn)].colType(idIn) : 0 ; } |
---|
466 | double m0(int idIn) { |
---|
467 | return isParticle(idIn) ? pdt[abs(idIn)].m0() : 0. ; } |
---|
468 | double mWidth(int idIn) { |
---|
469 | return isParticle(idIn) ? pdt[abs(idIn)].mWidth() : 0. ; } |
---|
470 | double mMin(int idIn) { |
---|
471 | return isParticle(idIn) ? pdt[abs(idIn)].mMin() : 0. ; } |
---|
472 | double m0Min(int idIn) { |
---|
473 | return isParticle(idIn) ? pdt[abs(idIn)].m0Min() : 0. ; } |
---|
474 | double mMax(int idIn) { |
---|
475 | return isParticle(idIn) ? pdt[abs(idIn)].mMax() : 0. ; } |
---|
476 | double m0Max(int idIn) { |
---|
477 | return isParticle(idIn) ? pdt[abs(idIn)].m0Max() : 0. ; } |
---|
478 | double tau0(int idIn) { |
---|
479 | return isParticle(idIn) ? pdt[abs(idIn)].tau0() : 0. ; } |
---|
480 | bool isResonance(int idIn) { |
---|
481 | return isParticle(idIn) ? pdt[abs(idIn)].isResonance() : false ; } |
---|
482 | bool mayDecay(int idIn) { |
---|
483 | return isParticle(idIn) ? pdt[abs(idIn)].mayDecay() : false ; } |
---|
484 | bool doExternalDecay(int idIn) { |
---|
485 | return isParticle(idIn) ? pdt[abs(idIn)].doExternalDecay() : false ; } |
---|
486 | bool isVisible(int idIn) { |
---|
487 | return isParticle(idIn) ? pdt[abs(idIn)].isVisible() : false ; } |
---|
488 | bool doForceWidth(int idIn) { |
---|
489 | return isParticle(idIn) ? pdt[abs(idIn)].doForceWidth() : false ; } |
---|
490 | bool hasChanged(int idIn) { |
---|
491 | return isParticle(idIn) ? pdt[abs(idIn)].hasChanged() : false ; } |
---|
492 | |
---|
493 | // Give back special mass-related quantities. |
---|
494 | bool useBreitWigner(int idIn) { |
---|
495 | return isParticle(idIn) ? pdt[abs(idIn)].useBreitWigner() : false ; } |
---|
496 | double constituentMass(int idIn) { |
---|
497 | return isParticle(idIn) ? pdt[abs(idIn)].constituentMass() : 0. ; } |
---|
498 | double mass(int idIn) { |
---|
499 | return isParticle(idIn) ? pdt[abs(idIn)].mass() : 0. ; } |
---|
500 | double mRun(int idIn, double mH) { |
---|
501 | return isParticle(idIn) ? pdt[abs(idIn)].mRun(mH) : 0. ; } |
---|
502 | |
---|
503 | // Give back other quantities. |
---|
504 | bool canDecay(int idIn) { |
---|
505 | return isParticle(idIn) ? pdt[abs(idIn)].canDecay() : false ; } |
---|
506 | bool isLepton(int idIn) { |
---|
507 | return isParticle(idIn) ? pdt[abs(idIn)].isLepton() : false ; } |
---|
508 | bool isQuark(int idIn) { |
---|
509 | return isParticle(idIn) ? pdt[abs(idIn)].isQuark() : false ; } |
---|
510 | bool isGluon(int idIn) { |
---|
511 | return isParticle(idIn) ? pdt[abs(idIn)].isGluon() : false ; } |
---|
512 | bool isDiquark(int idIn) { |
---|
513 | return isParticle(idIn) ? pdt[abs(idIn)].isDiquark() : false ; } |
---|
514 | bool isParton(int idIn) { |
---|
515 | return isParticle(idIn) ? pdt[abs(idIn)].isParton() : false ; } |
---|
516 | bool isHadron(int idIn) { |
---|
517 | return isParticle(idIn) ? pdt[abs(idIn)].isHadron() : false ; } |
---|
518 | bool isMeson(int idIn) { |
---|
519 | return isParticle(idIn) ? pdt[abs(idIn)].isMeson() : false ; } |
---|
520 | bool isBaryon(int idIn) { |
---|
521 | return isParticle(idIn) ? pdt[abs(idIn)].isBaryon() : false ; } |
---|
522 | bool isOctetHadron(int idIn) { |
---|
523 | return isParticle(idIn) ? pdt[abs(idIn)].isOctetHadron() : false ; } |
---|
524 | int heaviestQuark(int idIn) { |
---|
525 | return isParticle(idIn) ? pdt[abs(idIn)].heaviestQuark(idIn) : 0 ; } |
---|
526 | int baryonNumberType(int idIn) { |
---|
527 | return isParticle(idIn) ? pdt[abs(idIn)].baryonNumberType(idIn) : 0 ; } |
---|
528 | |
---|
529 | // Change branching ratios. |
---|
530 | void rescaleBR(int idIn, double newSumBR = 1.) { |
---|
531 | if (isParticle(idIn)) pdt[abs(idIn)].rescaleBR(newSumBR); } |
---|
532 | |
---|
533 | // Access methods stored in ResonanceWidths. |
---|
534 | void setResonancePtr(int idIn, ResonanceWidths* resonancePtrIn) { |
---|
535 | if (isParticle(idIn)) pdt[abs(idIn)].setResonancePtr( resonancePtrIn);} |
---|
536 | void resInit(int idIn) { if (isParticle(idIn)) |
---|
537 | pdt[abs(idIn)].resInit(infoPtr, settingsPtr, this, couplingsPtr);} |
---|
538 | double resWidth(int idIn, double mHat, int idInFlav = 0, |
---|
539 | bool openOnly = false, bool setBR = false) { |
---|
540 | return isParticle(idIn) ? pdt[abs(idIn)].resWidth(idIn, mHat, |
---|
541 | idInFlav, openOnly, setBR) : 0.;} |
---|
542 | double resWidthOpen(int idIn, double mHat, int idInFlav = 0) { |
---|
543 | return isParticle(idIn) ? pdt[abs(idIn)].resWidthOpen(idIn, mHat, |
---|
544 | idInFlav) : 0.;} |
---|
545 | double resWidthStore(int idIn, double mHat, int idInFlav = 0) { |
---|
546 | return isParticle(idIn) ? pdt[abs(idIn)].resWidthStore(idIn, mHat, |
---|
547 | idInFlav) : 0.;} |
---|
548 | double resOpenFrac(int id1In, int id2In = 0, int id3In = 0); |
---|
549 | double resWidthRescaleFactor(int idIn) { return isParticle(idIn) |
---|
550 | ? pdt[abs(idIn)].resWidthRescaleFactor() : 0.;} |
---|
551 | double resWidthChan(int idIn, double mHat, int idAbs1 = 0, |
---|
552 | int idAbs2 = 0) { return isParticle(idIn) |
---|
553 | ? pdt[abs(idIn)].resWidthChan( mHat, idAbs1, idAbs2) : 0.;} |
---|
554 | |
---|
555 | // Return pointer to entry. |
---|
556 | ParticleDataEntry* particleDataEntryPtr(int idIn) { |
---|
557 | return (isParticle(idIn)) ? &pdt[abs(idIn)] : &pdt[0]; } |
---|
558 | |
---|
559 | private: |
---|
560 | |
---|
561 | // Common data, accessible for the individual particles. |
---|
562 | int modeBreitWigner; |
---|
563 | double maxEnhanceBW, mQRun[7], Lambda5Run; |
---|
564 | |
---|
565 | // The individual particle need access to the full database. |
---|
566 | friend class ParticleDataEntry; |
---|
567 | |
---|
568 | // Pointer to various information on the generation. |
---|
569 | Info* infoPtr; |
---|
570 | |
---|
571 | // Pointer to the settings database. |
---|
572 | Settings* settingsPtr; |
---|
573 | |
---|
574 | // Pointer to the random number generator. |
---|
575 | Rndm* rndmPtr; |
---|
576 | |
---|
577 | // Pointer to Standard Model couplings. |
---|
578 | Couplings* couplingsPtr; |
---|
579 | |
---|
580 | // All particle data stored in a map. |
---|
581 | map<int, ParticleDataEntry> pdt; |
---|
582 | |
---|
583 | // Pointer to current particle (e.g. when reading decay channels). |
---|
584 | ParticleDataEntry* particlePtr; |
---|
585 | |
---|
586 | // Flag that initialization has been performed. |
---|
587 | bool isInit; |
---|
588 | |
---|
589 | // Method for common setting of particle-specific info. |
---|
590 | void initCommon(); |
---|
591 | |
---|
592 | // Useful functions for string handling. |
---|
593 | string toLower(const string& name); |
---|
594 | bool boolString(string tag); |
---|
595 | string attributeValue(string line, string attribute); |
---|
596 | bool boolAttributeValue(string line, string attribute); |
---|
597 | int intAttributeValue(string line, string attribute); |
---|
598 | double doubleAttributeValue(string line, string attribute); |
---|
599 | |
---|
600 | }; |
---|
601 | |
---|
602 | //========================================================================== |
---|
603 | |
---|
604 | } // end namespace Pythia8 |
---|
605 | |
---|
606 | #endif // Pythia8_ParticleData_H |
---|