- Timestamp:
- Dec 22, 2010, 3:52:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/high_energy/src/G4HEVector.cc
r1340 r1347 25 25 // 26 26 // 27 // $Id: G4HEVector.cc,v 1.2 0 2006/11/22 23:52:32dennis Exp $28 // GEANT4 tag $Name: geant4-09-0 3-ref-09$27 // $Id: G4HEVector.cc,v 1.22 2010/11/29 05:44:44 dennis Exp $ 28 // GEANT4 tag $Name: geant4-09-04-ref-00 $ 29 29 // 30 30 // … … 164 164 } 165 165 166 G4double 167 G4HEVector::getTotalMomentum() 168 { 169 return std::sqrt(px*px + py*py + pz*pz); 170 } 166 G4double G4HEVector::getTotalMomentum() const 167 { 168 return std::sqrt(px*px + py*py + pz*pz); 169 } 171 170 172 171 void 173 G4HEVector::setMomentum( 174 175 176 177 178 179 180 181 void 182 G4HEVector::setMomentumAndUpdate( G4double x, G4double y, G4double z)183 184 185 186 187 energy= std::sqrt(mass*mass + px*px + py*py + pz*pz);188 189 190 191 192 void 193 G4HEVector::setMomentum( G4double x, G4double y)194 195 196 197 198 172 G4HEVector::setMomentum(G4double x, G4double y, G4double z) 173 { 174 px = x; 175 py = y; 176 pz = z; 177 return; 178 } 179 180 void 181 G4HEVector::setMomentumAndUpdate(G4double x, G4double y, G4double z) 182 { 183 px = x; 184 py = y; 185 pz = z; 186 energy = std::sqrt(mass*mass + px*px + py*py + pz*pz); 187 kineticEnergy = Amax(0.,energy-mass); 188 return; 189 } 190 191 void 192 G4HEVector::setMomentum(G4double x, G4double y) 193 { 194 px = x; 195 py = y; 196 return; 197 } 199 198 200 199 void … … 312 311 } 313 312 314 G4double 315 G4HEVector::getEnergy() 316 { 317 return energy; 318 } 319 320 G4double 321 G4HEVector::getKineticEnergy() 322 { 323 return kineticEnergy; 324 } 313 G4double G4HEVector::getEnergy() const 314 { 315 return energy; 316 } 317 318 G4double G4HEVector::getKineticEnergy() const 319 { 320 return kineticEnergy; 321 } 325 322 326 323 void … … 367 364 } 368 365 369 G4double 370 G4HEVector::getMass() 371 { 372 return mass; 373 } 366 G4double G4HEVector::getMass() const 367 { 368 return mass; 369 } 374 370 375 371 void … … 380 376 } 381 377 382 G4double 383 G4HEVector::getCharge() 384 { 385 return charge; 386 } 378 G4double G4HEVector::getCharge() const 379 { 380 return charge; 381 } 387 382 388 383 void … … 433 428 } 434 429 435 G4int 436 G4HEVector::getCode() 437 { 438 return code; 439 } 440 441 G4String 442 G4HEVector::getName() 443 { 444 return particleName; 445 } 446 447 G4String 448 G4HEVector::getType() 449 { 450 return particleType; 451 } 430 G4int G4HEVector::getCode() const 431 { 432 return code; 433 } 434 435 G4String G4HEVector::getName() const 436 { 437 return particleName; 438 } 439 440 G4String G4HEVector::getType() const 441 { 442 return particleType; 443 } 452 444 453 G4int 454 G4HEVector::getBaryonNumber() 455 { 456 return baryon; 457 } 458 459 G4int 460 G4HEVector::getStrangenessNumber() 461 { 462 return strangeness; 463 } 445 G4int G4HEVector::getBaryonNumber() const 446 { 447 return baryon; 448 } 449 450 G4int G4HEVector::getStrangenessNumber() const 451 { 452 return strangeness; 453 } 454 464 455 G4int 465 456 G4HEVector::getQuarkContent(G4int flavor) … … 589 580 } 590 581 591 G4double 592 G4HEVector::CosAng( const G4HEVector & p ) 593 { 594 G4double a = std::sqrt( (px*px + py*py + pz*pz)*(p.px*p.px + p.py*p.py + p.pz*p.pz) ); 595 if( a != 0.0 ) 596 { 597 a = (px*p.px + py*p.py + pz*p.pz)/a; 598 if( std::fabs(a) > 1.0 ) 599 { 600 if(a<0.0) a=-1.0; 601 else a=1.0; 602 } 603 } 604 return a; 605 } 582 G4double G4HEVector::CosAng(const G4HEVector& p) const 583 { 584 G4double a = std::sqrt( (px*px + py*py + pz*pz)*(p.px*p.px + p.py*p.py + p.pz*p.pz) ); 585 if (a != 0.0) { 586 a = (px*p.px + py*p.py + pz*p.pz)/a; 587 if (std::fabs(a) > 1.0) { 588 if (a < 0.0) a = -1.0; 589 else a = 1.0; 590 } 591 } 592 return a; 593 } 606 594 607 595 G4double … … 725 713 } 726 714 727 G4double 728 G4HEVector::Length() 729 { 730 return std::sqrt(px*px + py*py + pz*pz); 731 } 715 G4double G4HEVector::Length() const 716 { 717 return std::sqrt(px*px + py*py + pz*pz); 718 } 732 719 733 720 void … … 1297 1284 } 1298 1285 1299 void 1300 G4HEVector::Print( G4int L) 1301 { 1302 G4cout << "HEV: " 1303 << L << " " << px << " " << py << " " << pz << " " 1304 << energy << " " << mass << " " << charge << " " 1305 << timeOfFlight << " " << side << " " << flag << " " 1306 << code << " " << baryon << " " << particleName << G4endl; 1307 /* 1308 printf("HEV: %3d %6f.2 %6f.2 %6f.2 %6f.2 %6f.2 %3f.0 %4f.1 %3d 1309 %3d %6d %6d %s \n", L, px, py, pz, energy, mass, charge, 1310 timeOfFlight, side, flag, code, baryon, particleName); 1311 */ 1312 return; 1313 } 1314 1286 void G4HEVector::Print(G4int L) const 1287 { 1288 G4cout << "HEV: " 1289 << L << " " << px << " " << py << " " << pz << " " 1290 << energy << " " << mass << " " << charge << " " 1291 << timeOfFlight << " " << side << " " << flag << " " 1292 << code << " " << baryon << " " << particleName << G4endl; 1293 return; 1294 }
Note: See TracChangeset
for help on using the changeset viewer.