Ignore:
Timestamp:
May 28, 2009, 4:26:57 PM (15 years ago)
Author:
garnier
Message:

maj sur la beta de geant 4.9.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedComptonModel.cc

    r1007 r1055  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LivermorePolarizedComptonModel.cc,v 1.1 2008/10/30 14:16:35 sincerti Exp $
    27 // GEANT4 tag $Name: geant4-09-02 $
     26// $Id: G4LivermorePolarizedComptonModel.cc,v 1.6 2009/05/03 08:29:55 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
    2828//
     29// History:
     30// --------
     31// 02 May 2009   S Incerti as V. Ivanchenko proposed in G4LivermoreComptonModel.cc
     32//
     33// Cleanup initialisation and generation of secondaries:
     34//                  - apply internal high-energy limit only in constructor
     35//                  - do not apply low-energy limit (default is 0)
     36//                  - remove GetMeanFreePath method and table
     37//                  - added protection against numerical problem in energy sampling
     38//                  - use G4ElementSelector
    2939
    3040#include "G4LivermorePolarizedComptonModel.hh"
     
    3848G4LivermorePolarizedComptonModel::G4LivermorePolarizedComptonModel(const G4ParticleDefinition*,
    3949                                             const G4String& nam)
    40 :G4VEmModel(nam),isInitialised(false)
    41 {
    42   lowEnergyLimit = 250 * eV; // SI - Could be 10 eV ?
     50:G4VEmModel(nam),isInitialised(false),meanFreePathTable(0),scatterFunctionData(0),crossSectionHandler(0)
     51{
     52  lowEnergyLimit = 250 * eV;
    4353  highEnergyLimit = 100 * GeV;
    44   SetLowEnergyLimit(lowEnergyLimit);
     54  //SetLowEnergyLimit(lowEnergyLimit);
    4555  SetHighEnergyLimit(highEnergyLimit);
    4656 
     
    5363  // 4 = entering in methods
    5464
     65  if( verboseLevel>0 ) {
    5566  G4cout << "Livermore Polarized Compton is constructed " << G4endl
    5667         << "Energy range: "
    57          << lowEnergyLimit / keV << " keV - "
     68         << lowEnergyLimit / eV << " eV - "
    5869         << highEnergyLimit / GeV << " GeV"
    5970         << G4endl;
    60 
     71  }
    6172}
    6273
     
    6576G4LivermorePolarizedComptonModel::~G4LivermorePolarizedComptonModel()
    6677
    67   delete meanFreePathTable;
    68   delete crossSectionHandler;
    69   delete scatterFunctionData;
     78  if (meanFreePathTable)   delete meanFreePathTable;
     79  if (crossSectionHandler) delete crossSectionHandler;
     80  if (scatterFunctionData) delete scatterFunctionData;
    7081}
    7182
     
    7889    G4cout << "Calling G4LivermorePolarizedComptonModel::Initialise()" << G4endl;
    7990
    80   InitialiseElementSelectors(particle,cuts);
    81 
    82   // Energy limits
    83  
    84   if (LowEnergyLimit() < lowEnergyLimit)
    85     {
    86       G4cout << "G4LivermorePolarizedComptonModel: low energy limit increased from " <<
    87         LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl;
    88       SetLowEnergyLimit(lowEnergyLimit);
    89     }
    90 
    91   if (HighEnergyLimit() > highEnergyLimit)
    92     {
    93       G4cout << "G4LivermorePolarizedComptonModel: high energy limit decreased from " <<
    94         HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl;
    95       SetHighEnergyLimit(highEnergyLimit);
    96     }
     91  if (crossSectionHandler)
     92  {
     93    crossSectionHandler->Clear();
     94    delete crossSectionHandler;
     95  }
    9796
    9897  // Reading of data files - all materials are read
     
    116115  shellData.LoadData(file);
    117116
    118   //
    119117  if (verboseLevel > 2)
    120118    G4cout << "Loaded cross section files for Livermore Polarized Compton model" << G4endl;
    121119
    122   G4cout << "Livermore Polarized Compton model is initialized " << G4endl
     120  InitialiseElementSelectors(particle,cuts);
     121
     122  if(  verboseLevel>0 ) {
     123    G4cout << "Livermore Polarized Compton model is initialized " << G4endl
    123124         << "Energy range: "
    124          << LowEnergyLimit() / keV << " keV - "
     125         << LowEnergyLimit() / eV << " eV - "
    125126         << HighEnergyLimit() / GeV << " GeV"
    126127         << G4endl;
    127 
     128  }
     129 
    128130  //
    129131   
    130132  if(isInitialised) return;
    131 
    132   if(pParticleChange)
    133     fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    134   else
    135     fParticleChange = new G4ParticleChangeForGamma();
    136    
     133  fParticleChange = GetParticleChangeForGamma();
    137134  isInitialised = true;
    138135}
     
    149146    G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermorePolarizedComptonModel" << G4endl;
    150147
     148  if (GammaEnergy < lowEnergyLimit || GammaEnergy > highEnergyLimit) return 0.0;
     149
    151150  G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
    152151  return cs;
     
    203202      fParticleChange->SetProposedKineticEnergy(0.);
    204203      fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0);
    205       // SI - IS THE FOLLOWING RETURN NECESSARY ?
    206204      return;
    207205    }
     
    210208
    211209  // Select randomly one element in the current material
    212 
    213   G4int Z = crossSectionHandler->SelectRandomAtom(couple,gammaEnergy0);
     210  //G4int Z = crossSectionHandler->SelectRandomAtom(couple,gammaEnergy0);
     211  const G4ParticleDefinition* particle =  aDynamicGamma->GetDefinition();
     212  const G4Element* elm = SelectRandomAtom(couple,particle,gammaEnergy0);
     213  G4int Z = (G4int)elm->GetZ();
    214214
    215215  // Sample the energy and the polarization of the scattered photon
     
    429429  else
    430430    {
     431      gammaEnergy1 = 0.;
    431432      fParticleChange->SetProposedKineticEnergy(0.) ;
    432433      fParticleChange->ProposeTrackStatus(fStopAndKill);
     
    439440  G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE;
    440441
     442  // SI -protection against negative final energy: no e- is created
     443  // like in G4LivermoreComptonModel.cc
     444  if(ElecKineEnergy < 0.0) {
     445    fParticleChange->ProposeLocalEnergyDeposit(gammaEnergy0 - gammaEnergy1);
     446    return;
     447  }
     448 
    441449  // SI - Removed range test
    442450 
     
    664672}
    665673
    666 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    667 
    668 G4double G4LivermorePolarizedComptonModel::GetMeanFreePath(const G4Track& track,
    669                                                       G4double,
    670                                                       G4ForceCondition*)
    671 {
    672   const G4DynamicParticle* photon = track.GetDynamicParticle();
    673   G4double energy = photon->GetKineticEnergy();
    674   const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
    675   size_t materialIndex = couple->GetIndex();
    676   G4double meanFreePath;
    677   if (energy > highEnergyLimit) meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex);
    678   else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX;
    679   else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex);
    680   return meanFreePath;
    681 }
    682 
    683 
     674
Note: See TracChangeset for help on using the changeset viewer.