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