StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ParticleData.h
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 
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.
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];
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 
333 
334 public:
335 
336  // Constructor.
337  ParticleData() : isInit(false) {}
338 
339  // Initialize pointers.
340  void initPtr(Info* infoPtrIn, Settings* settingsPtrIn, Rndm* rndmPtrIn,
341  Couplings* couplingsPtrIn) {infoPtr = infoPtrIn;
342  settingsPtr = settingsPtrIn; rndmPtr = rndmPtrIn;
343  couplingsPtr = couplingsPtrIn;}
344 
345  // Read in database from specific file.
346  bool init(string startFile = "../xmldoc/ParticleData.xml") {
347  initCommon(); return readXML(startFile);}
348 
349  // Overwrite existing database by reading from specific file.
350  bool reInit(string startFile, bool xmlFormat = true) { initCommon();
351  return (xmlFormat) ? readXML(startFile) : readFF(startFile);}
352 
353  // Initialize pointers, normal Breit-Wigners and special resonances.
354  void initWidths(vector<ResonanceWidths*> resonancePtrs);
355 
356  // Read or list whole (or part of) database from/to an XML file.
357  bool readXML(string inFile, bool reset = true) ;
358  void listXML(string outFile);
359 
360  // Read or list whole (or part of) database from/to a free format file.
361  bool readFF(string inFile, bool reset = true) ;
362  void listFF(string outFile);
363 
364  // Read in one update from a single line.
365  bool readString(string lineIn, bool warn = true, ostream& os = cout) ;
366 
367  // Print out table of whole database, or of only part of it.
368  void listAll(ostream& os = cout) {list(false, true, os);}
369  void listChanged(ostream& os = cout) {list(true, false, os);}
370  void listChanged(bool changedRes, ostream& os = cout) {
371  list(true, changedRes, os);}
372  void list(bool changedOnly = false, bool changedRes = true,
373  ostream& os = cout);
374 
375  // Print out specified particles.
376  void list(int idList, ostream& os = cout) {vector<int> idListTemp;
377  idListTemp.push_back(idList); list( idListTemp, os);}
378  void list(vector<int> idList, ostream& os = cout);
379 
380  // Check that table makes sense, especially for decays.
381  void checkTable(ostream& os = cout) {checkTable(1, os);};
382  void checkTable(int verbosity, ostream& os = cout) ;
383 
384  // Add new entry.
385  void addParticle(int idIn, string nameIn = " ", int spinTypeIn = 0,
386  int chargeTypeIn = 0, int colTypeIn = 0, double m0In = 0.,
387  double mWidthIn = 0., double mMinIn = 0., double mMaxIn = 0.,
388  double tau0In = 0.) { pdt[abs(idIn)] = ParticleDataEntry(idIn,
389  nameIn, spinTypeIn, chargeTypeIn, colTypeIn, m0In, mWidthIn,
390  mMinIn, mMaxIn, tau0In); }
391  void addParticle(int idIn, string nameIn, string antiNameIn,
392  int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
393  double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
394  double mMaxIn = 0., double tau0In = 0.) { pdt[abs(idIn)]
395  = ParticleDataEntry(idIn, nameIn, antiNameIn, spinTypeIn,
396  chargeTypeIn, colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In); }
397 
398  // Reset all the properties of an entry in one go.
399  void setAll(int idIn, string nameIn, string antiNameIn,
400  int spinTypeIn = 0, int chargeTypeIn = 0, int colTypeIn = 0,
401  double m0In = 0., double mWidthIn = 0., double mMinIn = 0.,
402  double mMaxIn = 0.,double tau0In = 0.) { if (isParticle(idIn))
403  pdt[abs(idIn)].setAll( nameIn, antiNameIn, spinTypeIn, chargeTypeIn,
404  colTypeIn, m0In, mWidthIn, mMinIn, mMaxIn, tau0In); }
405 
406  // Query existence of an entry.
407  bool isParticle(int idIn) {
408  if (pdt.find(abs(idIn)) == pdt.end()) return false;
409  if (idIn > 0 || pdt[abs(idIn)].hasAnti()) return true;
410  return false; }
411 
412  // Return the id of the sequentially next particle stored in table.
413  int nextId(int idIn) ;
414 
415  // Change current values one at a time (or set if not set before).
416  void name(int idIn, string nameIn) {
417  if (isParticle(idIn)) pdt[abs(idIn)].setName(nameIn); }
418  void antiName(int idIn, string antiNameIn) {
419  if (isParticle(idIn)) pdt[abs(idIn)].setAntiName(antiNameIn); }
420  void names(int idIn, string nameIn, string antiNameIn) {
421  if (isParticle(idIn)) pdt[abs(idIn)].setNames(nameIn, antiNameIn); }
422  void spinType(int idIn, int spinTypeIn) {
423  if (isParticle(idIn)) pdt[abs(idIn)].setSpinType(spinTypeIn); }
424  void chargeType(int idIn, int chargeTypeIn) {
425  if (isParticle(idIn)) pdt[abs(idIn)].setChargeType(chargeTypeIn); }
426  void colType(int idIn, int colTypeIn) {
427  if (isParticle(idIn)) pdt[abs(idIn)].setColType(colTypeIn); }
428  void m0(int idIn, double m0In) {
429  if (isParticle(idIn)) pdt[abs(idIn)].setM0(m0In); }
430  void mWidth(int idIn, double mWidthIn) {
431  if (isParticle(idIn)) pdt[abs(idIn)].setMWidth(mWidthIn); }
432  void mMin(int idIn, double mMinIn) {
433  if (isParticle(idIn)) pdt[abs(idIn)].setMMin(mMinIn); }
434  void mMax(int idIn, double mMaxIn) {
435  if (isParticle(idIn)) pdt[abs(idIn)].setMMax(mMaxIn); }
436  void tau0(int idIn, double tau0In) {
437  if (isParticle(idIn)) pdt[abs(idIn)].setTau0(tau0In); }
438  void isResonance(int idIn, bool isResonanceIn) {
439  if (isParticle(idIn)) pdt[abs(idIn)].setIsResonance(isResonanceIn); }
440  void mayDecay(int idIn, bool mayDecayIn) {
441  if (isParticle(idIn)) pdt[abs(idIn)].setMayDecay(mayDecayIn); }
442  void doExternalDecay(int idIn, bool doExternalDecayIn) {
443  if (isParticle(idIn))
444  pdt[abs(idIn)].setDoExternalDecay(doExternalDecayIn); }
445  void isVisible(int idIn, bool isVisibleIn) {
446  if (isParticle(idIn)) pdt[abs(idIn)].setIsVisible(isVisibleIn); }
447  void doForceWidth(int idIn, bool doForceWidthIn) {
448  if (isParticle(idIn)) pdt[abs(idIn)].setDoForceWidth(doForceWidthIn); }
449  void hasChanged(int idIn, bool hasChangedIn) {
450  if (isParticle(idIn)) pdt[abs(idIn)].setHasChanged(hasChangedIn); }
451 
452  // Give back current values.
453  bool hasAnti(int idIn) {
454  return isParticle(idIn) ? pdt[abs(idIn)].hasAnti() : false ; }
455  string name(int idIn) {
456  return (isParticle(abs(idIn))) ? pdt[abs(idIn)].name(idIn) : " "; }
457  int spinType(int idIn) {
458  return isParticle(idIn) ? pdt[abs(idIn)].spinType() : 0 ; }
459  int chargeType(int idIn) {
460  return isParticle(idIn) ? pdt[abs(idIn)].chargeType(idIn) : 0 ; }
461  double charge(int idIn) {
462  return isParticle(idIn) ? pdt[abs(idIn)].charge(idIn) : 0 ; }
463  int colType(int idIn) {
464  return isParticle(idIn) ? pdt[abs(idIn)].colType(idIn) : 0 ; }
465  double m0(int idIn) {
466  return isParticle(idIn) ? pdt[abs(idIn)].m0() : 0. ; }
467  double mWidth(int idIn) {
468  return isParticle(idIn) ? pdt[abs(idIn)].mWidth() : 0. ; }
469  double mMin(int idIn) {
470  return isParticle(idIn) ? pdt[abs(idIn)].mMin() : 0. ; }
471  double m0Min(int idIn) {
472  return isParticle(idIn) ? pdt[abs(idIn)].m0Min() : 0. ; }
473  double mMax(int idIn) {
474  return isParticle(idIn) ? pdt[abs(idIn)].mMax() : 0. ; }
475  double m0Max(int idIn) {
476  return isParticle(idIn) ? pdt[abs(idIn)].m0Max() : 0. ; }
477  double tau0(int idIn) {
478  return isParticle(idIn) ? pdt[abs(idIn)].tau0() : 0. ; }
479  bool isResonance(int idIn) {
480  return isParticle(idIn) ? pdt[abs(idIn)].isResonance() : false ; }
481  bool mayDecay(int idIn) {
482  return isParticle(idIn) ? pdt[abs(idIn)].mayDecay() : false ; }
483  bool doExternalDecay(int idIn) {
484  return isParticle(idIn) ? pdt[abs(idIn)].doExternalDecay() : false ; }
485  bool isVisible(int idIn) {
486  return isParticle(idIn) ? pdt[abs(idIn)].isVisible() : false ; }
487  bool doForceWidth(int idIn) {
488  return isParticle(idIn) ? pdt[abs(idIn)].doForceWidth() : false ; }
489  bool hasChanged(int idIn) {
490  return isParticle(idIn) ? pdt[abs(idIn)].hasChanged() : false ; }
491 
492  // Give back special mass-related quantities.
493  bool useBreitWigner(int idIn) {
494  return isParticle(idIn) ? pdt[abs(idIn)].useBreitWigner() : false ; }
495  double constituentMass(int idIn) {
496  return isParticle(idIn) ? pdt[abs(idIn)].constituentMass() : 0. ; }
497  double mass(int idIn) {
498  return isParticle(idIn) ? pdt[abs(idIn)].mass() : 0. ; }
499  double mRun(int idIn, double mH) {
500  return isParticle(idIn) ? pdt[abs(idIn)].mRun(mH) : 0. ; }
501 
502  // Give back other quantities.
503  bool canDecay(int idIn) {
504  return isParticle(idIn) ? pdt[abs(idIn)].canDecay() : false ; }
505  bool isLepton(int idIn) {
506  return isParticle(idIn) ? pdt[abs(idIn)].isLepton() : false ; }
507  bool isQuark(int idIn) {
508  return isParticle(idIn) ? pdt[abs(idIn)].isQuark() : false ; }
509  bool isGluon(int idIn) {
510  return isParticle(idIn) ? pdt[abs(idIn)].isGluon() : false ; }
511  bool isDiquark(int idIn) {
512  return isParticle(idIn) ? pdt[abs(idIn)].isDiquark() : false ; }
513  bool isParton(int idIn) {
514  return isParticle(idIn) ? pdt[abs(idIn)].isParton() : false ; }
515  bool isHadron(int idIn) {
516  return isParticle(idIn) ? pdt[abs(idIn)].isHadron() : false ; }
517  bool isMeson(int idIn) {
518  return isParticle(idIn) ? pdt[abs(idIn)].isMeson() : false ; }
519  bool isBaryon(int idIn) {
520  return isParticle(idIn) ? pdt[abs(idIn)].isBaryon() : false ; }
521  bool isOctetHadron(int idIn) {
522  return isParticle(idIn) ? pdt[abs(idIn)].isOctetHadron() : false ; }
523  int heaviestQuark(int idIn) {
524  return isParticle(idIn) ? pdt[abs(idIn)].heaviestQuark(idIn) : 0 ; }
525  int baryonNumberType(int idIn) {
526  return isParticle(idIn) ? pdt[abs(idIn)].baryonNumberType(idIn) : 0 ; }
527 
528  // Change branching ratios.
529  void rescaleBR(int idIn, double newSumBR = 1.) {
530  if (isParticle(idIn)) pdt[abs(idIn)].rescaleBR(newSumBR); }
531 
532  // Access methods stored in ResonanceWidths.
533  void setResonancePtr(int idIn, ResonanceWidths* resonancePtrIn) {
534  if (isParticle(idIn)) pdt[abs(idIn)].setResonancePtr( resonancePtrIn);}
535  void resInit(int idIn) { if (isParticle(idIn))
536  pdt[abs(idIn)].resInit(infoPtr, settingsPtr, this, couplingsPtr);}
537  double resWidth(int idIn, double mHat, int idInFlav = 0,
538  bool openOnly = false, bool setBR = false) {
539  return isParticle(idIn) ? pdt[abs(idIn)].resWidth(idIn, mHat,
540  idInFlav, openOnly, setBR) : 0.;}
541  double resWidthOpen(int idIn, double mHat, int idInFlav = 0) {
542  return isParticle(idIn) ? pdt[abs(idIn)].resWidthOpen(idIn, mHat,
543  idInFlav) : 0.;}
544  double resWidthStore(int idIn, double mHat, int idInFlav = 0) {
545  return isParticle(idIn) ? pdt[abs(idIn)].resWidthStore(idIn, mHat,
546  idInFlav) : 0.;}
547  double resOpenFrac(int id1In, int id2In = 0, int id3In = 0);
548  double resWidthRescaleFactor(int idIn) { return isParticle(idIn)
549  ? pdt[abs(idIn)].resWidthRescaleFactor() : 0.;}
550  double resWidthChan(int idIn, double mHat, int idAbs1 = 0,
551  int idAbs2 = 0) { return isParticle(idIn)
552  ? pdt[abs(idIn)].resWidthChan( mHat, idAbs1, idAbs2) : 0.;}
553 
554  // Return pointer to entry.
555  ParticleDataEntry* particleDataEntryPtr(int idIn) {
556  return (isParticle(idIn)) ? &pdt[abs(idIn)] : &pdt[0]; }
557 
558 private:
559 
560  // Common data, accessible for the individual particles.
561  int modeBreitWigner;
562  double maxEnhanceBW, mQRun[7], Lambda5Run;
563 
564  // The individual particle need access to the full database.
565  friend class ParticleDataEntry;
566 
567  // Pointer to various information on the generation.
568  Info* infoPtr;
569 
570  // Pointer to the settings database.
571  Settings* settingsPtr;
572 
573  // Pointer to the random number generator.
574  Rndm* rndmPtr;
575 
576  // Pointer to Standard Model couplings.
577  Couplings* couplingsPtr;
578 
579  // All particle data stored in a map.
580  map<int, ParticleDataEntry> pdt;
581 
582  // Pointer to current particle (e.g. when reading decay channels).
583  ParticleDataEntry* particlePtr;
584 
585  // Flag that initialization has been performed.
586  bool isInit;
587 
588  // Method for common setting of particle-specific info.
589  void initCommon();
590 
591  // Useful functions for string handling.
592  string toLower(const string& name);
593  bool boolString(string tag);
594  string attributeValue(string line, string attribute);
595  bool boolAttributeValue(string line, string attribute);
596  int intAttributeValue(string line, string attribute);
597  double doubleAttributeValue(string line, string attribute);
598 
599 };
600 
601 //==========================================================================
602 
603 } // end namespace Pythia8
604 
605 #endif // Pythia8_ParticleData_H