Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:27

0001 // ParticleDecays.h is a part of the PYTHIA event generator.
0002 // Copyright (C) 2024 Torbjorn Sjostrand.
0003 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
0004 // Please respect the MCnet Guidelines, see GUIDELINES for details.
0005 
0006 // This file contains the classes to perform a particle decay.
0007 // DecayHandler: base class for external handling of decays.
0008 // ParticleDecays: decay a particle.
0009 
0010 #ifndef Pythia8_ParticleDecays_H
0011 #define Pythia8_ParticleDecays_H
0012 
0013 #include "Pythia8/Basics.h"
0014 #include "Pythia8/Event.h"
0015 #include "Pythia8/FragmentationFlavZpT.h"
0016 #include "Pythia8/Info.h"
0017 #include "Pythia8/ParticleData.h"
0018 #include "Pythia8/PhysicsBase.h"
0019 #include "Pythia8/PythiaStdlib.h"
0020 #include "Pythia8/Settings.h"
0021 #include "Pythia8/TimeShower.h"
0022 #include "Pythia8/TauDecays.h"
0023 
0024 namespace Pythia8 {
0025 
0026 //==========================================================================
0027 
0028 // DecayHandler is base class for the external handling of decays.
0029 // There is only one pure virtual method, that should do the decay.
0030 
0031 class DecayHandler {
0032 
0033 public:
0034 
0035   // Destructor.
0036   virtual ~DecayHandler() {}
0037 
0038   // A virtual method, wherein the derived class method does a decay.
0039   // Usage: decay( idProd, mProd, pProd, iDec, event).
0040   virtual bool decay(vector<int>& , vector<double>& , vector<Vec4>& ,
0041    int , const Event& ) {return false;}
0042 
0043   // A virtual method, to do sequential decay chains.
0044   // Usage: decay( idProd, motherProd, mProd, pProd, iDec, event).
0045   virtual bool chainDecay(vector<int>& , vector<int>& , vector<double>& ,
0046     vector<Vec4>& , int , const Event& ) {return false;}
0047 
0048   // A virtual method, to return the particles the handler should decay.
0049   virtual vector<int> handledParticles() {return {};}
0050 
0051 };
0052 
0053 //==========================================================================
0054 
0055 // The ParticleDecays class contains the routines to decay a particle.
0056 
0057 class ParticleDecays : public PhysicsBase {
0058 
0059 public:
0060 
0061   // Constructor.
0062   ParticleDecays() : timesDecPtr(), flavSelPtr(), decayHandlePtr(),
0063     limitTau0(), limitTau(),
0064     limitRadius(), limitCylinder(), limitDecay(), mixB(), doFSRinDecays(),
0065     doGammaRad(), tauMode(), mSafety(), tau0Max(), tauMax(), rMax(), xyMax(),
0066     zMax(), xBdMix(), xBsMix(), sigmaSoft(), multIncrease(),
0067     multIncreaseWeak(), multRefMass(), multGoffset(), colRearrange(),
0068     stopMass(), sRhoDal(), wRhoDal(), hasPartons(), keepPartons(), idDec(),
0069     meMode(), mult(), scale(), decDataPtr() {}
0070 
0071   // Initialize: store pointers and find settings
0072   void init(TimeShowerPtr timesDecPtrIn, StringFlav* flavSelPtrIn,
0073             DecayHandlerPtr decayHandlePtrIn, vector<int> handledParticles);
0074 
0075   // Perform a decay of a single particle.
0076   bool decay(int iDec, Event& event);
0077 
0078   // Perform decays on all particles in the event.
0079   bool decayAll(Event& event, double minWidth = 0.);
0080 
0081   // Did decay result in new partons to hadronize?
0082   bool moreToDo() const {return hasPartons && keepPartons;}
0083 
0084 protected:
0085 
0086   virtual void onInitInfoPtr() override {
0087     registerSubObject(tauDecayer); }
0088 
0089 private:
0090 
0091   // Constants: could only be changed in the code itself.
0092   static const int    NTRYDECAY, NTRYPICK, NTRYMEWT, NTRYDALITZ;
0093   static const double MSAFEDALITZ, WTCORRECTION[11];
0094 
0095   // Pointers to timelike showers, for decays to partons (e.g. Upsilon).
0096   TimeShowerPtr timesDecPtr;
0097 
0098   // Pointer to class for flavour generation; needed when to pick hadrons.
0099   StringFlav*   flavSelPtr;
0100 
0101   // Pointer to a handler of external decays.
0102   DecayHandlerPtr decayHandlePtr;
0103 
0104   // Initialization data, read from Settings.
0105   bool   limitTau0, limitTau, limitRadius, limitCylinder, limitDecay,
0106          mixB, doFSRinDecays, doGammaRad;
0107   int    tauMode;
0108   double mSafety, tau0Max, tauMax, rMax, xyMax, zMax, xBdMix, xBsMix,
0109          sigmaSoft, multIncrease, multIncreaseWeak, multRefMass, multGoffset,
0110          colRearrange, stopMass, sRhoDal, wRhoDal;
0111 
0112   // Multiplicity. Decay products positions and masses.
0113   bool   hasPartons, keepPartons;
0114   int    idDec, meMode, mult;
0115   double scale;
0116   vector<int>    iProd, idProd, motherProd, cols, acols, idPartons;
0117   vector<double> mProd, mInv, rndmOrd;
0118   vector<Vec4>   pInv, pProd;
0119   vector<FlavContainer> flavEnds;
0120 
0121   // Pointer to particle data for currently decaying particle
0122   ParticleDataEntry* decDataPtr;
0123 
0124   // Tau particle decayer.
0125   TauDecays tauDecayer;
0126 
0127   // Check whether a decay is allowed, given the upcoming decay vertex.
0128   bool checkVertex(Particle& decayer);
0129 
0130   // Check for oscillations B0 <-> B0bar or B_s0 <-> B_s0bar.
0131   bool oscillateB(Particle& decayer);
0132 
0133   // Do a one-body decay.
0134   bool oneBody(Event& event);
0135 
0136   // Do a two-body decay;
0137   bool twoBody(Event& event);
0138 
0139   // Do a three-body decay;
0140   bool threeBody(Event& event);
0141 
0142   // Do a multibody decay using the M-generator algorithm.
0143   bool mGenerator(Event& event);
0144 
0145   // Select mass of lepton pair in a Dalitz decay.
0146   bool dalitzMass();
0147 
0148   // Do kinematics of gamma* -> l- l+ in Dalitz decay.
0149   bool dalitzKinematics(Event& event);
0150 
0151   // Translate a partonic content into a set of actual hadrons.
0152   bool pickHadrons();
0153 
0154   // Set colour flow and scale in a decay explicitly to partons.
0155   bool setColours(Event& event);
0156 
0157 };
0158 
0159 //==========================================================================
0160 
0161 } // end namespace Pythia8
0162 
0163 #endif // Pythia8_ParticleDecays_H