Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4DiffractiveSplitableHadron.cc,v 1.3 2003/11/03 17:54:53 hpw Exp $ >> 25 // GEANT4 tag $Name: geant4-06-00 $ 27 // 26 // 28 27 29 // ------------------------------------------- 28 // ------------------------------------------------------------ 30 // GEANT 4 class implementation file 29 // GEANT 4 class implementation file 31 // 30 // 32 // ---------------- G4DiffractiveSplitabl 31 // ---------------- G4DiffractiveSplitableHadron---------------- 33 // by Gunter Folger, August 1998. 32 // by Gunter Folger, August 1998. 34 // class splitting an interacting partic 33 // class splitting an interacting particle. Used by FTF String Model. 35 // ------------------------------------------- 34 // ------------------------------------------------------------ 36 35 37 #include "G4DiffractiveSplitableHadron.hh" 36 #include "G4DiffractiveSplitableHadron.hh" 38 37 39 #include "G4ParticleDefinition.hh" 38 #include "G4ParticleDefinition.hh" 40 #include "Randomize.hh" 39 #include "Randomize.hh" 41 40 >> 41 G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron() 42 42 43 //============================================ << 44 << 45 G4DiffractiveSplitableHadron::G4DiffractiveSpl << 46 { 43 { 47 PartonIndex = -1; << 48 G4LorentzVector tmp=G4LorentzVector(0.,0.,0. << 49 Parton[0] = new G4Parton( 1 ); << 50 Parton[1] = new G4Parton(-1 ); << 51 << 52 Parton[0]->Set4Momentum(tmp); Parton[1]->Set << 53 } 44 } 54 45 55 << 46 G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4ReactionProduct & aPrimary) 56 //============================================ << 47 : G4VSplitableHadron(aPrimary) 57 << 58 G4DiffractiveSplitableHadron::G4DiffractiveSpl << 59 G4VSplitableHadron( aPrimary ) << 60 { 48 { 61 PartonIndex = -1; << 49 PartonIndex=-2; 62 Parton[0] = nullptr; << 50 Parton[0]=NULL; 63 Parton[1] = nullptr; << 64 } 51 } 65 52 66 << 53 G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4Nucleon & aNucleon) 67 //============================================ << 54 : G4VSplitableHadron(aNucleon) 68 << 69 G4DiffractiveSplitableHadron::G4DiffractiveSpl << 70 G4VSplitableHadron( aNucleon ) << 71 { 55 { 72 PartonIndex = -1; << 56 PartonIndex=-2; 73 Parton[0] = nullptr; << 57 Parton[0]=NULL; 74 Parton[1] = nullptr; << 75 } 58 } 76 59 77 << 60 G4DiffractiveSplitableHadron::G4DiffractiveSplitableHadron(const G4VKineticNucleon * aNucleon) 78 //============================================ << 61 : G4VSplitableHadron(aNucleon) 79 << 80 G4DiffractiveSplitableHadron::G4DiffractiveSpl << 81 G4VSplitableHadron( aNucleon ) << 82 { 62 { 83 PartonIndex = -1; << 63 PartonIndex=-2; 84 Parton[0] = nullptr; << 64 Parton[0]=NULL; 85 Parton[1] = nullptr; << 86 } << 87 << 88 << 89 //============================================ << 90 << 91 G4DiffractiveSplitableHadron::~G4DiffractiveSp << 92 << 93 << 94 //============================================ << 95 << 96 void G4DiffractiveSplitableHadron::SplitUp() { << 97 << 98 if ( IsSplit() ) return; << 99 Splitting(); << 100 // Split once only... << 101 if ( Parton[0] != nullptr ) return; << 102 << 103 // flavours of quark ends << 104 G4int PDGcode = GetDefinition()->GetPDGEncod << 105 G4int stringStart, stringEnd; << 106 ChooseStringEnds( PDGcode, &stringStart, &st << 107 << 108 Parton[0] = new G4Parton( stringStart ); << 109 Parton[1] = new G4Parton( stringEnd ); << 110 << 111 G4LorentzVector tmp=G4LorentzVector(0.,0.,0. << 112 Parton[0]->Set4Momentum(tmp); Parton[1]->Set << 113 << 114 /* // << 115 if ( G4UniformRand() < 1.75 ) { //0.75 << 116 Parton[0] = new G4Parton( stringStart ); << 117 Parton[1] = new G4Parton( stringEnd ); << 118 } else { << 119 Parton[0] = new G4Parton( stringEnd ); << 120 Parton[1] = new G4Parton( stringStart ); << 121 } << 122 */ << 123 << 124 PartonIndex = -1; << 125 } << 126 << 127 << 128 //============================================ << 129 << 130 G4Parton* G4DiffractiveSplitableHadron::GetNex << 131 ++PartonIndex; << 132 if ( PartonIndex > 1 || PartonIndex < 0 ) << 133 G4int PartonInd( PartonIndex ); << 134 if ( PartonIndex == 1 ) PartonIndex = -1; << 135 return Parton[ PartonInd ]; << 136 } 65 } 137 66 >> 67 G4DiffractiveSplitableHadron::~G4DiffractiveSplitableHadron() >> 68 {} 138 69 139 //============================================ << 70 const G4DiffractiveSplitableHadron & G4DiffractiveSplitableHadron::operator=(const G4DiffractiveSplitableHadron &) 140 << 71 { 141 G4Parton* G4DiffractiveSplitableHadron::GetNex << 72 throw G4HadronicException(__FILE__, __LINE__, "G4DiffractiveSplitableHadron::operator= meant to not be accessable"); 142 ++PartonIndex; << 73 return *this; 143 if ( PartonIndex > 1 || PartonIndex < 0 ) << 144 G4int PartonInd( PartonIndex ); << 145 if ( PartonIndex == 1 ) PartonIndex = -1; << 146 return Parton[ PartonInd ]; << 147 } 74 } 148 75 >> 76 void G4DiffractiveSplitableHadron::SplitUp() >> 77 { >> 78 if (IsSplit()) return; >> 79 Splitting(); >> 80 // Split once only... >> 81 if (Parton[0] != NULL) return; 149 82 150 //============================================ << 83 // flavours of quark ends 151 << 84 152 void G4DiffractiveSplitableHadron::SetFirstPar << 85 G4int PDGcode=GetDefinition()->GetPDGEncoding(); 153 delete Parton[0]; << 86 G4int stringStart, stringEnd; 154 Parton[0] = new G4Parton( PDGcode ); << 87 ChooseStringEnds(PDGcode, &stringStart,&stringEnd); 155 G4LorentzVector tmp=G4LorentzVector(0.,0.,0. << 88 156 Parton[0]->Set4Momentum(tmp); << 89 Parton[0] = new G4Parton(stringStart); >> 90 Parton[1] = new G4Parton(stringEnd); >> 91 PartonIndex=-1; >> 92 157 } 93 } 158 94 159 << 95 G4Parton * G4DiffractiveSplitableHadron::GetNextParton() 160 //============================================ << 96 { 161 << 97 ++PartonIndex; 162 void G4DiffractiveSplitableHadron::SetSecondPa << 98 if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL; 163 delete Parton[1]; << 99 164 Parton[1] = new G4Parton( PDGcode ); << 100 return Parton[PartonIndex]; 165 G4LorentzVector tmp=G4LorentzVector(0.,0.,0. << 166 Parton[1]->Set4Momentum(tmp); << 167 } 101 } 168 102 169 << 103 G4Parton * G4DiffractiveSplitableHadron::GetNextAntiParton() 170 //============================================ << 104 { 171 << 105 return NULL; // to be looked at @@ 172 void G4DiffractiveSplitableHadron::ChooseStrin << 173 << 174 G4int absPDGcode = std::abs( PDGcode ); << 175 << 176 if ( absPDGcode < 1000 ) { //-------------- << 177 G4int heavy(0), light(0); << 178 if (!((absPDGcode == 111)||(absPDGcode == << 179 { // Ordinary mes << 180 heavy = absPDGcode/100; << 181 light = (absPDGcode % 100)/10; << 182 //G4int anti = std::pow( -1 , std::max( h << 183 G4int anti = 1 - 2*( std::max( heavy, lig << 184 if (PDGcode < 0 ) anti *= -1; << 185 heavy *= anti; << 186 light *= -1 * anti; << 187 } << 188 else << 189 { // Pi0, Eta, Eta << 190 if ( G4UniformRand() < 0.5 ) {heavy = 1; << 191 else {heavy = 2; << 192 } << 193 if ( G4UniformRand() < 0.5 ) { << 194 *aEnd = heavy; << 195 *bEnd = light; << 196 } else { << 197 *aEnd = light; << 198 *bEnd = heavy; << 199 } << 200 } else { //-------------- << 201 G4int j1000 = PDGcode/1000; << 202 G4int j100 = (PDGcode % 1000)/100; << 203 G4int j10 = (PDGcode % 100)/10; << 204 << 205 if ( absPDGcode > 4000 ) { << 206 *aEnd = j10; << 207 if ( G4UniformRand() > 0.25 ) { << 208 *bEnd = Diquark( j1000, j100, 0 ); << 209 } else { << 210 *bEnd = Diquark( j1000, j100, 1 ); << 211 } << 212 return; << 213 } << 214 << 215 G4double SuppresUUDDSS=1.0/2.0; << 216 if ((j1000 == j100) && (j1000 == j10)) Sup << 217 << 218 const G4int maxNumberOfLoops = 1000; << 219 G4int loopCounter = 0; << 220 do << 221 { << 222 G4double random = G4UniformRand(); << 223 << 224 if (random < 0.33333) << 225 { << 226 if (( j100 == j10 ) && ( G4UniformRand << 227 *aEnd = j1000; << 228 if ( j100 == j10 ) {*bEnd << 229 else << 230 if ( G4UniformRand() > 0.25) {*bEnd << 231 else {*bEnd = << 232 break; << 233 } << 234 else if (random < 0.66667) << 235 { << 236 if (( j1000 == j10 ) && ( G4UniformRan << 237 *aEnd = j100; << 238 if ( j1000 == j10 ) {*bEnd << 239 else << 240 if ( G4UniformRand() > 0.25) {*bEnd << 241 else {*bEnd = << 242 break; << 243 } << 244 else << 245 { << 246 if (( j1000 == j100 ) && ( G4UniformRa << 247 *aEnd = j10; << 248 if ( j1000 == j100 ) {*bEnd << 249 else << 250 if ( G4UniformRand() > 0.25) {*bEnd << 251 else {*bEnd = << 252 break; << 253 } << 254 } while ( (true) && << 255 ++loopCounter < maxNumberOfLoops << 256 if ( loopCounter >= maxNumberOfLoops ) { << 257 *aEnd = j10; *bEnd = Diquark( j1000, j10 << 258 } << 259 << 260 } << 261 } 106 } 262 107 >> 108 // >> 109 //----------------------- Implementation-------------------------- >> 110 // 263 111 264 //============================================ << 112 void G4DiffractiveSplitableHadron::ChooseStringEnds(G4int PDGcode,G4int * aEnd, G4int * bEnd) const 265 << 113 { 266 G4int G4DiffractiveSplitableHadron::Diquark( G << 114 const G4double udspin1= 1./6.; 267 G4int diquarkPDG = std::max( std::abs( aquar << 115 const G4double uuspin1= 1./3.; 268 std::min( std::abs( aquar << 116 // const G4double udspin0= 1./2.; //@ 269 2*Spin + 1; << 117 270 return ( aquark > 0 && bquark > 0 ) ? diqu << 118 G4int absPDGcode=abs(PDGcode); >> 119 >> 120 if ( absPDGcode < 1000 ) //-------------------- Meson ------------- >> 121 { >> 122 G4int heavy= absPDGcode/ 100; >> 123 G4int light= (absPDGcode %100)/10; >> 124 >> 125 // G4int anti= pow(-1 , std::max( heavy, light)); >> 126 G4int anti= 1 -2 * ( std::max( heavy, light ) % 2 ); >> 127 if (PDGcode < 0 ) anti *=-1; >> 128 >> 129 heavy *= anti; >> 130 light *= -1 * anti; >> 131 >> 132 if ( G4UniformRand() < 0.5 ) >> 133 { >> 134 *aEnd=heavy; >> 135 *bEnd=light; >> 136 } >> 137 else >> 138 { >> 139 *aEnd=light; >> 140 *bEnd=heavy; >> 141 } >> 142 } >> 143 else //-------------------- Barion -------------- >> 144 { >> 145 G4int j1000 = PDGcode/ 1000; >> 146 G4int j100 = (PDGcode % 1000) / 100; >> 147 G4int j10 = (PDGcode % 100) / 10; >> 148 >> 149 G4double random= G4UniformRand(); >> 150 >> 151 >> 152 if ( abs(j100) >= abs(j10) ) >> 153 { >> 154 if ( random < udspin1 ) >> 155 { >> 156 *aEnd=j1000; >> 157 *bEnd= Diquark( j100, j10, 1); >> 158 } else if ( random < (udspin1 + uuspin1) ) >> 159 { >> 160 *aEnd= j10; >> 161 *bEnd= Diquark( j1000, j100, 1); >> 162 } else >> 163 { >> 164 *aEnd=j100; >> 165 // Careful, there is no diquark q1=q2, (q1 q2)0, >> 166 // possible for Omega- >> 167 *bEnd= Diquark( j1000, j10, j1000 != j100 ? 0 : 1); >> 168 } >> 169 } else >> 170 { >> 171 // Lambda-like hadrons have two lightest quarks in spin 0 >> 172 if ( random < udspin1 ) >> 173 { >> 174 *aEnd=j1000; >> 175 // as above, but with charmed barions >> 176 *bEnd= Diquark( j100, j10, j100 != j10 ? 0 : 10); >> 177 } else if ( random < (udspin1 + uuspin1) ) >> 178 { >> 179 *aEnd= j10; >> 180 *bEnd= Diquark( j1000, j100, 1); >> 181 } else >> 182 { >> 183 *aEnd=j100; >> 184 *bEnd= Diquark( j1000, j10, 1); >> 185 } >> 186 >> 187 } >> 188 >> 189 } >> 190 >> 191 >> 192 271 } 193 } 272 194 >> 195 G4int G4DiffractiveSplitableHadron::Diquark(G4int aquark,G4int bquark,G4int Spin) const >> 196 { >> 197 G4int diquarkPDG; >> 198 >> 199 diquarkPDG = std::max( abs(aquark), abs(bquark) )*1000 + >> 200 std::min( abs(aquark), abs(bquark) )*100 + >> 201 2*Spin + 1; >> 202 return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG; >> 203 } 273 204