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: G4SingleDiffractiveExcitation.cc 106980 2017-10-31 09:02:49Z gcosmo $ 27 // ------------------------------------------- 28 // ------------------------------------------------------------ 28 // GEANT 4 class implemetation file 29 // GEANT 4 class implemetation file 29 // 30 // 30 // ---------------- G4SingleDiffractiveEx 31 // ---------------- G4SingleDiffractiveExcitation -------------- 31 // by Gunter Folger, October 1998. 32 // by Gunter Folger, October 1998. 32 // diffractive Excitation used by strings 33 // diffractive Excitation used by strings models 33 // Take a projectile and a target 34 // Take a projectile and a target 34 // excite the projectile and target 35 // excite the projectile and target 35 // ------------------------------------------- 36 // ------------------------------------------------------------ 36 37 37 #include "G4SingleDiffractiveExcitation.hh" 38 #include "G4SingleDiffractiveExcitation.hh" 38 #include "globals.hh" 39 #include "globals.hh" 39 #include "G4PhysicalConstants.hh" 40 #include "G4PhysicalConstants.hh" 40 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" 41 #include "Randomize.hh" 42 #include "Randomize.hh" 42 #include "G4LorentzRotation.hh" 43 #include "G4LorentzRotation.hh" 43 #include "G4ThreeVector.hh" 44 #include "G4ThreeVector.hh" 44 #include "G4ParticleDefinition.hh" 45 #include "G4ParticleDefinition.hh" 45 #include "G4VSplitableHadron.hh" 46 #include "G4VSplitableHadron.hh" 46 #include "G4ExcitedString.hh" 47 #include "G4ExcitedString.hh" 47 48 48 #include "G4Log.hh" 49 #include "G4Log.hh" 49 #include "G4Pow.hh" << 50 50 51 //#define debugSingleDiffraction << 52 51 53 G4SingleDiffractiveExcitation::G4SingleDiffrac << 52 G4SingleDiffractiveExcitation::G4SingleDiffractiveExcitation(G4double sigmaPt, G4double minextraMass,G4double x0mass) >> 53 : widthOfPtSquare(-2*sqr(sigmaPt)) , minExtraMass(minextraMass), minmass(x0mass) >> 54 {} 54 55 55 G4SingleDiffractiveExcitation::~G4SingleDiffra << 56 G4SingleDiffractiveExcitation::~G4SingleDiffractiveExcitation() >> 57 {} 56 58 57 G4bool G4SingleDiffractiveExcitation:: 59 G4bool G4SingleDiffractiveExcitation:: 58 ExciteParticipants( G4VSplitableHadron *projec << 60 ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) const 59 G4bool ProjectileDiffracti << 60 { 61 { 61 #ifdef debugSingleDiffraction << 62 G4cout<<G4endl<<"G4SingleDiffractiveExcita << 63 #endif << 64 << 65 G4LorentzVector Pprojectile=projectile->Get4 62 G4LorentzVector Pprojectile=projectile->Get4Momentum(); 66 G4double Mprojectile = projectile->GetDef << 63 G4double Mprojectile2=sqr(projectile->GetDefinition()->GetPDGMass() + minExtraMass); 67 G4double Mprojectile2=sqr(projectile->GetDef << 68 64 69 G4LorentzVector Ptarget=target->Get4Momentum 65 G4LorentzVector Ptarget=target->Get4Momentum(); 70 G4double Mtarget = target->GetDefinition( << 66 G4double Mtarget2=sqr(target->GetDefinition()->GetPDGMass() + minExtraMass); 71 G4double Mtarget2=sqr(target->GetDefinition( << 67 //G4cout << "E proj, target :" << Pprojectile.e() << ", " << Ptarget.e() << G4endl; >> 68 >> 69 G4bool KeepProjectile= G4UniformRand() > 0.5; 72 70 73 #ifdef debugSingleDiffraction << 71 // reset the min.mass of the non diffractive particle to its value, ( minus a bit for rounding...) 74 G4cout<<"Proj Targ "<<projectile->GetDefin << 72 if ( KeepProjectile ) 75 G4cout<<"Pr Tr 4-Mom "<<Pprojectile<<" "<< << 73 { 76 <<" "<<Ptarget <<" "<< << 74 //cout << " Projectile fix" << G4endl; 77 #endif << 75 Mprojectile2 = sqr(projectile->GetDefinition()->GetPDGMass() * (1-perCent) ); 78 << 76 } else { 79 G4LorentzVector Psum=Pprojectile+Ptarget; << 77 //cout << " Target fix" << G4endl; 80 G4double SqrtS=Psum.mag(); << 78 Mtarget2=sqr(target->GetDefinition()->GetPDGMass() * (1-perCent) ); 81 G4double S =Psum.mag2(); << 82 << 83 #ifdef debugSingleDiffraction << 84 G4cout<<"SqrtS-Mprojectile-Mtarget "<<Sqrt << 85 <<" "<<SqrtS-Mprojectile-Mtarget<<G4 << 86 #endif << 87 if (SqrtS-Mprojectile-Mtarget <= 250.0*MeV) << 88 #ifdef debugSingleDiffraction << 89 G4cerr<<"Projectile: "<<projectile->GetDef << 90 <<Pprojectile<<" "<<Pprojectile.mag( << 91 G4cerr<<"Target: "<<target->GetDefinit << 92 <<Ptarget<<" "<<Ptarget.mag()<<G4end << 93 G4cerr<<"sqrt(S) = "<<SqrtS<<" Mp + Mt = " << 94 #endif << 95 return true; << 96 } 79 } 97 80 >> 81 // Transform momenta to cms and then rotate parallel to z axis; >> 82 >> 83 G4LorentzVector Psum; >> 84 Psum=Pprojectile+Ptarget; >> 85 98 G4LorentzRotation toCms(-1*Psum.boostVector( 86 G4LorentzRotation toCms(-1*Psum.boostVector()); 99 87 100 G4LorentzVector Ptmp=toCms*Pprojectile; 88 G4LorentzVector Ptmp=toCms*Pprojectile; 101 89 102 if ( Ptmp.pz() <= 0. ) 90 if ( Ptmp.pz() <= 0. ) 103 { 91 { 104 // "String" moving backwards in CMS, abor 92 // "String" moving backwards in CMS, abort collision !! 105 // G4cout << " abort Collision!! " << 93 //G4cout << " abort Collision!! " << G4endl; 106 return false; 94 return false; 107 } 95 } 108 96 109 toCms.rotateZ(-1*Ptmp.phi()); 97 toCms.rotateZ(-1*Ptmp.phi()); 110 toCms.rotateY(-1*Ptmp.theta()); 98 toCms.rotateY(-1*Ptmp.theta()); 111 99 >> 100 //G4cout << "Pprojectile be4 boost " << Pprojectile << G4endl; >> 101 //G4cout << "Ptarget be4 boost : " << Ptarget << G4endl; >> 102 112 G4LorentzRotation toLab(toCms.inverse()); 103 G4LorentzRotation toLab(toCms.inverse()); 113 104 114 Pprojectile.transform(toCms); 105 Pprojectile.transform(toCms); 115 Ptarget.transform(toCms); 106 Ptarget.transform(toCms); 116 #ifdef debugSingleDiffraction << 117 G4cout << "Pprojectile in CMS " << Pproje << 118 G4cout << "Ptarget in CMS " << Ptarge << 119 #endif << 120 G4double maxPtSquare=sqr(Ptarget.pz()); << 121 << 122 G4double ProjectileMinDiffrMass(0.), TargetM << 123 G4double AveragePt2(0.); << 124 G4int absPDGcode=std::abs(projectile->GetDef << 125 << 126 if ( ProjectileDiffraction ) { << 127 if ( absPDGcode > 1000 ) << 128 { << 129 if ( absPDGcode > 4000 && absPDGcode < 6 << 130 { << 131 ProjectileMinDiffrMass = projectile->G << 132 AveragePt2 = 0.3; << 133 } << 134 else << 135 { << 136 ProjectileMinDiffrMass = 1.16; << 137 AveragePt2 = 0.3; << 138 } << 139 } << 140 else if( absPDGcode == 211 || absPDGcode = << 141 { << 142 ProjectileMinDiffrMass = 1.0; << 143 AveragePt2 = 0.3; << 144 } << 145 else if( absPDGcode == 321 || absPDGcode = << 146 { << 147 ProjectileMinDiffrMass = 1.1; << 148 AveragePt2 = 0.3; << 149 } << 150 else if( absPDGcode == 22) << 151 { << 152 ProjectileMinDiffrMass = 0.25; << 153 AveragePt2 = 0.36; << 154 } << 155 else if( absPDGcode > 400 && absPDGcode < << 156 { << 157 ProjectileMinDiffrMass = projectile->Get << 158 AveragePt2 = 0.3; << 159 } << 160 else << 161 { << 162 ProjectileMinDiffrMass = 1.1; << 163 AveragePt2 = 0.3; << 164 }; << 165 << 166 ProjectileMinDiffrMass = ProjectileMinDiff << 167 Mprojectile2=sqr(ProjectileMinDiffrMass); << 168 } << 169 else << 170 { << 171 TargetMinDiffrMass = 1.16*GeV; << 172 Mtarget2 = sqr( TargetMinDiffrMass) ; << 173 AveragePt2 = 0.3; << 174 } // end of if ( ProjectileDiffraction ) << 175 << 176 AveragePt2 = AveragePt2 * GeV*GeV; << 177 << 178 G4double Pt2, PZcms, PZcms2; << 179 G4double ProjMassT2, ProjMassT; << 180 G4double TargMassT2, TargMassT; << 181 G4double PMinusMin, PMinusMax; << 182 G4double TPlusMin, TPlusMax; << 183 G4double PMinusNew, PPlusNew, TPlusNew, TMin << 184 107 185 G4LorentzVector Qmomentum; 108 G4LorentzVector Qmomentum; 186 G4double Qminus, Qplus; << 187 << 188 G4int whilecount=0; 109 G4int whilecount=0; 189 do { 110 do { 190 whilecount++; << 111 // Generate pt >> 112 >> 113 G4double maxPtSquare=sqr(Ptarget.pz()); >> 114 if (whilecount++ >= 500 && (whilecount%100)==0) >> 115 //G4cout << "G4SingleDiffractiveExcitation::ExciteParticipants possibly looping" >> 116 // << ", loop count/ maxPtSquare : " >> 117 // << whilecount << " / " << maxPtSquare << G4endl; 191 118 192 if (whilecount > 1000 ) 119 if (whilecount > 1000 ) 193 { 120 { 194 Qmomentum=G4LorentzVector(0.,0.,0.,0.); 121 Qmomentum=G4LorentzVector(0.,0.,0.,0.); >> 122 //G4cout << "G4SingleDiffractiveExcitation::ExciteParticipants: Aborting loop!" << G4endl; 195 return false; // Ignore this intera 123 return false; // Ignore this interaction 196 } 124 } 197 << 125 Qmomentum=G4LorentzVector(GaussianPt(widthOfPtSquare,maxPtSquare),0); 198 // Generate pt << 199 Qmomentum=G4LorentzVector(GaussianPt(Avera << 200 << 201 Pt2 = G4ThreeVector( Qmomentum.vect() ).ma << 202 << 203 ProjMassT2 = Mprojectile2 + Pt2; << 204 ProjMassT = std::sqrt( ProjMassT2 ); << 205 TargMassT2 = Mtarget2 + Pt2; << 206 TargMassT = std::sqrt( TargMassT2 ); << 207 << 208 #ifdef debugSingleDiffraction << 209 G4cout<<whilecount<<" "<<Pt2<<" "<<ProjM << 210 #endif << 211 if ( SqrtS < ProjMassT + TargMassT ) conti << 212 << 213 PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + T << 214 - 2.0*S*ProjMassT2 - 2.0*S*TargM << 215 << 216 if ( PZcms2 < 0 ) continue; << 217 << 218 PZcms = std::sqrt( PZcms2 ); << 219 << 220 if ( ProjectileDiffraction ) << 221 { // The projectile will fragment, t << 222 PMinusMin = std::sqrt( ProjMassT2 + PZcm << 223 PMinusMax = SqrtS - TargMassT; << 224 << 225 PMinusNew = ChooseX( PMinusMin, PMinusMa << 226 TMinusNew = SqrtS - PMinusNew; << 227 126 228 Qminus = Ptarget.minus() - TMinusNew; << 127 // Momentum transfer 229 TPlusNew = TargMassT2 / TMinusNew; << 128 G4double Xmin = minmass / ( Pprojectile.e() + Ptarget.e() ); 230 Qplus = Ptarget.plus() - TPlusNew; << 129 G4double Xmax=1.; >> 130 G4double Xplus =ChooseX(Xmin,Xmax); >> 131 G4double Xminus=ChooseX(Xmin,Xmax); >> 132 >> 133 G4double pt2=G4ThreeVector(Qmomentum.vect()).mag2(); >> 134 G4double Qplus =-1 * pt2 / Xminus/Ptarget.minus(); >> 135 G4double Qminus= pt2 / Xplus /Pprojectile.plus(); >> 136 >> 137 if ( KeepProjectile ) >> 138 { >> 139 Qminus = (sqr(projectile->GetDefinition()->GetPDGMass()) + pt2 ) >> 140 / (Pprojectile.plus() + Qplus ) - Pprojectile.minus(); >> 141 } else { >> 142 Qplus = Ptarget.plus() - (sqr(target->GetDefinition()->GetPDGMass()) + pt2 ) >> 143 / (Ptarget.minus() - Qminus ); >> 144 } >> 145 >> 146 Qmomentum.setPz( (Qplus-Qminus)/2 ); >> 147 Qmomentum.setE( (Qplus+Qminus)/2 ); >> 148 >> 149 //G4cout << "Qplus / Qminus " << Qplus << " / " << Qminus<<G4endl; >> 150 //G4cout << "pt2 " << pt2 << G4endl; >> 151 //G4cout << "Qmomentum " << Qmomentum << G4endl; >> 152 //G4cout << " Masses (P/T) : " << (Pprojectile+Qmomentum).mag() << >> 153 // " / " << (Ptarget-Qmomentum).mag() << G4endl; >> 154 >> 155 } while ( (Ptarget-Qmomentum).mag2() <= Mtarget2 /* Loop checking, 26.10.2015, A.Ribon */ >> 156 || (Pprojectile+Qmomentum).mag2() <= Mprojectile2 >> 157 || (Ptarget-Qmomentum).e() < 0. >> 158 || (Pprojectile+Qmomentum).e() < 0. ); 231 159 232 } else { // The target will fragment, the << 160 //G4double Ecms=Pprojectile.e() + Ptarget.e(); 233 TPlusMin = std::sqrt( TargMassT2 + PZcms << 234 TPlusMax = SqrtS - ProjMassT; << 235 << 236 TPlusNew = ChooseX( TPlusMin, TPlusMax ) << 237 PPlusNew = SqrtS - TPlusNew; << 238 << 239 Qplus = PPlusNew - Pprojectile.plus(); << 240 PMinusNew = ProjMassT2 / PPlusNew; << 241 Qminus = PMinusNew - Pprojectile.minus() << 242 } << 243 << 244 Qmomentum.setPz( (Qplus - Qminus)/2 ); << 245 Qmomentum.setE( (Qplus + Qminus)/2 ); << 246 << 247 #ifdef debugSingleDiffraction << 248 G4cout<<ProjectileDiffraction<<" "<<( Pp << 249 G4cout<<!ProjectileDiffraction<<" "<<( P << 250 #endif << 251 << 252 } while ( ( ProjectileDiffraction&&( Pprojec << 253 (!ProjectileDiffraction&&( Ptarget << 254 // Repeat the sampling because there was n << 255 161 256 Pprojectile += Qmomentum; 162 Pprojectile += Qmomentum; 257 << 258 Ptarget -= Qmomentum; 163 Ptarget -= Qmomentum; 259 164 >> 165 //G4cout << "Pprojectile.e() : " << Pprojectile.e() << G4endl; >> 166 //G4cout << "Ptarget.e() : " << Ptarget.e() << G4endl; >> 167 //G4cout << "end event_______________________________________________"<<G4endl; >> 168 //G4cout << "Pprojectile with Q : " << Pprojectile << G4endl; >> 169 //G4cout << "Ptarget with Q : " << Ptarget << G4endl; >> 170 //G4cout << "Projectile back: " << toLab * Pprojectile << G4endl; >> 171 //G4cout << "Target back: " << toLab * Ptarget << G4endl; >> 172 260 // Transform back and update SplitableHadron 173 // Transform back and update SplitableHadron Participant. 261 Pprojectile.transform(toLab); 174 Pprojectile.transform(toLab); 262 Ptarget.transform(toLab); 175 Ptarget.transform(toLab); 263 176 264 #ifdef debugSingleDiffraction << 177 //G4cout << "G4SingleDiffractiveExcitation- Target mass " << Ptarget.mag() << G4endl; 265 G4cout << "Pprojectile in Lab. " << Pproj << 178 //G4cout << "G4SingleDiffractiveExcitation- Projectile mass " << Pprojectile.mag() << G4endl; 266 G4cout << "Ptarget in Lab. " << Ptarg << 267 G4cout << "G4SingleDiffractiveExcitation- << 268 G4cout << "G4SingleDiffractiveExcitation- << 269 #endif << 270 179 271 target->Set4Momentum(Ptarget); 180 target->Set4Momentum(Ptarget); 272 projectile->Set4Momentum(Pprojectile); 181 projectile->Set4Momentum(Pprojectile); 273 182 274 return true; 183 return true; 275 } 184 } 276 185 >> 186 277 // --------- private methods ----------------- 187 // --------- private methods ---------------------- 278 188 279 G4double G4SingleDiffractiveExcitation::Choose 189 G4double G4SingleDiffractiveExcitation::ChooseX(G4double Xmin, G4double Xmax) const 280 { 190 { 281 // choose an x between Xmin and Xmax with P( 191 // choose an x between Xmin and Xmax with P(x) ~ 1/x >> 192 // to be improved... >> 193 282 G4double range=Xmax-Xmin; 194 G4double range=Xmax-Xmin; 283 195 284 if ( Xmin <= 0. || range <=0. ) 196 if ( Xmin <= 0. || range <=0. ) 285 { 197 { 286 G4cout << " Xmin, range : " << Xmin << " , 198 G4cout << " Xmin, range : " << Xmin << " , " << range << G4endl; 287 throw G4HadronicException(__FILE__, __LINE 199 throw G4HadronicException(__FILE__, __LINE__, "G4SingleDiffractiveExcitation::ChooseX : Invalid arguments "); 288 } 200 } 289 201 290 G4double x = Xmin*G4Pow::GetInstance()->powA << 202 G4double x; 291 // G4double x = 1.0/sqr(1.0/std::sqrt(Xmin) << 203 do { >> 204 x=Xmin + G4UniformRand() * range; >> 205 } while ( Xmin/x < G4UniformRand() ); /* Loop checking, 26.10.2015, A.Ribon */ >> 206 >> 207 //cout << "DiffractiveX "<<x<<G4endl; 292 return x; 208 return x; 293 } 209 } 294 210 295 << 296 G4ThreeVector G4SingleDiffractiveExcitation::G 211 G4ThreeVector G4SingleDiffractiveExcitation::GaussianPt(G4double widthSquare, G4double maxPtSquare) const 297 { // @@ this method is used in FTF << 212 { >> 213 // @@ this method is used in FTFModel as well. Should go somewhere common! 298 214 299 G4double pt2; 215 G4double pt2; 300 216 301 const G4int maxNumberOfLoops = 1000; 217 const G4int maxNumberOfLoops = 1000; 302 G4int loopCounter = 0; << 218 G4int loopCounter = -1; 303 do { 219 do { 304 pt2=-widthSquare * G4Log( G4UniformRand() << 220 pt2=widthSquare * G4Log( G4UniformRand() ); 305 } while ( ( pt2 > maxPtSquare) && ++loopCoun << 221 } while ( ( pt2 > maxPtSquare) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 26.10.2015, A.Ribon */ 306 if ( loopCounter >= maxNumberOfLoops ) { << 222 if ( loopCounter >= maxNumberOfLoops ) pt2 = 0.0; 307 pt2 = 0.99*maxPtSquare; // Just an accept << 308 } << 309 223 310 pt2=std::sqrt(pt2); 224 pt2=std::sqrt(pt2); 311 225 312 G4double phi=G4UniformRand() * twopi; 226 G4double phi=G4UniformRand() * twopi; 313 227 314 return G4ThreeVector (pt2*std::cos(phi), pt2 228 return G4ThreeVector (pt2*std::cos(phi), pt2*std::sin(phi), 0.); 315 } 229 } 316 230 317 231