ThePEG  1.8.0
ParticleData.h
1 // -*- C++ -*-
2 //
3 // ParticleData.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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"
16 #include "ThePEG/Vectors/LorentzVector.h"
17 #include "ThePEG/Vectors/ThreeVector.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() const { return theMass; }
184 
188  Energy massMax() const { return mass() + widthUpCut(); }
189 
193  Energy massMin() const { return max(mass() - widthLoCut(), ZERO); }
194 
199  virtual Energy constituentMass() const { return mass(); }
200 
205 
210  Energy width() const {
211  return theWidth >= ZERO ? theWidth :
212  ( theCTau > Length() ? hbarc/theCTau :
213  ( theCTau == Length() ? Constants::MaxEnergy : ZERO ) );
214  }
215 
220  widthUpCut(wci);
221  return widthLoCut(wci);
222  }
223 
227  Energy widthCut() const { return max(widthUpCut(), widthLoCut()); }
228 
233 
237  Energy widthUpCut() const {
239  }
240 
245 
249  Energy widthLoCut() const {
251  }
252 
256  Length cTau(Length);
257 
264  Length cTau() const {
265  return theCTau > Length() ? theCTau :
266  ( theWidth > ZERO ? hbarc/theWidth :
267  ( stable() ? Constants::MaxLength : Length() ) );
268  }
269 
275 
280  Charge charge() const { return eplus*double(theCharge)/3.0; }
281 
285  PDT::Charge iCharge() const { return theCharge; }
286 
290  bool charged() const { return PDT::charged(theCharge); }
291 
295  bool positive() const { return PDT::positive(theCharge); }
296 
300  bool negative() const { return PDT::negative(theCharge); }
301 
307 
311  AngularMomentum spin() const { return hbar_Planck*double(theSpin-1)*0.5; }
312 
316  PDT::Spin iSpin() const { return theSpin; }
317 
322 
326  PDT::Colour iColour() const { return theColour; }
327 
331  bool coloured() const { return PDT::coloured(iColour()); }
332 
336  bool hasColour(bool anti = false) const {
337  return anti? hasAntiColour():
338  ( iColour() == PDT::Colour3 || iColour() == PDT::Colour6 ||
339  iColour() == PDT::Colour8 );
340  }
341 
345  bool hasAntiColour() const {
346  return iColour() == PDT::Colour3bar || iColour() == PDT::Colour6bar ||
347  iColour() == PDT::Colour8;
348  }
349 
354  void stable(bool stab);
355 
361  bool stable() const { return isStable || theDecayModes.empty(); }
362 
366  tPDPtr CC() const { return theAntiPartner; }
367 
372  void synchronized(bool sync);
373 
378  bool synchronized() const { return syncAnti; }
379 
384  void synchronize();
385 
389  void massGenerator(tMassGenPtr);
390 
394  tMassGenPtr massGenerator() const { return theMassGenerator; }
395 
399  void widthGenerator(tWidthGeneratorPtr);
400 
404  tWidthGeneratorPtr widthGenerator() const { return theWidthGenerator; }
405 
410  void variableRatio(bool varRatio);
411 
416  bool variableRatio() const { return theVariableRatio; }
417 
418 public:
419 
420 
427  void persistentOutput(PersistentOStream & os) const;
428 
434  void persistentInput(PersistentIStream & is, int version);
436 
437  static void Init();
438 
439 protected:
440 
447  virtual IBPtr clone() const;
448 
453  virtual IBPtr fullclone() const;
455 
461  virtual PDPtr pdclone() const;
462 
467  ParticleData(PID newId, const string & newPDGName);
468 
478  virtual void readSetup(istream & is);
479 
484  static void antiSetup(const PDPair & pap);
485 
486 
487 protected:
488 
494  virtual void doupdate();
495 
501  virtual void doinit();
502 
512  virtual void rebind(const TranslationMap & trans)
513  ;
514 
520  virtual IVector getReferences();
521 
526  virtual void doinitrun();
528 
529 protected:
530 
534  void addDecayMode(tDMPtr);
535 
539  void removeDecayMode(tDMPtr);
540 
541 private:
542 
547 
551  string thePDGName;
552 
557 
562 
567 
572 
577 
582 
587 
592 
597  MassGenPtr theMassGenerator;
598 
602  bool isStable;
603 
608  DecaySelector theDecaySelector;
609 
613  DecaySet theDecayModes;
614 
622  WidthGeneratorPtr theWidthGenerator;
623 
629 
635 
640  bool syncAnti;
641 
646 
651 
656 
661 
666 
671 
676 
680  void setMass(Energy);
681 
685  Energy defMass() const;
686 
690  void setWidth(Energy);
691 
695  Energy getWidth() const;
696 
700  Energy defWidth() const;
701 
705  void setCut(Energy);
706 
710  Energy getCut() const;
711 
715  Energy defCut() const;
716 
720  void setUpCut(Energy);
721 
725  Energy getUpCut() const;
726 
730  void setLoCut(Energy);
731 
735  Energy getLoCut() const;
736 
740  void setCTau(Length);
741 
745  Length getCTau() const;
746 
750  Length defCTau() const;
751 
755  void setStable(long);
756 
760  long getStable() const;
761 
765  void setSync(long);
766 
770  long getSync() const;
771 
775  void setVariableRatio(long);
776 
780  long getVariableRatio() const;
781 
785  string doSync(string);
786 
790  void setMassGenerator(MassGenPtr);
791 
795  void setWidthGenerator(WidthGeneratorPtr);
796 
800  void setCharge(int);
801 
805  string ssetCharge(string);
806 
810  int getCharge() const;
811 
815  int defCharge() const;
816 
820  void setSpin(int);
821 
825  int getSpin() const;
826 
830  int defSpin() const;
831 
835  void setColour(long);
836 
840  long getColour() const;
841 
845  long defColour() const;
846 
850  void insDecayModes(DMPtr dm, int);
851 
855  void delDecayModes(int i);
856 
860  vector<DMPtr> getDecayModes() const;
861 
865  string doSelectDecayModes(string);
866 
870  string doPrintDecayModes(string);
871 
876 
877 };
878 
883 template <>
884 struct BaseClassTrait<ParticleData,1>: public ClassTraitsType {
886  typedef Interfaced NthBase;
887 };
888 
891 template <>
892 struct ClassTraits<ParticleData>: public ClassTraitsBase<ParticleData> {
894  static string className() { return "ThePEG::ParticleData"; }
895 };
896 
899 }
900 
901 #endif /* ThePEG_ParticleData_H */
AngularMomentum spin() const
Get the spin.The spin is returned in standard units.
Definition: ParticleData.h:311
bool hasAntiColour() const
Return true if anti coloured or colour-octet.
Definition: ParticleData.h:345
Energy getWidth() const
Utility function for the interface.
static PDPtr Create(PID newId, const string &newPDGName)
Create a Particle which is its own anti-particle.
Energy theWidthLoCut
Lower width cut.
Definition: ParticleData.h:571
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...
bool coloured() const
Return true if coloured.
Definition: ParticleData.h:331
void setStable(long)
Utility function for the interface.
PID theId
Id number according to the STDHEP/PDG standard.
Definition: ParticleData.h:546
Energy theMass
Nominal mass.
Definition: ParticleData.h:556
const DecaySelector & decaySelector() const
Return the nominal decay selector for this particle.
Definition: ParticleData.h:163
int getCharge() const
Utility function for the interface.
Charge
Definition of enumerated values used for charge information.
Definition: PDT.h:51
The Particle class is used to describe an instance of a particle.
Definition: Particle.h:83
void setMass(Energy)
Utility function for the interface.
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
Length getCTau() const
Utility function for the interface.
const QTY< 1, 1, 0 >::Type hbar_Planck
Planck's constant (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:186
Colour-sextet.
Definition: PDT.h:100
Energy widthLoCut() const
Get the lower width cut.
Definition: ParticleData.h:249
long getColour() const
Utility function for the interface.
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:613
DecaySelector theDecaySelector
A selector of decay modes weighted by the nominal branching ratios.
Definition: ParticleData.h:608
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual void doinitrun()
Initialize this object.
PDT::Charge theDefCharge
Helper variable to keep track of the default charge.
Definition: ParticleData.h:665
tDMPtr selectMode(Particle &p) const
Selects a decay mode randomly according to the branching ratios.
PDT::Colour iColour() const
Get the colour of the particle in units of PDT::Colour.
Definition: ParticleData.h:326
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...
const string & genericName() const
Return the generic PDG name.
Definition: ParticleData.h:100
Energy getLoCut() const
Utility function for the interface.
Colour-anti-sextet.
Definition: PDT.h:101
PDT::Spin iSpin() const
Get the spin.
Definition: ParticleData.h:316
A 3-component vector.
Definition: ThreeVector.h:33
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:509
Repository inherits from the BaseRepository class.
Definition: Repository.h:45
Energy defWidth() const
Utility function for the interface.
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
virtual Energy constituentMass() const
Return the constituent mass of this particle if relevant.
Definition: ParticleData.h:199
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:660
bool negative() const
Return true if negatively charged.
Definition: ParticleData.h:300
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:640
Energy massMax() const
Return the maximum possible mass of this particle type.
Definition: ParticleData.h:188
virtual void rebind(const TranslationMap &trans)
Rebind pointer to other Interfaced objects.
virtual ~ParticleData()
Destructor.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
Energy defMass() const
Utility function for the interface.
Length cTau() const
Get the life time cTau cTau.
Definition: ParticleData.h:264
int defCharge() const
Utility function for the interface.
bool charged() const
Return true if charged.
Definition: ParticleData.h:290
void delDecayModes(int i)
Utility function for the interface.
Colour-octet.
Definition: PDT.h:102
bool variableRatio() const
Return true if the branching ratio should vary with the mass of the Particle instance.
Definition: ParticleData.h:416
tWidthGeneratorPtr widthGenerator() const
Get the width generator object.
Definition: ParticleData.h:404
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.
void setCut(Energy)
Utility function for the interface.
PDT::Spin theSpin
2 times the spin plus one.
Definition: ParticleData.h:586
void setColour(long)
Utility function for the interface.
bool hasColour(bool anti=false) const
Return true if (anti) coloured or colour-octet.
Definition: ParticleData.h:336
const Length MaxLength
A really large length.
Definition: Constants.h:30
PPtr produceParticle(const Lorentz5Momentum &) const
Produce a particle specifying momentum.
bool isStable
True if the particle is considered stable.
Definition: ParticleData.h:602
virtual void readSetup(istream &is)
Read setup info from a standard stream.
string thePDGName
Name and Id number according to the STDHEP/PDG standard.
Definition: ParticleData.h:551
Energy theWidth
Width.
Definition: ParticleData.h:561
QTY< 0, 1, 0 >::Type Energy
Energy.
Definition: Unitsystem.h:34
tMassGenPtr massGenerator() const
Get the mass generator object.
Definition: ParticleData.h:394
PDT::Spin theDefSpin
Helper variable to keep track of the default spin.
Definition: ParticleData.h:670
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
static ClassDescription< ParticleData > initParticleData
Describe a concrete class with persistent data.
Definition: ParticleData.h:875
PDT::Charge iCharge() const
Get the charge.
Definition: ParticleData.h:285
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
Energy getUpCut() const
Utility function for the interface.
long defColour() const
Utility function for the interface.
QTY< 1, 0, 0 >::Type Length
Length.
Definition: Unitsystem.h:40
Energy theDefCut
Helper variable to keep track of the default width cut.
Definition: ParticleData.h:655
bool stable() const
Return true if particle is to be considered stable.
Definition: ParticleData.h:361
void addDecayMode(tDMPtr)
Add a decay mode for this particle.
int defSpin() const
Utility function for the interface.
pair< PDPtr, PDPtr > PDPair
A pair of pointers to ParticleData objects.
Definition: Containers.h:115
vector< DMPtr > getDecayModes() const
Utility function for the interface.
Energy mass() const
Return the nominal mass.
Definition: ParticleData.h:183
static bool negative(Charge c)
True if the argument corresponds to a negative charge.
Definition: PDT.h:122
const DecaySet & decayModes() const
Access all the decay modes, including those which are switched off, or have zero branching ratio...
Definition: ParticleData.h:177
void setSync(long)
Utility function for the interface.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
Colour-anti-triplet.
Definition: PDT.h:99
PDT::Charge theCharge
Three times the charge.
Definition: ParticleData.h:581
string ssetCharge(string)
Utility function for the interface.
bool positive() const
Return true if positively charged.
Definition: ParticleData.h:295
const ZeroUnit ZERO
ZERO can be used as zero for any unitful quantity.
Definition: PhysicalQty.h:33
const string & PDGName() const
Return the generic PDG name.
Definition: ParticleData.h:94
Charge charge() const
Get the charge.
Definition: ParticleData.h:280
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
long getSync() const
Utility function for the interface.
void setCTau(Length)
Utility function for the interface.
Energy generateMass() const
Generate a mass for an instance of this particle type.
PDT::Colour theDefColour
Helper variable to keep track of the default colour.
Definition: ParticleData.h:675
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:566
Length generateLifeTime(Energy mass, Energy width) const
Generate a mass for an instance of this particle type.
static void antiSetup(const PDPair &pap)
Used by subclasses or by the Create method to setup anti-relationship.
tPDPtr CC() const
Get the pointer to the corresponding anti partner.
Definition: ParticleData.h:366
int getSpin() const
Utility function for the interface.
Length defCTau() const
Utility function for the interface.
PDT::Colour theColour
The colour for this particle.
Definition: ParticleData.h:591
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
void setLoCut(Energy)
Utility function for the interface.
Energy theDefMass
Helper variable to keep track of the default mass.
Definition: ParticleData.h:645
Energy defCut() const
Utility function for the interface.
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.
long id() const
Return the PDG id number.
Definition: ParticleData.h:88
string doPrintDecayModes(string)
Utility function for the interface.
void setSpin(int)
Utility function for the interface.
long getStable() const
Utility function for the interface.
Energy width() const
Get the width.
Definition: ParticleData.h:210
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
void setVariableRatio(long)
Utility function for the interface.
This template class allows the compiler to check calculations with physical quantities for dimensiona...
Definition: PhysicalQty.h:81
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
Energy generateWidth(Energy mass) const
Generate a width for an instance of this particle type.
long getVariableRatio() const
Utility function for the interface.
virtual IBPtr clone() const
Make a simple clone of this object.
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:597
Energy massMin() const
Return the minimum possible mass of this particle type.
Definition: ParticleData.h:193
bool theVariableRatio
Determine whether the branching fractions are allowed to change on a particle-by-particle basis...
Definition: ParticleData.h:628
void setCharge(int)
Utility function for the interface.
Energy theDefWidth
Helper variable to keep track of the default width.
Definition: ParticleData.h:650
virtual IVector getReferences()
Return a vector of all pointers to Interfaced objects used in this object.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
Energy widthCut(Energy wci)
Set the width cut.
Definition: ParticleData.h:219
virtual PDPtr pdclone() const
Special clone function used by the Repository.
tPDPtr theAntiPartner
Pointer to the object corresponding to the antiparticle.
Definition: ParticleData.h:634
WidthGeneratorPtr theWidthGenerator
A pointer to an object capable to generate the branching fractions for different decay modes for this...
Definition: ParticleData.h:622
Energy widthUpCut() const
Get the upper width cut.
Definition: ParticleData.h:237
Length theCTau
Lifetime.
Definition: ParticleData.h:576
The EventGenerator class manages a whole event generator run.
Energy getCut() const
Utility function for the interface.
virtual void doupdate()
Check sanity of the object during the setup phase.
const Energy MaxEnergy
A really large energy.
Definition: Constants.h:33
Energy widthCut() const
Get the width cut.
Definition: ParticleData.h:227
const QTY< 1, 1, 0 >::Type hbarc
Planck's constant times c (PDG 2006 value 197.326968(17) MeV fm)
Definition: Unitsystem.h:184