]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8175/include/RHadrons.h
Coverity 21241
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8175 / include / RHadrons.h
1 // RHadrons.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2013 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 // This file contains a class for the production and decay
7 // of long-lived heavy coloured particles, for now the gluino.
8
9 #ifndef Pythia8_RHadrons_H
10 #define Pythia8_RHadrons_H
11
12 #include "Basics.h"
13 #include "Event.h"
14 #include "FragmentationFlavZpT.h"
15 #include "FragmentationSystems.h"
16 #include "Info.h"
17 #include "ParticleData.h"
18 #include "PythiaStdlib.h"
19 #include "Settings.h"
20
21 namespace Pythia8 {
22  
23 //==========================================================================
24
25 // The RHadrons class contains the routines for the production and decay
26 // of long-lived heavy coloured particles.
27
28 class RHadrons {
29
30 public:
31
32   // Constructor. 
33   RHadrons() : allowRH(false), allowRSb(false), allowRSt(false), allowRGo(false), allowSomeR(false), setMassesRH(false),
34     idRSb(0), idRSt(0), idRGo(0),
35     maxWidthRH(0), probGluinoballRH(0), mOffsetCloudRH(0), mCollapseRH(0),
36     diquarkSpin1RH(0), m0Sb(0), m0St(0), m0Go(0), 
37     nRHad(0), iRHad(0), iBef(0), iSys(0),
38     systemPtr(0x0),
39     infoPtr(0x0),
40     particleDataPtr(0x0),
41     rndmPtr(0x0),
42     flavSelPtr(0x0),
43     zSelPtr(0x0) {} 
44  
45   // Initialization of R-hadron handling.
46   bool init( Info* infoPtrIn, Settings& settings,
47     ParticleData* particleDataPtrIn, Rndm* rndmPtrIn);
48
49   // Pointers to flavours and z sent from HadronLevel.
50   void fragPtrs( StringFlav* flavSelPtrIn, StringZ* zSelPtrIn) 
51     { flavSelPtr = flavSelPtrIn; zSelPtr = zSelPtrIn;}
52
53   // Produce R-hadrons.
54   bool produce( ColConfig& colConfig, Event& event); 
55
56   // Decay R-hadrons.
57   bool decay( Event& event); 
58
59   // Tell whether a given particle is supposed to form R-hadrons.
60   bool givesRHadron(int id);
61
62   // Tell whether any R-hadrons have been formed.
63   bool exist() {return (nRHad > 0);}
64
65   // Tell whether a R-hadron production+decay happened, and trace down.
66   int trace(int i) { for (int iR = 0; iR < nRHad; ++iR)
67     if (iBefRHad[iR] == i || iCreRHad[iR] == i) return iAftRHad[iR]; 
68     return 0;} 
69
70 private: 
71
72   // Constants: could only be changed in the code itself.
73   static const int    IDRHADSB[14], IDRHADST[14], IDRHADGO[38], NTRYMAX;
74   static const double MSAFETY, EGBORROWMAX;
75
76   // Initialization data, mainly read from Settings.
77   bool   allowRH, allowRSb, allowRSt, allowRGo, allowSomeR, setMassesRH;
78   int    idRSb, idRSt, idRGo; 
79   double maxWidthRH, probGluinoballRH, mOffsetCloudRH, mCollapseRH,
80          diquarkSpin1RH, m0Sb, m0St, m0Go;
81
82   // Current event properties.
83   vector<int>  iBefRHad, iCreRHad, iRHadron, iAftRHad;
84   vector<bool> isTriplet;
85   int          nRHad, iRHad, iBef, iSys;
86   ColSinglet*  systemPtr;
87
88   // Pointer to various information on the generation.
89   Info*          infoPtr;
90
91   // Pointer to the particle data table.
92   ParticleData*  particleDataPtr;
93
94   // Pointer to the random number generator.
95   Rndm*          rndmPtr;
96
97   // Pointers to classes for flavour and z generation.
98   StringFlav*    flavSelPtr;
99   StringZ*       zSelPtr;
100
101   // Split a system that contains both a sparticle and a junction.
102   bool splitOffJunction( ColConfig& colConfig, Event& event); 
103
104   // Open up a closed gluon/gluino loop.
105   bool openClosedLoop( ColConfig& colConfig, Event& event); 
106
107   // Split a single colour singlet that contains two sparticles.
108   bool splitSystem( ColConfig& colConfig, Event& event); 
109
110   // Produce a R-hadron from a squark.
111   bool produceSquark( ColConfig& colConfig, Event& event); 
112
113   // Produce a R-hadron from a gluino.
114   bool produceGluino( ColConfig& colConfig, Event& event); 
115
116   // Construct R-hadron code from squark and (di)quark codes.
117   int toIdWithSquark( int id1, int id2); 
118
119   // Construct squark and (di)quark codes from R-hadron code.
120   pair<int,int> fromIdWithSquark( int idRHad); 
121
122   // Construct R-hadron code from endpoints and a gluino.
123   int toIdWithGluino( int id1, int id2); 
124
125   // Construct endpoint codes from R-hadron code with a gluino.
126   pair<int,int> fromIdWithGluino( int idRHad); 
127
128   // Construct modified four-vectors to match modified masses.
129   bool newKin( Vec4 pOld1, Vec4 pOld2, double mNew1, double mNew2,
130     Vec4& pNew1, Vec4& pNew2, bool checkMargin = true); 
131   
132 };
133
134 //==========================================================================
135
136 } // end namespace Pythia8
137
138 #endif // Pythia8_RHadrons_H