thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
ParticleData.h
1 // -*- C++ -*-
2 //
3 // ParticleData.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2017 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_ParticleData_H
10 #define ThePEG_ParticleData_H
11 // This is the declaration of the ParticleData class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/PDT/PDT.h"
15 #include "ThePEG/PDT/PID.h"
18 #include "ThePEG/Interface/Interfaced.h"
19 #include "ThePEG/Utilities/Selector.h"
20 #include "ThePEG/PDT/WidthGenerator.h"
21 #include "ThePEG/PDT/MassGenerator.h"
22 #include "ThePEG/PDT/DecayMode.fh"
23 #include "ThePEG/Utilities/ClassTraits.h"
24 #include "ThePEG/Utilities/ClassDescription.h"
25 
26 namespace ThePEG {
27 
36 class ParticleData: public Interfaced {
37 
38 public:
39 
41  friend class Repository;
42 
44  friend class EventGenerator;
45 
47  friend class DecayMode;
48 
51 
52 public:
53 
59  ParticleData();
60 
64  virtual ~ParticleData();
66 
73  static PDPtr Create(PID newId, const string & newPDGName);
74 
78  static PDPair Create(PID newId, const string & newPDGName, const string & newAntiPDGName);
80 
81 public:
82 
88  long id() const { return theId; }
89 
94  const string & PDGName() const { return thePDGName; }
95 
100  const string & genericName() const { return thePDGName; }
102 
108  PPtr produceParticle(const Lorentz5Momentum &) const;
109 
113  PPtr produceParticle(const LorentzMomentum &) const;
114 
118  PPtr produceParticle(const LorentzMomentum &, Energy m) const;
119 
123  PPtr produceParticle(const Momentum3 & pp = Momentum3()) const;
124 
128  PPtr produceParticle(Energy m, const Momentum3 & pp = Momentum3()) const;
129 
134  PPtr produceParticle(Energy plus, Energy minus, Energy px, Energy py) const;
135 
139  Energy generateMass() const;
140 
146 
153  // Given a mass and a width of an instance of this particle type,
154  // generate a life time.
156 
163  const DecaySelector & decaySelector() const { return theDecaySelector; }
164 
171  tDMPtr selectMode(Particle & p) const;
172 
177  const DecaySet & decayModes() const { return theDecayModes; }
179 
183  Energy mass(Energy);
184 
188  Energy mass() const { return theMass; }
189 
194  return
196  }
197 
201  Energy massMax() const { return mass() + widthUpCut(); }
202 
206  Energy massMin() const { return max(mass() - widthLoCut(), ZERO); }
207 
212  virtual Energy constituentMass() const { return mass(); }
213 
218 
223  Energy width() const {
224  return theWidth >= ZERO ? theWidth :
225  ( theCTau > Length() ? hbarc/theCTau :
226  ( theCTau == Length() ? Constants::MaxEnergy : ZERO ) );
227  }
228 
233  widthUpCut(wci);
234  return widthLoCut(wci);
235  }
236 
240  Energy widthCut() const { return max(widthUpCut(), widthLoCut()); }
241 
246 
250  Energy widthUpCut() const {
252  }
253 
258 
262  Energy widthLoCut() const {
264  }
265 
269  Length cTau(Length);
270 
277  Length cTau() const {
278  return theCTau > Length() ? theCTau :
279  ( theWidth > ZERO ? hbarc/theWidth :
280  ( stable() ? Constants::MaxLength : Length() ) );
281  }
282 
287  return
289  }
290 
296 
301  Charge charge() const { return eplus*double(theCharge)/3.0; }
302 
306  PDT::Charge iCharge() const { return theCharge; }
307 
311  bool charged() const { return PDT::charged(theCharge); }
312 
316  bool positive() const { return PDT::positive(theCharge); }
317 
321  bool negative() const { return PDT::negative(theCharge); }
322 
328 
332  AngularMomentum spin() const { return hbar_Planck*double(theSpin-1)*0.5; }
333 
337  PDT::Spin iSpin() const { return theSpin; }
338 
343 
347  PDT::Colour iColour() const { return theColour; }
348 
352  bool coloured() const { return PDT::coloured(iColour()); }
353 
357  bool hasColour(bool anti = false) const {
358  return anti? hasAntiColour():
359  ( iColour() == PDT::Colour3 || iColour() == PDT::Colour6 ||
360  iColour() == PDT::Colour8 );
361  }
362 
366  bool hasAntiColour() const {
367  return iColour() == PDT::Colour3bar || iColour() == PDT::Colour6bar ||
368  iColour() == PDT::Colour8;
369  }
370 
375  void stable(bool stab);
376 
382  bool stable() const { return isStable; }
383 
387  tPDPtr CC() const { return theAntiPartner; }
388 
393  void synchronized(bool sync);
394 
399  bool synchronized() const { return syncAnti; }
400 
405  void synchronize();
406 
410  void massGenerator(tMassGenPtr);
411 
415  tMassGenPtr massGenerator() const { return theMassGenerator; }
416 
420  void widthGenerator(tWidthGeneratorPtr);
421 
425  tWidthGeneratorPtr widthGenerator() const { return theWidthGenerator; }
426 
431  void variableRatio(bool varRatio);
432 
437  bool variableRatio() const { return theVariableRatio; }
438 
439 public:
440 
441 
448  void persistentOutput(PersistentOStream & os) const;
449 
455  void persistentInput(PersistentIStream & is, int version);
457 
458  static void Init();
459 
460 protected:
461 
468  virtual IBPtr clone() const;
469 
474  virtual IBPtr fullclone() const;
476 
482  virtual PDPtr pdclone() const;
483 
488  ParticleData(PID newId, const string & newPDGName);
489 
499  virtual void readSetup(istream & is);
500 
505  static void antiSetup(const PDPair & pap);
506 
507 
508 protected:
509 
515  virtual void doupdate();
516 
522  virtual void doinit();
523 
533  virtual void rebind(const TranslationMap & trans)
534  ;
535 
541  virtual IVector getReferences();
542 
547  virtual void doinitrun();
549 
550 protected:
551 
555  void addDecayMode(tDMPtr);
556 
560  void removeDecayMode(tDMPtr);
561 
562 private:
563 
568 
572  string thePDGName;
573 
578 
583 
588 
593 
598 
603 
608 
613 
618 
623 
628 
633 
638  MassGenPtr theMassGenerator;
639 
643  bool isStable;
644 
649  DecaySelector theDecaySelector;
650 
654  DecaySet theDecayModes;
655 
663  WidthGeneratorPtr theWidthGenerator;
664 
670 
676 
681  bool syncAnti;
682 
687 
692 
697 
702 
707 
712 
717 
721  void setMass(Energy);
722 
727 
731  string doUnsetHardProcessMass(string);
732 
737  string doAdjustNominalMass(string);
738 
742  Energy defMass() const;
743 
747  void setWidth(Energy);
748 
753 
757  string doUnsetHardProcessWidth(string);
758 
762  Energy getWidth() const;
763 
767  Energy defWidth() const;
768 
772  void setCut(Energy);
773 
777  Energy getCut() const;
778 
782  Energy defCut() const;
783 
787  void setUpCut(Energy);
788 
792  Energy getUpCut() const;
793 
797  void setLoCut(Energy);
798 
802  Energy getLoCut() const;
803 
807  void setCTau(Length);
808 
812  Length getCTau() const;
813 
817  Length defCTau() const;
818 
822  void setStable(long);
823 
827  long getStable() const;
828 
832  void setSync(long);
833 
837  long getSync() const;
838 
842  void setVariableRatio(long);
843 
847  long getVariableRatio() const;
848 
852  string doSync(string);
853 
857  void setMassGenerator(MassGenPtr);
858 
862  void setWidthGenerator(WidthGeneratorPtr);
863 
867  void setCharge(int);
868 
872  string ssetCharge(string);
873 
877  int getCharge() const;
878 
882  int defCharge() const;
883 
887  void setSpin(int);
888 
892  int getSpin() const;
893 
897  int defSpin() const;
898 
902  void setColour(long);
903 
907  long getColour() const;
908 
912  long defColour() const;
913 
917  void insDecayModes(DMPtr dm, int);
918 
922  void delDecayModes(int i);
923 
927  vector<DMPtr> getDecayModes() const;
928 
932  string doSelectDecayModes(string);
933 
937  string doPrintDecayModes(string);
938 
943 
944 };
945 
950 template <>
951 struct BaseClassTrait<ParticleData,1>: public ClassTraitsType {
953  typedef Interfaced NthBase;
954 };
955 
958 template <>
959 struct ClassTraits<ParticleData>: public ClassTraitsBase<ParticleData> {
961  static string className() { return "ThePEG::ParticleData"; }
962 };
963 
966 }
967 
968 #endif /* ThePEG_ParticleData_H */
long getSync() const
Utility function for the interface.
static PDPtr Create(PID newId, const string &newPDGName)
Create a Particle which is its own anti-particle.
void setHardProcessMass(Energy)
Utility function for the interface.
Energy massMin() const
Return the minimum possible mass of this particle type.
Definition: ParticleData.h:206
Energy theWidthLoCut
Lower width cut.
Definition: ParticleData.h:612
PID is a helper class implementing the type of PDG particle ids.
Definition: PID.h:23
PersistentIStream is used to read persistent objects from a stream where they were previously written...
void setStable(long)
Utility function for the interface.
Energy width() const
Get the width.
Definition: ParticleData.h:223
PID theId
Id number according to the STDHEP/PDG standard.
Definition: ParticleData.h:567
Energy theMass
Nominal mass.
Definition: ParticleData.h:577
tWidthGeneratorPtr widthGenerator() const
Get the width generator object.
Definition: ParticleData.h:425
Charge
Definition of enumerated values used for charge information.
Definition: PDT.h:51
string doUnsetHardProcessWidth(string)
Reset the hard process mass.
void setHardProcessWidth(Energy)
Utility function for the interface.
The Particle class is used to describe an instance of a particle.
Definition: Particle.h:83
void setMass(Energy)
Utility function for the interface.
constexpr Energy MaxEnergy
A really large energy.
Definition: Constants.h:33
Energy hardProcessWidth() const
Return the width to be used when evaluating hard process cross sections.
Definition: ParticleData.h:286
bool charged() const
Return true if charged.
Definition: ParticleData.h:311
tDMPtr selectMode(Particle &p) const
Selects a decay mode randomly according to the branching ratios.
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
PPtr produceParticle(const Lorentz5Momentum &) const
Produce a particle specifying momentum.
Energy theHardProcessMass
The mass to be used when evaluating hard process cross sections.
Definition: ParticleData.h:587
Colour-sextet.
Definition: PDT.h:100
static bool coloured(Colour c)
True if the argument corresponds to a non-zero colour charge.
Definition: PDT.h:129
static bool charged(Charge c)
True if the argument corresponds to a non-zero charge.
Definition: PDT.h:108
void removeDecayMode(tDMPtr)
Remove a decay mode for this particle.
DecaySet theDecayModes
The set of all decay modes.
Definition: ParticleData.h:654
int defCharge() const
Utility function for the interface.
DecaySelector theDecaySelector
A selector of decay modes weighted by the nominal branching ratios.
Definition: ParticleData.h:649
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual void doinitrun()
Initialize this object.
PDT::Charge iCharge() const
Get the charge.
Definition: ParticleData.h:306
PDT::Charge theDefCharge
Helper variable to keep track of the default charge.
Definition: ParticleData.h:706
string doUnsetHardProcessMass(string)
Reset the hard process mass.
Length getCTau() const
Utility function for the interface.
constexpr Qty< 1, 1, 0 > hbar_Planck
Planck&#39;s constant (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:236
string doSync(string)
Utility function for the interface.
Colour
Definition of enumerated values used for colour information.
Definition: PDT.h:92
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
AngularMomentum spin() const
Get the spin.The spin is returned in standard units.
Definition: ParticleData.h:332
Colour-anti-sextet.
Definition: PDT.h:101
A 3-component vector.
Definition: ThreeVector.h:34
const string & PDGName() const
Return the generic PDG name.
Definition: ParticleData.h:94
Energy mass() const
Return the nominal mass.
Definition: ParticleData.h:188
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
Repository inherits from the BaseRepository class.
Definition: Repository.h:45
Length cTau() const
Get the life time cTau cTau.
Definition: ParticleData.h:277
Energy generateWidth(Energy mass) const
Generate a width for an instance of this particle type.
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
tMassGenPtr massGenerator() const
Get the mass generator object.
Definition: ParticleData.h:415
void insDecayModes(DMPtr dm, int)
Utility function for the interface.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
Length theDefCTau
Helper variable to keep track of the default lifetime.
Definition: ParticleData.h:701
Colour-triplet.
Definition: PDT.h:98
bool syncAnti
If syncAnti is true all changes to this object will be transfered to the antiParticle.
Definition: ParticleData.h:681
virtual void rebind(const TranslationMap &trans)
Rebind pointer to other Interfaced objects.
This is the main config header file for ThePEG.
virtual ~ParticleData()
Destructor.
Energy getWidth() const
Utility function for the interface.
bool positive() const
Return true if positively charged.
Definition: ParticleData.h:316
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
string doAdjustNominalMass(string)
Adjust the nominal mass to the hard process mass if a reshuffling is not desirable.
void delDecayModes(int i)
Utility function for the interface.
Energy widthUpCut() const
Get the upper width cut.
Definition: ParticleData.h:250
Colour-octet.
Definition: PDT.h:102
int getCharge() const
Utility function for the interface.
ParticleData inherits from InterfacedBase and represents the properties of a particle type...
Definition: ParticleData.h:36
void synchronize()
If there is an anti-partner, update this object to have correct anti-properties.
long defColour() const
Utility function for the interface.
bool stable() const
Return true if particle is to be considered stable.
Definition: ParticleData.h:382
void setCut(Energy)
Utility function for the interface.
Energy getLoCut() const
Utility function for the interface.
Charge charge() const
Get the charge.
Definition: ParticleData.h:301
Energy defCut() const
Utility function for the interface.
PDT::Spin theSpin
2 times the spin plus one.
Definition: ParticleData.h:627
void setColour(long)
Utility function for the interface.
Energy getCut() const
Utility function for the interface.
bool isStable
True if the particle is considered stable.
Definition: ParticleData.h:643
virtual void readSetup(istream &is)
Read setup info from a standard stream.
virtual Energy constituentMass() const
Return the constituent mass of this particle if relevant.
Definition: ParticleData.h:212
string thePDGName
Name and Id number according to the STDHEP/PDG standard.
Definition: ParticleData.h:572
Energy defMass() const
Utility function for the interface.
Energy theWidth
Width.
Definition: ParticleData.h:582
PDT::Spin theDefSpin
Helper variable to keep track of the default spin.
Definition: ParticleData.h:711
Energy defWidth() const
Utility function for the interface.
static ClassDescription< ParticleData > initParticleData
Describe a concrete class with persistent data.
Definition: ParticleData.h:942
tPDPtr CC() const
Get the pointer to the corresponding anti partner.
Definition: ParticleData.h:387
vector< DMPtr > getDecayModes() const
Utility function for the interface.
void setWidthGenerator(WidthGeneratorPtr)
Utility function for the interface.
Selector< tDMPtr > DecaySelector
A selector of DecayMode objects.
Definition: ParticleData.h:50
Spin
Definition of enumerated values used for spin information.
Definition: PDT.h:32
long getStable() const
Utility function for the interface.
virtual PDPtr pdclone() const
Special clone function used by the Repository.
Energy getUpCut() const
Utility function for the interface.
Energy theDefCut
Helper variable to keep track of the default width cut.
Definition: ParticleData.h:696
contains the ThreeVector class.
Length generateLifeTime(Energy mass, Energy width) const
Generate a mass for an instance of this particle type.
void addDecayMode(tDMPtr)
Add a decay mode for this particle.
contains the LorentzVector class.
const DecaySelector & decaySelector() const
Return the nominal decay selector for this particle.
Definition: ParticleData.h:163
PDT::Spin iSpin() const
Get the spin.
Definition: ParticleData.h:337
pair< PDPtr, PDPtr > PDPair
A pair of pointers to ParticleData objects.
Definition: Containers.h:115
Energy widthCut() const
Get the width cut.
Definition: ParticleData.h:240
Energy massMax() const
Return the maximum possible mass of this particle type.
Definition: ParticleData.h:201
long getVariableRatio() const
Utility function for the interface.
static bool negative(Charge c)
True if the argument corresponds to a negative charge.
Definition: PDT.h:122
void setSync(long)
Utility function for the interface.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
Energy widthLoCut() const
Get the lower width cut.
Definition: ParticleData.h:262
Colour-anti-triplet.
Definition: PDT.h:99
PDT::Charge theCharge
Three times the charge.
Definition: ParticleData.h:622
string ssetCharge(string)
Utility function for the interface.
bool hasColour(bool anti=false) const
Return true if (anti) coloured or colour-octet.
Definition: ParticleData.h:357
const string & genericName() const
Return the generic PDG name.
Definition: ParticleData.h:100
void setWidth(Energy)
Utility function for the interface.
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition: Interfaced.h:38
void setCTau(Length)
Utility function for the interface.
constexpr Qty< 1, 1, 0 > hbarc
Planck&#39;s constant times c (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:234
Energy theHardProcessWidth
The width to be used when evaluating hard process cross sections.
Definition: ParticleData.h:597
PDT::Colour theDefColour
Helper variable to keep track of the default colour.
Definition: ParticleData.h:716
void setMassGenerator(MassGenPtr)
Utility function for the interface.
static bool positive(Charge c)
True if the argument corresponds to a positive charge.
Definition: PDT.h:115
Energy theWidthUpCut
Upper width cut.
Definition: ParticleData.h:607
static void antiSetup(const PDPair &pap)
Used by subclasses or by the Create method to setup anti-relationship.
PDT::Colour theColour
The colour for this particle.
Definition: ParticleData.h:632
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
void setLoCut(Energy)
Utility function for the interface.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
Energy theDefMass
Helper variable to keep track of the default mass.
Definition: ParticleData.h:686
ParticleData()
Default constructor.
string doSelectDecayModes(string)
Utility function for the interface.
The DecayMode class describes a decay channel of a particle.
Definition: DecayMode.h:87
void setUpCut(Energy)
Utility function for the interface.
constexpr Length MaxLength
A really large length.
Definition: Constants.h:30
const DecaySet & decayModes() const
Access all the decay modes, including those which are switched off, or have zero branching ratio...
Definition: ParticleData.h:177
string doPrintDecayModes(string)
Utility function for the interface.
long getColour() const
Utility function for the interface.
void setSpin(int)
Utility function for the interface.
bool hardProcessMassSet
True, if a hard process mass has been set.
Definition: ParticleData.h:592
Energy hardProcessMass() const
Return the mass to be used when evaluating hard process cross sections.
Definition: ParticleData.h:193
void setVariableRatio(long)
Utility function for the interface.
bool coloured() const
Return true if coloured.
Definition: ParticleData.h:352
long id() const
Return the PDG id number.
Definition: ParticleData.h:88
Length defCTau() const
Utility function for the interface.
int defSpin() const
Utility function for the interface.
Energy generateMass() const
Generate a mass for an instance of this particle type.
vector< IBPtr > IVector
A vector of pointers to InterfacedBase objects.
Definition: Containers.h:67
MassGenPtr theMassGenerator
A pointer to an object capable to generate a mass for a particle of this type.
Definition: ParticleData.h:638
bool theVariableRatio
Determine whether the branching fractions are allowed to change on a particle-by-particle basis...
Definition: ParticleData.h:669
void setCharge(int)
Utility function for the interface.
Energy theDefWidth
Helper variable to keep track of the default width.
Definition: ParticleData.h:691
virtual IVector getReferences()
Return a vector of all pointers to Interfaced objects used in this object.
PDT::Colour iColour() const
Get the colour of the particle in units of PDT::Colour.
Definition: ParticleData.h:347
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
Energy widthCut(Energy wci)
Set the width cut.
Definition: ParticleData.h:232
virtual IBPtr clone() const
Make a simple clone of this object.
tPDPtr theAntiPartner
Pointer to the object corresponding to the antiparticle.
Definition: ParticleData.h:675
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
WidthGeneratorPtr theWidthGenerator
A pointer to an object capable to generate the branching fractions for different decay modes for this...
Definition: ParticleData.h:663
constexpr ZeroUnit ZERO
ZERO can be used as zero for any unitful quantity.
Definition: PhysicalQty.h:33
Length theCTau
Lifetime.
Definition: ParticleData.h:617
bool hardProcessWidthSet
True, if a hard process width has been set.
Definition: ParticleData.h:602
bool variableRatio() const
Return true if the branching ratio should vary with the mass of the Particle instance.
Definition: ParticleData.h:437
The EventGenerator class manages a whole event generator run.
virtual void doupdate()
Check sanity of the object during the setup phase.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
int getSpin() const
Utility function for the interface.
bool hasAntiColour() const
Return true if anti coloured or colour-octet.
Definition: ParticleData.h:366
bool negative() const
Return true if negatively charged.
Definition: ParticleData.h:321