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: G4FTFParticipants.cc,v 1.5 2005/06/04 13:47:01 jwellisc Exp $ >> 25 // GEANT4 tag $Name: geant4-07-01 $ 27 // 26 // 28 << 29 // ------------------------------------------- 27 // ------------------------------------------------------------ 30 // GEANT 4 class implementation file 28 // GEANT 4 class implementation file 31 // 29 // 32 // ---------------- G4FTFParticipants---- 30 // ---------------- G4FTFParticipants---------------- 33 // by Gunter Folger, June 1998. 31 // by Gunter Folger, June 1998. 34 // class finding colliding particles in 32 // class finding colliding particles in FTFPartonStringModel 35 // Changed in a part by V. Uzhinsky in oder t << 36 // with original FRITIOF mode. November << 37 // Ajusted for (anti) nucleus - nucleus inter << 38 // (February 2011) << 39 // ------------------------------------------- 33 // ------------------------------------------------------------ 40 34 41 #include <utility> << 42 #include <vector> << 43 #include <algorithm> << 44 << 45 #include "G4FTFParticipants.hh" 35 #include "G4FTFParticipants.hh" 46 #include "G4ios.hh" << 47 #include "Randomize.hh" << 48 #include "G4SystemOfUnits.hh" << 49 #include "G4FTFParameters.hh" << 50 #include "G4DiffractiveSplitableHadron.hh" 36 #include "G4DiffractiveSplitableHadron.hh" 51 #include "G4VSplitableHadron.hh" 37 #include "G4VSplitableHadron.hh" 52 #include "G4PhysicalConstants.hh" << 38 #include "G4PomeronCrossSection.hh" 53 << 39 #include "Randomize.hh" 54 << 40 #include <utility> 55 //============================================ << 56 << 57 //#define debugFTFparticipant << 58 << 59 << 60 //============================================ << 61 << 62 G4FTFParticipants::G4FTFParticipants() : Bimpa << 63 Bmin2 << 64 curre << 65 {} << 66 << 67 << 68 //============================================ << 69 << 70 G4FTFParticipants::~G4FTFParticipants() {} << 71 << 72 //============================================ << 73 << 74 void G4FTFParticipants::GetList( const G4React << 75 G4FTFParamete << 76 << 77 #ifdef debugFTFparticipant << 78 G4cout << "Participants::GetList" << G4endl << 79 << "thePrimary " << thePrimary.GetMom << 80 #endif << 81 << 82 G4double betta_z = thePrimary.GetMomentum(). << 83 if ( betta_z < 1.0e-10 ) betta_z = 1.0e-10; << 84 << 85 StartLoop(); // reset Loop over Interactions << 86 << 87 for ( unsigned int i = 0; i < theInteraction << 88 theInteractions.clear(); << 89 << 90 G4double deltaxy = 2.0 * fermi; // Extra nu << 91 << 92 if ( theProjectileNucleus == nullptr ) { // << 93 << 94 G4double impactX( 0.0 ), impactY( 0.0 ); << 95 G4double B( 0.0 ), B2( 0.0 ); << 96 << 97 G4VSplitableHadron* primarySplitable = new << 98 << 99 #ifdef debugFTFparticipant << 100 G4cout << "Hadron-nucleus or anti-baryon-n << 101 #endif << 102 << 103 G4double xyradius = theNucleus->GetOuterRa << 104 << 105 const G4int maxNumberOfLoops = 1000; << 106 G4int loopCounter = 0; << 107 do { << 108 << 109 std::pair< G4double, G4double > theImpac << 110 if ( SampleBinInterval() ) { << 111 B2 = GetBmin2() + G4UniformRand() * ( << 112 B = B2 > 0.0 ? std::sqrt( B2 ) : 0.0; << 113 G4double Phi = twopi * G4UniformRand() << 114 impactX = B * std::cos( Phi ); << 115 impactY = B * std::sin( Phi ); << 116 SetImpactParameter( B ); << 117 } else { << 118 theImpactParameter = theNucleus->Choos << 119 impactX = theImpactParameter.first; << 120 impactY = theImpactParameter.second; << 121 SetImpactParameter( std::sqrt( sqr(imp << 122 } << 123 << 124 #ifdef debugFTFparticipant << 125 G4cout << "New interaction list," << " b << 126 << std::sqrt( sqr(impactX ) + sqr << 127 #endif << 128 << 129 G4ThreeVector thePosition( impactX, impa << 130 primarySplitable->SetPosition( thePositi << 131 << 132 theNucleus->StartLoop(); << 133 G4Nucleon* nucleon; << 134 << 135 #ifdef debugFTFparticipant << 136 G4int TrN( 0 ); << 137 #endif << 138 << 139 while ( ( nucleon = theNucleus->GetNextN << 140 << 141 G4double impact2 = sqr( impactX - nucl << 142 sqr( impactY - nucl << 143 41 144 if ( theParameters->GetProbabilityOfIn << 145 G4UniformRand() ) { << 146 primarySplitable->SetStatus( 1 ); / << 147 G4VSplitableHadron* targetSplitable << 148 if ( ! nucleon->AreYouHit() ) { << 149 targetSplitable = new G4Diffractiv << 150 nucleon->Hit( targetSplitable ); << 151 targetSplitable->SetStatus( 1 ); / << 152 42 153 #ifdef debugFTFparticipant << 43 // Class G4FTFParticipants 154 G4cout << "Participated nucleons # << 155 << primarySplitable << " " << 156 #endif << 157 44 158 } << 159 G4InteractionContent* aInteraction = << 160 G4Nucleon* PrNucleon = 0; << 161 aInteraction->SetProjectileNucleon( << 162 aInteraction->SetTarget( targetSplit << 163 aInteraction->SetTargetNucleon( nucl << 164 aInteraction->SetStatus( 1 ); << 165 aInteraction->SetInteractionTime( ( << 166 << 167 theInteractions.push_back( aInteract << 168 } << 169 45 170 #ifdef debugFTFparticipant << 171 TrN++; << 172 #endif << 173 46 174 } << 47 G4FTFParticipants::G4FTFParticipants() >> 48 { >> 49 } 175 50 176 } while ( ( theInteractions.size() == 0 ) << 51 G4FTFParticipants::G4FTFParticipants(const G4FTFParticipants &): G4VParticipants() 177 ++loopCounter < maxNumberOfLoops << 52 { 178 if ( loopCounter >= maxNumberOfLoops ) { << 53 } 179 #ifdef debugFTFparticipant << 180 G4cout << "BAD situation: forced exit fr << 181 #endif << 182 return; << 183 } << 184 54 185 #ifdef debugFTFparticipant << 186 G4cout << "Number of Hit nucleons " << the << 187 << "\t By[fm] " << impactY/fermi << << 188 << std::sqrt( sqr( impactX ) + sqr( << 189 #endif << 190 << 191 //SortInteractionsIncT(); // Not need beca << 192 ShiftInteractionTime(); // To put correct << 193 return; << 194 << 195 } // end of if ( theProjectileNucleus == 0 << 196 << 197 // Projectile and target are nuclei << 198 << 199 #ifdef debugFTFparticipant << 200 G4cout << "Projectile and target are nuclei" << 201 #endif << 202 << 203 //G4cout<<theProjectileNucleus->GetOuterRadi << 204 << 205 // Range of impact parameter sampling << 206 G4double xyradius = theProjectileNucleus->Ge << 207 << 208 G4double impactX( 0.0 ), impactY( 0.0 ); << 209 G4double B( 0.0 ), B2( 0.0 ); << 210 << 211 const G4int maxNumberOfLoops = 1000; << 212 G4int loopCounter = 0; << 213 do { << 214 << 215 std::pair< G4double, G4double > theImpactP << 216 if ( SampleBinInterval() ) { << 217 B2 = GetBmin2() + G4UniformRand() * ( Ge << 218 B = B2 > 0.0 ? std::sqrt( B2 ) : 0.0; << 219 G4double Phi = twopi * G4UniformRand(); << 220 impactX = B * std::cos( Phi ); << 221 impactY = B * std::sin( Phi ); << 222 SetImpactParameter( B ); << 223 } else { << 224 theImpactParameter = theNucleus->ChooseI << 225 impactX = theImpactParameter.first; << 226 impactY = theImpactParameter.second; << 227 SetImpactParameter( std::sqrt( sqr(impac << 228 } << 229 55 230 #ifdef debugFTFparticipant << 56 G4FTFParticipants::~G4FTFParticipants() 231 G4cout << "New interaction list, " << "b[f << 57 { 232 << std::sqrt( sqr( impactX ) + sqr( << 58 // G4cout << "G4FTFParticipants::~G4FTFParticipants() called" << G4endl; 233 #endif << 234 << 235 G4ThreeVector theBeamPosition( impactX, im << 236 << 237 theProjectileNucleus->StartLoop(); << 238 G4Nucleon* ProjectileNucleon; << 239 << 240 #ifdef debugFTFparticipant << 241 G4int PrNuclN( 0 ); << 242 #endif << 243 << 244 while ( ( ProjectileNucleon = theProjectil << 245 << 246 G4VSplitableHadron* ProjectileSplitable << 247 theNucleus->StartLoop(); << 248 G4Nucleon* TargetNucleon = 0; << 249 << 250 #ifdef debugFTFparticipant << 251 G4int TrNuclN( 0 ); << 252 #endif << 253 << 254 while ( ( TargetNucleon = theNucleus->Ge << 255 << 256 G4double impact2 = sqr( impactX + Proj << 257 TargetNucleon- << 258 sqr( impactY + Proj << 259 TargetNucleon- << 260 G4VSplitableHadron* TargetSplitable = << 261 if ( theParameters->GetProbabilityOfIn << 262 G4UniformRand() ) { // An intera << 263 << 264 #ifdef debugFTFparticipant << 265 G4cout << G4endl << "An Interaction << 266 << " " << ProjectileNucleon-> << 267 << "Targ N mom " << TrNuclN < << 268 << "PrN TrN Z coords [fm]" << << 269 << " " << TargetNucleon->GetP << 270 << " " << ProjectileNucleon-> << 271 TargetNucleon->GetP << 272 #endif << 273 << 274 if ( ! ProjectileNucleon->AreYouHit( << 275 // Projectile nucleon was not invo << 276 ProjectileSplitable = new G4Diffra << 277 ProjectileNucleon->Hit( Projectile << 278 ProjectileSplitable->SetStatus( 1 << 279 } else { // Projectile nucleon was << 280 ProjectileSplitable = ProjectileNu << 281 } << 282 << 283 if ( ! TargetNucleon->AreYouHit() ) << 284 TargetSplitable = new G4Diffractiv << 285 TargetNucleon->Hit( TargetSplitabl << 286 TargetSplitable->SetStatus( 1 ); << 287 } else { // Target nucleon was invo << 288 TargetSplitable = TargetNucleon->G << 289 } << 290 << 291 G4InteractionContent* anInteraction << 292 anInteraction->SetTarget( TargetSpli << 293 anInteraction->SetProjectileNucleon( << 294 anInteraction->SetTargetNucleon( Tar << 295 anInteraction->SetInteractionTime( ( << 296 << 297 anInteraction->SetStatus( 1 ); << 298 << 299 #ifdef debugFTFparticipant << 300 G4cout << "Part anInteraction->GetIn << 301 << anInteraction->GetInteract << 302 << "Splitable Pr* Tr* " << Pr << 303 << TargetSplitable << G4endl; << 304 #endif << 305 << 306 theInteractions.push_back( anInterac << 307 << 308 } // End of an Interaction has happend << 309 << 310 #ifdef debugFTFparticipant << 311 TrNuclN++; << 312 #endif << 313 << 314 } // End of while ( ( TargetNucleon = t << 315 << 316 #ifdef debugFTFparticipant << 317 PrNuclN++; << 318 #endif << 319 << 320 } // End of while ( ( ProjectileNucleon = << 321 << 322 if ( theInteractions.size() != 0 ) theProj << 323 << 324 } while ( ( theInteractions.size() == 0 ) && << 325 ++loopCounter < maxNumberOfLoops ) << 326 if ( loopCounter >= maxNumberOfLoops ) { << 327 #ifdef debugFTFparticipant << 328 G4cout << "BAD situation: forced exit from << 329 #endif << 330 return; << 331 } << 332 << 333 SortInteractionsIncT(); << 334 ShiftInteractionTime(); << 335 << 336 #ifdef debugFTFparticipant << 337 G4cout << G4endl << "Number of primary colli << 338 << "\t Bx[fm] " << impactX/fermi << " << 339 << "\t B[fm] " << std::sqrt( sqr( imp << 340 << "FTF participant End. ############ << 341 #endif << 342 return; << 343 } 59 } 344 60 345 61 346 //============================================ << 62 //const G4FTFParticipants & G4FTFParticipants::operator=(const G4FTFParticipants &right) >> 63 //{} 347 64 348 bool G4FTFPartHelperForSortInT( const G4Intera << 349 const G4Intera << 350 return Int1->GetInteractionTime() < Int2->Ge << 351 } << 352 65 >> 66 //int G4FTFParticipants::operator==(const G4FTFParticipants &right) const >> 67 //{} 353 68 354 //============================================ << 69 //int G4FTFParticipants::operator!=(const G4FTFParticipants &right) const 355 << 70 //{} 356 void G4FTFParticipants::SortInteractionsIncT() << 71 357 if ( theInteractions.size() < 2 ) return; / << 72 void G4FTFParticipants::BuildInteractions(const G4ReactionProduct &thePrimary) 358 std::sort( theInteractions.begin(), theInter << 73 { >> 74 >> 75 StartLoop(); // reset Loop over Interactions >> 76 >> 77 for(unsigned int i=0; i<theInteractions.size(); i++) delete theInteractions[i]; >> 78 theInteractions.clear(); >> 79 >> 80 // --- cms energy >> 81 >> 82 G4double s = sqr( thePrimary.GetMass() ) + >> 83 sqr( G4Proton::Proton()->GetPDGMass() ) + >> 84 2*thePrimary.GetTotalEnergy()*G4Proton::Proton()->GetPDGMass(); >> 85 >> 86 // G4cout << " primary Total E (GeV): " << thePrimary.GetTotalEnergy()/GeV << G4endl; >> 87 // G4cout << " primary Mass (GeV): " << thePrimary.GetMass() /GeV << G4endl; >> 88 // G4cout << "cms std::sqrt(s) (GeV) = " << std::sqrt(s) / GeV << G4endl; >> 89 >> 90 G4PomeronCrossSection theCrossSection(thePrimary.GetDefinition()); >> 91 >> 92 >> 93 >> 94 G4double deltaxy=2 * fermi; >> 95 >> 96 G4VSplitableHadron * primarySplitable=new G4DiffractiveSplitableHadron(thePrimary); >> 97 >> 98 G4double xyradius; >> 99 xyradius =theNucleus->GetOuterRadius() + deltaxy; >> 100 >> 101 // G4cout <<" G4FTFParticipants::StartLoop: xyradius " << xyradius << G4endl; >> 102 >> 103 G4bool nucleusNeedsShift = true; >> 104 >> 105 while ( theInteractions.size() == 0 ) >> 106 { >> 107 std::pair<G4double, G4double> theImpactParameter; >> 108 theImpactParameter = theNucleus->ChooseImpactXandY(xyradius); >> 109 G4double impactX = theImpactParameter.first; >> 110 G4double impactY = theImpactParameter.second; >> 111 >> 112 // G4cout << " impctX, impctY " << impactX/fermi << " "<<impactY/fermi << " fm" << G4endl; >> 113 >> 114 theNucleus->StartLoop(); >> 115 G4Nucleon * nucleon; >> 116 while ( (nucleon=theNucleus->GetNextNucleon()) ) >> 117 { >> 118 G4double impact2= sqr(impactX - nucleon->GetPosition().x()) + >> 119 sqr(impactY - nucleon->GetPosition().y()); >> 120 if ( theCrossSection.GetInelasticProbability(s,impact2) >> 121 > G4UniformRand() ) >> 122 { >> 123 if ( nucleusNeedsShift ) >> 124 { // on the first hit, shift nucleus >> 125 nucleusNeedsShift = false; >> 126 theNucleus->DoTranslation(G4ThreeVector(-1*impactX,-1*impactY,0.)); >> 127 impactX=0; >> 128 impactY=0; >> 129 } >> 130 G4VSplitableHadron * targetSplitable; >> 131 if ( (targetSplitable=nucleon->GetSplitableHadron()) == NULL ) >> 132 { >> 133 targetSplitable= new G4DiffractiveSplitableHadron(*nucleon); >> 134 nucleon->Hit(targetSplitable); >> 135 } >> 136 G4InteractionContent * aInteraction = new G4InteractionContent(primarySplitable); >> 137 aInteraction->SetTarget(targetSplitable); >> 138 theInteractions.push_back(aInteraction); >> 139 } >> 140 } >> 141 >> 142 // G4cout << "Number of Hit nucleons " << theInteractions.entries() >> 143 // << "\t" << impactX/fermi << "\t"<<impactY/fermi >> 144 // << "\t" << std::sqrt(sqr(impactX)+sqr(impactY))/fermi <<G4endl; >> 145 >> 146 } >> 147 359 } 148 } 360 149 361 150 362 //============================================ << 151 // Implementation (private) methods 363 152 364 void G4FTFParticipants::ShiftInteractionTime() << 365 G4double InitialTime = theInteractions[0]->G << 366 for ( unsigned int i = 1; i < theInteraction << 367 G4double InterTime = theInteractions[i]->G << 368 theInteractions[i]->SetInteractionTime( In << 369 G4InteractionContent* aCollision = theInte << 370 G4VSplitableHadron* projectile = aCollisio << 371 G4VSplitableHadron* target = aCollision->G << 372 G4ThreeVector prPosition = projectile->Get << 373 prPosition.setZ( target->GetPosition().z() << 374 projectile->SetPosition( prPosition ); << 375 projectile->SetTimeOfCreation( InterTime ) << 376 target->SetTimeOfCreation( InterTime ); << 377 } << 378 return; << 379 } << 380 153 381 154 382 //============================================ << 383 155 384 void G4FTFParticipants::Clean() { << 385 for ( size_t i = 0; i < theInteractions.size << 386 if ( theInteractions[ i ] ) { << 387 delete theInteractions[ i ]; << 388 theInteractions[ i ] = 0; << 389 } << 390 } << 391 theInteractions.clear(); << 392 currentInteraction = -1; << 393 } << 394 156 395 157