Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4QParton.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29// ------------------------------------------------------------
30// GEANT 4 class implementation file
31//
32// ---------------- G4QParton ----------------
33// by Mikhail Kossov, Oct 2006.
34// class for Parton (inside a string) used by Parton String Models
35// For comparison mirror member functions are taken from G4 class:
36// G4Parton
37// ------------------------------------------------------------------------
38// Short description: The Quark-Gluon String consists of the partons, which
39// are quarks and some times gluons.
40// ------------------------------------------------------------------------
41
42//#define debug
43
44#include "G4QParton.hh"
45
46G4QParton::G4QParton() // By default creates only quarks (not di-quarks)
47{
48 // CHIPS is working only with u, d, and s quarks (SU(3)xSU(3)) (no gluons! M.K.)
49 // Random Flavor/Colour/Spin definition for default constructor (with .3 s-suppresion)
50 PGGCode=(G4int)(2.3*G4UniformRand())+1; //@@ Additional parameter of s/u (M.K.)
51 theType=1;
52#ifdef debug
53 G4cout<<"....G4QParton::DefConstructer: PDG = "<<PGGCode<<", Type="<<theType<<G4endl;
54#endif
55 // random colour (1,2,3)=(R,G,B) for quarks and (-1,-2,-3)=(aR,aG,aB) for anti-quarks
56 theColour = (G4int)(3*G4UniformRand())+1;
57 if(theColour>3) theColour = 3; // Should never happend
58 theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
59 QCont = G4QContent(0,0,0,0,0,0);
60 // Default definition (initialization)
61 theX = 0.;
62 thePosition=G4ThreeVector(0.,0.,0.);
63 theMomentum=G4LorentzVector(0.,0.,0.,0.);
64}
65
67{
68 SetPDGCode(PDG);
69 // Default definition (initialization)
70 theX = 0.;
71 thePosition=G4ThreeVector(0.,0.,0.);
72 theMomentum=G4LorentzVector(0.,0.,0.,0.);
73}
74
76{
77 PGGCode = right.PGGCode;
78 QCont = right.QCont;
79 theType = right.theType;
80 theMomentum = right.theMomentum;
81 thePosition = right.thePosition;
82 theX = right.theX;
83 theColour = right.theColour;
84 theSpinZ = right.theSpinZ;
85#ifdef debug
86 G4cout<<"G4QParton::RCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
87 <<theSpinZ<<G4endl;
88#endif
89}
90
92{
93 PGGCode = right->PGGCode;
94 QCont = right->QCont;
95 theType = right->theType;
96 theMomentum = right->theMomentum;
97 thePosition = right->thePosition;
98 theX = right->theX;
99 theColour = right->theColour;
100 theSpinZ = right->theSpinZ;
101#ifdef debug
102 G4cout<<"G4QParton::PCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
103 <<theSpinZ<<G4endl;
104#endif
105}
106
108{
109 if(this != &right) // Beware of self assignment
110 {
111 PGGCode = right.GetPDGCode();
112 QCont = right.QCont;
113 theType = right.GetType();
114 theMomentum = right.Get4Momentum();
115 thePosition = right.GetPosition();
116 theX = right.theX;
117 theColour = right.theColour;
118 theSpinZ = right.theSpinZ;
119#ifdef debug
120 G4cout<<"G4QParton::=Constructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
121 <<theSpinZ<<G4endl;
122#endif
123 }
124 return *this;
125}
126
128
129// Redefine the parton nature without changing x, 4Mom, Pos etc.
131{
132 PGGCode=PDG;
133 G4int aPDG=std::abs(PDG);
134 if(aPDG < 3304 && aPDG > 1100 && aPDG%100 < 4) // di-quark
135 {
136 theType=2;
137 G4int cPDG=aPDG/100;
138 if(PDG>0)
139 {
140 if (cPDG==11) QCont=G4QContent(2,0,0,0,0,0); // dd
141 else if(cPDG==21) QCont=G4QContent(1,1,0,0,0,0); // ud
142 else if(cPDG==22) QCont=G4QContent(0,2,0,0,0,0); // uu
143 else if(cPDG==31) QCont=G4QContent(1,0,1,0,0,0); // sd
144 else if(cPDG==32) QCont=G4QContent(0,1,1,0,0,0); // su
145 else if(cPDG==33) QCont=G4QContent(0,0,2,0,0,0); // ss
146 else
147 {
148 G4cerr<<"***G4QParton::SetPDGCode: bad di-quark PDG="<<PDG<<G4endl;
149 G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) DiQuark");
150 }
151 }
152 else
153 {
154 if (cPDG==11) QCont=G4QContent(0,0,0,2,0,0); // anti-dd
155 else if(cPDG==21) QCont=G4QContent(0,0,0,1,1,0); // anti-ud
156 else if(cPDG==22) QCont=G4QContent(0,0,0,0,2,0); // anti-uu
157 else if(cPDG==31) QCont=G4QContent(0,0,0,1,0,1); // anti-sd
158 else if(cPDG==32) QCont=G4QContent(0,0,0,0,1,1); // anti-su
159 else if(cPDG==33) QCont=G4QContent(0,0,0,0,0,2); // anti-ss
160 else
161 {
162 G4cerr<<"***G4QParton::SetPDGCode: bad anti-di-quark PDG="<<PDG<<G4endl;
163 G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) AntiDiQuark");
164 }
165 }
166 }
167 else if(aPDG && aPDG<4) // quark
168 {
169 theType=1;
170 if(PDG>0)
171 {
172 if (PDG==1) QCont=G4QContent(1,0,0,0,0,0); // d
173 else if(PDG==2) QCont=G4QContent(0,1,0,0,0,0); // u
174 else if(PDG==3) QCont=G4QContent(0,0,1,0,0,0); // s
175 else
176 {
177 G4cerr<<"***G4QParton::SetPDGCode: bad quark PDG="<<PDG<<G4endl;
178 G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Quark");
179 }
180 }
181 else
182 {
183 if (PDG==-1) QCont=G4QContent(0,0,0,1,0,0); // anti-d
184 else if(PDG==-2) QCont=G4QContent(0,0,0,0,1,0); // anti-u
185 else if(PDG==-3) QCont=G4QContent(0,0,0,0,0,1); // anti-s
186 else
187 {
188 G4cerr<<"***G4QParton::SetPDGCode: bad anti-quark PDG="<<PDG<<G4endl;
189 G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Anti-Quark");
190 }
191 }
192 }
193 else if(aPDG==9 || aPDG==21) // gluon
194 {
195 theType=0;
196 QCont=G4QContent(0,0,0,0,0,0);
197 }
198 else
199 {
200 G4cerr<<"***G4QParton::SetPDGCode: wrong gluon/quark/diquark PDG="<<PDG<<G4endl;
201 G4Exception("G4QParton::SetPDGCode:","72",FatalException,"WrongPartonPDG");
202 }
203#ifdef debug
204 G4cout<<"....G4QParton::SetPDGCode: PDG = "<<PDG<<", Type="<<theType<<G4endl;
205#endif
206 //
207 // colour by random in (1,2,3)=(R,G,B) for quarks and
208 // in (-1,-2,-3)=(Rbar,Gbar,Bbar) for anti-quarks:
209 G4int RGB=(G4int)(3*G4UniformRand())+1;
210 if(theType==1)
211 {
212 if(PDG>0) theColour = RGB;
213 else theColour =-RGB;
214 }
215 // colour by random in (-1,-2,-3)=(Rbar,Gbar,Bbar)=(GB,RB,RG) for di-quarks and
216 // in (1,2,3)=(R,G,B)=(GB,RB,RG) for anti-di-quarks:
217 else if(theType==2)
218 {
219 if(PDG>0) theColour =-RGB;
220 else theColour = RGB;
221 }
222 // ColourByRandom (-11,-12,-13,-21,...,-33)=(RRbar,RGbar,RBbar,...,BBbar) for gluons
223 else theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
224 //
225 // spin-z choosen at random from PDG-encoded spin:
226 //
227 G4double dPDGSpin=1.; // Quark 2S
228 if (theType==0) dPDGSpin=2.; // Gluon 2S
229 else if(theType==2) dPDGSpin=aPDG%10-1; // Di-quark 2S
230 theSpinZ = (G4int)((dPDGSpin+1)*G4UniformRand())-dPDGSpin/2;
231}
232
233// QGS x+/x- logic of the Energy and Pz calculation
234void G4QParton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
235{
236 G4LorentzVector a4Momentum = Get4Momentum();
237 aLightConeMomentum*=theX;
238 G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py());
239 a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum) *
240 (aDirection? 1: -1));
241 a4Momentum.setE( 0.5*(aLightConeMomentum + TransverseMass2/aLightConeMomentum));
242 Set4Momentum(a4Momentum);
243}
244
245// Reduce DiQ-aDiQ to Q-aQ (true if succeeded). General function of the QPartons operations
247{
248 G4bool result=false;
249 G4int sPDG=d1->GetPDGCode();
250 G4int nPDG=d2->GetPDGCode();
251#ifdef debug
252 G4cout<<"G4QParton::ReduceDiQADiQ: **Called** LPDG="<<sPDG<<", RPDG="<<nPDG<<G4endl;
253#endif
254 G4int qPDG=sPDG;
255 if(qPDG<-99) qPDG=(-qPDG)/100;
256 else qPDG/=100;
257 G4int dPDG=nPDG;
258 if(dPDG<-99) dPDG=(-dPDG)/100;
259 else dPDG/=100;
260 G4int L1=qPDG/10;
261 G4int L2=qPDG%10;
262 G4int R1=dPDG/10;
263 G4int R2=dPDG%10;
264 if(L1==R1 || L1==R2 || L2==R1 || L2==R2) // Annihilation condition
265 {
266 if (L1==R1)
267 {
268 if(sPDG>0) sPDG=L2;
269 else sPDG=-L2;
270 if(nPDG>0) nPDG=R2;
271 else nPDG=-R2;
272#ifdef debug
273 G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
274#endif
275 }
276 else if(L1==R2)
277 {
278 if(sPDG>0) sPDG=L2;
279 else sPDG=-L2;
280 if(nPDG>0) nPDG=R1;
281 else nPDG=-R1;
282#ifdef debug
283 G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
284#endif
285 }
286 else if(L2==R1)
287 {
288 if(sPDG>0) sPDG=L1;
289 else sPDG=-L1;
290 if(nPDG>0) nPDG=R2;
291 else nPDG=-R2;
292#ifdef debug
293 G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
294#endif
295 }
296 else //(L2==R2)
297 {
298 if(sPDG>0) sPDG=L1;
299 else sPDG=-L1;
300 if(nPDG>0) nPDG=R1;
301 else nPDG=-R1;
302#ifdef debug
303 G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
304#endif
305 }
306 d1->SetPDGCode(sPDG); // Reset the left quark
307 d2->SetPDGCode(nPDG); // Reset the right quark
308 result=true;
309#ifdef debug
310 G4cout<<"G4QParton::ReduceDiQADiQ:AfterReduction,L="<<sPDG<<",R="<<nPDG<<G4endl;
311#endif
312 }
313#ifdef debug
314 else G4cout<<"-Warning-G4QParton::ReduceDiQADiQ:DQ-aDQ reduction to Q-aQ Failed"<<G4endl;
315#endif
316 return result;
317}
@ FatalException
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:53
void SetPDGCode(G4int aPDG)
Definition: G4QParton.cc:130
void DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
Definition: G4QParton.cc:234
const G4QParton & operator=(const G4QParton &right)
Definition: G4QParton.cc:107
const G4ThreeVector & GetPosition() const
Definition: G4QParton.hh:83
const G4int & GetType() const
Definition: G4QParton.hh:88
G4int GetPDGCode() const
Definition: G4QParton.hh:81
const G4LorentzVector & Get4Momentum() const
Definition: G4QParton.hh:84
void Set4Momentum(const G4LorentzVector &aMomentum)
Definition: G4QParton.hh:75
G4bool ReduceDiQADiQ(G4QParton *d1, G4QParton *d2)
Definition: G4QParton.cc:246
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
T sqr(const T &x)
Definition: templates.hh:145