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.3 2006/12/12 11:02:22 mkossov Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
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 | |
---|
40 | #include "G4QParton.hh" |
---|
41 | |
---|
42 | G4QParton::G4QParton(G4int PDGcode) |
---|
43 | { |
---|
44 | PDGencoding=PDGcode; |
---|
45 | theX = 0; |
---|
46 | theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding); |
---|
47 | G4int aPDG=std::abs(PDGcode); |
---|
48 | //___________quarks__ 2 possible codes for gluons _ Condition for di-quarks |
---|
49 | if(!aPDG || (aPDG>3 && PDGcode!=9 && PDGcode!=21 && (aPDG>3303||aPDG<1103||aPDG%100>3)) |
---|
50 | || theDefinition==0) |
---|
51 | { |
---|
52 | G4cerr<<"***G4QParton::Constructor: wrong quark/diquark PDG="<<PDGcode<<G4endl; |
---|
53 | G4Exception("G4QParton::Constructor:","72",FatalException,"WrongPartonPDG"); |
---|
54 | } |
---|
55 | // |
---|
56 | // colour by random in (1,2,3)=(R,G,B) for quarks and |
---|
57 | // in (-1,-2,-3)=(Rbar,Gbar,Bbar) for anti-quarks: |
---|
58 | G4int RGB=(G4int)(3*G4UniformRand())+1; |
---|
59 | G4String name=theDefinition->GetParticleType(); |
---|
60 | if(name == "quarks") |
---|
61 | { |
---|
62 | if(PDGcode>0) theColour = RGB; |
---|
63 | else theColour =-RGB; |
---|
64 | } |
---|
65 | // colour by random in (-1,-2,-3)=(Rbar,Gbar,Bbar)=(GB,RB,RG) for di-quarks and |
---|
66 | // in (1,2,3)=(R,G,B)=(GB,RB,RG) for anti-di-quarks: |
---|
67 | else if(name == "diquarks") |
---|
68 | { |
---|
69 | if(PDGcode>0) theColour =-RGB; |
---|
70 | else theColour = RGB; |
---|
71 | } |
---|
72 | // colour by random in (-11,-12,-13,-21,...,-33)=(RRbar,RGbar,RBbar,...,BBbar) for gluons |
---|
73 | else if(name == "gluons") theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1); |
---|
74 | else |
---|
75 | { |
---|
76 | G4cerr<<"***G4QParton::Constructor: not quark/diquark/gluon = " |
---|
77 | <<theDefinition->GetParticleType()<<G4endl; |
---|
78 | G4Exception("G4QParton::Constructor:","72",FatalException,"WrongParton"); |
---|
79 | } |
---|
80 | // isospin-z from PDG-encoded isospin-z for |
---|
81 | // quarks, anti-quarks, di-quarks, and anti-di-quarks: |
---|
82 | if (name == "quarks" || name == "diquarks")theIsoSpinZ = theDefinition->GetPDGIsospin3(); |
---|
83 | // isospin-z choosen at random from PDG-encoded isospin for gluons (should be zero): |
---|
84 | else |
---|
85 | { |
---|
86 | G4int thisPDGiIsospin=theDefinition->GetPDGiIsospin(); |
---|
87 | if (thisPDGiIsospin == 0) theIsoSpinZ = 0; |
---|
88 | //@@ ? M.K. |
---|
89 | else theIsoSpinZ = ((G4int)((thisPDGiIsospin+1)*G4UniformRand()))-thisPDGiIsospin*0.5; |
---|
90 | } |
---|
91 | // |
---|
92 | // spin-z choosen at random from PDG-encoded spin: |
---|
93 | // |
---|
94 | G4int thisPDGiSpin=theDefinition->GetPDGiSpin(); |
---|
95 | if(thisPDGiSpin == 0) theSpinZ = 0; |
---|
96 | else theSpinZ = (G4int)((thisPDGiSpin+1)*G4UniformRand())-thisPDGiSpin*0.5;; |
---|
97 | } |
---|
98 | |
---|
99 | G4QParton::G4QParton(const G4QParton &right) |
---|
100 | { |
---|
101 | PDGencoding = right.PDGencoding; |
---|
102 | theMomentum = right.theMomentum; |
---|
103 | thePosition = right.thePosition; |
---|
104 | theX = right.theX; |
---|
105 | theDefinition = right.theDefinition; |
---|
106 | theColour = right.theColour; |
---|
107 | theIsoSpinZ = right.theIsoSpinZ; |
---|
108 | theSpinZ = right.theSpinZ; |
---|
109 | } |
---|
110 | |
---|
111 | G4QParton::G4QParton(const G4QParton* right) |
---|
112 | { |
---|
113 | PDGencoding = right->PDGencoding; |
---|
114 | theMomentum = right->theMomentum; |
---|
115 | thePosition = right->thePosition; |
---|
116 | theX = right->theX; |
---|
117 | theDefinition = right->theDefinition; |
---|
118 | theColour = right->theColour; |
---|
119 | theIsoSpinZ = right->theIsoSpinZ; |
---|
120 | theSpinZ = right->theSpinZ; |
---|
121 | } |
---|
122 | |
---|
123 | const G4QParton& G4QParton::operator=(const G4QParton &right) |
---|
124 | { |
---|
125 | if(this != &right) // Beware of self assignment |
---|
126 | { |
---|
127 | PDGencoding=right.GetPDGCode(); |
---|
128 | theMomentum=right.Get4Momentum(); |
---|
129 | thePosition=right.GetPosition(); |
---|
130 | theX = right.theX; |
---|
131 | theDefinition = right.theDefinition; |
---|
132 | theColour = right.theColour; |
---|
133 | theIsoSpinZ = right.theIsoSpinZ; |
---|
134 | theSpinZ = right.theSpinZ; |
---|
135 | } |
---|
136 | return *this; |
---|
137 | } |
---|
138 | |
---|
139 | G4QParton::~G4QParton() |
---|
140 | { |
---|
141 | // cout << "G4QParton::~G4QParton(): this = "<<this <<endl; |
---|
142 | // cout << "break here"<<this <<endl; |
---|
143 | } |
---|
144 | |
---|
145 | void G4QParton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection) |
---|
146 | { |
---|
147 | G4double Mass = GetMass(); |
---|
148 | G4LorentzVector a4Momentum = Get4Momentum(); |
---|
149 | aLightConeMomentum*=theX; |
---|
150 | G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py()) + sqr(Mass); |
---|
151 | a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum)*(aDirection? 1: -1)); |
---|
152 | a4Momentum.setE( 0.5*(aLightConeMomentum + TransverseMass2/aLightConeMomentum)); |
---|
153 | Set4Momentum(a4Momentum); |
---|
154 | } |
---|