Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/materials/src/G4MaterialPropertyVector.cc

    r1196 r1315  
    2525//
    2626//
    27 // $Id: G4MaterialPropertyVector.cc,v 1.17 2009/04/21 15:35:45 gcosmo Exp $
    28 // GEANT4 tag $Name: materials-V09-02-18 $
     27// $Id: G4MaterialPropertyVector.cc,v 1.18 2010/04/22 21:15:19 gum Exp $
     28// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2929//
    3030//
     
    154154G4double G4MaterialPropertyVector::GetProperty(G4double aPhotonEnergy) const
    155155{
    156   G4MPVEntry *target, *temp;
    157156  G4int left, right;
    158157  G4double ratio1, ratio2, pmright, pmleft, InterpolatedValue;
     
    175174    G4Exception("G4MaterialPropertyVector::GetProperty()", "OutOfRange",
    176175                JustWarning, "Attempt to retrieve property below range !");
     176    G4cout << "   aPhotonEnergy = " <<  aPhotonEnergy/MeV
     177           << " [MeV]  PMmin = " << PMmin << " [MeV]" << G4endl;         
    177178    return minProp;
    178179  }
     
    182183    G4Exception("G4MaterialPropertyVector::GetProperty()", "OutOfRange",
    183184                JustWarning, "Attempt to retrieve property above range !");
     185    G4cout << "   aPhotonEnergy = " <<  aPhotonEnergy/MeV
     186           << " [MeV]  PMmax = " << PMmax << " [MeV]" << G4endl;         
    184187    return maxProp;
    185188  }
    186  
    187   target = new G4MPVEntry(aPhotonEnergy, 0.0);
    188 
    189   temp = 0;
    190   //temp = MPV.find(target);
    191   std::vector<G4MPVEntry*>::const_iterator i;
    192   for (i = MPV.begin(); i != MPV.end(); i++)
    193   {
    194     if (**i == *target)  { temp = *i; break; }
    195   }
    196   if (temp != 0)
    197   {
    198     ////////////////////////
    199     // Return actual value
    200     ////////////////////////
    201 
    202     G4double retval = temp->GetProperty();
    203     delete target;
    204     return retval;
    205   }
    206   else
    207   {
    208     //////////////////////////////
    209     // Return interpolated value
    210     //////////////////////////////
    211 
    212     GetAdjacentBins(aPhotonEnergy, &left, &right);
    213 
    214     pmleft = MPV[left]->GetPhotonEnergy();
    215     pmright = MPV[right]->GetPhotonEnergy();
    216     ratio1 = (aPhotonEnergy-pmleft)/(pmright-pmleft);
    217     ratio2 = 1 - ratio1;
    218     InterpolatedValue = MPV[left]->GetProperty()*ratio2 +
    219                         MPV[right]->GetProperty()*ratio1;
    220     delete target;
    221     return InterpolatedValue;
    222   } 
     189
     190  //////////////////////////////
     191  // Return interpolated value
     192  //////////////////////////////
     193
     194  GetAdjacentBins(aPhotonEnergy, &left, &right);
     195  pmleft = MPV[left]->GetPhotonEnergy();
     196  pmright = MPV[right]->GetPhotonEnergy();
     197  ratio1 = (aPhotonEnergy-pmleft)/(pmright-pmleft);
     198  ratio2 = 1 - ratio1;
     199  InterpolatedValue = MPV[left]->GetProperty()*ratio2 +
     200                      MPV[right]->GetProperty()*ratio1;
     201  return InterpolatedValue;
    223202}
    224203
     
    340319  {
    341320    mid = (*left + *right)/2;
    342     if (MPV[mid]->GetPhotonEnergy() < aPhotonEnergy)
     321    if (MPV[mid]->GetPhotonEnergy() <= aPhotonEnergy)
    343322    {
    344323      *left = mid;
Note: See TracChangeset for help on using the changeset viewer.