Ignore:
Timestamp:
Dec 22, 2010, 3:52:27 PM (13 years ago)
Author:
garnier
Message:

geant4 tag 9.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/high_energy/src/G4HEVector.cc

    r1340 r1347  
    2525//
    2626//
    27 // $Id: G4HEVector.cc,v 1.20 2006/11/22 23:52:32 dennis Exp $
    28 // GEANT4 tag $Name: geant4-09-03-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 $
    2929//
    3030//
     
    164164   }
    165165
    166 G4double
    167 G4HEVector::getTotalMomentum()
    168    {
    169      return std::sqrt(px*px + py*py + pz*pz);
    170    }
     166G4double G4HEVector::getTotalMomentum() const
     167{
     168  return std::sqrt(px*px + py*py + pz*pz);
     169}
    171170
    172171void
    173 G4HEVector::setMomentum( G4double x, G4double y, G4double z)
    174    {
    175      px = x;
    176      py = y;
    177      pz = z;
    178      return;
    179    }
    180 
    181 void
    182 G4HEVector::setMomentumAndUpdate( G4double x, G4double y, G4double z )
    183    {
    184      px = x;
    185      py = y;
    186      pz = z;
    187      energy        = std::sqrt(mass*mass + px*px + py*py + pz*pz);
    188      kineticEnergy = Amax(0.,energy-mass);
    189      return;
    190    }
    191 
    192 void
    193 G4HEVector::setMomentum( G4double x, G4double y )
    194    {
    195      px = x;
    196      py = y;
    197      return;
    198    }
     172G4HEVector::setMomentum(G4double x, G4double y, G4double z)
     173{
     174  px = x;
     175  py = y;
     176  pz = z;
     177  return;
     178}
     179
     180void
     181G4HEVector::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
     191void
     192G4HEVector::setMomentum(G4double x, G4double y)
     193{
     194  px = x;
     195  py = y;
     196  return;
     197}
    199198
    200199void
     
    312311   }
    313312
    314 G4double
    315 G4HEVector::getEnergy()
    316    {
    317      return energy;
    318    }
    319 
    320 G4double
    321 G4HEVector::getKineticEnergy()
    322    {
    323      return kineticEnergy;
    324    }
     313G4double G4HEVector::getEnergy() const
     314{
     315  return energy;
     316}
     317
     318G4double G4HEVector::getKineticEnergy() const
     319{
     320  return kineticEnergy;
     321}
    325322
    326323void
     
    367364   }   
    368365
    369 G4double
    370 G4HEVector::getMass()
    371    {
    372      return mass;
    373    }
     366G4double G4HEVector::getMass() const
     367{
     368  return mass;
     369}
    374370
    375371void
     
    380376   }
    381377
    382 G4double
    383 G4HEVector::getCharge()
    384    {
    385      return charge;
    386    }
     378G4double G4HEVector::getCharge() const
     379{
     380  return charge;
     381}
    387382
    388383void
     
    433428   }
    434429
    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    }
     430G4int G4HEVector::getCode() const
     431{
     432  return code;
     433}
     434
     435G4String G4HEVector::getName() const
     436{
     437  return particleName;
     438}
     439
     440G4String G4HEVector::getType() const
     441{
     442  return particleType;
     443}
    452444 
    453 G4int
    454 G4HEVector::getBaryonNumber()
    455    {
    456      return baryon;
    457    }
    458 
    459 G4int
    460 G4HEVector::getStrangenessNumber()
    461    {
    462      return strangeness;
    463    }
     445G4int G4HEVector::getBaryonNumber() const
     446{
     447  return baryon;
     448}
     449
     450G4int G4HEVector::getStrangenessNumber() const
     451{
     452  return strangeness;
     453}
     454
    464455G4int
    465456G4HEVector::getQuarkContent(G4int flavor)
     
    589580   }
    590581
    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    }
     582G4double 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}
    606594
    607595G4double
     
    725713   }
    726714
    727 G4double
    728 G4HEVector::Length()
    729    {
    730      return  std::sqrt(px*px + py*py + pz*pz);
    731    }
     715G4double G4HEVector::Length() const
     716{
     717  return std::sqrt(px*px + py*py + pz*pz);
     718}
    732719
    733720void
     
    12971284}
    12981285
    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 
     1286void 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.