PYTHIA  8.312
ParticleDecays.h
1 // ParticleDecays.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // This file contains the classes to perform a particle decay.
7 // DecayHandler: base class for external handling of decays.
8 // ParticleDecays: decay a particle.
9 
10 #ifndef Pythia8_ParticleDecays_H
11 #define Pythia8_ParticleDecays_H
12 
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/Event.h"
15 #include "Pythia8/FragmentationFlavZpT.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/ParticleData.h"
18 #include "Pythia8/PhysicsBase.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/Settings.h"
21 #include "Pythia8/TimeShower.h"
22 #include "Pythia8/TauDecays.h"
23 
24 namespace Pythia8 {
25 
26 //==========================================================================
27 
28 // DecayHandler is base class for the external handling of decays.
29 // There is only one pure virtual method, that should do the decay.
30 
31 class DecayHandler {
32 
33 public:
34 
35  // Destructor.
36  virtual ~DecayHandler() {}
37 
38  // A virtual method, wherein the derived class method does a decay.
39  // Usage: decay( idProd, mProd, pProd, iDec, event).
40  virtual bool decay(vector<int>& , vector<double>& , vector<Vec4>& ,
41  int , const Event& ) {return false;}
42 
43  // A virtual method, to do sequential decay chains.
44  // Usage: decay( idProd, motherProd, mProd, pProd, iDec, event).
45  virtual bool chainDecay(vector<int>& , vector<int>& , vector<double>& ,
46  vector<Vec4>& , int , const Event& ) {return false;}
47 
48  // A virtual method, to return the particles the handler should decay.
49  virtual vector<int> handledParticles() {return {};}
50 
51 };
52 
53 //==========================================================================
54 
55 // The ParticleDecays class contains the routines to decay a particle.
56 
57 class ParticleDecays : public PhysicsBase {
58 
59 public:
60 
61  // Constructor.
62  ParticleDecays() : timesDecPtr(), flavSelPtr(), decayHandlePtr(),
63  limitTau0(), limitTau(),
64  limitRadius(), limitCylinder(), limitDecay(), mixB(), doFSRinDecays(),
65  doGammaRad(), tauMode(), mSafety(), tau0Max(), tauMax(), rMax(), xyMax(),
66  zMax(), xBdMix(), xBsMix(), sigmaSoft(), multIncrease(),
67  multIncreaseWeak(), multRefMass(), multGoffset(), colRearrange(),
68  stopMass(), sRhoDal(), wRhoDal(), hasPartons(), keepPartons(), idDec(),
69  meMode(), mult(), scale(), decDataPtr() {}
70 
71  // Initialize: store pointers and find settings
72  void init(TimeShowerPtr timesDecPtrIn, StringFlav* flavSelPtrIn,
73  DecayHandlerPtr decayHandlePtrIn, vector<int> handledParticles);
74 
75  // Perform a decay of a single particle.
76  bool decay(int iDec, Event& event);
77 
78  // Perform decays on all particles in the event.
79  bool decayAll(Event& event, double minWidth = 0.);
80 
81  // Did decay result in new partons to hadronize?
82  bool moreToDo() const {return hasPartons && keepPartons;}
83 
84 protected:
85 
86  virtual void onInitInfoPtr() override {
87  registerSubObject(tauDecayer); }
88 
89 private:
90 
91  // Constants: could only be changed in the code itself.
92  static const int NTRYDECAY, NTRYPICK, NTRYMEWT, NTRYDALITZ;
93  static const double MSAFEDALITZ, WTCORRECTION[11];
94 
95  // Pointers to timelike showers, for decays to partons (e.g. Upsilon).
96  TimeShowerPtr timesDecPtr;
97 
98  // Pointer to class for flavour generation; needed when to pick hadrons.
99  StringFlav* flavSelPtr;
100 
101  // Pointer to a handler of external decays.
102  DecayHandlerPtr decayHandlePtr;
103 
104  // Initialization data, read from Settings.
105  bool limitTau0, limitTau, limitRadius, limitCylinder, limitDecay,
106  mixB, doFSRinDecays, doGammaRad;
107  int tauMode;
108  double mSafety, tau0Max, tauMax, rMax, xyMax, zMax, xBdMix, xBsMix,
109  sigmaSoft, multIncrease, multIncreaseWeak, multRefMass, multGoffset,
110  colRearrange, stopMass, sRhoDal, wRhoDal;
111 
112  // Multiplicity. Decay products positions and masses.
113  bool hasPartons, keepPartons;
114  int idDec, meMode, mult;
115  double scale;
116  vector<int> iProd, idProd, motherProd, cols, acols, idPartons;
117  vector<double> mProd, mInv, rndmOrd;
118  vector<Vec4> pInv, pProd;
119  vector<FlavContainer> flavEnds;
120 
121  // Pointer to particle data for currently decaying particle
122  ParticleDataEntry* decDataPtr;
123 
124  // Tau particle decayer.
125  TauDecays tauDecayer;
126 
127  // Check whether a decay is allowed, given the upcoming decay vertex.
128  bool checkVertex(Particle& decayer);
129 
130  // Check for oscillations B0 <-> B0bar or B_s0 <-> B_s0bar.
131  bool oscillateB(Particle& decayer);
132 
133  // Do a one-body decay.
134  bool oneBody(Event& event);
135 
136  // Do a two-body decay;
137  bool twoBody(Event& event);
138 
139  // Do a three-body decay;
140  bool threeBody(Event& event);
141 
142  // Do a multibody decay using the M-generator algorithm.
143  bool mGenerator(Event& event);
144 
145  // Select mass of lepton pair in a Dalitz decay.
146  bool dalitzMass();
147 
148  // Do kinematics of gamma* -> l- l+ in Dalitz decay.
149  bool dalitzKinematics(Event& event);
150 
151  // Translate a partonic content into a set of actual hadrons.
152  bool pickHadrons();
153 
154  // Set colour flow and scale in a decay explicitly to partons.
155  bool setColours(Event& event);
156 
157 };
158 
159 //==========================================================================
160 
161 } // end namespace Pythia8
162 
163 #endif // Pythia8_ParticleDecays_H
virtual void onInitInfoPtr() override
Definition: ParticleDecays.h:86
virtual ~DecayHandler()
Destructor.
Definition: ParticleDecays.h:36
This class holds info on a single particle species.
Definition: ParticleData.h:125
Definition: PhysicsBase.h:27
The ParticleDecays class contains the routines to decay a particle.
Definition: ParticleDecays.h:57
The Event class holds all info on the generated event.
Definition: Event.h:453
virtual bool decay(vector< int > &, vector< double > &, vector< Vec4 > &, int, const Event &)
Definition: ParticleDecays.h:40
virtual bool chainDecay(vector< int > &, vector< int > &, vector< double > &, vector< Vec4 > &, int, const Event &)
Definition: ParticleDecays.h:45
Definition: TauDecays.h:27
bool moreToDo() const
Did decay result in new partons to hadronize?
Definition: ParticleDecays.h:82
Definition: Event.h:32
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
ParticleDecays()
Constructor.
Definition: ParticleDecays.h:62
virtual vector< int > handledParticles()
A virtual method, to return the particles the handler should decay.
Definition: ParticleDecays.h:49
The StringFlav class is used to select quark and hadron flavours.
Definition: FragmentationFlavZpT.h:84
Definition: ParticleDecays.h:31