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