source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QParton.cc @ 1071

Last change on this file since 1071 was 1055, checked in by garnier, 15 years ago

maj sur la beta de geant 4.9.3

File size: 6.4 KB
Line 
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: G4QParton.cc,v 1.4 2009/02/23 09:49:24 mkossov Exp $
28// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
29//
30// ------------------------------------------------------------
31//      GEANT 4 class implementation file
32//
33//      ---------------- G4QParton ----------------
34//             by Mikhail Kossov, Oct 2006.
35//   class for Parton (inside a string) used by Parton String Models
36//   For comparison mirror member functions are taken from G4 class:
37//   G4Parton
38// ------------------------------------------------------------------------
39// Short description: The Quark-Gluon String consists of the partons, which
40// are quarks and some times gluons.
41// ------------------------------------------------------------------------
42#include "G4QParton.hh"
43
44G4QParton::G4QParton(G4int PDGcode)
45{
46  PDGencoding=PDGcode;
47  theX = 0;
48  theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding);
49       G4int aPDG=std::abs(PDGcode);
50  //___________quarks__ 2 possible codes for gluons _ Condition for di-quarks
51  if(!aPDG || (aPDG>3 && PDGcode!=9 && PDGcode!=21 &&
52          (aPDG>3303||aPDG<1103||aPDG%100>3)) || theDefinition==0)
53  {
54    G4cerr<<"***G4QParton::Constructor: wrong quark/diquark PDG="<<PDGcode<<G4endl;
55         G4Exception("G4QParton::Constructor:","72",FatalException,"WrongPartonPDG");
56  }
57  //
58  // colour by random in (1,2,3)=(R,G,B) for quarks and
59  //                  in (-1,-2,-3)=(Rbar,Gbar,Bbar) for anti-quarks:
60       G4int RGB=(G4int)(3*G4UniformRand())+1;
61  G4String name=theDefinition->GetParticleType();
62  if(name == "quarks")
63  {
64    if(PDGcode>0) theColour = RGB;
65    else          theColour =-RGB;
66  }
67  // colour by random in (-1,-2,-3)=(Rbar,Gbar,Bbar)=(GB,RB,RG) for di-quarks and
68  //                  in (1,2,3)=(R,G,B)=(GB,RB,RG) for anti-di-quarks:
69  else if(name == "diquarks")
70  {
71    if(PDGcode>0) theColour =-RGB;
72    else          theColour = RGB;
73  }
74  // ColourByRandom (-11,-12,-13,-21,...,-33)=(RRbar,RGbar,RBbar,...,BBbar) for gluons
75  else if(name == "gluons") theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
76  else
77  {
78    G4cerr<<"***G4QParton::Constructor: not quark/diquark/gluon = "
79          <<theDefinition->GetParticleType()<<G4endl;
80    G4Exception("G4QParton::Constructor:","72",FatalException,"WrongParton");
81  }
82  // isospin-z from PDG-encoded isospin-z for
83  // quarks, anti-quarks, di-quarks, and anti-di-quarks:
84  if(name == "quarks" || name == "diquarks") theIsoSpinZ = theDefinition->GetPDGIsospin3();
85       // isospin-z choosen at random from PDG-encoded isospin for gluons (should be zero):
86  else
87  {
88    G4int thisPDGiIsospin=theDefinition->GetPDGiIsospin();
89    if (thisPDGiIsospin == 0) theIsoSpinZ = 0;
90         //@@ ? M.K.
91    else theIsoSpinZ=((G4int)((thisPDGiIsospin+1)*G4UniformRand())) - thisPDGiIsospin*0.5;
92  }
93  //
94  // spin-z choosen at random from PDG-encoded spin:
95  //
96  G4int thisPDGiSpin=theDefinition->GetPDGiSpin();
97  if(thisPDGiSpin == 0) theSpinZ = 0;
98  else theSpinZ = (G4int)((thisPDGiSpin+1)*G4UniformRand())-thisPDGiSpin*0.5;;
99}
100
101G4QParton::G4QParton(const G4QParton &right)
102{
103  PDGencoding = right.PDGencoding;
104  theMomentum = right.theMomentum;
105  thePosition = right.thePosition;
106  theX = right.theX;
107  theDefinition = right.theDefinition;
108  theColour = right.theColour;
109  theIsoSpinZ = right.theIsoSpinZ;
110  theSpinZ = right.theSpinZ;
111}
112
113G4QParton::G4QParton(const G4QParton* right)
114{
115  PDGencoding   = right->PDGencoding;
116  theMomentum   = right->theMomentum;
117  thePosition   = right->thePosition;
118  theX          = right->theX;
119  theDefinition = right->theDefinition;
120  theColour     = right->theColour;
121  theIsoSpinZ   = right->theIsoSpinZ;
122  theSpinZ      = right->theSpinZ;
123}
124
125const G4QParton& G4QParton::operator=(const G4QParton &right)
126{
127  if(this != &right)                          // Beware of self assignment
128  {
129    PDGencoding=right.GetPDGCode();
130    theMomentum=right.Get4Momentum();
131    thePosition=right.GetPosition();
132    theX = right.theX;
133    theDefinition = right.theDefinition;
134    theColour = right.theColour;
135    theIsoSpinZ = right.theIsoSpinZ;
136    theSpinZ = right.theSpinZ; 
137  }
138  return *this;
139}
140
141G4QParton::~G4QParton()
142{
143  //G4cout << "G4QParton::~G4QParton(): this = "<<this <<G4endl;
144  //G4cout << "break here"<<this <<G4endl;
145}
146
147void G4QParton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
148{
149  G4double Mass = GetMass();
150  G4LorentzVector a4Momentum = Get4Momentum();
151  aLightConeMomentum*=theX;
152  G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py()) + sqr(Mass);
153  a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum) *
154                                                                      (aDirection? 1: -1));
155  a4Momentum.setE( 0.5*(aLightConeMomentum + TransverseMass2/aLightConeMomentum));
156  Set4Momentum(a4Momentum);
157} 
Note: See TracBrowser for help on using the repository browser.