Changeset 961 for trunk


Ignore:
Timestamp:
Apr 6, 2009, 12:21:12 PM (17 years ago)
Author:
garnier
Message:

update processes

Location:
trunk/source/processes
Files:
445 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/cuts/History

    r819 r961  
    1 $Id: History,v 1.21 2007/06/06 14:50:38 gcosmo Exp $
     1$Id: History,v 1.22 2008/03/02 10:52:55 kurasige Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19Mar. 2nd, 2008  -  H.Kurashige (procuts-V09-01-00)
     20- Add ProductionCutsMessenger
     21- Suppress 'too big cut value' messsage for higher verbosity
    1922
    2023June 6th, 2007 -  L.Urban (procuts-V08-03-01)
  • trunk/source/processes/cuts/include/G4MCCIndexConversionTable.hh

    r819 r961  
    2525//
    2626// $Id: G4MCCIndexConversionTable.hh,v 1.3 2006/06/29 19:29:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
  • trunk/source/processes/cuts/include/G4MaterialCutsCouple.hh

    r819 r961  
    2626//
    2727// $Id: G4MaterialCutsCouple.hh,v 1.3 2006/06/29 19:29:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4PhysicsTableHelper.hh

    r819 r961  
    2626//
    2727// $Id: G4PhysicsTableHelper.hh,v 1.3 2006/06/29 19:29:46 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4ProductionCuts.hh

    r819 r961  
    2626//
    2727// $Id: G4ProductionCuts.hh,v 1.4 2006/06/29 19:29:48 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4ProductionCutsTable.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ProductionCutsTable.hh,v 1.8 2007/03/15 04:06:40 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ProductionCutsTable.hh,v 1.9 2008/03/02 10:52:55 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    4646//    Modify RetrieveCutsTable to allow materials and
    4747//    couples can be different from one in file (i.e. at storing)
    48 //
     48//   Modified                      2 Mar. 2008 H.Kurashige
     49//    add messenger
    4950// ------------------------------------------------------------
    5051
     
    5758class G4VPhysicalVolume;
    5859class G4ProductionCuts;
     60
     61class G4ProductionCutsTableMessenger;
    5962
    6063#include "globals.hh"
     
    227230
    228231  private:
    229    G4int verboseLevel;
     232    G4int verboseLevel;
     233    G4ProductionCutsTableMessenger* fMessenger;
    230234
    231235};
     
    340344
    341345inline
    342  void G4ProductionCutsTable::SetVerboseLevel(G4int value)
    343 {
    344    verboseLevel = value;
    345 }
    346 
    347 inline
    348346 G4int G4ProductionCutsTable::GetVerboseLevel() const
    349347{
  • trunk/source/processes/cuts/include/G4RToEConvForAntiNeutron.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForAntiNeutron.hh,v 1.2 2006/06/29 19:29:52 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForAntiProton.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForAntiProton.hh,v 1.2 2006/06/29 19:29:54 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForElectron.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForElectron.hh,v 1.2 2006/06/29 19:29:56 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForGamma.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForGamma.hh,v 1.2 2006/06/29 19:29:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForNeutron.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForNeutron.hh,v 1.2 2006/06/29 19:30:00 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForPositron.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForPositron.hh,v 1.2 2006/06/29 19:30:02 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4RToEConvForProton.hh

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForProton.hh,v 1.2 2006/06/29 19:30:04 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/include/G4VRangeToEnergyConverter.hh

    r819 r961  
    2626//
    2727// $Id: G4VRangeToEnergyConverter.hh,v 1.4 2006/06/29 19:30:06 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4MCCIndexConversionTable.cc

    r819 r961  
    2525//
    2626// $Id: G4MCCIndexConversionTable.cc,v 1.3 2006/06/29 19:30:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
  • trunk/source/processes/cuts/src/G4MaterialCutsCouple.cc

    r819 r961  
    2626//
    2727// $Id: G4MaterialCutsCouple.cc,v 1.3 2006/06/29 19:30:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4PhysicsTableHelper.cc

    r819 r961  
    2525//
    2626// $Id: G4PhysicsTableHelper.cc,v 1.5 2006/06/29 19:30:12 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
  • trunk/source/processes/cuts/src/G4ProductionCuts.cc

    r819 r961  
    2626//
    2727// $Id: G4ProductionCuts.cc,v 1.5 2006/06/29 19:30:14 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4ProductionCutsTable.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ProductionCutsTable.cc,v 1.17 2007/05/30 08:22:20 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ProductionCutsTable.cc,v 1.18 2008/03/02 10:52:55 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    3232//      GEANT 4 class implementation file/  History:
    3333//    06/Oct. 2002, M.Asai : First implementation
     34//    02/Mar. 2008, H.Kurashige : Add messenger
    3435// --------------------------------------------------------------
    3536
     
    3738#include "G4ProductionCuts.hh"
    3839#include "G4MCCIndexConversionTable.hh"
     40#include "G4ProductionCutsTableMessenger.hh"
    3941#include "G4ParticleDefinition.hh"
    4042#include "G4ParticleTable.hh"
     
    6668
    6769G4ProductionCutsTable::G4ProductionCutsTable()
    68   : firstUse(true),verboseLevel(1)
     70  : firstUse(true),verboseLevel(1),fMessenger(0)
    6971{
    7072  for(size_t i=0;i< NumberOfG4CutIndex;i++)
     
    7880  fG4RegionStore = G4RegionStore::GetInstance();
    7981  defaultProductionCuts = new G4ProductionCuts();
     82
     83  // add messenger for UI
     84  fMessenger = new G4ProductionCutsTableMessenger(this);
    8085}
    8186
     
    103108  }
    104109  fG4ProductionCutsTable =0;
     110
     111  if (fMessenger !=0) delete fMessenger;
     112  fMessenger = 0;
    105113}
    106114
     
    108116{
    109117  if(firstUse){
    110     if(G4ParticleTable::GetParticleTable()->FindParticle("gamma"))
    111     { converters[0] = new G4RToEConvForGamma(); }
    112     if(G4ParticleTable::GetParticleTable()->FindParticle("e-"))
    113     { converters[1] = new G4RToEConvForElectron(); }
    114     if(G4ParticleTable::GetParticleTable()->FindParticle("e+"))
    115     { converters[2] = new G4RToEConvForPositron(); }
     118    if(G4ParticleTable::GetParticleTable()->FindParticle("gamma")){
     119      converters[0] = new G4RToEConvForGamma();
     120      converters[0]->SetVerboseLevel(GetVerboseLevel());
     121    }
     122    if(G4ParticleTable::GetParticleTable()->FindParticle("e-")){
     123      converters[1] = new G4RToEConvForElectron();
     124      converters[1]->SetVerboseLevel(GetVerboseLevel());
     125        }
     126    if(G4ParticleTable::GetParticleTable()->FindParticle("e+")){
     127      converters[2] = new G4RToEConvForPositron();
     128      converters[2]->SetVerboseLevel(GetVerboseLevel());
     129    }
    116130    firstUse = false;
    117131  }
     
    376390 
    377391#ifdef G4VERBOSE 
    378   if (verboseLevel >1) {
     392  if (verboseLevel >2) {
    379393    G4cout << "G4ProductionCutsTable::StoreCutsTable " ;
    380394    G4cout << " Material/Cuts information have been succesfully stored ";
     
    396410  if (!RetrieveCutsInfo(dir, ascii)) return false;
    397411#ifdef G4VERBOSE 
    398   if (verboseLevel >1) {
     412  if (verboseLevel >2) {
    399413    G4cout << "G4ProductionCutsTable::RetrieveCutsTable " ;
    400414    G4cout << " Material/Cuts information have been succesfully retreived ";
     
    420434  //  isNeedForRestoreCoupleInfo = false;
    421435  if (!CheckMaterialInfo(directory, ascii)) return false;
    422   if (verboseLevel >1) {
     436  if (verboseLevel >2) {
    423437      G4cerr << "G4ProductionCutsTable::CheckMaterialInfo  passed !!"<< G4endl;
    424438  }
    425439  if (!CheckMaterialCutsCoupleInfo(directory, ascii)) return false;
    426   if (verboseLevel >1) {
     440  if (verboseLevel >2) {
    427441    G4cerr << "G4ProductionCutsTable::CheckMaterialCutsCoupleInfo  passed !!"<< G4endl;
    428442  }
     
    10801094  return true;
    10811095}
     1096
     1097// Set Verbose Level
     1098//   set same verbosity to all registered RangeToEnergyConverters 
     1099 void G4ProductionCutsTable::SetVerboseLevel(G4int value)
     1100{
     1101  verboseLevel = value;
     1102  for (int ip=0; ip< NumberOfG4CutIndex; ip++) {
     1103    if (converters[ip] !=0 ){
     1104      converters[ip]->SetVerboseLevel(value);
     1105    }
     1106  }
     1107}
     1108
  • trunk/source/processes/cuts/src/G4RToEConvForAntiNeutron.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForAntiNeutron.cc,v 1.3 2006/06/29 19:30:18 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForAntiProton.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForAntiProton.cc,v 1.3 2006/06/29 19:30:20 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForElectron.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForElectron.cc,v 1.5 2006/06/29 19:30:22 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForGamma.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForGamma.cc,v 1.4 2006/06/29 19:30:24 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForNeutron.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForNeutron.cc,v 1.3 2006/06/29 19:30:26 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForPositron.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForPositron.cc,v 1.5 2006/06/29 19:30:28 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4RToEConvForProton.cc

    r819 r961  
    2626//
    2727// $Id: G4RToEConvForProton.cc,v 1.3 2006/06/29 19:30:30 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/cuts/src/G4VRangeToEnergyConverter.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4VRangeToEnergyConverter.cc,v 1.8 2007/06/06 05:13:34 urban Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4VRangeToEnergyConverter.cc,v 1.9 2008/03/02 10:52:56 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    274274    theLossTable->reserve(G4Element::GetNumberOfElements());
    275275#ifdef G4VERBOSE
    276     if (GetVerboseLevel()>2) {
     276    if (GetVerboseLevel()>3) {
    277277      G4cout << "G4VRangeToEnergyConverter::BuildLossTable() ";
    278278      G4cout << "Create theLossTable[" << theLossTable << "]";
     
    447447  if ( theCutInLength >= rmax )  {
    448448#ifdef G4VERBOSE
    449     if (GetVerboseLevel()>0) {
     449    if (GetVerboseLevel()>2) {
    450450      G4cout << "G4VRangeToEnergyConverter::ConvertCutToKineticEnergy ";
    451451      G4cout << "  for " << theParticle->GetParticleName() << G4endl;
  • trunk/source/processes/decay/History

    r819 r961  
    1 $Id: History,v 1.28.2.1 2008/04/17 08:59:24 kurasige Exp $
     1$Id: History,v 1.34 2008/11/14 15:55:47 kurasige Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
    19 - Apr. 16,  08 H.Kurashige  (decay-V09-00-03)
     19-Sep. 19 2008   H.Kurashige (decay-V09-01-04)
     20- modify process sub type enumeration
     21
     22- Aug. 22,  08 P.Gumplinger (decay-V09-01-03)
     23- fix a bug in G4DecayWithSpin.cc: there is a memory overwrite when the
     24  GetFieldValue being called initializes a fieldValue array of size 6
     25  when the array is only defined of size 3 in the calling program.
     26  Thanks to Kamil Sedlak (PSI) for pointing this out and suggesting this
     27  fix.
     28 
     29- Apr. 16,  08 H.Kurashige  (decay-V09-01-02)
    2030- fix a bug when shortlived particles has finite  pre-assigned proper time
    2131 
     32- Apr. 11,  08 P.Gumplinger (decay-V09-01-01)
     33- modify G4DecayWithSpin::DecayIt to allow spin precession also for EM Fields;
     34  e.g. fields that do "DoesFieldChangeEnergy()" but only if the B-field
     35  component is > 0. (thanks to Kamil Sedlak, Toni Shiroka from PSI)
     36
     37- Dec. 15,  07 H.Kurashige (decay-V09-01-00)
     38- add G4DecayProcessType
     39- define process sub type
    2240
    2341- Oct. 29,  07 P.Gumplinger (decay-V09-00-02)
  • trunk/source/processes/decay/include/G4Decay.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Decay.hh,v 1.18 2007/07/23 23:13:04 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Decay.hh,v 1.20 2008/09/19 03:19:53 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    5858#include "G4VRestDiscreteProcess.hh"
    5959#include "G4ParticleChangeForDecay.hh"
     60#include "G4DecayProcessType.hh"
     61
    6062class G4VExtDecayer;
    6163
     
    206208
    207209inline
    208  void G4Decay::SetExtDecayer(G4VExtDecayer* val)
    209 {
    210   pExtDecayer = val;
    211 }
    212 
    213 inline
    214210 const G4VExtDecayer* G4Decay::GetExtDecayer() const
    215211{
  • trunk/source/processes/decay/include/G4UnknownDecay.hh

    r819 r961  
    2626//
    2727// $Id: G4UnknownDecay.hh,v 1.3 2006/06/29 19:30:56 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/decay/include/G4VExtDecayer.hh

    r819 r961  
    2626//
    2727// $Id: G4VExtDecayer.hh,v 1.4 2006/06/29 19:31:11 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/decay/src/G4Decay.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Decay.cc,v 1.27.2.1 2008/04/17 08:59:24 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Decay.cc,v 1.30 2008/09/19 03:19:53 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    6464                                pExtDecayer(0)
    6565{
     66  // set Process Sub Type
     67  SetProcessSubType(static_cast<int>(DECAY));
     68
    6669#ifdef G4VERBOSE
    6770  if (GetVerboseLevel()>1) {
     
    6972  }
    7073#endif
     74
    7175  pParticleChange = &fParticleChangeForDecay;
    7276}
     
    404408    fRemainderLifeTime = pTime - track.GetProperTime();
    405409    if (fRemainderLifeTime <= 0.0) fRemainderLifeTime = DBL_MIN;
     410   
    406411    G4double  rvalue=0.0;
    407412    // use pre-assigned Decay time to determine PIL
    408413    if (aLife>0.0) {
    409414      // ordinary particle
    410       rvalue = (fRemainderLifeTime/aLife)*GetMeanFreePath(track, previousStepSize
    411 , condition);
     415      rvalue = (fRemainderLifeTime/aLife)*GetMeanFreePath(track, previousStepSize, condition);
    412416    } else {
    413417     // shortlived particle
     
    418422    }
    419423    return rvalue;
    420  
    421424  }
    422425}
     
    440443  return fRemainderLifeTime;
    441444}
     445
     446
     447void G4Decay::SetExtDecayer(G4VExtDecayer* val)
     448{
     449  pExtDecayer = val;
     450
     451  // set Process Sub Type
     452  if ( pExtDecayer !=0 ) {
     453    SetProcessSubType(static_cast<int>(DECAY_External));
     454  }
     455}
  • trunk/source/processes/decay/src/G4DecayWithSpin.cc

    r819 r961  
    2929//      History:
    3030//      17 August 2004  P. Gumplinger, T. MacPhail
     31//      11 April  2008  Kamil Sedlak (PSI), Toni Shiroka (PSI)
    3132// ------------------------------------------------------------
    3233//
     
    4748#include "G4Transform3D.hh"
    4849
    49 G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processName){}
     50G4DecayWithSpin::G4DecayWithSpin(const G4String& processName):G4Decay(processName)
     51{
     52  // set Process Sub Type   
     53  SetProcessSubType(static_cast<int>(DECAY_WithSpin));
     54
     55}
    5056
    5157G4DecayWithSpin::~G4DecayWithSpin(){}
     
    97103    if(fieldMgr)field = fieldMgr->GetDetectorField();
    98104
    99     if (field && !(fieldMgr->DoesFieldChangeEnergy())) {
     105    if (field) {
    100106
    101107       G4double point[4];
     
    105111       point[3] = aTrack.GetGlobalTime();
    106112
    107        G4double fieldValue[3];
     113       G4double fieldValue[6];
    108114       field -> GetFieldValue(point,fieldValue);
    109115
    110116       G4ThreeVector B(fieldValue[0],fieldValue[1],fieldValue[2]);
    111117
    112        parent_polarization = Spin_Precession(aStep,B,fRemainderLifeTime);
     118       // Call the spin precession only for non-zero mag. field
     119       if (B.mag2() > 0.) parent_polarization =
     120                                 Spin_Precession(aStep,B,fRemainderLifeTime);
    113121
    114122    }
  • trunk/source/processes/decay/src/G4PionDecayMakeSpin.cc

    r819 r961  
    3737
    3838G4PionDecayMakeSpin::G4PionDecayMakeSpin(const G4String& processName)
    39                                : G4Decay(processName) { }
     39                               : G4Decay(processName)
     40{
     41  // set Process Sub Type
     42  SetProcessSubType(static_cast<int>(DECAY_PionMakeSpin));
     43
     44}
    4045
    4146G4PionDecayMakeSpin::~G4PionDecayMakeSpin() { }
  • trunk/source/processes/decay/src/G4UnknownDecay.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4UnknownDecay.cc,v 1.5 2007/10/06 07:01:09 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4UnknownDecay.cc,v 1.6 2007/12/15 12:29:16 kurasige Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    4040#include "G4PhysicsLogVector.hh"
    4141#include "G4ParticleChangeForDecay.hh"
     42#include "G4DecayProcessType.hh"
     43
    4244
    4345// constructor
     
    4749                                HighestValue(20.0)
    4850{
     51  // set Process Sub Type
     52  SetProcessSubType(static_cast<int>(DECAY_Unknown));
     53
    4954#ifdef G4VERBOSE
    5055  if (GetVerboseLevel()>1) {
  • trunk/source/processes/electromagnetic/GNUmakefile

    r819 r961  
    1 # $Id: GNUmakefile,v 1.6 2006/09/21 21:35:20 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.7 2008/11/14 19:54:40 gcosmo Exp $
    22# ------------------------------------------------------------------
    33# GNUmakefile for electromagnetic library.  Gabriele Cosmo, 18/9/96.
     
    88name := G4electromagnetic
    99
    10 SUBDIRS = muons standard utils xrays lowenergy highenergy polarisation
    11 SUBLIBS = G4muons G4emstandard G4emutils G4xrays G4emlowenergy G4emhighenergy G4polar
     10SUBDIRS = muons standard utils xrays lowenergy highenergy adjoint polarisation
     11SUBLIBS = G4muons G4emstandard G4emutils G4xrays G4emlowenergy G4emhighenergy G4emadjoint G4polar
    1212
    1313ifndef G4INSTALL
  • trunk/source/processes/electromagnetic/highenergy/GNUmakefile

    r819 r961  
    1 # $Id: GNUmakefile,v 1.3 2005/05/18 10:12:32 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.4 2008/03/06 11:47:10 vnivanch Exp $
    22# --------------------------------------------------------------------
    33# GNUmakefile for electromagnetic sub-library.  John Allison, 25/6/98.
     
    2525            -I$(G4BASE)/processes/electromagnetic/utils/include \
    2626            -I$(G4BASE)/processes/electromagnetic/standard/include \
     27            -I$(G4BASE)/processes/electromagnetic/muons/include \
    2728            -I$(G4BASE)/particles/management/include \
    2829            -I$(G4BASE)/particles/bosons/include \
  • trunk/source/processes/electromagnetic/highenergy/History

    r819 r961  
    1 $Id: History,v 1.22 2007/11/13 18:36:29 vnivanch Exp $
     1$Id: History,v 1.31 2009/02/20 16:38:33 vnivanch Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     2020 February 09: V.Ivanchenko (emhighenergy-V09-02-00)
     21- Cleanup: improved comments, move virtual methods from .hh to .cc
     22
     2316 October 08: V.Ivanchenko (emhighenergy-V09-01-06)
     24- Updated processes enumeration and printout
     25
     2621 July 08:  V.Ivanchenko (emhighenergy-V09-01-05)
     27- G4hBremsstrahlungModel, G4hPairProductionModel - do not use A in
     28                          the CrossSectionPerAtom
     29
     3010 July 08:  V.Ivanchenko (emhighenergy-V09-01-04)
     31- G4eeCrossSections - migrated to PDG 2006
     32- G4eeToHadronsMultiModel - added main reaction channels for omega and
     33                            phi resonances
     34- New models: G4eeTo3PiModel, G4eeToPGammaModel, G4ee2KChargedModel,
     35  G4ee2KNeutralModel
     36
     378 July 08:  V.Ivanchenko (emhighenergy-V09-01-03)
     38- G4GammaConversionToMuons - all exit() substituted by warnings
     39
     404 April 08:  V.Ivanchenko (emhighenergy-V09-01-02)
     41- G4hBremsstrahlungModel - remove static const
     42
     4314 March 08:  V.Ivanchenko (emhighenergy-V09-01-01)
     4406 March 08:  V.Ivanchenko (emhighenergy-V09-01-00)
     45- G4hBremsstrahlungModel, G4hBremsstrahlung, G4hPairProductionModel,
     46  G4hPairProduction are added
     47- SubType for all processes is initialized
    1948
    204913 November 07:  V.Ivanchenko (emhighenergy-V09-00-01)
  • trunk/source/processes/electromagnetic/highenergy/include/G4AnnihiToMuPair.hh

    r819 r961  
    2626//
    2727// $Id: G4AnnihiToMuPair.hh,v 1.2 2006/06/29 19:32:12 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//         ------------ G4AnnihiToMuPair physics process ------
  • trunk/source/processes/electromagnetic/highenergy/include/G4BetheBlochNoDeltaModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BetheBlochNoDeltaModel.hh,v 1.7 2006/06/29 19:32:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BetheBlochNoDeltaModel.hh,v 1.8 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6868                                        G4double cutEnergy);
    6969
    70   virtual G4double ComputeCrossSectionPerElectron(
    71                                         const G4ParticleDefinition*,
    72                                         G4double kineticEnergy,
    73                                         G4double cutEnergy,
    74                                         G4double maxEnergy);
     70  virtual G4double CrossSectionPerVolume(const G4Material*,
     71                                         const G4ParticleDefinition*,
     72                                         G4double kineticEnergy,
     73                                         G4double cutEnergy,
     74                                         G4double maxEnergy);
    7575
    7676private:
     
    8484//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8585
    86 inline G4double G4BetheBlochNoDeltaModel::ComputeDEDXPerVolume(
    87                             const G4Material* material,
    88                             const G4ParticleDefinition* pd,
    89                             G4double kinEnergy, G4double)
    90 {
    91   G4double dedx = G4BetheBlochModel::ComputeDEDXPerVolume(material, pd, kinEnergy, DBL_MAX);
    92   return dedx;
    93 }
    94 
    95 inline G4double G4BetheBlochNoDeltaModel::ComputeCrossSectionPerElectron(
    96                             const G4ParticleDefinition*,
    97                             G4double, G4double, G4double)
    98 {
    99   return 0.0;
    100 }
    101 
    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    103 
    10486#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4BraggNoDeltaModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggNoDeltaModel.hh,v 1.6 2006/06/29 19:32:16 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggNoDeltaModel.hh,v 1.7 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6868                                        G4double cutEnergy);
    6969
    70   virtual G4double ComputeCrossSectionPerElectron(
     70  virtual G4double CrossSectionPerVolume(const G4Material*,
    7171                                         const G4ParticleDefinition*,
    7272                                         G4double kineticEnergy,
    7373                                         G4double cutEnergy,
    7474                                         G4double maxEnergy);
    75 
    7675private:
    7776
     
    8483//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8584
    86 inline G4double G4BraggNoDeltaModel::ComputeDEDXPerVolume(
    87                             const G4Material* material,
    88                             const G4ParticleDefinition* pd,
    89                             G4double kinEnergy, G4double)
    90 {
    91   G4double dedx = G4BraggIonModel::ComputeDEDXPerVolume(material, pd, kinEnergy, DBL_MAX);
    92   return dedx;
    93 }
    94 
    95 inline G4double G4BraggNoDeltaModel::ComputeCrossSectionPerElectron(
    96                             const G4ParticleDefinition*,
    97                             G4double, G4double, G4double)
    98 {
    99   return 0.0;
    100 }
    101 
    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    103 
    10485#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4GammaConversionToMuons.hh

    r819 r961  
    2626//
    2727// $Id: G4GammaConversionToMuons.hh,v 1.2 2006/06/29 19:32:18 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//         ------------ G4GammaConversionToMuons physics process ------
  • trunk/source/processes/electromagnetic/highenergy/include/G4Vee2hadrons.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4Vee2hadrons.hh,v 1.3 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4Vee2hadrons.hh,v 1.4 2008/07/10 18:06:38 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6363public:
    6464
    65   G4Vee2hadrons() {};
     65  G4Vee2hadrons() : lowEnergy(0.0), highEnergy(1.1*GeV) {};
    6666
    6767  virtual ~G4Vee2hadrons() {};
     
    7676
    7777  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    78                       G4double, const G4ThreeVector&) const = 0;
     78                                 G4double, const G4ThreeVector&) = 0;
     79
     80  void SetLowEnergy(G4double val) {lowEnergy = val;};
     81
     82  G4double LowEnergy() const {return lowEnergy;};
     83
     84  void SetHighEnergy(G4double val) {highEnergy = val;};
     85
     86  G4double HighEnergy() const {return highEnergy;};
    7987
    8088private:
     
    8492  G4Vee2hadrons(const  G4Vee2hadrons&);
    8593
     94  G4double lowEnergy;
     95  G4double highEnergy;
     96
    8697};
    8798
  • trunk/source/processes/electromagnetic/highenergy/include/G4eeCrossSections.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeCrossSections.hh,v 1.2 2006/06/29 19:32:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeCrossSections.hh,v 1.3 2008/07/10 18:06:38 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7070  G4double CrossSection3pi(G4double);
    7171
     72  G4double CrossSectionPi0G(G4double);
     73
     74  G4double CrossSectionEtaG(G4double);
     75
    7276  G4double CrossSection2Kcharged(G4double);
    7377
    7478  G4double CrossSection2Kneutral(G4double);
     79
     80  std::complex<G4double> DpRho(G4double e);
    7581
    7682private:
     
    95101  G4double WidthPhi(G4double e);
    96102
    97   std::complex<G4double> DpRho(G4double e);
    98 
    99103  std::complex<G4double> DpOm(G4double e);
    100104
    101105  std::complex<G4double> DpPhi(G4double e);
    102 
    103106
    104107  // hide assignment operator
  • trunk/source/processes/electromagnetic/highenergy/include/G4eeToHadrons.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadrons.hh,v 1.8 2007/05/23 08:50:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadrons.hh,v 1.9 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7070
    7171  // Print out of the class parameters
    72   void PrintInfo();
     72  virtual void PrintInfo();
    7373
    7474  // Set the factor to artificially increase the crossSection (default 1)
     
    7777protected:
    7878
    79   void InitialiseProcess(const G4ParticleDefinition*);
     79  virtual void InitialiseProcess(const G4ParticleDefinition*);
    8080
    8181private:
     
    9292};
    9393
    94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    96 
    97 inline G4bool G4eeToHadrons::IsApplicable(const G4ParticleDefinition& p)
    98 {
    99   return (&p == G4Positron::Positron());
    100 }
    101 
    10294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    10395
  • trunk/source/processes/electromagnetic/highenergy/include/G4eeToHadronsModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadronsModel.hh,v 1.6 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadronsModel.hh,v 1.7 2008/07/10 18:06:38 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6363public:
    6464
    65   G4eeToHadronsModel(const G4Vee2hadrons*, G4int ver=0,
     65  G4eeToHadronsModel(G4Vee2hadrons*, G4int ver=0,
    6666                     const G4String& nam = "eeToHadrons");
    6767
     
    6969
    7070  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    71 
    72   G4double PeakEnergy() const;
    7371
    7472  virtual G4double CrossSectionPerVolume(const G4Material*,
     
    9997  G4DynamicParticle* GenerateCMPhoton(G4double);
    10098
     99  inline G4double PeakEnergy() const;
     100
    101101private:
    102102
     
    107107  G4eeToHadronsModel(const  G4eeToHadronsModel&);
    108108
    109   const G4Vee2hadrons*  model;
     109  G4Vee2hadrons*        model;
    110110  G4ParticleDefinition* theGamma;
    111111  G4PhysicsVector*      crossPerElectron;
     
    133133//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    134134
    135 inline G4double G4eeToHadronsModel::CrossSectionPerVolume(
    136                                       const G4Material* mat,
    137                                       const G4ParticleDefinition* p,
    138                                       G4double kineticEnergy,
    139                                       G4double, G4double)
    140 {
    141   return mat->GetElectronDensity()*
    142     ComputeCrossSectionPerElectron(p, kineticEnergy);
    143 }
    144 
    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    146 
    147 inline G4double G4eeToHadronsModel::ComputeCrossSectionPerAtom(
    148                                       const G4ParticleDefinition* p,
    149                                       G4double kineticEnergy,
    150                                       G4double Z, G4double,
    151                                       G4double, G4double)
    152 {
    153   return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
    154 }
    155 
    156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    157 
    158135#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4eeToHadronsMultiModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadronsMultiModel.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadronsMultiModel.hh,v 1.7 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5959
    6060class G4eeCrossSections;
     61class G4Vee2hadrons;
    6162
    6263class G4eeToHadronsMultiModel : public G4VEmModel
     
    8485                                         G4double maxEnergy = DBL_MAX);
    8586
    86   virtual G4double ComputeCrossSectionPerElectron(
    87                                          const G4ParticleDefinition*,
    88                                          G4double kineticEnergy,
    89                                          G4double cutEnergy = 0.0,
    90                                          G4double maxEnergy = DBL_MAX);
    91 
    9287  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    9388                                 const G4MaterialCutsCouple*,
     
    9691                                 G4double maxEnergy = DBL_MAX);
    9792
    98   void PrintInfo();
     93  virtual void PrintInfo();
    9994
    10095  // Set the factor to artificially increase the crossSection (default 1)
    10196  void SetCrossSecFactor(G4double fac);
    10297
     98  inline G4double ComputeCrossSectionPerElectron(
     99                                         const G4ParticleDefinition*,
     100                                         G4double kineticEnergy,
     101                                         G4double cutEnergy = 0.0,
     102                                         G4double maxEnergy = DBL_MAX);
     103
    103104private:
     105
     106  void AddEEModel(G4Vee2hadrons*);
    104107
    105108  // hide assignment operator
     
    128131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    129132
    130 inline G4double G4eeToHadronsMultiModel::CrossSectionPerVolume(
    131                                       const G4Material* mat,
    132                                       const G4ParticleDefinition* p,
    133                                       G4double kineticEnergy,
    134                                       G4double, G4double)
    135 {
    136   return mat->GetElectronDensity()*
    137     ComputeCrossSectionPerElectron(p, kineticEnergy);
    138 }
    139 
    140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    141 
    142 inline G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerAtom(
    143                                       const G4ParticleDefinition* p,
    144                                       G4double kineticEnergy,
    145                                       G4double Z, G4double,
    146                                       G4double, G4double)
    147 {
    148   return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
    149 }
    150 
    151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    152 
    153133inline G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerElectron(
    154134                                      const G4ParticleDefinition*,
     
    169149//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    170150
    171 inline
    172 void G4eeToHadronsMultiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
    173                                                 const G4MaterialCutsCouple* couple,
    174                                                 const G4DynamicParticle* dp,
    175                                                 G4double, G4double)
    176 {
    177   G4double kinEnergy = dp->GetKineticEnergy();
    178   if (kinEnergy > thKineticEnergy) {
    179     G4double q = cumSum[nModels-1]*G4UniformRand();
    180     for(G4int i=0; i<nModels; i++) {
    181       if(q <= cumSum[i]) {
    182         (models[i])->SampleSecondaries(newp, couple,dp);
    183         if(newp->size() > 0) fParticleChange->ProposeTrackStatus(fStopAndKill);
    184         break;
    185       }
    186     }
    187   }
    188 }
    189 
    190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    191 
    192151#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4eeToTwoPiModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToTwoPiModel.hh,v 1.3 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToTwoPiModel.hh,v 1.5 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6767  virtual ~G4eeToTwoPiModel();
    6868
    69   G4double ThresholdEnergy() const;
     69  virtual G4double ThresholdEnergy() const;
    7070
    71   G4double PeakEnergy() const;
     71  virtual G4double PeakEnergy() const;
    7272
    73   G4double ComputeCrossSection(G4double) const;
     73  virtual G4double ComputeCrossSection(G4double) const;
    7474
    75   G4PhysicsVector* PhysicsVector(G4double, G4double) const;
     75  virtual G4PhysicsVector* PhysicsVector(G4double, G4double) const;
    7676
    7777  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    78               G4double, const G4ThreeVector&) const;
     78              G4double, const G4ThreeVector&);
    7979
    8080private:
    81 
    82   void Initialise();
    8381
    8482  // hide assignment operator
     
    9088  G4double massPi;
    9189  G4double massRho;
    92   G4double highEnergy;
    9390
    9491};
     
    9693//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    9794
    98 inline G4double G4eeToTwoPiModel::ThresholdEnergy() const
    99 {
    100   return 2.0*massPi;
    101 }
    102 
    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    104 
    105 inline G4double G4eeToTwoPiModel::PeakEnergy() const
    106 {
    107   return massRho;
    108 }
    109 
    110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    111 
    112 inline G4double G4eeToTwoPiModel::ComputeCrossSection(G4double e) const
    113 {
    114   G4double ee = std::min(GeV,e);
    115   return cross->CrossSection2pi(ee);
    116 }
    117 
    118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    119 
    12095#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4hhIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hhIonisation.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4hhIonisation.hh,v 1.6 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6969  virtual ~G4hhIonisation();
    7070
    71   G4bool IsApplicable(const G4ParticleDefinition& p);
     71  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    7272
    73   G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    74                             const G4Material*, G4double cut);
     73  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     74                                    const G4Material*, G4double cut);
    7575
    7676  // Print out of the class parameters
     
    104104
    105105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    107 
    108 inline G4bool G4hhIonisation::IsApplicable(const G4ParticleDefinition& p)
    109 {
    110   return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 100.0*MeV &&
    111          !p.IsShortLived());
    112 }
    113 
    114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    115 
    116 inline G4double G4hhIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
    117                                                 const G4Material*,
    118                                                 G4double cut)
    119 {
    120   G4double x = 0.5*cut/electron_mass_c2;
    121   G4double y = electron_mass_c2/mass;
    122   G4double g = x*y + std::sqrt((1. + x)*(1. + x*y*y));
    123   return mass*(g - 1.0);
    124 }
    125 
    126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    127106
    128107#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4mplIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4mplIonisation.hh,v 1.5 2007/05/23 08:50:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4mplIonisation.hh,v 1.6 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7272  virtual ~G4mplIonisation();
    7373
    74   G4bool IsApplicable(const G4ParticleDefinition& p);
     74  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    7575
    7676  // Print out of the class parameters
     
    9494
    9595//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    97 
    98 inline G4bool G4mplIonisation::IsApplicable(const G4ParticleDefinition& p)
    99 {
    100   return (p.GetParticleName() == "monopole");
    101 }
    102 
    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    10496
    10597#endif
  • trunk/source/processes/electromagnetic/highenergy/include/G4mplIonisationModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4mplIonisationModel.hh,v 1.6 2007/11/13 18:36:29 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4mplIonisationModel.hh,v 1.7 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    120120
    121121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    122 
    123 inline void G4mplIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
    124                                                     const G4MaterialCutsCouple*,
    125                                                     const G4DynamicParticle*,
    126                                                     G4double,
    127                                                     G4double)
    128 {}
    129 
    130 inline G4double G4mplIonisationModel::Dispersion(
    131                           const G4Material* material,
    132                           const G4DynamicParticle* dp,
    133                                 G4double& tmax,
    134                                 G4double& length)
    135 {
    136   G4double siga = 0.0;
    137   G4double tau   = dp->GetKineticEnergy()/mass;
    138   if(tau > 0.0) {
    139     G4double electronDensity = material->GetElectronDensity();
    140     G4double gam   = tau + 1.0;
    141     G4double invbeta2 = (gam*gam)/(tau * (tau+2.0));
    142     siga  = (invbeta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
    143       * electronDensity * chargeSquare;
    144   }
    145   return siga;
    146 }
    147 
    148 
    149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/highenergy/src/G4AnnihiToMuPair.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4AnnihiToMuPair.cc,v 1.3 2006/06/29 19:32:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4AnnihiToMuPair.cc,v 1.5 2008/10/16 14:29:48 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//         ------------ G4AnnihiToMuPair physics process ------
     
    6666 
    6767 CrossSecFactor = 1.;
     68 SetProcessSubType(6);
     69
    6870}
    6971
     
    244246void G4AnnihiToMuPair::PrintInfoDefinition()
    245247{
    246   G4String comments ="e+e->mu+mu- annihilation, atomic e- at rest.\n";
    247   G4cout << G4endl << GetProcessName() << ":  " << comments
    248          << "        threshold at " << LowestEnergyLimit/GeV << " GeV"
     248  G4String comments ="e+e->mu+mu- annihilation, atomic e- at rest, SubType=.";
     249  G4cout << G4endl << GetProcessName() << ":  " << comments
     250         << GetProcessSubType() << G4endl;
     251  G4cout << "        threshold at " << LowestEnergyLimit/GeV << " GeV"
    249252         << " good description up to "
    250253         << HighestEnergyLimit/TeV << " TeV for all Z." << G4endl;
  • trunk/source/processes/electromagnetic/highenergy/src/G4BetheBlochNoDeltaModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BetheBlochNoDeltaModel.cc,v 1.3 2006/06/29 19:32:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BetheBlochNoDeltaModel.cc,v 1.4 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5858{}
    5959
     60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     61
    6062G4BetheBlochNoDeltaModel::~G4BetheBlochNoDeltaModel()
    6163{}
     
    6365//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    6466
     67G4double G4BetheBlochNoDeltaModel::ComputeDEDXPerVolume(
     68                            const G4Material* material,
     69                            const G4ParticleDefinition* pd,
     70                            G4double kinEnergy, G4double)
     71{
     72  return
     73    G4BetheBlochModel::ComputeDEDXPerVolume(material, pd, kinEnergy, DBL_MAX);
     74}
    6575
     76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     77
     78G4double G4BetheBlochNoDeltaModel::CrossSectionPerVolume(
     79                    const G4Material*,const G4ParticleDefinition*,
     80                    G4double, G4double, G4double)
     81{
     82  return 0.0;
     83}
     84
     85//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     86
     87
  • trunk/source/processes/electromagnetic/highenergy/src/G4BraggNoDeltaModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggNoDeltaModel.cc,v 1.3 2006/06/29 19:32:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggNoDeltaModel.cc,v 1.4 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5353//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    5454
    55 
    5655G4BraggNoDeltaModel::G4BraggNoDeltaModel(const G4ParticleDefinition*p,
    5756                                         const G4String& nam) :
    5857  G4BraggIonModel(p, nam)
    5958{}
     59
     60//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    6061
    6162G4BraggNoDeltaModel::~G4BraggNoDeltaModel()
     
    6465//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    6566
     67G4double G4BraggNoDeltaModel::ComputeDEDXPerVolume(
     68                            const G4Material* material,
     69                            const G4ParticleDefinition* pd,
     70                            G4double kinEnergy, G4double)
     71{
     72  return
     73    G4BraggIonModel::ComputeDEDXPerVolume(material, pd, kinEnergy, DBL_MAX);
     74}
    6675
     76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     77
     78G4double G4BraggNoDeltaModel::CrossSectionPerVolume(
     79                            const G4Material*,
     80                            const G4ParticleDefinition*,
     81                            G4double, G4double, G4double)
     82{
     83  return 0.0;
     84}
     85
     86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     87
     88
  • trunk/source/processes/electromagnetic/highenergy/src/G4GammaConversionToMuons.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4GammaConversionToMuons.cc,v 1.4 2006/06/29 19:32:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4GammaConversionToMuons.cc,v 1.7 2008/10/16 14:29:48 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//         ------------ G4GammaConversionToMuons physics process ------
     
    5151    HighestEnergyLimit(1e21*eV), // ok to 1e21eV=1e12GeV, then LPM suppression
    5252    CrossSecFactor(1.)
    53 { }
     53{
     54  SetProcessSubType(15);
     55}
    5456
    5557//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     
    261263    G4double xxp=1.-4./3.*xPM; // the main xPlus dependence
    262264    result=xxp*log(W)*LogWmaxInv;
    263     if(result>1.)
    264     { G4cout << "error in dSigxPlusGen, result=" << result << " is >1" << '\n';
    265       exit(10);
     265    if(result>1.) {
     266      G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
     267             << " in dSigxPlusGen, result=" << result << " > 1" << G4endl;
    266268    }
    267269  }
     
    285287      f1=(1.-2.*xPM+4.*xPM*t*(1.-t)) / (1.+C1/(t*t));
    286288      if(f1<0 || f1> f1_max) // should never happend
    287       { G4cout << "outside allowed range f1=" << f1 << G4endl;
    288         exit(1);
    289       }
     289        {
     290          G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
     291                 << "outside allowed range f1=" << f1 << " is set to zero"
     292                 << G4endl;
     293          f1 = 0.0;
     294        }
    290295    }
    291296    while ( G4UniformRand()*f1_max > f1);
     
    299304      f2=1.-2.*xPM+4.*xPM*t*(1.-t)*(1.+cos(2.*psi));
    300305      if(f2<0 || f2> f2_max) // should never happend
    301       { G4cout << "outside allowed range f2=" << f2 << G4endl;
    302         exit(1);
    303       }
     306        {
     307          G4cout << "G4GammaConversionToMuons::PostStepDoIt WARNING:"
     308                 << "outside allowed range f2=" << f2 << " is set to zero"
     309                 << G4endl;
     310          f2 = 0.0;
     311        }
    304312    }
    305313    while ( G4UniformRand()*f2_max > f2);
     
    387395void G4GammaConversionToMuons::PrintInfoDefinition()
    388396{
    389   G4String comments ="gamma->mu+mu- Bethe Heitler process.\n";
     397  G4String comments ="gamma->mu+mu- Bethe Heitler process, SubType= ";
    390398  G4cout << G4endl << GetProcessName() << ":  " << comments
    391          << "        good cross section parametrization from "
     399         << GetProcessSubType() << G4endl;
     400  G4cout << "        good cross section parametrization from "
    392401         << G4BestUnit(LowestEnergyLimit,"Energy")
    393402         << " to " << HighestEnergyLimit/GeV << " GeV for all Z." << G4endl;
  • trunk/source/processes/electromagnetic/highenergy/src/G4eeCrossSections.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeCrossSections.cc,v 1.6 2006/06/29 19:32:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeCrossSections.cc,v 1.7 2008/07/10 18:06:39 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    3939//
    4040// Modifications:
    41 //
     41// 10.07.2008 Updated for PDG Jour. Physics, G33, 1 (2006)
    4242//
    4343// -------------------------------------------------------------------
     
    5252#include "G4PionMinus.hh"
    5353#include "G4PionZero.hh"
     54#include "G4Eta.hh"
    5455#include "G4KaonPlus.hh"
    5556#include "G4KaonMinus.hh"
     
    8081  MsPi = G4PionPlus::PionPlus()->GetPDGMass();
    8182  MsPi0= G4PionZero::PionZero()->GetPDGMass();
    82   MsEta= 547.30*MeV;
     83  MsEta= G4Eta::Eta()->GetPDGMass();
    8384  MsEtap=957.78*MeV;
    8485  MsKs = G4KaonZeroLong::KaonZeroLong()->GetPDGMass();
    85   MsKc=G4KaonPlus::KaonPlus()->GetPDGMass();
    86   MsRho= 770.0*MeV;
    87   MsOm = 781.94*MeV;
     86  MsKc = G4KaonPlus::KaonPlus()->GetPDGMass();
     87  MsRho= 775.5*MeV;
     88  MsOm = 782.62*MeV;
    8889  MsF0 = 980.0*MeV;
    89   MsA0 = 983.4*MeV;
    90   MsPhi= 1019.413*MeV;
     90  MsA0 = 984.7*MeV;
     91  MsPhi= 1019.46*MeV;
    9192  MsK892 = 891.66*MeV;
    92   MsK0892 = 896.10*MeV;
    93   GRho = 150.7*MeV;
    94   GOm = 8.41*MeV;
    95   GPhi = 4.43*MeV;
     93  MsK0892 = 896.0*MeV;
     94  GRho = 149.4*MeV;
     95  GOm = 8.49*MeV;
     96  GPhi = 4.26*MeV;
    9697  GK892 = 50.8*MeV;
    97   GK0892 = 50.5*MeV;
     98  GK0892 = 50.3*MeV;
    9899  PhRho = 0.0;
    99100  PhOm = 0.0;
     
    103104  BrRhoPiG = 4.5e-4;
    104105  BrRhoPi0G= 6.8e-4;
    105   BrRhoEtaG= 2.4e-4;
    106   BrRhoEe = 4.49e-5;
    107   BrOm3Pi = 0.888;
    108   BrOmPi0G= 0.085;
    109   BrOmEtaG= 6.5e-4;
    110   BrOm2Pi = 0.0221;
     106  BrRhoEtaG= 2.95e-4;
     107  BrRhoEe = 4.7e-5;
     108  BrOm3Pi = 0.891;
     109  BrOmPi0G= 0.089;
     110  BrOmEtaG= 4.9e-4;
     111  BrOm2Pi = 0.017;
    111112  PhOm2Pi = 90.0;
    112   BrOmEe = 7.07e-5;
    113   BrPhi2Kc = 0.491;
    114   BrPhiKsKl= 0.341;
    115   BrPhi3Pi = 0.155;
    116   BrPhiPi0G= 1.31e-3;
    117   BrPhiEtaG= 1.26e-2;
    118   BrPhi2Pi = 8.e-5;
     113  BrOmEe = 7.18e-5;
     114  BrPhi2Kc = 0.492;
     115  BrPhiKsKl= 0.34;
     116  BrPhi3Pi = 0.153;
     117  BrPhiPi0G= 1.25e-3;
     118  BrPhiEtaG= 1.301e-2;
     119  BrPhi2Pi = 7.3e-5;
    119120  PhPhi2Pi = -20.0*degree;
    120   BrPhiEe = 2.99e-4;
     121  BrPhiEe = 2.97e-4;
    121122
    122123  MsRho3 = MsRho*MsRho*MsRho;
     
    125126
    126127  MeVnb = 3.8938e+11*nanobarn;
    127   Alpha = 1.0/137.036;
     128  Alpha = fine_structure_const;
    128129
    129130  AOmRho = 3.0;
     
    134135  brsigpipi = 1.;
    135136
    136   msrho1450 = 1465.*MeV;
    137   msrho1700 = 1700.*MeV;
    138   grho1450 = 310.*MeV;
    139   grho1700 = 240.*MeV;
     137  msrho1450 = 1459.*MeV;
     138  msrho1700 = 1688.8*MeV;
     139  grho1450 = 171.*MeV;
     140  grho1700 = 161.*MeV;
    140141  arhoompi0 = 1.;
    141142  arho1450ompi0 = 1.;
     
    190191
    191192G4double G4eeCrossSections::CrossSection2pi(G4double e)
    192 {
    193  
     193{
    194194  complex<G4double> xr(cos(PhRho),sin(PhRho));
    195195  complex<G4double> xo(cos(PhOm2Pi),sin(PhOm2Pi));
     
    205205    + sqrt(Width2p(s,MsOm,GOm,BrOm2Pi,MsPi)*MsOm3*BrOmEe*GOm)*xo/dom
    206206    + sqrt(Width2p(s,MsPhi,GPhi,BrPhi2Pi,MsPi)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
     207
     208  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     209
     210  return cross;
     211}
     212
     213//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     214
     215G4double G4eeCrossSections::CrossSection3pi(G4double e)
     216{
     217  complex<G4double> xf(cos(PhPhi2Pi),sin(PhPhi));
     218
     219  G4double s = e*e;
     220  complex<G4double> dom  = DpOm(e);
     221  complex<G4double> dphi = DpPhi(e);
     222
     223  complex<G4double> amp =
     224    sqrt(Width3p(s,MsOm,GOm,BrOm3Pi)*MsOm3*BrOmEe*GOm)/dom
     225    + sqrt(Width3p(s,MsPhi,GPhi,BrPhi3Pi)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
     226
     227  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     228
     229  return cross;
     230}
     231
     232//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     233
     234G4double G4eeCrossSections::CrossSectionPi0G(G4double e)
     235{
     236  complex<G4double> xf(cos(PhPhi),sin(PhPhi));
     237
     238  G4double s = e*e;
     239  complex<G4double> drho = DpRho(e);
     240  complex<G4double> dom  = DpOm(e);
     241  complex<G4double> dphi = DpPhi(e);
     242
     243  complex<G4double> amp =
     244      sqrt(WidthPg(s,MsRho,GRho,BrRhoPi0G,MsPi0)*MsRho3*BrRhoEe*GRho)/drho
     245    + sqrt(WidthPg(s,MsOm,GOm,BrOmPi0G,MsPi0)*MsOm3*BrOmEe*GOm)/dom
     246    + sqrt(WidthPg(s,MsPhi,GPhi,BrPhiPi0G,MsPi0)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
     247
     248  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     249
     250  return cross;
     251}
     252
     253//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     254
     255G4double G4eeCrossSections::CrossSectionEtaG(G4double e)
     256{
     257  complex<G4double> xf(cos(PhPhi),sin(PhPhi));
     258
     259  G4double s = e*e;
     260  complex<G4double> drho = DpRho(e);
     261  complex<G4double> dom  = DpOm(e);
     262  complex<G4double> dphi = DpPhi(e);
     263
     264  complex<G4double> amp =
     265      sqrt(WidthPg(s,MsRho,GRho,BrRhoEtaG,MsEta)*MsRho3*BrRhoEe*GRho)/drho
     266    + sqrt(WidthPg(s,MsOm,GOm,BrOmEtaG,MsEta)*MsOm3*BrOmEe*GOm)/dom
     267    + sqrt(WidthPg(s,MsPhi,GPhi,BrPhiEtaG,MsEta)*MsPhi3*BrPhiEe*GPhi)*xf/dphi;
     268
     269  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     270
     271  return cross;
     272}
     273
     274//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     275
     276G4double G4eeCrossSections::CrossSection2Kcharged(G4double e)
     277{
     278  G4double s = e*e;
     279  complex<G4double> dphi = DpPhi(e);
     280
     281  complex<G4double> amp =
     282    sqrt(Width2p(s,MsPhi,GPhi,BrPhi2Kc,MsKc)*MsPhi3*BrPhiEe*GPhi)/dphi;
     283
     284  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     285
     286  return cross;
     287}
     288
     289//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     290
     291G4double G4eeCrossSections::CrossSection2Kneutral(G4double e)
     292{
     293  G4double s = e*e;
     294  complex<G4double> dphi = DpPhi(e);
     295
     296  complex<G4double> amp =
     297    sqrt(Width2p(s,MsPhi,GPhi,BrPhiKsKl,MsKs)*MsPhi3*BrPhiEe*GPhi)/dphi;
    207298
    208299  G4double cross = 12.0*pi*MeVnb*norm(amp)/(e*s);
     
    238329G4double G4eeCrossSections::PhaseSpace3p(G4double e)
    239330{
    240  
     331  //     E.A.Kuraev, Z.K.Silagadze.
     332  //  Once more about the omega->3 pi contact term.
     333  //  Yadernaya Phisica, 1995, V58, N9, p.1678-1694. 
     334
    241335  //  G4bool b;
    242336  //  G4double x = ph3p->GetValue(e, b);
  • trunk/source/processes/electromagnetic/highenergy/src/G4eeToHadrons.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadrons.cc,v 1.7 2006/06/29 19:32:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadrons.cc,v 1.9 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6464    isInitialised(false)
    6565{
    66     SetVerboseLevel(1);
     66  SetVerboseLevel(1);
     67  SetProcessSubType(fAnnihilationToHadrons);
    6768}
    6869
     
    7172G4eeToHadrons::~G4eeToHadrons()
    7273{}
     74
     75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     76
     77G4bool G4eeToHadrons::IsApplicable(const G4ParticleDefinition& p)
     78{
     79  return (&p == G4Positron::Positron());
     80}
    7381
    7482//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/highenergy/src/G4eeToHadronsModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadronsModel.cc,v 1.8 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadronsModel.cc,v 1.9 2008/07/10 18:06:39 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6565using namespace std;
    6666
    67 G4eeToHadronsModel::G4eeToHadronsModel(const G4Vee2hadrons* m,
    68                                              G4int ver,
     67G4eeToHadronsModel::G4eeToHadronsModel(G4Vee2hadrons* m, G4int ver,
    6968                                       const G4String& nam)
    7069  : G4VEmModel(nam),
    71   model(m),
    72   crossPerElectron(0),
    73   crossBornPerElectron(0),
    74   isInitialised(false),
    75   nbins(100),
    76   verbose(ver)
    77 {
    78   theGamma      = G4Gamma::Gamma();
     70    model(m),
     71    crossPerElectron(0),
     72    crossBornPerElectron(0),
     73    isInitialised(false),
     74    nbins(100),
     75    verbose(ver)
     76{
     77  theGamma = G4Gamma::Gamma();
    7978}
    8079
     
    9695  isInitialised  = true;
    9796
     97  // Lab system
    9898  highKinEnergy = HighEnergyLimit();
    9999  lowKinEnergy  = LowEnergyLimit();
    100100
    101   emin  = model->ThresholdEnergy();
    102   emax = 2.0*electron_mass_c2*sqrt(1.0 + 0.5*highKinEnergy/electron_mass_c2);
    103   if(emin > emax) emin = emax;
    104 
    105   lowKinEnergy  = 0.5*emin*emin/electron_mass_c2 - 2.0*electron_mass_c2;
    106 
    107   epeak = min(model->PeakEnergy(), emax);
     101  // CM system
     102  emin  = model->LowEnergy();
     103  emax  = model->HighEnergy();
     104
     105  G4double emin0 =
     106    2.0*electron_mass_c2*sqrt(1.0 + 0.5*lowKinEnergy/electron_mass_c2);
     107  G4double emax0 =
     108    2.0*electron_mass_c2*sqrt(1.0 + 0.5*highKinEnergy/electron_mass_c2);
     109
     110  // recompute low energy
     111  if(emin0 > emax) {
     112    emin0 = emax;
     113    model->SetLowEnergy(emin0);
     114  }
     115  if(emin > emin0) {
     116    emin0 = emin;
     117    lowKinEnergy  = 0.5*emin*emin/electron_mass_c2 - 2.0*electron_mass_c2;
     118    SetLowEnergyLimit(lowKinEnergy);
     119  }
     120
     121  // recompute high energy
     122  if(emax < emax0) {
     123    emax0 = emax;
     124    highKinEnergy = 0.5*emax*emax/electron_mass_c2 - 2.0*electron_mass_c2;
     125    SetHighEnergyLimit(highKinEnergy);
     126  }
     127
     128  // peak energy
     129  epeak = std::min(model->PeakEnergy(), emax);
    108130  peakKinEnergy  = 0.5*epeak*epeak/electron_mass_c2 - 2.0*electron_mass_c2;
    109131
     
    148170    }
    149171  }
     172}
     173
     174//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     175
     176G4double G4eeToHadronsModel::CrossSectionPerVolume(
     177                                      const G4Material* mat,
     178                                      const G4ParticleDefinition* p,
     179                                      G4double kineticEnergy,
     180                                      G4double, G4double)
     181{
     182  return mat->GetElectronDensity()*
     183    ComputeCrossSectionPerElectron(p, kineticEnergy);
     184}
     185
     186//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     187
     188G4double G4eeToHadronsModel::ComputeCrossSectionPerAtom(
     189                                      const G4ParticleDefinition* p,
     190                                      G4double kineticEnergy,
     191                                      G4double Z, G4double,
     192                                      G4double, G4double)
     193{
     194  return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
    150195}
    151196
  • trunk/source/processes/electromagnetic/highenergy/src/G4eeToHadronsMultiModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToHadronsMultiModel.cc,v 1.4 2007/05/23 08:50:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToHadronsMultiModel.cc,v 1.6 2008/07/11 17:49:11 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    3434// File name:     G4eeToHadronsMultiModel
    3535//
    36 // Author:        Vladimir Ivanchenko on base of Michel Maire code
     36// Author:        Vladimir Ivanchenko
    3737//
    3838// Creation date: 02.08.2004
     
    5151#include "G4eeToHadronsMultiModel.hh"
    5252#include "G4eeToTwoPiModel.hh"
     53#include "G4eeTo3PiModel.hh"
     54#include "G4eeToPGammaModel.hh"
     55#include "G4ee2KNeutralModel.hh"
     56#include "G4ee2KChargedModel.hh"
    5357#include "G4eeCrossSections.hh"
     58#include "G4Vee2hadrons.hh"
    5459
    5560//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8085//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8186
    82 void G4eeToHadronsMultiModel::Initialise(const G4ParticleDefinition* p, const G4DataVector& v)
     87void G4eeToHadronsMultiModel::Initialise(const G4ParticleDefinition*,
     88                                         const G4DataVector&)
    8389{
    8490  if(!isInitialised) {
    8591    isInitialised = true;
    8692
    87     thKineticEnergy = DBL_MAX;
    88     maxKineticEnergy = HighEnergyLimit();
     93    thKineticEnergy  = DBL_MAX;
     94    maxKineticEnergy = 1.2*GeV;
    8995
    9096    cross = new G4eeCrossSections();
    91     G4eeToHadronsModel* model =
    92       new G4eeToHadronsModel(new G4eeToTwoPiModel(cross), verbose);
    93     models.push_back(model);
    94     model->SetHighEnergyLimit(maxKineticEnergy);
    95     model->Initialise(p, v);
    96     G4double emin = model->LowEnergyLimit();
    97     if(emin < thKineticEnergy) thKineticEnergy = emin;
    98     ekinMin.push_back(emin);
    99     ekinMax.push_back(model->HighEnergyLimit());
    100     ekinPeak.push_back(model->PeakEnergy());
    101     cumSum.push_back(0.0);
    102     nModels = 1;
    103 
    104     if(pParticleChange)
     97
     98    G4eeToTwoPiModel* m2pi = new G4eeToTwoPiModel(cross);
     99    m2pi->SetHighEnergy(maxKineticEnergy);
     100    AddEEModel(m2pi);
     101
     102    G4eeTo3PiModel* m3pi1 = new G4eeTo3PiModel(cross);
     103    m3pi1->SetHighEnergy(0.95*GeV);
     104    AddEEModel(m3pi1);
     105
     106    G4eeTo3PiModel* m3pi2 = new G4eeTo3PiModel(cross);
     107    m3pi2->SetLowEnergy(0.95*GeV);
     108    m3pi2->SetHighEnergy(maxKineticEnergy);
     109    AddEEModel(m3pi2);
     110
     111    G4ee2KChargedModel* m2kc = new G4ee2KChargedModel(cross);
     112    m2kc->SetHighEnergy(maxKineticEnergy);
     113    AddEEModel(m2kc);
     114
     115    G4ee2KNeutralModel* m2kn = new G4ee2KNeutralModel(cross);
     116    m2kn->SetHighEnergy(maxKineticEnergy);
     117    AddEEModel(m2kn);
     118
     119    G4eeToPGammaModel* mpg1 = new G4eeToPGammaModel(cross,"pi0");
     120    mpg1->SetLowEnergy(0.7*GeV);
     121    mpg1->SetHighEnergy(maxKineticEnergy);
     122    AddEEModel(mpg1);
     123
     124    G4eeToPGammaModel* mpg2 = new G4eeToPGammaModel(cross,"eta");
     125    mpg2->SetLowEnergy(0.7*GeV);
     126    mpg2->SetHighEnergy(maxKineticEnergy);
     127    AddEEModel(mpg2);
     128
     129    nModels = models.size();
     130
     131    if(pParticleChange) {
    105132      fParticleChange =
    106133        reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    107     else
     134    } else {
    108135      fParticleChange = new G4ParticleChangeForGamma();
     136    }
     137  }
     138}
     139
     140//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     141
     142void G4eeToHadronsMultiModel::AddEEModel(G4Vee2hadrons* mod)
     143{
     144  G4eeToHadronsModel* model = new G4eeToHadronsModel(mod, verbose);
     145  model->SetLowEnergyLimit(LowEnergyLimit());
     146  model->SetHighEnergyLimit(HighEnergyLimit());
     147  models.push_back(model);
     148  G4double elow = mod->ThresholdEnergy();
     149  ekinMin.push_back(elow);
     150  if(thKineticEnergy > elow) thKineticEnergy = elow;
     151  ekinMax.push_back(mod->HighEnergy());
     152  ekinPeak.push_back(mod->PeakEnergy());
     153  cumSum.push_back(0.0);
     154}
     155
     156//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     157
     158G4double G4eeToHadronsMultiModel::CrossSectionPerVolume(
     159                                      const G4Material* mat,
     160                                      const G4ParticleDefinition* p,
     161                                      G4double kineticEnergy,
     162                                      G4double, G4double)
     163{
     164  return mat->GetElectronDensity()*
     165    ComputeCrossSectionPerElectron(p, kineticEnergy);
     166}
     167
     168//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     169
     170G4double G4eeToHadronsMultiModel::ComputeCrossSectionPerAtom(
     171                                      const G4ParticleDefinition* p,
     172                                      G4double kineticEnergy,
     173                                      G4double Z, G4double,
     174                                      G4double, G4double)
     175{
     176  return Z*ComputeCrossSectionPerElectron(p, kineticEnergy);
     177}
     178
     179
     180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     181
     182void G4eeToHadronsMultiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
     183                                                const G4MaterialCutsCouple* couple,
     184                                                const G4DynamicParticle* dp,
     185                                                G4double, G4double)
     186{
     187  G4double kinEnergy = dp->GetKineticEnergy();
     188  if (kinEnergy > thKineticEnergy) {
     189    G4double q = cumSum[nModels-1]*G4UniformRand();
     190    for(G4int i=0; i<nModels; i++) {
     191      if(q <= cumSum[i]) {
     192        (models[i])->SampleSecondaries(newp, couple,dp);
     193        if(newp->size() > 0) fParticleChange->ProposeTrackStatus(fStopAndKill);
     194        break;
     195      }
     196    }
    109197  }
    110198}
     
    115203{
    116204  if(verbose > 0) {
    117     G4cout << "      e+ annihilation into hadrons active above "
    118            << thKineticEnergy/GeV << " GeV"
     205    G4double e1 = 0.5*thKineticEnergy*thKineticEnergy/electron_mass_c2
     206      - 2.0*electron_mass_c2;
     207    G4double e2 = 0.5*maxKineticEnergy*maxKineticEnergy/electron_mass_c2
     208      - 2.0*electron_mass_c2;
     209    G4cout << "      e+ annihilation into hadrons active from "
     210           << e1/GeV << " GeV to " << e2/GeV << " GeV"
    119211           << G4endl;
    120212  }
     
    128220    csFactor = fac;
    129221    if(verbose > 0)
    130       G4cout << "### G4eeToHadronsMultiModel: The cross section for G4eeToHadronsMultiModel is  "
    131              << "increased by the Factor= " << csFactor << G4endl;
    132   }
    133 }
    134 
    135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     222      G4cout << "### G4eeToHadronsMultiModel: The cross section for G4eeToHadronsMultiModel "
     223             << " is increased by the Factor= " << csFactor << G4endl;
     224  }
     225}
     226
     227//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/highenergy/src/G4eeToTwoPiModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eeToTwoPiModel.cc,v 1.5 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eeToTwoPiModel.cc,v 1.7 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6464  cross(cr)
    6565{
    66   Initialise();
     66  massPi = G4PionPlus::PionPlus()->GetPDGMass();
     67  massRho = 775.5*MeV;
    6768}
    6869
     
    7475//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7576
    76 void G4eeToTwoPiModel::Initialise()
     77G4double G4eeToTwoPiModel::ThresholdEnergy() const
    7778{
    78   massPi = G4PionPlus::PionPlus()->GetPDGMass();
    79   massRho = 770.*MeV;
    80   highEnergy = 1.*GeV;
    81   cross = new G4eeCrossSections();
     79  return 2.0*massPi;
     80}
     81
     82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     83
     84G4double G4eeToTwoPiModel::PeakEnergy() const
     85{
     86  return massRho;
     87}
     88
     89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     90
     91G4double G4eeToTwoPiModel::ComputeCrossSection(G4double e) const
     92{
     93  G4double ee = std::min(HighEnergy(),e);
     94  return cross->CrossSection2pi(ee);
    8295}
    8396
     
    87100                                                 G4double emax) const
    88101{
    89   G4double tmin = max(emin, 2.0*massPi);
    90   G4double tmax = max(tmin, emax);
     102  G4double tmin = std::max(emin, 2.0*massPi);
     103  G4double tmax = std::max(tmin, emax);
    91104  G4int nbins = (G4int)((tmax - tmin)/(5.*MeV));
    92105  G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
     106  v->SetSpline(true);
    93107  return v;
    94108}
     
    97111
    98112void G4eeToTwoPiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
    99             G4double e, const G4ThreeVector& direction) const
     113            G4double e, const G4ThreeVector& direction)
    100114{
    101115
     
    113127  dir.rotateUz(direction);
    114128
    115   // create G4DynamicParticle object for delta ray
     129  // create G4DynamicParticle objects
    116130  G4DynamicParticle* pip =
    117131     new G4DynamicParticle(G4PionPlus::PionPlus(),dir,tkin);
  • trunk/source/processes/electromagnetic/highenergy/src/G4hhIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hhIonisation.cc,v 1.6 2007/05/22 17:37:30 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4hhIonisation.cc,v 1.9 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6464    isInitialised(false)
    6565{
    66   minKinEnergy = 0.1*keV;
    67   maxKinEnergy = 100.*TeV;
    68   SetDEDXBinning(120);
    69   SetMinKinEnergy(minKinEnergy);
    70   SetMaxKinEnergy(maxKinEnergy);
    7166  SetStepFunction(0.1, 0.1*mm);
    7267  SetVerboseLevel(1);
     68  SetProcessSubType(fIonisation);
    7369  mass = 0.0;
    7470  ratio = 0.0;
     
    7975G4hhIonisation::~G4hhIonisation()
    8076{}
     77
     78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     79
     80G4bool G4hhIonisation::IsApplicable(const G4ParticleDefinition& p)
     81{
     82  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 100.0*MeV &&
     83         !p.IsShortLived());
     84}
     85
     86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     87
     88G4double G4hhIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
     89                                          const G4Material*,
     90                                          G4double cut)
     91{
     92  G4double x = 0.5*cut/electron_mass_c2;
     93  G4double y = electron_mass_c2/mass;
     94  G4double g = x*y + std::sqrt((1. + x)*(1. + x*y*y));
     95  return mass*(g - 1.0);
     96}
    8197
    8298//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    101117  G4int nm = 1;
    102118
     119  minKinEnergy = MinKinEnergy();
     120
    103121  if(eth > minKinEnergy) {
    104122    G4VEmModel* em = new G4BraggNoDeltaModel();
     
    109127  }
    110128
    111   if(eth < maxKinEnergy) {
     129  if(eth < MaxKinEnergy()) {
    112130    G4VEmModel* em1 = new G4BetheBlochNoDeltaModel();
    113131    em1->SetLowEnergyLimit(std::max(eth,minKinEnergy));
    114     em1->SetHighEnergyLimit(maxKinEnergy);
     132    em1->SetHighEnergyLimit(MaxKinEnergy());
    115133    AddEmModel(nm, em1, flucModel);
    116134  }
    117135
    118   if(verboseLevel>0)
     136  if(verboseLevel>1) {
    119137    G4cout << "G4hhIonisation is initialised: Nmodels= " << nm << G4endl;
    120 
     138  }
    121139  isInitialised = true;
    122140}
     
    127145{
    128146  G4cout << "      Delta-ray will not be produced; "
    129          << "Bether-Bloch model for E > " << std::max(eth,minKinEnergy)
    130147         << G4endl;
    131   if(eth > minKinEnergy) G4cout
    132          << "      ICRU49 parametrisation scaled from protons below.";
    133   G4cout << G4endl;
    134148}
    135149
  • trunk/source/processes/electromagnetic/highenergy/src/G4mplIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4mplIonisation.cc,v 1.5 2007/05/31 11:13:31 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4mplIonisation.cc,v 1.8 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6464
    6565  SetVerboseLevel(0);
     66  SetProcessSubType(fIonisation);
     67  SetStepFunction(0.2, 1*mm);
    6668}
    6769
     
    7072G4mplIonisation::~G4mplIonisation()
    7173{}
     74
     75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     76
     77G4bool G4mplIonisation::IsApplicable(const G4ParticleDefinition& p)
     78{
     79  return (p.GetParticleName() == "monopole");
     80}
    7281
    7382//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8291
    8392  G4mplIonisationModel* ion  = new G4mplIonisationModel(magneticCharge,"PAI");
    84   ion->SetLowEnergyLimit(0.1*keV);
    85   ion->SetHighEnergyLimit(100.*TeV);
     93  ion->SetLowEnergyLimit(MinKinEnergy());
     94  ion->SetHighEnergyLimit(MaxKinEnergy());
    8695  AddEmModel(0,ion,ion);
    87 
    88   SetStepFunction(0.2, 1*mm);
    8996
    9097  isInitialised = true;
  • trunk/source/processes/electromagnetic/highenergy/src/G4mplIonisationModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4mplIonisationModel.cc,v 1.5 2007/11/13 18:36:29 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4mplIonisationModel.cc,v 1.6 2009/02/20 16:38:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    139139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    140140
    141 G4double G4mplIonisationModel::ComputeDEDXAhlen(const G4Material* material, G4double bg2)
     141G4double G4mplIonisationModel::ComputeDEDXAhlen(const G4Material* material,
     142                                                G4double bg2)
    142143{
    143144  G4double eDensity = material->GetElectronDensity();
     
    176177  return dedx;
    177178}
     179
     180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     181
     182void G4mplIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
     183                                             const G4MaterialCutsCouple*,
     184                                             const G4DynamicParticle*,
     185                                             G4double,
     186                                             G4double)
     187{}
    178188
    179189//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    204214  return loss;
    205215}
     216
     217//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     218
     219G4double G4mplIonisationModel::Dispersion(const G4Material* material,
     220                                          const G4DynamicParticle* dp,
     221                                          G4double& tmax,
     222                                          G4double& length)
     223{
     224  G4double siga = 0.0;
     225  G4double tau   = dp->GetKineticEnergy()/mass;
     226  if(tau > 0.0) {
     227    G4double electronDensity = material->GetElectronDensity();
     228    G4double gam   = tau + 1.0;
     229    G4double invbeta2 = (gam*gam)/(tau * (tau+2.0));
     230    siga  = (invbeta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
     231      * electronDensity * chargeSquare;
     232  }
     233  return siga;
     234}
     235
     236//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/lowenergy/GNUmakefile

    r819 r961  
    1 # $Id: GNUmakefile,v 1.5 2003/09/20 14:41:31 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.7 2008/11/20 12:06:28 alechner Exp $
    22# --------------------------------------------------------------------
    33# GNUmakefile for electromagnetic sub-library.  John Allison, 25/6/98.
     
    1414CPPFLAGS += -I$(G4BASE)/global/management/include \
    1515            -I$(G4BASE)/global/HEPRandom/include \
     16            -I$(G4BASE)/global/HEPNumerics/include \
    1617            -I$(G4BASE)/global/HEPGeometry/include \
    1718            -I$(G4BASE)/geometry/management/include \
     
    2021            -I$(G4BASE)/processes/cuts/include \
    2122            -I$(G4BASE)/processes/electromagnetic/utils/include \
     23            -I$(G4BASE)/processes/electromagnetic/standard/include \
    2224            -I$(G4BASE)/particles/management/include \
    2325            -I$(G4BASE)/particles/bosons/include \
  • trunk/source/processes/electromagnetic/lowenergy/History

    r819 r961  
    1 $Id: History,v 1.284 2007/11/26 17:27:09 pia Exp $
     1$Id: History,v 1.346 2009/02/20 10:49:54 sincerti Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     2016.02.2009, S. Incerti, tag emlowen-V09-02-15
     21            - added protections against FPE in G4hLowEnergyLoss.cc (see EM forum
     22              item 893)
     23
     2416.02.2009, S. Incerti, tag emlowen-V09-02-14
     25            - removed compilation warning in G4DNAEmfietzoglouExcitationModel.cc
     26
     2716.02.2009, S. Incerti, tag emlowen-V09-02-13
     28            - improved energy limit display in Geant4-DNA model classes
     29            - commented InitialiseElementSelectors call.
     30
     3116.02.2009, S. Incerti, tag emlowen-V09-02-12
     32            Made compatible with tag emutils-V09-02-00 the following files
     33            - G4DNAElastic.cc
     34            - G4DNAExcitation.cc
     35            - G4DNAIonisation.cc
     36            - G4DNAChargeDecrease.cc
     37            - G4DNAChargeIncrease.cc
     38
     3914.02.2009, S. Incerti, tag emlowen-V09-02-11
     40            Added several corrections to migrated Geant4-DNA processes:
     41            - G4DNABornIonisationModel.cc
     42            - G4DNAEmfietzoglouExcitationModel.cc
     43            - G4DNARuddIonisationModel.cc
     44            - G4DNAIonisation.hh
     45
     4610.02.2009, L. Pandola, tag emlowen-V09-02-10
     47            - Added G4LivermoreIonisationModel, namely first implementation of
     48              LowEnergyIonisation in the new design
     49
     5029.01.2009, L. Pandola, tag emlowen-V09-02-09
     51            - Updated public interface of G4eIonisationCrossSectionHandler.cc in order to
     52              facilitate the migration from G4LowEnergyIonisation to G4LivermoreIonisationModel
     53
     5422.01.2009, S. Incerti, tag emlowen-V09-02-08
     55            - Fixed compilation error problem & code syntax in DNA model classes
     56
     5721.01.2009, S. Incerti, tag emlowen-V09-02-07
     58            - Updated Livermore photon processes classes for handling of compound materials
     59            - Added pointer removal protections
     60            - Involved classes are :
     61              G4LivermoreRayleighModel.cc
     62              G4LivermorePolarizedRayleighModel.cc
     63              G4LivermorePolarizedComptonModel.cc
     64              G4LivermorePhotoElectricModel.cc
     65              G4LivermoreGammaconversionModel.cc
     66              G4LivermoreComptonModel.cc
     67
     6820.01.2009, S. Incerti, tag emlowen-V09-02-06
     69            Added 'kill particle without total energy deposit' feature for DNA charge change processes
     70            Involved files are :
     71            - G4DNAProcess.icc,
     72            - G4FinalStateProduct.hh,.cc,
     73            - G4FinalStateChargeDecrease.cc
     74            - G4FinalStateChargeIncrease.cc
     75
     7620.01.2009, S. Incerti, tag emlowen-V09-02-05
     77            - Corrected energy limits in G4CrossSectionIonisationBornPartial.cc
     78            - Added proton case in G4CrossSectionExcitationMillerGreenPartial.cc
     79            - Added protection (waterExcitation.ExcitationEnergy) in G4CrossSectionExcitationMillerGreenPartial.cc
     80
     8119.01.2009, S. Incerti, tag emlowen-V09-02-04
     82            Added angle initialisation in G4DNAScreenedRutherfordElasticModel
     83
     8412.01.2009, S. Incerti, tag emlowen-V09-02-03
     85            Added preliminary migrated Geant4-DNA processes and models.
     86
     8708.01.2009  L. Pandola, tag emlowen-V09-02-02
     88            Edited G4PenelopePhotoElectric.cc and G4PenelopePhotoElectricModel.cc
     89            to suppress a warning message from G4AtomicTransitionManager appearing
     90            for some elements (Oxygen ,Fluorine). This is due to the fact that
     91            Penelope and G4AtomicTransitionManager databases may contain a different number
     92            of shells. Physics results are unchanged.
     93
     9419.12.2008  L. Pandola, tag emlowen-V09-02-01
     95            Added G4RayleighScattering process (G4VEmProcess) to
     96            describe Rayleigh scattering. This was not available within
     97            the Std package
     98
     9915.12.2008  L. Pandola, tag emlowen-V09-02-00
     100            Same as the previous one (emlowen-V09-01-46). I arrived too late.
     101
     10215.12.2008  L. Pandola, tag emlowen-V09-01-46
     103            Added G4PenelopeBremsstrahlungModel, namely bremsstrahlung according to Penelope
     104            model, migrated to the Std-design (inheriting from G4VEmModel). A few minor
     105            cleaning of G4PenelopeBremsstrahlungContinuous.cc and G4PenelopeIonisation.cc.
     106            From this tag, ALL Penelope processes have been migrated.
     107
     10812.12.2008   S. Incerti, tag emlowen-V09-01-45
     109             Upgrade to G4LogLogInterpolation_revision1c.cc
     110
     11109.12.2008  S. Incerti, tag emlowen-V09-01-44
     112            Added protection to G4FinalStateElasticChampion.cc for angular treatment of XS
     113            at 180*deg
     114
     11509.12.2008   S. Incerti, tag emlowen-V09-01-43
     116             Contains G4PenelopeBremsstrahlungContinuous.hh/.cc from Luciano
     117             Contains G4LogLogInterpolation_revision1b.cc
     118
     11909.12.2008   S. Incerti, tag emlowen-V09-01-42
     120             Upgrade to G4LogLogInterpolation_revision1b.cc
     121
     12209.12.2008   S. Incerti, tag emlowen-V09-01-41
     123             Return to original G4LogLogInterpolation.cc/.hh class
     124             from tag emlowen-V09-01-20
     125
     12608.12.2008   S. Incerti, tag emlowen-V09-01-40
     127             Added protection in G4LogLogInterpolation.cc class
     128             against null energy and cross section values
     129
     13006.12.2008   S. Incerti, tag emlowen-V09-01-39
     131             Added vector initialization and EOF protection in G4FinalStateElasticChampion.cc
     132             Added EOF protection in G4FinalStateIonisationBorn.cc
     133
     13406.12.2008   S. Incerti, tag emlowen-V09-01-38
     135             Updated G4LogLogInterpolation class (hh and cc) provided by
     136             Nicolas Karakatsanis (updated revision 1)
     137
     13805.12.2008   S. Incerti, tag emlowen-V09-01-37
     139             Updated G4LogLogInterpolation class (hh and cc) provided by
     140             Nicolas Karakatsanis (revision 1)
     141
     14205.12.2008   S. Incerti, tag emlowen-V09-01-36
     143             Updated low energy limits of Geant4-DNA e- models (Brenner-Zaider and Champion's
     144             elastic scattering and Emfietzoglou's excitation)
     145
     14605.12.2008   S. Incerti, tag emlowen-V09-01-35
     147             Added protection in G4FinalStateIonisationBorn.cc causing run-time error (valgrind with test20)
     148
     14904.12.2008   L. Pandola, tag emlowen-V09-01-34
     150             Correction for G4PenelopeComptonModel: now the cross section table
     151             calculated by the model corresponds to the original FORTRAN-Penelope.
     152             The difference was only for compounds materials and below 1 keV, so
     153             irrelevant for virtually all applications.
     154             First inclusion of G4PenelopeIonisationModel.
     155
     15624.11.2008   G. Cosmo, tag emlowen-V09-01-33
     157             Fixed compilation errors on gcc-4.3.2:
     158             o added required names for struct types (and using G4 prefix);
     159             o correctly initialise cached iterators (cannot be an integer!).
     160
     16121.11.2008   A. Lechner, tag emlowen-V09-01-32
     162             added and tagged new stopping power model for ions, which by default
     163             uses ICRU 73 data tables. Following files are concerned:
     164             G4IonParametrisedLossModel.hh
     165             G4IonParametrisedLossModel.icc
     166             G4IonParametrisedLossModel.cc
     167             G4IonParametrisedLossTable.hh
     168             G4IonParametrisedLossTable.icc
     169
     17006.11.2008   S. Incerti, tag emlowen-V09-01-31
     171             corrected bug in computation of diff cross section maximum in
     172             G4FinalStateElasticBrennerZaider.cc
     173
     17430.10.2008   S. Incerti, tag emlowen-V09-01-30
     175             added & tagged new photon models compatible with standard EM design :
     176             
     177             -- Penelope models are provided by L. Pandola :
     178             G4PenelopeComptonModel.hh and .cc
     179             G4PenelopeGammaConversionModel.hh and .cc
     180             G4PenelopePhotoElectricModel.hh and .cc
     181             G4PenelopeRayleighModel.hh and .cc
     182             
     183             -- Livermore models are provided by S. Incerti :
     184             G4LivermoreComptonModel.hh and .cc
     185             G4LivermoreGammaConversionModel.hh and .cc
     186             G4LivermorePhotoElectricModel.hh and .cc
     187             G4LivermorePolarizedComptonModel.hh and .cc
     188             G4LivermorePolarizedRayleighModel.hh and .cc
     189             G4LivermoreRayleighModel.hh and .cc
     190
     19129.10.2008   S. Incerti, tag emlowen-V09-01-29
     192             - improved generation of scattering angle in G4FinalStateElasticChampion.cc
     193
     19430.09.2008   S. Incerti, tag emlowen-V09-01-28
     195             - removed G4cout in G4LowEnergyCompton.cc (bug report #1026)
     196
     19720.08.2008   S. Incerti, tag emlowen-V09-01-27
     198             - added KillParticle in G4FinalStateElasticChampion.cc below low energy limit
     199             - modified condition on low energy limit in G4CrossSectionElasticChampion.cc and G4FinalStateElasticChampion.cc
     200 
     20120.08.2008   S. Incerti, tag emlowen-V09-01-26
     202             - removed AddEnergyDeposit below low energy limit in G4FinalStateElasticBrennerZaider.cc (bug, thanks to Marion Bug)
     203             - removed AddEnergyDeposit below low energy limit in G4FinalStateExcitationEmfietzoglou.cc (idem)
     204             - removed AddEnergyDeposit below low energy limit in G4FinalStateIonisationRudd.cc (idem)
     205             - decreased low energy limit for e- to 12.61 eV in G4CrossSectionIonisationBorn.cc (from sigma_ionisation_e_born.dat table in $G4LEDATA/dna) instead of 25 eV
     206             - decreased low energy limit for e- to 12.61 eV in G4FinalStateIonisationBorn.cc (from sigma_ionisation_e_born.dat table in $G4LEDATA/dna) instead of 25 eV
     207
     20816.07.2008   S. Incerti, tag emlowen-V09-01-25
     209             added preliminary process for positronium production
     210             from C. Champion's model
     211             G4CrossSectionPsCreationChampion.hh and .cc
     212             G4CrossSectionPsCreationChampionPartial.hh and .cc
     213             G4FinalStatePsCreationChampion.hh and .cc
     214             and updated G4DNAGenericIonsManager.cc
     215             *** Will work only from version 6.2 of G4EMLOW data
     216
     21715.07.2008   S. Incerti, tag emlowen-V09-01-24
     218             added new elastic scattering process for electrons
     219             (Geant4 DNA) from C. Champion's model
     220             G4CrossSectionElasticChampion.hh and .cc
     221             G4FinalStateElasticChampion.hh and .cc
     222             *** Will work only from version 6.2 of G4EMLOW data
     223
     22414.07.2008   S. Incerti, tag emlowen-V09-01-23
     225             cleaned and updated energy limits of the following
     226             25 files (Geant4 DNA)
     227
     228-G4CrossSectionChargeDecrease.hh and .cc
     229-G4CrossSectionChargeDecreasePartial.hh and .cc
     230-G4CrossSectionChargeIncrease.hh and .cc
     231-G4CrossSectionChargeIncreasePartial.hh and .cc
     232-G4CrossSectionElasticScreenedRutherfordHE.hh and .cc
     233-G4CrossSectionElasticScreenedRutherfordLE.hh and .cc
     234-G4CrossSectionExcitationBorn.hh and .cc
     235-G4CrossSectionExcitationBornPartial.hh and .cc
     236-G4CrossSectionExcitationEmfietzoglou.hh and .cc
     237-G4CrossSectionExcitationEmfietzoglouPartial.hh and .cc
     238-G4CrossSectionExcitationMillerGreen.hh and .cc
     239-G4CrossSectionExcitationMillerGreenPartial.hh and .cc
     240-G4CrossSectionIonisationBorn.hh and .cc
     241-G4CrossSectionIonisationBornPartial.hh and .cc
     242-G4CrossSectionIonisationRudd.hh and .cc
     243-G4CrossSectionIonisationRuddPartial.hh and .cc
     244-G4FinalStateChargeDecrease.hh and .cc
     245-G4FinalStateChargeIncrease.hh and .cc
     246-G4FinalStateElasticBrennerZaider.hh and .cc
     247-G4FinalStateElasticScreenedRutherford.hh and .cc
     248-G4FinalStateExcitationBorn.hh and .cc
     249-G4FinalStateExcitationEmfietzoglou.hh and .cc
     250-G4FinalStateExcitationMillerGreen.hh and .cc
     251-G4FinalStateIonisationBorn.hh and .cc
     252-G4FinalStateIonisationRudd.hh and .cc
     253
     25430.06.2008   S. Incerti, tag emlowen-V09-01-22
     255             corrected wrong upper energy limit for :
     256             - hydrogen in G4CrossSectionIonisationRudd
     257             - proton in G4ChargeDecrease
     258
     25927.06.2008   S. Incerti, tag emlowen-V09-01-21
     260             - added two new classes for electron elastic scattering
     261             G4CrossSectionElasticScreenedRutherfordLE.cc and .hh below 200 eV
     262             G4CrossSectionElasticScreenedRutherfordHE.cc and .hh above 200 eV
     263             that should replace the G4CrossSectionElasticScreenedRutherfordHE class
     264             - raised lower energy limit of G4CrossSectionExcitationEmfietzoglou.cc up to 10 eV
     265
     26627.06.2008   S. Incerti, tag emlowen-VO9-01-20
     267             - added protection against negative log argument in G4LogLogInterpolation.cc
     268             - added protection against energies above 200 eV in G4FinalStateElasticBrennerZaider.cc
     269             - removed verbose in G4CrossSectionChargeTransferExp.cc and in G4CrossSectionExcitationBorn.cc
     270
     27126.06.2208   S. Incerti, tag emlowen-V09-01-19
     272             Added protection against FPE in G4hShellCrossSectionDoubleExp.cc
     273
     27420.06.2008   S. Incerti, tag emlowen-V09-01-18
     275             Added 4 protections against FPE in G4hLowEnergyLoss.cc
     276
     27711.06.2008   S. Incerti, tag emlowen-V09-01-17
     278             - added missing & for cosTheta and phi variables in G4FinalStateIonisationRudd.hh and .cc
     279             which were causing wrong angular distributions (bug fix)
     280             - removed annoying PrintData in G4CrossSectionExcitationBornPartial.cc
     281
     28202.06.2008   S. Incerti, tag emlowen-V09-01-16
     283             Removed while(1) statement in G4FinalStateIonisationBorn.cc
     284             fixing compilation warning.
     285             Restored headers for G4PaulKCrossSection, G4OrlicLCrossSection
     286             and G4ecpssrCrossSection which were lost.
     287
     28801.06.2008   F.Lei, tag emlowen-V09-01-15
     289             Correction to the corrupted G4Augerdata.cc, and this tag is on top
     290             of emlowen-V09-01-12! as emlowen-V09-01-13 is internal and incomplete. 
     291 
     29222.05.2008   F.Lei, tag emlowen-V09-01-14
     293             Load the the complete Auger dataset on initialization     
     294
     29506.05.2008   H.Ben Abdelouahed, tag emlowen-V09-01-12, emlowen-V09-01-13
     296             Semi-Empirical model implementation for L-SubShells-Cross-Section
     297             with protons projectiles
     298
     29902.05.2008   MGP, tag emlowen-V09-01-11
     300             Added Doppler broadening in G4LowEnergyComptonPolarized
     301             (Francesco Longo), same model as in G4LowEnergyCompton
     302             Added PIXE cross section, L shells, for protons in
     303             G4OrlicLCrossSection (Haifa Ben Abdelwahed)
     304             Corrected compilation warnings as in message by
     305             G. Cosmo on 29/4/2008
     306
     30724.04.2008   MGP, tag emlowen-V09-01-10
     308             Fix in Doppler broadening of G4LowEnergyCompton
     309             Attempts to fix floating point exceptions in
     310             G4FinalStateElasticBrennerZaider and G4hLowEnergyLoss
     311
     31222.04.2008   H.Ben Abdelouahed, tag emlowen-V09-01-09
     313             ECPSSR model implementation for K-Shell-Cross-Section
     314             with protons and alpha projectiles
     315 
     31618.03.2008   G.Cosmo, tag emlowen-V09-01-08
     317             Fixed compilation error in G4CrossSectionChargeTransferExp.cc
     318             for missing inclusion of <sstream>, detected on SUN-CC.
     319
     32025.03.2008   MGP, tag emlowen-V09-01-07
     321             New charge transfer process by incident protons
     322             (two cross section and one final state policy classes)
     323
     32417.03.2008   MGP, tag emlowen-V09-01-06
     325             Doppler broadening added to G4LowEnergyCompton
     326             based on Y. Namito, S. Ban and H. Hirayama,
     327             NIM A 349, pp. 489-494, 1994
     328
     32910.03.2008   MGP, tag emlowen-V09-01-05
     330             Developments for Doppler broadening concerning data management
     331
     33210.03.2008   MGP, tag emlowen-V09-01-04
     333             Fixes to *DataSet files for better readability of the code
     334             Extensions to G4ShellData to deal with shell data relevant to
     335             Doppler broadening simulation
     336 
     33707.03.2008   MGP, tag emlowen-V09-01-03
     338             Reverted to G4hLowEnergyIonisation.cc and G4hLowEnergyLoss.cc
     339             as in emlowen-V09-01-01
     340
     34107.03.2008   MGP, tag emlowen-V09-01-02
     342             Operation for convenience of configuration management:
     343             updated G4hLowEnergyIonisation.cc and G4hLowEnergyLoss.cc
     344             to the head; the modifications to these two classes
     345             were an attempt to address a PRS report by A. Howard,
     346             but they proved ineffective and caused other problems;
     347             a tag including them is made to facilitate later retrieve
     348
     34906.03.2008   MGP, tag emlowen-V09-01-01
     350             Restored readability of *DataSet* classes regards the
     351             indentation of the code
     352
     35321.02.2008   MGP, tag emlowen-V09-01-00
     354             Bug fix in G4AtomicTransitionManager concerning
     355             total radiative and non radiative probabilities
     356             (fix provided by A. Mantero)
    19357
    2035826.11.2007   MGP, tag emlowen-V09-00-28
  • trunk/source/processes/electromagnetic/lowenergy/include/G4AtomicDeexcitation.hh

    r819 r961  
    2626//
    2727// $Id: G4AtomicTransitionManager.hh,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4AtomicShell.hh

    r819 r961  
    2626//
    2727// $Id: G4AtomicShell.hh,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4AtomicTransitionManager.hh

    r819 r961  
    2626//
    2727// $Id: G4AtomicTransitionManager.hh,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4AugerData.hh

    r819 r961  
    2525//
    2626// $Id: G4AugerData.hh
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4BremsstrahlungParameters.hh

    r819 r961  
    2626//
    2727// $Id: G4BremsstrahlungParameters.hh,v 1.10 2006/06/29 19:33:06 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CompositeEMDataSet.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4CompositeEMDataSet.hh,v 1.8 2006/06/29 19:33:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4CompositeEMDataSet.hh,v 1.12 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    4444// -------------------------------------------------------------------
    4545
    46 #ifndef   G4COMPOSITEEMDATASET_HH
    47  #define G4COMPOSITEEMDATASET_HH 1
     46#ifndef G4COMPOSITEEMDATASET_HH
     47#define G4COMPOSITEEMDATASET_HH 1
    4848
    49  #include "globals.hh"
    50  #include "G4VEMDataSet.hh"
    51  #include <vector>
     49#include "globals.hh"
     50#include "G4VEMDataSet.hh"
     51#include <vector>
    5252
    53  class G4VDataSetAlgorithm;
     53class G4VDataSetAlgorithm;
    5454
    55  class G4CompositeEMDataSet : public G4VEMDataSet
    56  {
    57   public:
    58                                                 G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, G4double argUnitEnergies=MeV, G4double argUnitData=barn, G4int argMinZ=1, G4int argMaxZ=99);
    59    virtual                                     ~G4CompositeEMDataSet();
     55class G4CompositeEMDataSet : public G4VEMDataSet
     56{
     57public:
     58  G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm,
     59                       G4double eUnit=MeV,
     60                       G4double dataUnit=barn,
     61                       G4int zMin=1,
     62                       G4int zMax=99);
     63
     64  virtual ~G4CompositeEMDataSet();
    6065 
    61    virtual G4double                             FindValue(G4double argEnergy, G4int argComponentId=0) const;
     66  virtual G4double FindValue(G4double x, G4int componentId=0) const;
    6267 
    63    virtual void                                PrintData(void) const;
     68  virtual void PrintData(void) const;
    6469
    65    virtual const G4VEMDataSet *                 GetComponent(G4int argComponentId) const { return components[argComponentId]; }
    66    virtual void                                 AddComponent(G4VEMDataSet * argDataSet) { components.push_back(argDataSet); }
    67    virtual size_t                               NumberOfComponents(void) const { return components.size(); }
     70  virtual const G4VEMDataSet* GetComponent(G4int componentId) const { return components[componentId]; }
     71  virtual void AddComponent(G4VEMDataSet* dataSet) { components.push_back(dataSet); }
     72  virtual size_t NumberOfComponents() const { return components.size(); }
    6873
    69    virtual const G4DataVector &                 GetEnergies(G4int argComponentId) const { return GetComponent(argComponentId)->GetEnergies(0); }
    70    virtual const G4DataVector &                 GetData(G4int argComponentId) const { return GetComponent(argComponentId)->GetData(0); }
    71    virtual void                                 SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId);
     74  virtual const G4DataVector& GetEnergies(G4int componentId) const { return GetComponent(componentId)->GetEnergies(0); }
     75  virtual const G4DataVector& GetData(G4int componentId) const { return GetComponent(componentId)->GetData(0); }
     76  virtual void SetEnergiesData(G4DataVector* x, G4DataVector* data, G4int componentId);
    7277
    73    virtual G4bool                               LoadData(const G4String & argFileName);
    74    virtual G4bool                               SaveData(const G4String & argFileName) const;
     78  virtual G4bool LoadData(const G4String& fileName);
     79  virtual G4bool SaveData(const G4String& fileName) const;
     80
     81 virtual G4double RandomSelect(G4int componentId) const;
     82
    7583   
    76   private:
    77    void                                         CleanUpComponents(void);
     84private:
     85
     86  void CleanUpComponents(void);
    7887 
    79    // Hide copy constructor and assignment operator
    80                                                 G4CompositeEMDataSet();
    81                                                 G4CompositeEMDataSet(const G4CompositeEMDataSet & copy);
    82    G4CompositeEMDataSet &                       operator=(const G4CompositeEMDataSet & right);
     88  // Hide copy constructor and assignment operator
     89  G4CompositeEMDataSet();
     90  G4CompositeEMDataSet(const G4CompositeEMDataSet& copy);
     91  G4CompositeEMDataSet& operator=(const G4CompositeEMDataSet& right);
    8392
    84    std::vector<G4VEMDataSet *>                  components;          // Owned pointers
     93  std::vector<G4VEMDataSet*> components;    // Owned pointers
    8594
    86    G4VDataSetAlgorithm *                        algorithm;           // Owned pointer
     95  G4VDataSetAlgorithm* algorithm;           // Owned pointer
    8796 
    88    G4double                                    unitEnergies;
    89    G4double                                    unitData;
     97  G4double unitEnergies;
     98  G4double unitData;
    9099
    91    G4int                                        minZ;
    92    G4int                                        maxZ;
    93  };
     100  G4int minZ;
     101  G4int maxZ;
     102};
    94103#endif /* G4COMPOSITEEMDATASET_HH */
    95104
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionChargeDecrease.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeDecrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionChargeDecrease.hh,v 1.2 2008/07/14 20:47:32 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONCHARGEDECREASE_HH
    5230#define G4CROSSSECTIONCHARGEDECREASE_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <map>
    5632#include "G4CrossSectionChargeDecreasePartial.hh"
     33#include "G4Track.hh"
     34#include "G4Proton.hh"
     35#include "G4DNAGenericIonsManager.hh"
    5736
    58 class G4Track;
    59  
    6037class G4CrossSectionChargeDecrease
    6138{
     
    6845  G4double CrossSection(const G4Track&);
    6946 
    70   // Copy constructor and assignment operator to be added here
    71    
    7247private:
    7348   
    74   G4String name; 
    7549  G4double lowEnergyLimitDefault;
    7650  G4double highEnergyLimitDefault;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionChargeDecreasePartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeDecreasePartial.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 // 08 Nov 2007  MGP               Got code from S.I.; lowercase data member
    37 //
    38 // -------------------------------------------------------------------
    39 
    40 // Class description:
    41 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4CrossSectionChargeDecreasePartial.hh,v 1.2 2008/07/14 20:47:32 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4CROSSSECTIONCHARGEDECREASEPARTIAL_HH
    5330#define G4CROSSSECTIONCHARGEDECREASEPARTIAL_HH 1
    5431 
    55 #include "globals.hh"
     32#include "G4Proton.hh"
     33#include "G4DNAGenericIonsManager.hh"
     34#include "Randomize.hh"
    5635
    5736class G4ParticleDefinition;
     
    7150  G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
    7251 
    73   // Copy constructor and assignment operator to be added here
    74    
    7552private:
    7653   
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionChargeIncrease.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeIncrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionChargeIncrease.hh,v 1.2 2008/07/14 20:47:33 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONCHARGEIncrease_HH
    5230#define G4CROSSSECTIONCHARGEIncrease_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <map>
    5632#include "G4CrossSectionChargeIncreasePartial.hh"
     33#include "G4Track.hh"
     34#include "G4DNAGenericIonsManager.hh"
    5735
    58 class G4Track;
    59  
    6036class G4CrossSectionChargeIncrease
    6137{
     
    6844  G4double CrossSection(const G4Track&);
    6945 
    70   // Copy constructor and assignment operator to be added here
    71    
    7246private:
    7347   
    74   G4String name; 
    7548  G4double lowEnergyLimitDefault;
    7649  G4double highEnergyLimitDefault;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionChargeIncreasePartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeIncreasePartial.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionChargeIncreasePartial.hh,v 1.2 2008/07/14 20:47:33 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONCHARGEIncreasePARTIAL_HH
    5230#define G4CROSSSECTIONCHARGEIncreasePARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 
    56 class G4ParticleDefinition;
     32#include "G4DNAGenericIonsManager.hh"
     33#include "Randomize.hh"
    5734 
    5835class G4CrossSectionChargeIncreasePartial
     
    7047  G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
    7148 
    72   // Copy constructor and assignment operator to be added here
    73    
    7449private:
    7550   
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionElasticScreenedRutherford.hh

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionElasticScreenedRutherford.hh,v 1.1 2007/10/12 23:07:10 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationBorn.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationBorn.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationBorn.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONEXCITATIONBORN_HH
    5230#define G4CROSSSECTIONEXCITATIONBORN_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <vector>
    56 #include "G4WaterExcitationStructure.hh"
    5732#include "G4DNACrossSectionDataSet.hh"
     33#include "G4Track.hh"
     34#include "G4LogLogInterpolation.hh"
    5835
    59 class G4Track;
    60  
    6136class G4CrossSectionExcitationBorn
    6237{
     
    6944  G4double CrossSection(const G4Track& track);
    7045 
    71   // Copy constructor and assignment operator to be added here
    72    
    7346private:
    7447   
    75   G4String name; 
    7648  G4double lowEnergyLimit;
    7749  G4double highEnergyLimit;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationBornPartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationBornPartial.hh,v 1.1 2007/10/15 08:34:12 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationBornPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONEXCITATIONBORNPARTIAL_HH
    5230#define G4CROSSSECTIONEXCITATIONBORNPARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <vector>
    5632#include "G4DNACrossSectionDataSet.hh"
     33#include "G4LogLogInterpolation.hh"
     34#include "Randomize.hh"
     35#include <deque>
    5736 
    5837class G4CrossSectionExcitationBornPartial
     
    6443  virtual ~G4CrossSectionExcitationBornPartial();
    6544 
    66   // Select an excitation level according to the partial cross sections
    6745  G4int RandomSelect(G4double energy);
    6846 
    69   // Copy constructor and assignment operator to be added here
    70    
    7147private:
    7248   
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationEmfietzoglou.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationEmfietzoglou.hh,v 1.2 2007/10/15 08:31:49 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationEmfietzoglou.hh,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONEXCITATIONEMFIETZOGLOU_HH
    5230#define G4CROSSSECTIONEXCITATIONEMFIETZOGLOU_HH 1
    5331 
    54 #include "globals.hh"
    5532#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
     33#include "G4Track.hh"
    5634
    57 class G4Track;
    58  
    5935class G4CrossSectionExcitationEmfietzoglou
    6036{
     
    6743  G4double CrossSection(const G4Track&);
    6844 
    69   // Copy constructor and assignment operator to be added here
    70    
    7145private:
    7246   
    73   G4String name; 
    7447  G4double lowEnergyLimit;
    7548  G4double highEnergyLimit;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationEmfietzoglouPartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationEmfietzoglouPartial.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationEmfietzoglouPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONEXCITATIONEMFIETZOGLOUPARTIAL_HH
    5230#define G4CROSSSECTIONEXCITATIONEMFIETZOGLOUPARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <vector>
    5632#include "G4WaterExcitationStructure.hh"
     33#include <deque>
     34#include "Randomize.hh"
    5735
    5836class G4Track;
     
    7250  G4int RandomSelect(G4double energy);
    7351 
    74   // Copy constructor and assignment operator to be added here
    75    
    7652private:
    7753   
    78  // Number of excitation levels of the water molecule
    7954  G4int nLevels;
    8055
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationMillerGreen.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationMillerGreen.hh,v 1.2 2007/11/08 19:56:02 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationMillerGreen.hh,v 1.3 2008/07/14 20:47:34 sincerti Exp $
    5027
    5128#ifndef G4CROSSSECTIONEXCITATIONMILLERGREEN_HH
    5229#define G4CROSSSECTIONEXCITATIONMILLERGREEN_HH 1
    5330 
    54 #include "globals.hh"
    55 #include <map>
    5631#include "G4CrossSectionExcitationMillerGreenPartial.hh"
    57 
    58 class G4Track;
     32#include "G4Track.hh"
     33#include "G4Proton.hh"
     34#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
     35#include "G4DNAGenericIonsManager.hh"
    5936 
    6037class G4CrossSectionExcitationMillerGreen
     
    6845  G4double CrossSection(const G4Track&);
    6946 
    70   // Copy constructor and assignment operator to be added here
    71    
    7247private:
    7348   
    74   G4String name; 
    7549  G4double lowEnergyLimitDefault;
    7650  G4double highEnergyLimitDefault;
     
    8054
    8155  G4CrossSectionExcitationMillerGreenPartial partialCrossSection;
    82 
    8356};
    8457
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionExcitationMillerGreenPartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationMillerGreenPartial.hh,v 1.1 2007/11/08 19:56:02 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionExcitationMillerGreenPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONEXCITATIONMILLERGREENPARTIAL_HH
    5230#define G4CROSSSECTIONEXCITATIONMILLERGREENPARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <vector>
    5632#include "G4WaterExcitationStructure.hh"
    57 #include "G4ParticleDefinition.hh"
     33#include "G4Track.hh"
     34#include "G4Proton.hh"
     35#include "G4DNAGenericIonsManager.hh"
     36#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
     37#include "Randomize.hh"
    5838
    59 class G4Track;
    60  
    6139class G4CrossSectionExcitationMillerGreenPartial
    6240{
     
    7351  G4int RandomSelect(G4double energy, const G4ParticleDefinition* particle);
    7452 
    75   // Copy constructor and assignment operator to be added here
    76    
    7753private:
    7854   
    79   // Number of excitation levels of the water molecule
    8055  G4int nLevels;
    8156
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionHandler.hh

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionHandler.hh,v 1.9 2006/06/29 19:33:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationBorn.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4CrossSectionIonisationBorn.hh,v 1.1 2007/10/22 09:12:58 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for ionisation cross section in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     27// $Id: G4CrossSectionIonisationBorn.hh,v 1.3 2008/12/18 13:01:22 gunter Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5029
    5130#ifndef G4CROSSSECTIONIONISATIONBORN_HH
    5231#define G4CROSSSECTIONIONISATIONBORN_HH 1
    5332 
    54 #include "globals.hh"
    55 #include <map>
    5633#include "G4DNACrossSectionDataSet.hh"
     34#include "G4ParticleDefinition.hh"
     35#include "G4Electron.hh"
     36#include "G4Proton.hh"
     37#include "G4Track.hh"
     38#include "G4LogLogInterpolation.hh"
    5739 
    58 class G4Track;
    59 
    6040class G4CrossSectionIonisationBorn
    6141{
     
    6848  G4double CrossSection(const G4Track& track);
    6949                       
    70   // Copy constructor and assignment operator to be added here
    71    
    7250private:
    7351   
    74   G4String name; 
    7552  G4double lowEnergyLimitDefault;
    7653  G4double highEnergyLimitDefault;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationBornElectron.hh

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionIonisationBornElectron.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationBornPartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationBornPartial.hh,v 1.1 2007/10/22 09:12:58 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for ionisation cross section in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionIonisationBornPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONIONISATIONBORNPARTIAL_HH
    5230#define G4CROSSSECTIONIONISATIONBORNPARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <map>
    56 #include <functional>
    5732#include "G4DNACrossSectionDataSet.hh"
     33#include "G4Electron.hh"
     34#include "G4Proton.hh"
     35#include "G4Track.hh"
     36#include "G4LogLogInterpolation.hh"
     37#include "Randomize.hh"
    5838 
    59 class G4Track;
    60 
    6139class G4CrossSectionIonisationBornPartial
    6240{
     
    6745  ~G4CrossSectionIonisationBornPartial();
    6846 
    69   // Partial cross section
    70   // G4double CrossSection(G4double energy, const G4String& particle);
    7147  G4double CrossSection(const G4Track& track);
    7248                       
    73   // Sum of partial cross sections at a given energy value for a particle type
    7449  G4double Sum(G4double energy, const G4String& particle);
    7550
    7651  G4int RandomSelect(G4double energy,const G4String& particle );
    7752 
    78   // Copy constructor and assignment operator to be added here
    79    
    8053private:
    8154   
    82   G4String name; 
    8355  G4double lowEnergyLimitDefault;
    8456  G4double highEnergyLimitDefault;
     
    9365  MapData tableData;
    9466
    95 
    96 
    97   // G4DNACrossSectionDataSet* table;
    98  
    9967};
    10068
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationBornPartialElectron.hh

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionIonisationBornPartialElectron.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationRudd.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationRudd.hh,v 1.1 2007/11/08 21:35:31 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for ionisation cross section in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionIonisationRudd.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONIONISATIONRUDD_HH
    5230#define G4CROSSSECTIONIONISATIONRUDD_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <map>
    5632#include "G4DNACrossSectionDataSet.hh"
     33#include "G4Proton.hh"
     34#include "G4Track.hh"
     35#include "G4LogLogInterpolation.hh"
     36#include "G4DNAGenericIonsManager.hh"
    5737 
    58 class G4Track;
    59 
    6038class G4CrossSectionIonisationRudd
    6139{
     
    6846  G4double CrossSection(const G4Track& track);
    6947                       
    70   // Copy constructor and assignment operator to be added here
    71    
    7248private:
    7349   
    74   G4String name; 
    7550  G4double lowEnergyLimitDefault;
    7651  G4double highEnergyLimitDefault;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionIonisationRuddPartial.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationRuddPartial.hh,v 1.1 2007/11/08 21:35:31 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for ionisation cross section in water
    41 // Reference: TNS Geant4-DNA paper
    42 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    43 // design foundation and implementation of the first set of models,
    44 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    45 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    46 // Further documentation available from http://www.ge.infn.it/geant4/dna
    47 
    48 // -------------------------------------------------------------------
    49 
     26// $Id: G4CrossSectionIonisationRuddPartial.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129#ifndef G4CROSSSECTIONIONISATIONRuddPARTIAL_HH
    5230#define G4CROSSSECTIONIONISATIONRuddPARTIAL_HH 1
    5331 
    54 #include "globals.hh"
    55 #include <map>
    56 #include <functional>
    5732#include "G4DNACrossSectionDataSet.hh"
    58  
    59 class G4Track;
     33#include "G4Proton.hh"
     34#include "G4Track.hh"
     35#include "G4LogLogInterpolation.hh"
     36#include "G4DNAGenericIonsManager.hh"
     37#include "Randomize.hh"
    6038
    6139class G4CrossSectionIonisationRuddPartial
     
    6745  ~G4CrossSectionIonisationRuddPartial();
    6846 
    69   // Partial cross section
    70   // G4double CrossSection(G4double energy, const G4String& particle);
    7147  G4double CrossSection(const G4Track& track);
    7248                       
    73   // Sum of partial cross sections at a given energy value for a particle type
    7449  G4double Sum(G4double energy, const G4String& particle);
    7550
    7651  G4int RandomSelect(G4double energy,const G4String& particle );
    7752 
    78   // Copy constructor and assignment operator to be added here
    79    
    8053private:
    8154   
    82   G4String name; 
    8355  G4double lowEnergyLimitDefault;
    8456  G4double highEnergyLimitDefault;
     
    9264  typedef std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > MapData;
    9365  MapData tableData;
    94 
    95 
    96 
    97   // G4DNACrossSectionDataSet* table;
    98  
    9966};
    10067
  • trunk/source/processes/electromagnetic/lowenergy/include/G4CrossSectionKill.hh

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionKill.hh,v 1.1 2007/11/09 20:26:47 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4DNACrossSectionDataSet.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4DNACrossSectionDataSet.hh,v 1.4 2007/10/15 08:31:49 pia Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4DNACrossSectionDataSet.hh,v 1.6 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Riccardo Capra <capra@ge.infn.it>
     
    4545// -------------------------------------------------------------------
    4646
    47 #ifndef   G4DNACROSSSECTIONDATASET_HH
    48  #define  G4DNACROSSSECTIONDATASET_HH 1
     47#ifndef  G4DNACROSSSECTIONDATASET_HH
     48#define  G4DNACROSSSECTIONDATASET_HH 1
    4949
    50  #include "G4ShellEMDataSet.hh"
     50#include "G4ShellEMDataSet.hh"
    5151
    52  class G4DNACrossSectionDataSet : public G4VEMDataSet
    53  {
    54   public:
    55    G4DNACrossSectionDataSet(G4VDataSetAlgorithm* argAlgorithm,
    56                             G4double argUnitEnergies=MeV,
    57                             G4double argUnitData=barn);
     52class G4DNACrossSectionDataSet : public G4VEMDataSet
     53{
    5854
    59    virtual ~G4DNACrossSectionDataSet();
     55public:
     56  G4DNACrossSectionDataSet(G4VDataSetAlgorithm* algo,
     57                           G4double xUnit=MeV,
     58                           G4double dataUnit=barn);
    6059
    61    virtual G4double FindValue(G4double argEnergy, G4int argComponentId=0) const;
     60  virtual ~G4DNACrossSectionDataSet();
     61
     62  virtual G4double FindValue(G4double e, G4int componentId=0) const;
    6263 
    63    virtual void PrintData(void) const;
     64  virtual void PrintData(void) const;
    6465
    65    virtual const G4VEMDataSet*  GetComponent(G4int argComponentId) const
    66    { return components[argComponentId]; }
     66  virtual const G4VEMDataSet*  GetComponent(G4int componentId) const
     67  { return components[componentId]; }
    6768
    68    virtual void AddComponent(G4VEMDataSet * argDataSet)
    69    { components.push_back(argDataSet); }
    70    virtual size_t NumberOfComponents(void) const
    71    { return components.size(); }
     69  virtual void AddComponent(G4VEMDataSet* dataSet)
     70  { components.push_back(dataSet); }
    7271
    73    virtual const G4DataVector& GetEnergies(G4int argComponentId) const
    74    { return GetComponent(argComponentId)->GetEnergies(0); }
     72  virtual size_t NumberOfComponents(void) const
     73  { return components.size(); }
    7574
    76    virtual const G4DataVector& GetData(G4int argComponentId) const
    77    { return GetComponent(argComponentId)->GetData(0); }
     75  virtual const G4DataVector& GetEnergies(G4int componentId) const
     76  { return GetComponent(componentId)->GetEnergies(0); }
    7877
    79    virtual void SetEnergiesData(G4DataVector* argEnergies, G4DataVector* argData, G4int argComponentId);
     78  virtual const G4DataVector& GetData(G4int componentId) const
     79  { return GetComponent(componentId)->GetData(0); }
    8080
    81    virtual G4bool LoadData(const G4String & argFileName);
    82    virtual G4bool SaveData(const G4String & argFileName) const;
     81  virtual void SetEnergiesData(G4DataVector* x, G4DataVector* values, G4int componentId);
    8382
    84    //   void CleanUpComponents();
     83  virtual G4bool LoadData(const G4String & argFileName);
     84  virtual G4bool SaveData(const G4String & argFileName) const;
     85 
     86  virtual G4double RandomSelect(G4int /*componentId */) const { return -1.; };
     87
     88
     89  //   void CleanUpComponents();
    8590   
    86   private:
     91private:
    8792
    88    G4String FullFileName(const G4String & argFileName) const;
     93  G4String FullFileName(const G4String & argFileName) const;
    8994
    90    // Hide copy constructor and assignment operator
    91    G4DNACrossSectionDataSet();
    92    G4DNACrossSectionDataSet(const G4DNACrossSectionDataSet & copy);
    93    G4DNACrossSectionDataSet& operator=(const G4DNACrossSectionDataSet & right);
     95  // Hide copy constructor and assignment operator
     96  G4DNACrossSectionDataSet();
     97  G4DNACrossSectionDataSet(const G4DNACrossSectionDataSet & copy);
     98  G4DNACrossSectionDataSet& operator=(const G4DNACrossSectionDataSet & right);
    9499
    95    std::vector<G4VEMDataSet*> components;          // Owned pointers
     100  std::vector<G4VEMDataSet*> components;          // Owned pointers
    96101
    97    G4int z;
     102  G4int z;
    98103
    99    G4VDataSetAlgorithm* algorithm;           // Owned pointer
     104  G4VDataSetAlgorithm* algorithm;           // Owned pointer
    100105 
    101    G4double unitEnergies;
    102    G4double unitData;
     106  G4double unitEnergies;
     107  G4double unitData;
    103108
    104    G4double GetUnitEnergies() const { return unitEnergies; }
    105    G4double GetUnitData() const { return unitData; }
    106    const G4VDataSetAlgorithm* GetAlgorithm() const { return algorithm; }
     109  G4double GetUnitEnergies() const { return unitEnergies; }
     110  G4double GetUnitData() const { return unitData; }
     111  const G4VDataSetAlgorithm* GetAlgorithm() const { return algorithm; }
    107112   
    108    void CleanUpComponents(void);
     113  void CleanUpComponents(void);
    109114
    110115
  • trunk/source/processes/electromagnetic/lowenergy/include/G4DNAGenericIonsManager.hh

    r819 r961  
    2626//
    2727// $Id: G4DNAGenericIonsManager.hh,v 1.3 2006/06/29 19:34:16 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929
    3030#ifndef   G4DNAGENERICIONSMANAGER_HH
  • trunk/source/processes/electromagnetic/lowenergy/include/G4DNAProcess.hh

    r819 r961  
    2626//
    2727// $Id: G4DNAProcess.hh,v 1.5 2007/11/09 16:20:04 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author:  Maria Grazia Pia (Maria.Grazia.Pia@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4DNAProcess.icc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4DNAProcess.icc,v 1.11 2007/12/10 16:31:19 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4DNAProcess.icc,v 1.12 2009/01/20 07:50:28 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    111111      aParticleChange.ProposeEnergy(0.);
    112112      aParticleChange.ProposeMomentumDirection( 0., 0., 0. );
    113       aParticleChange.ProposeLocalEnergyDeposit(track.GetKineticEnergy() + deposit);
    114        
     113     
     114      if (product.PrimaryParticleIsKilledAndDoNotDepositEnergy())
     115      {
     116        aParticleChange.ProposeLocalEnergyDeposit(deposit);
     117      }
     118      else
     119      {
     120        aParticleChange.ProposeLocalEnergyDeposit(track.GetKineticEnergy() + deposit);
     121      }
     122     
    115123    }
    116124  else
  • trunk/source/processes/electromagnetic/lowenergy/include/G4DummyFinalState.hh

    r819 r961  
    2626//
    2727// $Id: G4DummyFinalState.hh,v 1.2 2007/10/07 12:52:18 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4EMDataSet.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EMDataSet.hh,v 1.7 2006/06/29 19:35:31 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4EMDataSet.hh,v 1.12 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    4545
    4646#ifndef   G4EMDATASET_HH
    47  #define  G4EMDATASET_HH 1
     47#define  G4EMDATASET_HH 1
    4848
    49  #include "globals.hh"
    50  #include "G4VEMDataSet.hh"
     49#include "globals.hh"
     50#include "G4VEMDataSet.hh"
    5151
    52  class G4VDataSetAlgorithm;
     52class G4VDataSetAlgorithm;
    5353
    54  class G4EMDataSet : public G4VEMDataSet
    55  {
    56   public:
    57                                                 G4EMDataSet(G4int argZ, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergies=MeV, G4double argUnitData=barn);
    58                                                 G4EMDataSet(G4int argZ, G4DataVector * argEnergies, G4DataVector * argData, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergues=MeV, G4double argUnitData=barn);
    59    virtual                                     ~G4EMDataSet();
     54class G4EMDataSet : public G4VEMDataSet
     55{
     56public:
     57  G4EMDataSet(G4int argZ,
     58              G4VDataSetAlgorithm* algo,
     59              G4double xUnit=MeV,
     60              G4double yUnit=barn,
     61              G4bool random=false);
     62
     63  G4EMDataSet(G4int argZ,
     64              G4DataVector* xData,
     65              G4DataVector* data,
     66              G4VDataSetAlgorithm* algo,
     67              G4double xUnit=MeV,
     68              G4double yUnit=barn,
     69              G4bool random=false);
     70
     71  virtual ~G4EMDataSet();
    6072 
    61    virtual G4double                             FindValue(G4double argEnergy, G4int argComponentId=0) const;
     73  virtual G4double FindValue(G4double x, G4int componentId=0) const;
    6274 
    63    virtual void                                PrintData(void) const;
     75  virtual void PrintData(void) const;
    6476
    65    virtual const G4VEMDataSet *                 GetComponent(G4int /* argComponentId */) const { return 0; }
    66    virtual void                                 AddComponent(G4VEMDataSet * /* argDataSet */) {}
    67    virtual size_t                               NumberOfComponents(void) const { return 0; }
     77  virtual const G4VEMDataSet* GetComponent(G4int /* componentId */) const { return 0; }
    6878
    69    virtual const G4DataVector &                 GetEnergies(G4int /* argComponentId */) const { return *energies; }
    70    virtual const G4DataVector &                 GetData(G4int /* argComponentId */) const { return *data; }
    71    virtual void                                 SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId);
     79  virtual void AddComponent(G4VEMDataSet* /* dataSet */) {}
    7280
    73    virtual G4bool                               LoadData(const G4String & argFileName);
    74    virtual G4bool                               SaveData(const G4String & argFileName) const;
    75    
    76   private:
    77    size_t                                       FindLowerBound(G4double argEnergy) const;
    78    
    79    G4String                                     FullFileName(const G4String & argFileName) const;
     81  virtual size_t NumberOfComponents(void) const { return 0; }
    8082
    81    // Hide copy constructor and assignment operator
    82                                                 G4EMDataSet();
    83                                                 G4EMDataSet(const G4EMDataSet & copy);
    84    G4EMDataSet &                                operator=(const G4EMDataSet & right);
     83  virtual const G4DataVector& GetEnergies(G4int /* componentId */) const { return *energies; }
     84  virtual const G4DataVector& GetData(G4int /* componentId */) const { return *data; }
     85  virtual void SetEnergiesData(G4DataVector* xData, G4DataVector* data, G4int componentId);
    8586
    86    G4int                                        z;
     87  virtual G4bool LoadData(const G4String& fileName);
     88  virtual G4bool SaveData(const G4String& fileName) const;
    8789
    88    G4DataVector *                               energies;            // Owned pointer
    89    G4DataVector *                               data;                // Owned pointer
     90  virtual G4double RandomSelect(G4int componentId = 0) const;
     91    
    9092
    91    G4VDataSetAlgorithm *                        algorithm;           // Owned pointer
     93private:
     94
     95  size_t FindLowerBound(G4double energy) const;
     96  size_t FindLowerBound(G4double x, G4DataVector* values) const;
     97
     98  G4double IntegrationFunction(G4double x);
     99
     100  virtual void BuildPdf();
    92101 
    93    G4double                                     unitEnergies;
    94    G4double                                     unitData;
    95  };
     102  G4String FullFileName(const G4String& fileName) const;
     103
     104  // Hide copy constructor and assignment operator
     105  G4EMDataSet();
     106  G4EMDataSet(const G4EMDataSet& copy);
     107  G4EMDataSet& operator=(const G4EMDataSet& right);
     108
     109  G4int z;
     110
     111  G4DataVector* energies;            // Owned pointer
     112  G4DataVector* data;                // Owned pointer
     113
     114  G4VDataSetAlgorithm* algorithm;    // Owned pointer
     115 
     116  G4double unitEnergies;
     117  G4double unitData;
     118
     119  G4DataVector* pdf;
     120  G4bool randomSet;
     121};
    96122#endif /* G4EMDATASET_HH */
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateChargeDecrease.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateChargeDecrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateChargeDecrease.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATECHARGEDECREASE_HH
    5330#define G4FINALSTATECHARGEDECREASE_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    57 //#include "G4WaterExcitationStructure.hh"
    5833#include "G4CrossSectionChargeDecreasePartial.hh"
    5934
    60 class G4Track;
    61 class G4Step;
    62 
    63  class G4FinalStateChargeDecrease
    64  {
     35class G4FinalStateChargeDecrease
     36{
    6537 public:
    6638   
     
    7345 private:
    7446   
    75    // Copy constructor and assignment operator to be added here
    76    
    77    G4String name; 
    7847   G4double lowEnergyLimit;
    7948   G4double highEnergyLimit;
     
    8958};
    9059
    91 
    9260#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateChargeIncrease.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateChargeIncrease.hh,v 1.1 2007/11/08 18:24:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateChargeIncrease.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATECHARGEIncrease_HH
    5330#define G4FINALSTATECHARGEIncrease_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    5733#include "G4CrossSectionChargeIncreasePartial.hh"
     34#include "G4Electron.hh"
     35#include "G4Proton.hh"
    5836
    59 class G4Track;
    60 class G4Step;
    61 
    62  class G4FinalStateChargeIncrease
    63  {
     37class G4FinalStateChargeIncrease
     38{
    6439 public:
    6540   
     
    7247 private:
    7348   
    74    // Copy constructor and assignment operator to be added here
    75    
    76    G4String name; 
    7749   G4double lowEnergyLimit;
    7850   G4double highEnergyLimit;
     
    8961};
    9062
    91 
    9263#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateElasticBrennerZaider.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateElasticBrennerZaider.hh,v 1.1 2007/10/12 23:07:10 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateElasticBrennerZaider.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEELASTICBRENNERZAIDER_HH
    5330#define G4FINALSTATEELASTICBRENNERZAIDER_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
     33#include "Randomize.hh"
    5734
    5835class G4Track;
     
    7148 private:
    7249   
    73    // Copy constructor and assignment operator to be added here
    74    
    75    G4String name; 
    7650   G4double lowEnergyLimit;
    7751   G4double highEnergyLimit;
     
    8963 };
    9064
    91 
    9265#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateElasticScreenedRutherford.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateElasticScreenedRutherford.hh,v 1.2 2007/10/12 23:02:55 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateElasticScreenedRutherford.hh,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEELASTICSCREENEDRUTHERFORD_HH
    5330#define G4FINALSTATEELASTICSCREENEDRUTHERFORD_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
     33#include "Randomize.hh"
    5734
    5835class G4Track;
     
    7148 private:
    7249   
    73    // Copy constructor and assignment operator to be added here
    74    
    75    G4String name; 
    7650   G4double lowEnergyLimit;
    7751   G4double highEnergyLimit;
     
    8357 };
    8458
    85 
    8659#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateExcitationBorn.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationBorn.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationBorn.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEEXCITATIONBORN_HH
    5330#define G4FINALSTATEEXCITATIONBORN_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    5733#include "G4WaterExcitationStructure.hh"
    5834#include "G4CrossSectionExcitationBornPartial.hh"
    5935
    60 class G4Track;
    61 class G4Step;
    62 
    63  class G4FinalStateExcitationBorn
    64  {
     36class G4FinalStateExcitationBorn
     37{
    6538 public:
    6639   
     
    7245   
    7346 private:
    74    
    75    // Copy constructor and assignment operator to be added here
    76    
    77    G4String name; 
     47
    7848   G4double lowEnergyLimit;
    7949   G4double highEnergyLimit;
     
    8555};
    8656
    87 
    8857#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateExcitationEmfietzoglou.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationEmfietzoglou.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationEmfietzoglou.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEEXCITATIONEMFIETZOGLOU_HH
    5330#define G4FINALSTATEEXCITATIONEMFIETZOGLOU_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    57 #include "G4WaterExcitationStructure.hh"
    5833#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
    5934
     
    7348 private:
    7449   
    75    // Copy constructor and assignment operator to be added here
    76    
    77    G4String name; 
    7850   G4double lowEnergyLimit;
    7951   G4double highEnergyLimit;
     
    8557};
    8658
    87 
    8859#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateExcitationMillerGreen.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationMillerGreen.hh,v 1.1 2007/11/08 19:56:02 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationMillerGreen.hh,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEEXCITATIONMILLERGREEN_HH
    5330#define G4FINALSTATEEXCITATIONMILLERGREEN_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    57 #include "G4WaterExcitationStructure.hh"
    5833#include "G4CrossSectionExcitationMillerGreenPartial.hh"
    5934
    60 class G4Track;
    61 class G4Step;
    62 
    63  class G4FinalStateExcitationMillerGreen
    64  {
     35class G4FinalStateExcitationMillerGreen
     36{
    6537 public:
    6638   
     
    7345 private:
    7446   
    75    // Copy constructor and assignment operator to be added here
    76    
    77    G4String name; 
    7847   G4double lowEnergyLimit;
    7948   G4double highEnergyLimit;
     
    8554};
    8655
    87 
    8856#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateIonisationBorn.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateIonisationBorn.hh,v 1.3 2007/11/13 15:20:19 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateIonisationBorn.hh,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#ifndef G4FINALSTATEIONISATIONBORN_HH
    5330#define G4FINALSTATEIONISATIONBORN_HH 1
    5431 
    55 #include "globals.hh"
    5632#include "G4FinalStateProduct.hh"
    5733#include "G4WaterIonisationStructure.hh"
     
    6137class G4Step;
    6238
    63  class G4FinalStateIonisationBorn
    64  {
     39class G4FinalStateIonisationBorn
     40{
    6541 public:
    6642   
     
    7147   const G4FinalStateProduct& GenerateFinalState(const G4Track& track, const G4Step& step);
    7248   
    73  private:
     49private:
    7450   
    75    // Copy constructor and assignment operator to be added here
    76    
    77    G4String name; 
    7851   G4double lowEnergyLimitDefault;
    7952   G4double highEnergyLimitDefault;
     
    11285   TriDimensionMap eDiffCrossSectionData[6];
    11386   TriDimensionMap pDiffCrossSectionData[6];
    114    // TriDimensionMap eDiffCrossSectionData;
    115    // TriDimensionMap pDiffCrossSectionData;
    11687   std::vector<double> eTdummyVec;
    11788   std::vector<double> pTdummyVec;
     
    12192   VecMap pVecm;
    12293 
    123    //   std::ifstream eDiffCrossSection;
    124    //   std::ifstream pDiffCrossSection;
    125    
    12694};
    12795
    128 
    12996#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateIonisationRudd.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateIonisationRudd.hh,v 1.2 2007/11/09 16:30:56 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // History:
    33 // -----------
    34 // Date         Name              Modification
    35 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    36 //
    37 // -------------------------------------------------------------------
    38 
    39 // Class description:
    40 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    41 // Reference: TNS Geant4-DNA paper
    42 // Reference: TNS Geant4-DNA paper
    43 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    44 // design foundation and implementation of the first set of models,
    45 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    46 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
     26// $Id: G4FinalStateIonisationRudd.hh,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5028
    5129
     
    5331#define G4FINALSTATEIONISATIONRUDD_HH 1
    5432 
    55 #include "globals.hh"
    5633#include "G4FinalStateProduct.hh"
    5734#include "G4WaterIonisationStructure.hh"
    5835#include "G4CrossSectionIonisationRuddPartial.hh"
    59 
    60 class G4Track;
    61 class G4Step;
    62 class G4ParticleDefinition;
     36#include "G4Electron.hh"
     37#include "G4Proton.hh"
    6338
    6439class G4FinalStateIonisationRudd
     
    7449private:
    7550   
    76   // Copy constructor and assignment operator to be added here
    77    
    78   G4String name; 
    7951  G4double lowEnergyLimitDefault;
    8052  G4double highEnergyLimitDefault;
     
    9567                                         G4double incomingParticleEnergy,
    9668                                         G4double outgoingParticleEnergy,
    97                                          G4double cosTheta,
    98                                          G4double phi);
     69                                         G4double & cosTheta,
     70                                         G4double & phi);
    9971   
    10072  G4double  DifferentialCrossSection(G4ParticleDefinition* particleDefinition,
     
    130102};
    131103
    132 
    133104#endif
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateKill.hh

    r819 r961  
    2626//
    2727// $Id: G4FinalStateKill.hh,v 1.1 2007/11/09 20:26:47 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FinalStateProduct.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4FinalStateProduct.hh,v 1.4 2007/10/15 08:31:49 pia Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4FinalStateProduct.hh,v 1.5 2009/01/20 07:50:28 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    7272  void ModifyPrimaryParticle(const G4ThreeVector& direction, G4double energy);
    7373 
     74  void DoNotDepositEnergy();
    7475  void KillPrimaryParticle();
    75  
     76
    7677  G4bool PrimaryParticleIsKilled() const { return killStatus; }
     78 
     79  G4bool PrimaryParticleIsKilledAndDoNotDepositEnergy() const { return doNotDepositStatus; }
    7780 
    7881  G4bool PrimaryParticleIsModified() const { return isModified; }
     
    9699 
    97100  G4bool killStatus;
     101  G4bool doNotDepositStatus;
    98102  G4bool isModified;
    99103  G4double localEnergyDeposit;
  • trunk/source/processes/electromagnetic/lowenergy/include/G4FluoTransition.hh

    r819 r961  
    2626//
    2727// $Id: G4FluoTransition.hh,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LinInterpolation.hh

    r819 r961  
    2626//
    2727// $Id: G4LinInterpolation.hh,v 1.3 2006/06/29 19:35:45 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LogLogInterpolation.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4LogLogInterpolation.hh,v 1.4 2006/06/29 19:35:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4LogLogInterpolation.hh,v 1.6 2008/12/09 13:28:02 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyBremsstrahlung.hh

    r819 r961  
    2727// -------------------------------------------------------------------
    2828// $Id: G4LowEnergyBremsstrahlung.hh,v 1.37 2006/06/29 19:35:55 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyCompton.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LowEnergyCompton.hh,v 1.21 2006/06/29 19:35:57 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4LowEnergyCompton.hh,v 1.24 2008/11/04 10:14:00 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// Author: A. Forti
     
    4848#include "globals.hh"
    4949#include "G4VDiscreteProcess.hh"
     50#include "G4ShellData.hh"
     51#include "G4DopplerProfile.hh"
    5052
    5153class G4Track;
     
    6769  G4bool IsApplicable(const G4ParticleDefinition& definition);
    6870 
    69   void BuildPhysicsTable(const G4ParticleDefinition& photon);
     71  void BuildPhysicsTable(const G4ParticleDefinition& definition);
    7072 
    71   G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep);
     73  G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step& step);
    7274 
    7375  // For testing purpose only
    74   G4double DumpMeanFreePath(const G4Track& aTrack,
     76  G4double DumpMeanFreePath(const G4Track& track,
    7577                            G4double previousStepSize,
    7678                            G4ForceCondition* condition)
    77   { return GetMeanFreePath(aTrack, previousStepSize, condition); }
     79  { return GetMeanFreePath(track, previousStepSize, condition); }
    7880
    7981protected:
    8082
    81   G4double GetMeanFreePath(const G4Track& aTrack,
     83  G4double GetMeanFreePath(const G4Track& track,
    8284                           G4double previousStepSize,
    8385                           G4ForceCondition* condition);
     
    102104  const G4double intrinsicHighEnergyLimit;
    103105
     106  G4ShellData shellData;
     107  G4DopplerProfile profileData;
    104108};
    105109
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyGammaConversion.hh

    r819 r961  
    2626//
    2727// $Id: G4LowEnergyGammaConversion.hh,v 1.15 2006/06/29 19:35:59 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyIonisation.hh

    r819 r961  
    2626// -------------------------------------------------------------------
    2727// $Id: G4LowEnergyIonisation.hh,v 1.41 2006/06/29 19:36:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyPhotoElectric.hh

    r819 r961  
    2626//
    2727// $Id: G4LowEnergyPhotoElectric.hh,v 1.28 2006/06/29 19:36:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyPolarizedCompton.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4LowEnergyPolarizedCompton.hh,v 1.9 2006/06/29 19:36:05 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4LowEnergyPolarizedCompton.hh,v 1.10 2008/05/02 13:04:41 flongo Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
     
    5757#include "globals.hh"
    5858#include "G4VDiscreteProcess.hh"
     59
     60// Doppler Broadening
     61
     62#include "G4ShellData.hh"
     63#include "G4DopplerProfile.hh"
     64
    5965
    6066class G4Track;
     
    125131                         G4ThreeVector& polarization0, G4ThreeVector& polarization1);
    126132 
     133  // Doppler Broadening
     134 
     135  G4ShellData shellData;
     136  G4DopplerProfile profileData;
     137
     138
    127139};
    128140
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyPolarizedRayleigh.hh

    r819 r961  
    2525//
    2626// $Id: G4LowEnergyPolarizedRayleigh.hh,v 1.5 2006/06/29 19:36:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4LowEnergyRayleigh.hh

    r819 r961  
    2626//
    2727// $Id: G4LowEnergyRayleigh.hh,v 1.16 2006/06/29 19:36:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeBremsstrahlung.hh

    r819 r961  
    2727// -------------------------------------------------------------------
    2828// $Id: G4PenelopeBremsstrahlung.hh,v 1.8 2006/06/29 19:36:15 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: L.Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeBremsstrahlungAngular.hh

    r819 r961  
    2727// -------------------------------------------------------------------
    2828// $Id: G4PenelopeBremsstrahlungAngular.hh,v 1.3 2006/06/29 19:36:17 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: L.Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeBremsstrahlungContinuous.hh

    r819 r961  
    2626//
    2727// -------------------------------------------------------------------
    28 // $Id: G4PenelopeBremsstrahlungContinuous.hh,v 1.3 2006/06/29 19:36:19 gunter Exp $
    29 // GEANT4 tag $Name: $
     28// $Id: G4PenelopeBremsstrahlungContinuous.hh,v 1.4 2008/12/09 15:04:05 pandola Exp $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: L.Pandola
     
    3535// 20 Feb 2003  L. Pandola       1st implementation
    3636// 17 Mar 2003  L. Pandola       Added the correction for positrons
     37// 09 Dec 2008  L. Pandola       Cosmetics: say what variables are
     38//
    3739// Class description:
    3840// Calculation of continuous energy loss for Penelope Bremsstrahlung
     
    5456public:
    5557 
    56   G4PenelopeBremsstrahlungContinuous(G4int Zmat,G4double tCut, G4double emin, G4double emax,
    57                                      const G4String partName);
     58  G4PenelopeBremsstrahlungContinuous(G4int Z,G4double energyCut, G4double energyMin,
     59                                     G4double energyMax,
     60                                     const G4String particleName);
    5861  ~G4PenelopeBremsstrahlungContinuous();
    59   G4double CalculateStopping(G4double PrimaryEnergy);
     62  G4double CalculateStopping(G4double energy);
    6063 
    6164private:
    62 
    6365  void PrepareInterpolationTable();
    6466  void LoadFromFile();
     
    7577  G4double ExtendedLogEnergy[NumberofExtendedEGrid];
    7678  G4double p0[NumberofExtendedEGrid][NumberofKPoints];
    77   //G4double Pbcut[NumberofExtendedEGrid]; //serve?
     79  //G4double Pbcut[NumberofExtendedEGrid]; //useful?
    7880};
    7981
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeCompton.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PenelopeCompton.hh,v 1.10 2006/06/29 19:36:21 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4PenelopeCompton.hh,v 1.11 2008/03/26 15:30:19 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// Author: Luciano Pandola
     
    3636// 26 Mar 2003   L.Pandola    Added fluorescence
    3737// 18 Mar 2004   L.Pandola    Use of std::map (code review)
     38// 26 Mar 2008   L.Pandola    Add boolean flag to control atomic de-excitation
    3839//
    3940// -------------------------------------------------------------------
     
    7879  { return GetMeanFreePath(aTrack, previousStepSize, condition); }
    7980
     81  void SetUseAtomicDeexcitation(G4bool value){fUseAtomicDeexcitation = value;};
     82
     83  G4bool GetUseAtomicDeexcitation(){return fUseAtomicDeexcitation;};
     84
    8085protected:
    8186
     
    118123
    119124  std::vector<G4VEMDataSet*> *matCrossSections; //for random choice of atom
     125
    120126  G4double cutForLowEnergySecondaryPhotons;
     127  G4bool fUseAtomicDeexcitation;
    121128};
    122129
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeGammaConversion.hh

    r819 r961  
    2626//
    2727// $Id: G4PenelopeGammaConversion.hh,v 1.2 2006/06/29 19:36:25 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: L. Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeIonisation.hh

    r819 r961  
    2626// -------------------------------------------------------------------
    2727// $Id: G4PenelopeIonisation.hh,v 1.5 2006/06/29 19:36:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: L. Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopePhotoElectric.hh

    r819 r961  
    2626//
    2727// $Id: G4PenelopePhotoElectric.hh,v 1.4 2006/06/29 19:36:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: L.Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4PenelopeRayleigh.hh

    r819 r961  
    2626//
    2727// $Id: G4PenelopeRayleigh.hh,v 1.5 2006/06/29 19:36:37 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Luciano Pandola
  • trunk/source/processes/electromagnetic/lowenergy/include/G4RangeNoTest.hh

    r819 r961  
    2626//
    2727// $Id: G4RangeNoTest.hh,v 1.4 2006/06/29 19:36:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4RangeTest.hh

    r819 r961  
    2626//
    2727// $Id: G4RangeTest.hh,v 1.4 2006/06/29 19:36:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4SemiLogInterpolation.hh

    r819 r961  
    2626//
    2727// $Id: G4SemiLogInterpolation.hh,v 1.4 2006/06/29 19:36:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4ShellData.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ShellData.hh,v 1.5 2007/02/20 16:53:16 mantero Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ShellData.hh,v 1.7 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    5555public:
    5656
    57   G4ShellData(G4int minZ = 1, G4int maxZ = 100);
     57  G4ShellData(G4int minZ = 1, G4int maxZ = 100, G4bool isOccupancy = false);
    5858
    5959  ~G4ShellData();
     
    6363  G4int ShellId(G4int Z, G4int shellIndex) const;
    6464
    65   const G4DataVector& ShellIdVector(G4int Z) const;
     65  G4double ShellOccupancyProbability(G4int Z, G4int shellIndex) const;
     66
     67  const std::vector<G4double>& ShellIdVector(G4int Z) const;
    6668
    6769  G4double BindingEnergy(G4int Z, G4int shellIndex) const;
     70
     71  void SetOccupancyData() { occupancyData = true; }
    6872
    6973  void LoadData(const G4String& fileName);
    7074
    7175  void PrintData() const;
     76
     77  // Randomly select a shell based on shell occupancy
     78  G4int SelectRandomShell(G4int Z) const;
    7279
    7380private:
     
    7784  G4ShellData(const G4ShellData&);
    7885
    79    G4int zMin;
     86  const std::vector<G4double>& ShellVector(G4int Z) const;
     87
     88  G4int zMin;
    8089  G4int zMax;
    8190
    82   std::map<G4int,G4DataVector*,std::less<G4int> > idMap;
     91  G4bool occupancyData;
     92
     93  std::map<G4int,std::vector<G4double>*,std::less<G4int> > idMap;
    8394  std::map<G4int,G4DataVector*,std::less<G4int> > bindingMap;
    8495  std::vector<G4int> nShells;
     96  std::map<G4int,std::vector<G4double>*,std::less<G4int> > occupancyPdfMap;
    8597
    8698};
  • trunk/source/processes/electromagnetic/lowenergy/include/G4ShellEMDataSet.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ShellEMDataSet.hh,v 1.9 2007/10/15 08:31:49 pia Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ShellEMDataSet.hh,v 1.12 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    3333// -----------
    3434// 31 Jul 2001   MGP        Created
     35//  9 Mar 2008   MGP        Cleaned up unreadable code modified by former developer
     36//                          (Further clean-up needed)
    3537//
    3638// -------------------------------------------------------------------
     
    4446// -------------------------------------------------------------------
    4547
    46 #ifndef   G4SHELLEMDATASET_HH
    47  #define  G4SHELLEMDATASET_HH 1
     48#ifndef  G4SHELLEMDATASET_HH
     49#define  G4SHELLEMDATASET_HH 1
    4850
    49  #include "globals.hh"
    50  #include "G4VEMDataSet.hh"
    51  #include <vector>
     51#include "globals.hh"
     52#include "G4VEMDataSet.hh"
     53#include <vector>
    5254
    53  class G4VDataSetAlgorithm;
     55class G4VDataSetAlgorithm;
    5456
    55  class G4ShellEMDataSet : public G4VEMDataSet
    56  {
    57   public:
    58    G4ShellEMDataSet(G4int argZ, G4VDataSetAlgorithm* argAlgorithm, G4double argUnitEnergies=MeV, G4double argUnitData=barn);
    59    virtual ~G4ShellEMDataSet();
     57class G4ShellEMDataSet : public G4VEMDataSet
     58{
     59public:
     60  G4ShellEMDataSet(G4int Z,
     61                   G4VDataSetAlgorithm* algo,
     62                   G4double eUnit=MeV,
     63                   G4double dataUnit=barn);
     64
     65  virtual ~G4ShellEMDataSet();
    6066 
    61    virtual G4double FindValue(G4double argEnergy, G4int argComponentId=0) const;
     67  virtual G4double FindValue(G4double energy, G4int componentId=0) const;
    6268 
    63    virtual void PrintData(void) const;
     69  virtual void PrintData(void) const;
    6470
    65    virtual const G4VEMDataSet*  GetComponent(G4int argComponentId) const { return components[argComponentId]; }
    66    virtual void AddComponent(G4VEMDataSet * argDataSet) { components.push_back(argDataSet); }
    67    virtual size_t NumberOfComponents(void) const { return components.size(); }
     71  virtual const G4VEMDataSet*  GetComponent(G4int componentId) const { return components[componentId]; }
     72  virtual void AddComponent(G4VEMDataSet* dataSet) { components.push_back(dataSet); }
     73  virtual size_t NumberOfComponents(void) const { return components.size(); }
    6874
    69    virtual const G4DataVector& GetEnergies(G4int argComponentId) const { return GetComponent(argComponentId)->GetEnergies(0); }
    70    virtual const G4DataVector& GetData(G4int argComponentId) const { return GetComponent(argComponentId)->GetData(0); }
    71    virtual void SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId);
     75  virtual const G4DataVector& GetEnergies(G4int componentId) const { return GetComponent(componentId)->GetEnergies(0); }
     76  virtual const G4DataVector& GetData(G4int componentId) const { return GetComponent(componentId)->GetData(0); }
     77  virtual void SetEnergiesData(G4DataVector* energies, G4DataVector* data, G4int componentId);
    7278
    73    virtual G4bool LoadData(const G4String & argFileName);
    74    virtual G4bool SaveData(const G4String & argFileName) const;
     79  virtual G4bool LoadData(const G4String& fileName);
     80  virtual G4bool SaveData(const G4String& fileName) const;
     81
     82  virtual G4double RandomSelect(G4int /*componentId = 0*/) const { return -1.; };
    7583   
    76  protected:
    77    G4double GetUnitEnergies() const { return unitEnergies; }
    78    G4double GetUnitData() const { return unitData; }
    79    const G4VDataSetAlgorithm* GetAlgorithm() const { return algorithm; }
     84protected:
     85
     86  G4double GetUnitEnergies() const { return unitEnergies; }
     87  G4double GetUnitData() const { return unitData; }
     88  const G4VDataSetAlgorithm* GetAlgorithm() const { return algorithm; }
    8089   
    81    void CleanUpComponents(void);
     90  void CleanUpComponents(void);
    8291
    83  private:
    84    G4String FullFileName(const G4String & argFileName) const;
     92private:
     93
     94  G4String FullFileName(const G4String& fileName) const;
    8595 
    86    // Hide copy constructor and assignment operator
    87    G4ShellEMDataSet();
    88    G4ShellEMDataSet(const G4ShellEMDataSet & copy);
    89    G4ShellEMDataSet& operator=(const G4ShellEMDataSet & right);
     96  // Hide copy constructor and assignment operator
     97  G4ShellEMDataSet();
     98  G4ShellEMDataSet(const G4ShellEMDataSet& copy);
     99  G4ShellEMDataSet& operator=(const G4ShellEMDataSet& right);
    90100
    91    std::vector<G4VEMDataSet*> components;          // Owned pointers
     101  std::vector<G4VEMDataSet*> components;          // Owned pointers
    92102
    93    G4int z;
     103  G4int z;
    94104
    95    G4VDataSetAlgorithm* algorithm;           // Owned pointer
     105  G4VDataSetAlgorithm* algorithm;           // Owned pointer
    96106 
    97    G4double unitEnergies;
    98    G4double unitData;
    99  };
     107  G4double unitEnergies;
     108  G4double unitData;
     109};
    100110#endif /* G4SHELLEMDATASET_HH */
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VCrossSectionHandler.hh

    r819 r961  
    2626//
    2727// $Id: G4VCrossSectionHandler.hh,v 1.14 2006/06/29 19:37:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VDataSetAlgorithm.hh

    r819 r961  
    2626//
    2727// $Id: G4VDataSetAlgorithm.hh,v 1.7 2006/06/29 19:37:07 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VEMDataSet.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4VEMDataSet.hh,v 1.9 2007/10/15 08:31:49 pia Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4VEMDataSet.hh,v 1.12 2008/03/17 13:45:25 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    4444// -------------------------------------------------------------------
    4545
    46 #ifndef   G4VEMDATASET_HH
    47  #define  G4VEMDATASET_HH 1
     46#ifndef  G4VEMDATASET_HH
     47#define  G4VEMDATASET_HH 1
    4848
    49  #include "globals.hh"
    50  #include "G4DataVector.hh"
     49#include "globals.hh"
     50#include "G4DataVector.hh"
    5151
    52  class G4VEMDataSet
    53  {
    54   public:
    55                                                 G4VEMDataSet() { }
    56    virtual                                    ~G4VEMDataSet() { }
     52class G4VEMDataSet
     53{
     54public:
     55  G4VEMDataSet() { }
     56  virtual ~G4VEMDataSet() { }
    5757 
    58    virtual G4double                             FindValue(G4double argEnergy, G4int argComponentId=0) const = 0;
     58  virtual G4double FindValue(G4double x, G4int componentId = 0) const = 0;
    5959 
    60    virtual void                                PrintData(void) const = 0;
     60  virtual void PrintData(void) const = 0;
    6161 
    62    virtual const G4VEMDataSet *                 GetComponent(G4int argComponentId) const = 0;
    63    virtual void                                 AddComponent(G4VEMDataSet * argDataSet) = 0;
    64    virtual size_t                              NumberOfComponents(void) const = 0;
     62  virtual const G4VEMDataSet* GetComponent(G4int componentId) const = 0;
     63  virtual void AddComponent(G4VEMDataSet* dataSet) = 0;
     64  virtual size_t NumberOfComponents(void) const = 0;
    6565 
    66    virtual const G4DataVector &                 GetEnergies(G4int argComponentId) const = 0;
    67    virtual const G4DataVector &                 GetData(G4int argComponentId) const = 0;
    68    virtual void                                 SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponent=0) = 0;
     66  virtual const G4DataVector& GetEnergies(G4int componentId) const = 0;
     67  virtual const G4DataVector& GetData(G4int componentId) const = 0;
     68  virtual void SetEnergiesData(G4DataVector* x, G4DataVector* data, G4int component=0) = 0;
    6969 
    70    virtual G4bool                               LoadData(const G4String & argFileName) = 0;
    71    virtual G4bool                               SaveData(const G4String & argFileName) const = 0;
     70  virtual G4bool LoadData(const G4String& fileName) = 0;
     71  virtual G4bool SaveData(const G4String& fileName) const = 0;
     72
     73  virtual G4double RandomSelect(G4int componentId = 0) const = 0;
    7274   
    73   private:
    74    // Hide copy constructor and assignment operator
    75                                                 G4VEMDataSet(const G4VEMDataSet & copy);
    76    G4VEMDataSet &                               operator=(const G4VEMDataSet & right);
    77  };
     75private:
     76  // Hide copy constructor and assignment operator
     77  G4VEMDataSet(const G4VEMDataSet& copy);
     78  G4VEMDataSet& operator=(const G4VEMDataSet& right);
     79};
    7880#endif /* G4VEMDATASET_HH */
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VLowEnergyDiscretePhotonProcess.hh

    r819 r961  
    2525//
    2626// $Id: G4VLowEnergyDiscretePhotonProcess.hh,v 1.4 2006/06/29 19:37:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VLowEnergyTestableDiscreteProcess.hh

    r819 r961  
    2626//
    2727// $Id: G4VLowEnergyTestableDiscreteProcess.hh,v 1.3 2006/06/29 19:37:17 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VRangeTest.hh

    r819 r961  
    2626//
    2727// $Id: G4VRangeTest.hh,v 1.3 2006/06/29 19:37:21 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4VeLowEnergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4VeLowEnergyLoss.hh,v 1.9 2006/06/29 19:37:23 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// 3.4.2000 Veronique Lefebure:
  • trunk/source/processes/electromagnetic/lowenergy/include/G4WaterExcitationStructure.hh

    r819 r961  
    2626//
    2727// $Id: G4WaterExcitationStructure.hh,v 1.1 2007/10/15 08:33:25 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4WaterIonisationStructure.hh

    r819 r961  
    2626//
    2727// $Id: G4WaterIonisationStructure.hh,v 1.1 2007/11/08 20:38:40 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eBremsstrahlungSpectrum.hh

    r819 r961  
    2525//
    2626// $Id: G4eBremsstrahlungSpectrum.hh,v 1.8 2006/06/29 19:37:33 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eCrossSectionExcitationEmfietzoglou.hh

    r819 r961  
    2626//
    2727// $Id: G4eCrossSectionExcitationEmfietzoglou.hh,v 1.1 2007/05/02 17:18:48 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eCrossSectionScreenedRutherford.hh

    r819 r961  
    2626//
    2727// $Id: G4eCrossSectionScreenedRutherford.hh,v 1.2 2007/10/12 12:26:34 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eIonisationCrossSectionHandler.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eIonisationCrossSectionHandler.hh,v 1.6 2006/06/29 19:37:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eIonisationCrossSectionHandler.hh,v 1.7 2009/01/29 08:13:27 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4040// Modified:
    4141// 10 Oct 2001  M.G. Pia        Revision to improve code quality and consistency with design
    42 //
     42// 28 Jan 2009  L.Pandola    Added public method to make a easier migration of
     43//                           G4LowEnergyIonisation to G4LivermoreIonisationModel
    4344// -------------------------------------------------------------------
    4445
     
    7273
    7374  ~G4eIonisationCrossSectionHandler();
     75
     76  G4double GetCrossSectionAboveThresholdForElement(G4double energy,
     77                                                   G4double cutEnergy,
     78                                                   G4int Z);
    7479 
    7580protected:
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eIonisationParameters.hh

    r819 r961  
    2626//
    2727// $Id: G4eIonisationParameters.hh,v 1.8 2006/06/29 19:37:38 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eIonisationSpectrum.hh

    r819 r961  
    2525//
    2626// $Id: G4eIonisationSpectrum.hh,v 1.7 2006/06/29 19:37:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eLowEnergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4eLowEnergyLoss.hh,v 1.14 2006/06/29 19:37:42 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4eLowEnergyLoss.icc

    r819 r961  
    2626//
    2727// $Id: G4eLowEnergyLoss.icc,v 1.8 2006/06/29 19:37:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ---------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hLowEnergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4hLowEnergyLoss.hh,v 1.17 2006/06/29 19:37:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// $Id:
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hLowEnergyLoss.icc

    r819 r961  
    2626//
    2727// $Id: G4hLowEnergyLoss.icc,v 1.3 2006/06/29 19:38:00 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// $Id:
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hShellCrossSectionDoubleExp.hh

    r819 r961  
    4545// -------------------------------------------------------------------
    4646// $Id: G4hShellCrossSectionDoubleExp.hh,v 1.3 2006/06/29 19:38:12 gunter Exp $
    47 // GEANT4 tag $Name: $
     47// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4848
    4949#ifndef G4HSHELLCROSSSECTIONDOUBLEEXP_HH
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hShellCrossSectionDoubleExpData.hh

    r819 r961  
    4040// -------------------------------------------------------------------
    4141// $Id: G4hShellCrossSectionDoubleExpData.hh,v 1.3 2006/06/29 19:38:14 gunter Exp $
    42 // GEANT4 tag $Name: $
     42// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4343
    4444#ifndef G4hShellCrossSectionDoubleExpData_HH
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hShellCrossSectionExp.hh

    r819 r961  
    4545// -------------------------------------------------------------------
    4646// $Id: G4hShellCrossSectionExp.hh,v 1.3 2006/06/29 19:38:16 gunter Exp $
    47 // GEANT4 tag $Name: $
     47// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4848
    4949#ifndef G4HSHELLCROSSSECTIONEXP_HH
  • trunk/source/processes/electromagnetic/lowenergy/include/G4hShellCrossSectionExpData.hh

    r819 r961  
    3838// -------------------------------------------------------------------
    3939// $Id: G4hShellCrossSectionExpData.hh,v 1.3 2006/06/29 19:38:18 gunter Exp $
    40 // GEANT4 tag $Name: $
     40// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4141
    4242#ifndef G4hShellCrossSectionExpData_HH
  • trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicDeexcitation.cc

    r819 r961  
    2626//
    2727// $Id: G4AtomicDeexcitation.cc,v 1.11
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicShell.cc

    r819 r961  
    2626//
    2727// $Id: G4AtomicShell.cc,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4AtomicTransitionManager.cc

    r819 r961  
    2626//
    2727// $Id: G4AtomicTransitionManager.cc,v 1.2 ????
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
     
    319319        G4double totalRadTransProb = 0;
    320320       
    321       for (size_t j = 1; j<transProb.size(); j++)
     321        for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1
    322322        {
    323323          totalRadTransProb = totalRadTransProb + transProb[j];
     
    361361      G4double totalRadTransProb = 0;
    362362     
    363       for(size_t j = 1; j<transProb.size(); j++)
     363      for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1
    364364        {
    365365          totalRadTransProb = totalRadTransProb + transProb[j];
  • trunk/source/processes/electromagnetic/lowenergy/src/G4AugerData.cc

    r819 r961  
    480480
    481481
    482   for (G4int element = 6; element < 101; element++)
     482  for (G4int element = 6; element < 100; element++)
    483483    {
    484       if(nMaterials == 0 || activeZ.contains(element)) {
    485         augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
    486      
    487         G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
    488       //      PrintData(element);
    489       }   
    490     }
    491  
    492   G4cout << "AugerTransitionTable complete"<< G4endl;
     484      //      if(nMaterials == 0 || activeZ.contains(element)) {
     485      augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
     486      //        G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
     487      // G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
     488      G4cout << "AugerTransitionTable complete"<< G4endl;
     489    }
    493490}
    494491
  • trunk/source/processes/electromagnetic/lowenergy/src/G4BremsstrahlungCrossSectionHandler.cc

    r819 r961  
    2525//
    2626// $Id: G4BremsstrahlungCrossSectionHandler.cc,v 1.9 2006/06/29 19:38:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4BremsstrahlungParameters.cc

    r819 r961  
    2626//
    2727// $Id: G4BremsstrahlungParameters.cc,v 1.19 2006/06/29 19:38:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CompositeEMDataSet.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4CompositeEMDataSet.cc,v 1.9 2006/06/29 19:38:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4CompositeEMDataSet.cc,v 1.13 2008/03/17 13:40:53 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    4242#include <sstream>
    4343
    44                                                 G4CompositeEMDataSet :: G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, G4double argUnitEnergies, G4double argUnitData, G4int argMinZ, G4int argMaxZ)
    45 :
    46  algorithm(argAlgorithm),
    47  unitEnergies(argUnitEnergies),
    48  unitData(argUnitData),
    49  minZ(argMinZ),
    50  maxZ(argMaxZ)
     44G4CompositeEMDataSet::G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm,
     45                                           G4double argUnitEnergies,
     46                                           G4double argUnitData,
     47                                           G4int argMinZ,
     48                                           G4int argMaxZ)
     49  :
     50  algorithm(argAlgorithm),
     51  unitEnergies(argUnitEnergies),
     52  unitData(argUnitData),
     53  minZ(argMinZ),
     54  maxZ(argMaxZ)
    5155{
    52  if (algorithm == 0)
    53   G4Exception("G4CompositeEMDataSet::G4CompositeEMDataSet - interpolation == 0");
     56  if (algorithm == 0)
     57    G4Exception("G4CompositeEMDataSet::G4CompositeEMDataSet - interpolation == 0");
    5458}
    5559
    5660
    5761
    58                                                 G4CompositeEMDataSet :: ~G4CompositeEMDataSet()
     62G4CompositeEMDataSet::~G4CompositeEMDataSet()
    5963{
    60  CleanUpComponents();
     64  CleanUpComponents();
     65  if (algorithm) delete algorithm;
     66}
    6167
    62  if (algorithm)
    63   delete algorithm;
     68
     69G4double G4CompositeEMDataSet::FindValue(G4double argEnergy, G4int argComponentId) const
     70{
     71  const G4VEMDataSet* component(GetComponent(argComponentId));
     72 
     73  if (component) return component->FindValue(argEnergy);
     74
     75  std::ostringstream message;
     76  message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found";
     77 
     78  G4Exception(message.str().c_str());
     79 
     80  return 0.;
     81}
     82
     83void G4CompositeEMDataSet::PrintData(void) const
     84{
     85  const size_t n(NumberOfComponents());
     86
     87  G4cout << "The data set has " << n << " components" << G4endl;
     88  G4cout << G4endl;
     89 
     90  size_t i(0);
     91 
     92  while (i<n)
     93    {
     94      G4cout << "--- Component " << i << " ---" << G4endl;
     95      GetComponent(i)->PrintData();
     96      i++;
     97    }
     98}
     99
     100void G4CompositeEMDataSet::SetEnergiesData(G4DataVector* argEnergies, G4DataVector* argData, G4int argComponentId)
     101{
     102  G4VEMDataSet * component(components[argComponentId]);
     103 
     104  if (component)
     105    {
     106      component->SetEnergiesData(argEnergies, argData, 0);
     107      return;
     108    }
     109
     110  std::ostringstream message;
     111  message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
     112 
     113  G4Exception(message.str().c_str());
     114}
     115
     116G4bool G4CompositeEMDataSet::LoadData(const G4String& argFileName)
     117{
     118  CleanUpComponents();
     119
     120  for (G4int z(minZ); z<maxZ; z++)
     121    {
     122      G4VEMDataSet* component = new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
     123      if (!component->LoadData(argFileName))
     124        {
     125          delete component;
     126          return false;
     127        }
     128      AddComponent(component);
     129    }
     130  return true;
    64131}
    65132
    66133
    67134
     135G4bool G4CompositeEMDataSet::SaveData(const G4String& argFileName) const
     136{
     137  for (G4int z=minZ; z<maxZ; z++)
     138    {
     139      const G4VEMDataSet* component(GetComponent(z-minZ));
     140 
     141      if (!component)
     142        {
     143          std::ostringstream message;
     144          message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found";
     145          G4Exception(message.str().c_str());
     146        }
    68147
     148      if (!component->SaveData(argFileName))
     149        return false;
     150    }
     151 
     152  return true;
     153}
    69154
    70 
    71 G4double                                        G4CompositeEMDataSet :: FindValue(G4double argEnergy, G4int argComponentId) const
     155void G4CompositeEMDataSet::CleanUpComponents(void)
    72156{
    73  const G4VEMDataSet * component(GetComponent(argComponentId));
    74  
    75  if (component)
    76   return component->FindValue(argEnergy);
    77 
    78  std::ostringstream message;
    79  message << "G4CompositeEMDataSet::FindValue - component " << argComponentId << " not found";
    80  
    81  G4Exception(message.str().c_str());
    82  
    83  return 0.;
     157  while (!components.empty())
     158    {
     159      if (components.back())
     160        delete components.back();
     161      components.pop_back();
     162    }
    84163}
    85164
    86165
    87 
    88 
    89 
    90 void                                            G4CompositeEMDataSet :: PrintData(void) const
     166G4double G4CompositeEMDataSet::RandomSelect(G4int componentId) const
    91167{
    92  const size_t n(NumberOfComponents());
    93 
    94  G4cout << "The data set has " << n << " components" << G4endl;
    95  G4cout << G4endl;
    96  
    97  size_t i(0);
    98  
    99  while (i<n)
    100  {
    101   G4cout << "--- Component " << i << " ---" << G4endl;
    102   GetComponent(i)->PrintData();
    103   i++;
    104  }
     168  G4double value = 0.;
     169  if (componentId >= 0 && componentId < (G4int)components.size())
     170    {
     171      const G4VEMDataSet* dataSet = GetComponent(componentId);
     172      value = dataSet->RandomSelect();
     173    }
     174  return value;
    105175}
    106 
    107 
    108 
    109 
    110 
    111 void                                            G4CompositeEMDataSet :: SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int argComponentId)
    112 {
    113  G4VEMDataSet * component(components[argComponentId]);
    114  
    115  if (component)
    116  {
    117   component->SetEnergiesData(argEnergies, argData, 0);
    118   return;
    119  }
    120 
    121  std::ostringstream message;
    122  message << "G4CompositeEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
    123  
    124  G4Exception(message.str().c_str());
    125 }
    126 
    127 
    128 
    129 
    130 
    131 G4bool                                          G4CompositeEMDataSet :: LoadData(const G4String & argFileName)
    132 {
    133  CleanUpComponents();
    134 
    135  for (G4int z(minZ); z<maxZ; z++)
    136  {
    137   G4VEMDataSet * component=new G4EMDataSet(z, algorithm->Clone(), unitEnergies, unitData);
    138   if (!component->LoadData(argFileName))
    139   {
    140    delete component;
    141    return false;
    142   }
    143  
    144   AddComponent(component);
    145  }
    146  
    147  return true;
    148 }
    149 
    150 
    151 
    152 G4bool                                          G4CompositeEMDataSet :: SaveData(const G4String & argFileName) const
    153 {
    154  for (G4int z(minZ); z<maxZ; z++)
    155  {
    156   const G4VEMDataSet * component(GetComponent(z-minZ));
    157  
    158   if (!component)
    159   {
    160    std::ostringstream message;
    161    message << "G4CompositeEMDataSet::SaveData - component " << (z-minZ) << " not found";
    162  
    163    G4Exception(message.str().c_str());
    164   }
    165 
    166   if (!component->SaveData(argFileName))
    167    return false;
    168  }
    169  
    170  return true;
    171 }
    172 
    173 
    174 
    175 
    176 
    177 void                                            G4CompositeEMDataSet :: CleanUpComponents(void)
    178 {
    179  while (!components.empty())
    180  {
    181   if (components.back())
    182    delete components.back();
    183 
    184   components.pop_back();
    185  }
    186 }
    187 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeDecrease.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeDecrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionChargeDecrease.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionChargeDecrease.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4Proton.hh"
    57 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
    58 #include "G4DNAGenericIonsManager.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5932
    6033G4CrossSectionChargeDecrease::G4CrossSectionChargeDecrease()
    6134{
    62   // Default energy limits (defined for protection against anomalous behaviour only)
    63   name = "ChargeDecrease";
    6435  lowEnergyLimitDefault = 1 * keV;
    6536  highEnergyLimitDefault = 10 * MeV;
     
    7647
    7748  if (protonDef != 0)
    78     {
    79       proton = protonDef->GetParticleName();
    80       lowEnergyLimit[proton] = 1. * keV;
    81       highEnergyLimit[proton] = 10. * keV;
    82     }
     49  {
     50    proton = protonDef->GetParticleName();
     51    lowEnergyLimit[proton] = 1. * keV;
     52    highEnergyLimit[proton] = 10. * MeV;
     53  }
    8354  else
    84     {
    85       G4Exception("G4CrossSectionChargeDecrease Constructor: proton is not defined");
    86     }
     55  {
     56    G4Exception("G4CrossSectionChargeDecrease Constructor: proton is not defined");
     57  }
    8758
    8859  if (alphaPlusPlusDef != 0)
    89     {
    90       alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
    91       lowEnergyLimit[alphaPlusPlus] = 1. * keV;
    92       highEnergyLimit[alphaPlusPlus] = 10. * MeV;
    93     }
     60  {
     61    alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
     62    lowEnergyLimit[alphaPlusPlus] = 1. * keV;
     63    highEnergyLimit[alphaPlusPlus] = 10. * MeV;
     64  }
    9465  else
    95     {
    96       G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlusPlus is not defined");
    97     }
     66  {
     67    G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlusPlus is not defined");
     68  }
    9869
    9970  if (alphaPlusDef != 0)
    100     {
    101       alphaPlus = alphaPlusDef->GetParticleName();
    102       lowEnergyLimit[alphaPlus] = 1. * keV;
    103       highEnergyLimit[alphaPlus] = 10. * MeV;
    104     }
     71  {
     72    alphaPlus = alphaPlusDef->GetParticleName();
     73    lowEnergyLimit[alphaPlus] = 1. * keV;
     74    highEnergyLimit[alphaPlus] = 10. * MeV;
     75  }
    10576  else
    106     {
    107       G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlus is not defined");
    108     }
     77  {
     78    G4Exception("G4CrossSectionChargeDecrease Constructor: alphaPlus is not defined");
     79  }
    10980
    11081}
    11182
     83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11284
    11385G4CrossSectionChargeDecrease::~G4CrossSectionChargeDecrease()
    11486{}
    11587 
     88//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11689
    11790G4double G4CrossSectionChargeDecrease::CrossSection(const G4Track& track)
     
    140113    G4Exception("G4CrossSectionChargeDecrease: attempting to calculate cross section for wrong particle");
    141114
    142   // Retrieve energy limits for the current particle type
    143 
    144115  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    145116  pos1 = lowEnergyLimit.find(particleName);
    146117
    147   // Lower limit
    148118  if (pos1 != lowEnergyLimit.end())
    149     {
    150       lowLim = pos1->second;
    151     }
     119  {
     120    lowLim = pos1->second;
     121  }
    152122
    153   // Upper limit
    154123  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    155124  pos2 = highEnergyLimit.find(particleName);
    156125
    157126  if (pos2 != highEnergyLimit.end())
    158     {
    159       highLim = pos2->second;
    160     }
    161 
    162   //
     127  {
     128    highLim = pos2->second;
     129  }
    163130
    164131  G4double crossSection(0.);
    165132  if (k >= lowLim && k <= highLim)
    166     {
     133  {
    167134      crossSection = partialCrossSection.Sum(k,particleDefinition);
    168     }
     135  }
    169136 
    170137  return crossSection;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeDecreasePartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeDecreasePartial.cc,v 1.1 2007/11/08 18:25:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 // 08 Nov 2007  MGP               Got code from S.I.; added variable initialisation to avoid compilation warnings
    40 //
    41 // -------------------------------------------------------------------
    42 
    43 // Class description:
    44 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    45 // Reference: TNS Geant4-DNA paper
    46 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    47 // design foundation and implementation of the first set of models,
    48 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    49 // Further documentation available from http://www.ge.infn.it/geant4/dna
    50 
    51 // -------------------------------------------------------------------
    52 
     26// $Id: G4CrossSectionChargeDecreasePartial.cc,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5328
    5429#include "G4CrossSectionChargeDecreasePartial.hh"
    55 #include "G4ParticleDefinition.hh"
    56 #include "G4Proton.hh"
    57 #include "G4DNAGenericIonsManager.hh"
    58 
    59 #include "Randomize.hh"
    60 
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6132
    6233G4CrossSectionChargeDecreasePartial::G4CrossSectionChargeDecreasePartial()
     
    11687}
    11788
     89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     90
    11891G4CrossSectionChargeDecreasePartial::~G4CrossSectionChargeDecreasePartial()
    119 { }
    120  
     92{}
     93 
     94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     95
    12196G4double G4CrossSectionChargeDecreasePartial::CrossSection(G4double k, G4int index,
    12297                                                           const G4ParticleDefinition* particleDefinition)
     
    149124 
    150125  if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex])
    151     {
     126  {
    152127      //
    153128      // if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
     
    163138        + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex]
    164139                                                                                 - x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
    165     }
     140  }
    166141
    167142  G4double x(std::log10(k/eV));
     
    197172 
    198173  while (i>0)
    199     {
     174  {
    200175      i--;
    201176      values[i]=CrossSection(k, i, particleDefinition);
    202177      value+=values[i];
    203     }
     178  }
    204179 
    205180  value*=G4UniformRand();
     
    207182  i=n;
    208183  while (i>0)
    209     {
     184  {
    210185      i--;
    211186   
     
    214189 
    215190      value-=values[i];
    216     }
     191  }
    217192 
    218193  delete[] values;
     
    220195  return i;
    221196}
     197
     198//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    222199
    223200G4double G4CrossSectionChargeDecreasePartial::Sum(G4double k, const G4ParticleDefinition* particleDefinition)
     
    234211
    235212  for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++)
    236     {
    237       totalCrossSection += CrossSection(k,i,particleDefinition);
    238     }
     213  {
     214    totalCrossSection += CrossSection(k,i,particleDefinition);
     215  }
    239216  return totalCrossSection;
    240217}
    241 
    242 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeIncrease.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeIncrease.cc,v 1.3 2007/12/10 16:31:21 gunter Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionChargeIncrease.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionChargeIncrease.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4ParticleDefinition.hh"
    57 #include "G4DNAGenericIonsManager.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5832
    5933G4CrossSectionChargeIncrease::G4CrossSectionChargeIncrease()
    6034{
    61   // Default energy limits (defined for protection against anomalous behaviour only)
    62   name = "ChargeIncrease";
    6335  lowEnergyLimitDefault = 1 * keV;
    6436  highEnergyLimitDefault = 10 * MeV;
     
    7547
    7648  if (hydrogenDef != 0)
    77     {
    78       hydrogen = hydrogenDef->GetParticleName();
    79       lowEnergyLimit[hydrogen] = 1. * keV;
    80       highEnergyLimit[hydrogen] = 10. * MeV;
    81     }
     49  {
     50    hydrogen = hydrogenDef->GetParticleName();
     51    lowEnergyLimit[hydrogen] = 1. * keV;
     52    highEnergyLimit[hydrogen] = 10. * MeV;
     53  }
    8254  else
    83     {
    84       G4Exception("G4CrossSectionChargeIncrease Constructor: hydrogen is not defined");
    85     }
     55  {
     56    G4Exception("G4CrossSectionChargeIncrease Constructor: hydrogen is not defined");
     57  }
    8658
    8759  if (alphaPlusDef != 0)
    88     {
    89       alphaPlus = alphaPlusDef->GetParticleName();
    90       lowEnergyLimit[alphaPlus] = 1. * keV;
    91       highEnergyLimit[alphaPlus] = 10. * MeV;
    92     }
     60  {
     61    alphaPlus = alphaPlusDef->GetParticleName();
     62    lowEnergyLimit[alphaPlus] = 1. * keV;
     63    highEnergyLimit[alphaPlus] = 10. * MeV;
     64  }
    9365  else
    94     {
    95       G4Exception("G4CrossSectionChargeIncrease Constructor: alphaPlus is not defined");
    96     }
     66  {
     67    G4Exception("G4CrossSectionChargeIncrease Constructor: alphaPlus is not defined");
     68  }
    9769
    9870  if (heliumDef != 0)
    99     {
    100       helium = heliumDef->GetParticleName();
    101       lowEnergyLimit[helium] = 1. * keV;
    102       highEnergyLimit[helium] = 10. * MeV;
    103     }
     71  {
     72    helium = heliumDef->GetParticleName();
     73    lowEnergyLimit[helium] = 1. * keV;
     74    highEnergyLimit[helium] = 10. * MeV;
     75  }
    10476  else
    105     {
    106       G4Exception("G4CrossSectionChargeIncrease Constructor: helium is not defined");
    107     }
     77  {
     78    G4Exception("G4CrossSectionChargeIncrease Constructor: helium is not defined");
     79  }
    10880
    10981}
    11082
     83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11184
    11285G4CrossSectionChargeIncrease::~G4CrossSectionChargeIncrease()
    11386{}
    11487 
     88//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11589
    11690G4double G4CrossSectionChargeIncrease::CrossSection(const G4Track& track)
     
    139113    G4Exception("G4CrossSectionChargeIncrease: attempting to calculate cross section for wrong particle");
    140114
    141 
    142   // Retrieve energy limits for the current particle type
    143 
    144115  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    145116  pos1 = lowEnergyLimit.find(particleName);
    146117
    147   // Lower limit
    148118  if (pos1 != lowEnergyLimit.end())
    149     {
    150       lowLim = pos1->second;
    151     }
     119  {
     120    lowLim = pos1->second;
     121  }
    152122
    153   // Upper limit
    154123  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    155124  pos2 = highEnergyLimit.find(particleName);
    156125
    157126  if (pos2 != highEnergyLimit.end())
    158     {
    159       highLim = pos2->second;
    160     }
     127  {
     128    highLim = pos2->second;
     129  }
    161130
    162131  G4double totalCrossSection = 0.;
    163132
    164133  if (k >= lowLim && k <= highLim)
    165     {
     134  {
    166135      //HYDROGEN
    167136      if (particleDefinition == instance->GetIon("hydrogen"))
    168         {
     137      {
    169138          const  G4double aa = 2.835;
    170139          const  G4double bb = 0.310;
     
    180149          G4double sigmah = temp * (aa * std::log(1.0 + x) + bb) / x;
    181150          totalCrossSection = 1.0/(1.0/sigmal + 1.0/sigmah) *m*m;
    182         }
     151      }
    183152      else
    184         {
     153      {
    185154          totalCrossSection = partialCrossSection.Sum(k,particleDefinition);
    186         }
    187     }
     155      }
     156  }
    188157 
    189158  return totalCrossSection;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionChargeIncreasePartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionChargeIncreasePartial.cc,v 1.1 2007/11/08 18:25:25 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionChargeIncreasePartial.cc,v 1.2 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionChargeIncreasePartial.hh"
    54 #include "G4DynamicParticle.hh"
    55 #include "G4ParticleDefinition.hh"
    56 #include "G4Proton.hh"
    57 #include "G4DNAGenericIonsManager.hh"
    58 
    59 #include "Randomize.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6032
    6133G4CrossSectionChargeIncreasePartial::G4CrossSectionChargeIncreasePartial()
    6234{
    63 
    6435  //ALPHA+
     36
    6537  f0[0][0]=1.;
    6638  a0[0][0]=2.25;
     
    10173
    10274  numberOfPartialCrossSections[1]=2;
    103 
    104 }
     75}
     76
     77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    10578
    10679G4CrossSectionChargeIncreasePartial::~G4CrossSectionChargeIncreasePartial()
    107 { }
     80{}
    10881 
     82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     83
    10984G4double G4CrossSectionChargeIncreasePartial::CrossSection(G4double k, G4int index,
    11085                                                           const G4ParticleDefinition* particleDefinition)
     
    137112 
    138113  if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex])
    139     {
     114  {
    140115      //
    141116      // if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
     
    148123      x1[index][particleTypeIndex]=x0[index][particleTypeIndex] + std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) / (c0[index][particleTypeIndex] * d0[index][particleTypeIndex]), 1. / (d0[index][particleTypeIndex] - 1.));
    149124      b1[index][particleTypeIndex]=(a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) * x1[index][particleTypeIndex] + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex] - x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
    150     }
     125  }
    151126
    152127  G4double x(std::log10(k/eV));
     
    161136
    162137  return f0[index][particleTypeIndex] * std::pow(10., y)*m*m;
    163 
    164  
    165 }
     138 
     139}
     140
     141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    166142
    167143G4int G4CrossSectionChargeIncreasePartial::RandomSelect(G4double k,
     
    183159 
    184160  while (i>0)
    185     {
     161  {
    186162      i--;
    187163      values[i]=CrossSection(k, i, particleDefinition);
    188164      value+=values[i];
    189     }
     165  }
    190166 
    191167  value*=G4UniformRand();
     
    193169  i=n;
    194170  while (i>0)
    195     {
     171  {
    196172      i--;
    197173   
     
    200176 
    201177      value-=values[i];
    202     }
     178  }
    203179 
    204180  delete[] values;
     
    206182  return i;
    207183}
     184
     185//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    208186
    209187G4double G4CrossSectionChargeIncreasePartial::Sum(G4double k, const G4ParticleDefinition* particleDefinition)
     
    219197
    220198  for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++)
    221     {
    222       totalCrossSection += CrossSection(k,i,particleDefinition);
    223     }
     199  {
     200    totalCrossSection += CrossSection(k,i,particleDefinition);
     201  }
    224202  return totalCrossSection;
    225203}
    226204
    227 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionElasticScreenedRutherford.cc

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionElasticScreenedRutherford.cc,v 1.1 2007/10/12 23:11:41 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationBorn.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationBorn.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationBorn.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationBorn.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4ParticleDefinition.hh"
    57 #include "G4Electron.hh"
    58 #include "G4LogLogInterpolation.hh"
    5930
    60 #include "Randomize.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6132
    6233G4CrossSectionExcitationBorn::G4CrossSectionExcitationBorn()
    6334{
    64 
    65   // ---- MGP ---- Limits to be checked: current values are just temporary for testing purpose
    66   name = "ExcitationBorn";
    67   lowEnergyLimit = 1. * keV;
     35  lowEnergyLimit = 500. * keV;
    6836  highEnergyLimit = 10 * MeV;
    69 
    7037  table = 0;
    7138}
    7239
     40//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7341
    7442G4CrossSectionExcitationBorn::~G4CrossSectionExcitationBorn()
     
    7745}
    7846 
     47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     48
    7949G4double G4CrossSectionExcitationBorn::CrossSection(const G4Track& track)
    8050{
    81   // Lazy initialisation: load cross section tables in memory the first time access to them is required
    82  
     51
    8352  G4double sigma = 0.;
    8453
    8554  if (table == 0)
    86     {
    87       // Load tables
    88       // ---- MGP ----
    89       table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m );
    90       table->LoadData("dna/sigma_excitation_p_born");
    91      
    92       // ---- MGP ---- Temporary
    93       table->PrintData();
    94     }
     55  {
     56    table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m );
     57    table->LoadData("dna/sigma_excitation_p_born");
     58  }
    9559
    9660  const G4DynamicParticle* particle = track.GetDynamicParticle();
    9761  G4double k = particle->GetKineticEnergy();
    9862
    99   if (k > lowEnergyLimit && k < highEnergyLimit)
    100     {
    101       sigma = table->FindValue(k); // no electron interaction ---- MGP ---- What does this mean?
    102     }
     63  if (k >= lowEnergyLimit && k <= highEnergyLimit)
     64  {
     65    sigma = table->FindValue(k);
     66  }
    10367  return sigma;
    10468}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationBornPartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationBornPartial.cc,v 1.1 2007/10/15 08:57:54 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationBornPartial.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationBornPartial.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4ParticleDefinition.hh"
    57 #include "G4Electron.hh"
    58 #include "G4LogLogInterpolation.hh"
    5930
    60 #include "Randomize.hh"
    61 
    62 #include <deque>
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4CrossSectionExcitationBornPartial::G4CrossSectionExcitationBornPartial()
    6534{
    6635  table = 0;
    67   // nLevels = waterExcitation.NumberOfLevels();
    6836}
    6937
     38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7039
    7140G4CrossSectionExcitationBornPartial::~G4CrossSectionExcitationBornPartial()
     
    7443}
    7544
     45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7646
    7747G4int G4CrossSectionExcitationBornPartial::RandomSelect(G4double k)
    7848{   
    79   // Lazy initialisation: load cross section tables in memory the first time access to them is required
    80  
    8149  G4int level = 0;
    8250
    8351  if (table == 0)
    84     {
    85       // Load tables
    86       // ---- MGP ----
    87       table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m );
    88       table->LoadData("dna/sigma_excitation_p_born");
    89      
    90       // ---- MGP ---- Temporary
    91       table->PrintData();
    92     }
     52  {
     53    table = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,(1e-22/3.343)*m*m );
     54    table->LoadData("dna/sigma_excitation_p_born");
     55  }
    9356
    9457  G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
     
    9962 
    10063  while (i>0)
    101     {
    102       i--;
    103       valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
    104       value += valuesBuffer[i];
    105     }
     64  {
     65    i--;
     66    valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
     67    value += valuesBuffer[i];
     68  }
    10669 
    10770  value *= G4UniformRand();
     
    11073 
    11174  while (i > 0)
     75  {
     76    i--;
     77     
     78    if (valuesBuffer[i] > value)
    11279    {
    113       i--;
    114      
    115       if (valuesBuffer[i] > value)
    116         {
    117           delete[] valuesBuffer;
    118           return i;
    119         }
     80      delete[] valuesBuffer;
     81      return i;
     82    }
    12083      value -= valuesBuffer[i];
    121     }
     84  }
    12285
    123   // It should never end up here
    124 
    125   // ---- MGP ---- Is the following line really necessary? 
    12686  if (valuesBuffer) delete[] valuesBuffer;
    12787
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationEmfietzoglou.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationEmfietzoglou.cc,v 1.2 2007/10/15 08:36:35 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationEmfietzoglou.cc,v 1.5 2008/12/05 11:58:16 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationEmfietzoglou.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5632
    5733G4CrossSectionExcitationEmfietzoglou::G4CrossSectionExcitationEmfietzoglou()
    5834{
    59 
    60   name = "CrossSectionExcitationEmfietzoglou";
    61   lowEnergyLimit = 7.4 * eV;
     35  lowEnergyLimit = 8.23 * eV;
    6236  highEnergyLimit = 10. * MeV;
    6337}
    6438
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6540
    6641G4CrossSectionExcitationEmfietzoglou::~G4CrossSectionExcitationEmfietzoglou()
    67 { }
     42{}
    6843 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6945
    7046G4double G4CrossSectionExcitationEmfietzoglou::CrossSection(const G4Track& track)
     
    7349  G4double k = particle->GetKineticEnergy();
    7450
    75   // Cross section = 0 outside the energy validity limits set in the constructor
    76   // ---- MGP ---- Better handling of these limits to be set in a following design iteration
    77 
    7851  G4double sigma = 0.;
    7952
    80   if (k > lowEnergyLimit && k < highEnergyLimit) sigma = partialCrossSection.Sum(k);
     53  if (k >= lowEnergyLimit && k <= highEnergyLimit) sigma = partialCrossSection.Sum(k);
    8154
    8255  return sigma;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationEmfietzoglouPartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationEmfietzoglouPartial.cc,v 1.2 2007/12/10 16:31:26 gunter Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationEmfietzoglouPartial.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4ParticleDefinition.hh"
    57 #include "G4Electron.hh"
    5830
    59 #include "Randomize.hh"
    60 
    61 #include <deque>
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6232
    6333G4CrossSectionExcitationEmfietzoglouPartial::G4CrossSectionExcitationEmfietzoglouPartial()
    6434{
    65 
    6635  nLevels = waterExcitation.NumberOfLevels();
    67   //G4cout << "Water excitation energy: number of levels = " << nLevels << G4endl;
    6836}
    6937
     38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7039
    7140G4CrossSectionExcitationEmfietzoglouPartial::~G4CrossSectionExcitationEmfietzoglouPartial()
    72 { }
     41{}
    7342 
     43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     44
    7445G4double G4CrossSectionExcitationEmfietzoglouPartial::CrossSection(G4double t, G4int level)
    7546{
     
    8455  // Aj, Bj, Cj & Pj are parameters that can be found in Emfietzoglou's papers
    8556  //
    86   //
    8757  // From Phys. Med. Biol. 48 (2003) 2355-2371, D.Emfietzoglou,
    8858  // Monte Carlo Simulation of the energy loss of low energy electrons in liquid Water
    89  
     59  //
    9060  // Scaling for macroscopic cross section: number of water moleculs per unit volume
    91   // (capra) const G4double sigma0 = (10. / 3.343e22) * cm2;
     61  // const G4double sigma0 = (10. / 3.343e22) * cm2;
     62
    9263  const G4double density = 3.34192e+19 * mm3;
    9364
     
    10071 
    10172  G4double exc = waterExcitation.ExcitationEnergy(level);
    102   // G4cout << "Water excitation energy " << exc/keV << " level = " << level << G4endl;
    103 
     73 
    10474  if (t >= exc)
    10575    {
     
    11383}
    11484
     85//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     86
    11587G4int G4CrossSectionExcitationEmfietzoglouPartial::RandomSelect(G4double k)
    11688{
     
    11991  std::deque<double> values;
    12092 
    121   // ---- MGP ---- The following algorithm is wrong: it works is the cross section
     93  // ---- MGP ---- The following algorithm is wrong: it works if the cross section
    12294  // is a monotone increasing function.
    12395  // The algorithm should be corrected by building the cumulative function
     
    12698
    12799  while (i > 0)
    128     {
    129       i--;
    130       G4double partial = CrossSection(k,i);
    131       values.push_front(partial);
    132       value += partial;
    133     }
     100  {
     101    i--;
     102    G4double partial = CrossSection(k,i);
     103    values.push_front(partial);
     104    value += partial;
     105  }
    134106
    135     value *= G4UniformRand();
     107  value *= G4UniformRand();
    136108   
    137     i = nLevels;
     109  i = nLevels;
    138110
    139     while (i > 0)
    140       {
    141         i--;
    142         if (values[i] > value) return i;
    143         value -= values[i];
    144       }
     111  while (i > 0)
     112  {
     113    i--;
     114    if (values[i] > value) return i;
     115    value -= values[i];
     116  }
    145117   
    146     return 0;
     118  return 0;
    147119}
     120
     121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    148122
    149123G4double G4CrossSectionExcitationEmfietzoglouPartial::Sum(G4double k)
     
    152126
    153127  for (G4int i=0; i<nLevels; i++)
    154     {
    155       totalCrossSection += CrossSection(k,i);
    156     }
     128  {
     129    totalCrossSection += CrossSection(k,i);
     130  }
    157131  return totalCrossSection;
    158132}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationMillerGreen.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationMillerGreen.cc,v 1.3 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationMillerGreen.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationMillerGreen.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4Proton.hh"
    57 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
    58 #include "G4DNAGenericIonsManager.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5932
    6033G4CrossSectionExcitationMillerGreen::G4CrossSectionExcitationMillerGreen()
    6134{
    62   // Default energy limits (defined for protection against anomalous behaviour only)
    63   name = "ExcitationMillerGreen";
    6435  lowEnergyLimitDefault = 10 * eV;
    6536  highEnergyLimitDefault = 10 * MeV;
     
    7849
    7950  if (protonDef != 0)
    80     {
    81       proton = protonDef->GetParticleName();
    82       lowEnergyLimit[proton] = 10. * eV;
    83       highEnergyLimit[proton] = 500. * keV;
    84     }
     51  {
     52    proton = protonDef->GetParticleName();
     53    lowEnergyLimit[proton] = 10. * eV;
     54    highEnergyLimit[proton] = 500. * keV;
     55  }
    8556  else
    86     {
    87       G4Exception("G4CrossSectionExcitationMillerGreen Constructor: proton is not defined");
    88     }
     57  {
     58    G4Exception("G4CrossSectionExcitationMillerGreen Constructor: proton is not defined");
     59  }
    8960
    9061  if (alphaPlusPlusDef != 0)
    91     {
    92       alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
    93       lowEnergyLimit[alphaPlusPlus] = 1. * keV;
    94       highEnergyLimit[alphaPlusPlus] = 10. * MeV;
    95     }
     62  {
     63    alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
     64    lowEnergyLimit[alphaPlusPlus] = 1. * keV;
     65    highEnergyLimit[alphaPlusPlus] = 10. * MeV;
     66  }
    9667  else
    97     {
     68  {
    9869      G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlusPlus is not defined");
    99     }
     70  }
    10071
    10172  if (alphaPlusDef != 0)
    102     {
    103       alphaPlus = alphaPlusDef->GetParticleName();
    104       lowEnergyLimit[alphaPlus] = 1. * keV;
    105       highEnergyLimit[alphaPlus] = 10. * MeV;
    106     }
     73  {
     74    alphaPlus = alphaPlusDef->GetParticleName();
     75    lowEnergyLimit[alphaPlus] = 1. * keV;
     76    highEnergyLimit[alphaPlus] = 10. * MeV;
     77  }
    10778  else
    108     {
    109       G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlus is not defined");
    110     }
     79  {
     80    G4Exception("G4CrossSectionExcitationMillerGreen Constructor: alphaPlus is not defined");
     81  }
    11182
    11283  if (heliumDef != 0)
    113     {
    114       helium = heliumDef->GetParticleName();
    115       lowEnergyLimit[helium] = 1. * keV;
    116       highEnergyLimit[helium] = 10. * MeV;
    117     }
     84  {
     85    helium = heliumDef->GetParticleName();
     86    lowEnergyLimit[helium] = 1. * keV;
     87    highEnergyLimit[helium] = 10. * MeV;
     88  }
    11889  else
    119     {
    120       G4Exception("G4CrossSectionExcitationMillerGreen Constructor: helium is not defined");
    121     }
    122  
    123  
     90  {
     91    G4Exception("G4CrossSectionExcitationMillerGreen Constructor: helium is not defined");
     92  }
     93   
    12494}
    12595
     96//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    12697
    12798G4CrossSectionExcitationMillerGreen::~G4CrossSectionExcitationMillerGreen()
    12899{}
    129100 
     101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    130102
    131103G4double G4CrossSectionExcitationMillerGreen::CrossSection(const G4Track& track)
     
    154126  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    155127
    156   // Retrieve energy limits for the current particle type
    157 
    158128  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    159129  pos1 = lowEnergyLimit.find(particleName);
    160130
    161   // Lower limit
    162131  if (pos1 != lowEnergyLimit.end())
    163     {
    164       lowLim = pos1->second;
    165     }
     132  {
     133    lowLim = pos1->second;
     134  }
    166135
    167   // Upper limit
    168136  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    169137  pos2 = highEnergyLimit.find(particleName);
    170138
    171139  if (pos2 != highEnergyLimit.end())
    172     {
    173       highLim = pos2->second;
    174     }
     140  {
     141    highLim = pos2->second;
     142  }
    175143
    176   //
    177144  const G4ParticleDefinition* particleDefinition = track.GetDefinition();
    178145
     
    180147 
    181148  if (k >= lowLim && k <= highLim)
     149  {
     150    crossSection = partialCrossSection.Sum(k,particleDefinition);
     151    G4DNAGenericIonsManager *instance;
     152    instance = G4DNAGenericIonsManager::Instance();
     153
     154    // add ONE or TWO electron-water excitation for alpha+ and helium
     155 
     156    if ( particleDefinition == instance->GetIon("alpha+")
     157         ||
     158         particleDefinition == instance->GetIon("helium")
     159       )
    182160    {
    183  
    184       crossSection = partialCrossSection.Sum(k,particleDefinition);
    185       G4DNAGenericIonsManager *instance;
    186       instance = G4DNAGenericIonsManager::Instance();
    187 
    188       // add ONE or TWO electron-water excitation for alpha+ and helium
    189  
    190       if ( particleDefinition == instance->GetIon("alpha+")
    191            ||
    192            particleDefinition == instance->GetIon("helium")
    193            )
    194         {
    195161          G4CrossSectionExcitationEmfietzoglouPartial * excitationXS =
    196162            new G4CrossSectionExcitationEmfietzoglouPartial();
     163
    197164          G4double sigmaExcitation=0;
    198165          if (k*0.511/3728 > 7.4*eV && k*0.511/3728 < 10*keV) sigmaExcitation = excitationXS->Sum(k*0.511/3728);
     
    200167          if ( particleDefinition == instance->GetIon("alpha+") )
    201168            crossSection = crossSection +  sigmaExcitation ;
     169         
    202170          if ( particleDefinition == instance->GetIon("helium") )
    203171            crossSection = crossSection + 2*sigmaExcitation ;
     172         
    204173          delete excitationXS;
    205         }     
    206     }
     174    }     
     175  }
    207176     
    208177  return crossSection;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionExcitationMillerGreenPartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionExcitationMillerGreenPartial.cc,v 1.1 2007/11/08 19:57:23 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionExcitationMillerGreenPartial.cc,v 1.3 2009/01/20 07:40:53 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionExcitationMillerGreenPartial.hh"
    54 #include "G4Track.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "G4ParticleDefinition.hh"
    57 #include "G4Proton.hh"
    58 #include "G4DNAGenericIonsManager.hh"
    59 #include "G4CrossSectionExcitationEmfietzoglouPartial.hh"
    60 #include "Randomize.hh"
    61 #include <deque>
    62 
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4CrossSectionExcitationMillerGreenPartial::G4CrossSectionExcitationMillerGreenPartial()
    6534{
    66 
    6735  nLevels = waterExcitation.NumberOfLevels();
    68   //G4cout << "Water excitation energy: number of levels = " << nLevels << G4endl;
    6936 
    7037  //PROTON
     
    10673}
    10774
     75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     76
    10877G4CrossSectionExcitationMillerGreenPartial::~G4CrossSectionExcitationMillerGreenPartial()
    109 { }
    110  
     78{}
     79 
     80//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     81
    11182G4double G4CrossSectionExcitationMillerGreenPartial::CrossSection(G4double k, G4int excitationLevel,
    11283                                                                  const G4ParticleDefinition* particleDefinition)
     
    144115  tCorrected = k * kineticEnergyCorrection[particleTypeIndex];
    145116
    146   // Assume that the material is water; proper algorithm to calculate correctly for any material to be inserted here
     117  // SI - added protection
     118  if (tCorrected < waterExcitation.ExcitationEnergy(excitationLevel)) return 0;
     119  //
     120 
    147121  G4int z = 10;
    148122
     
    168142}
    169143
     144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     145
    170146G4int G4CrossSectionExcitationMillerGreenPartial::RandomSelect(G4double k,
    171147                                                               const G4ParticleDefinition* particle)
     
    175151  std::deque<double> values;
    176152 
    177   // ---- MGP ---- The following algorithm is wrong: it works is the cross section
     153  // ---- MGP ---- The following algorithm is wrong: it works if the cross section
    178154  // is a monotone increasing function.
    179155  // The algorithm should be corrected by building the cumulative function
     
    186162  // ELECTRON CORRECTION
    187163 
    188   if ( particle == instance->GetIon("alpha++"))
    189     {  while (i > 0)
    190       {
     164  if ( particle == instance->GetIon("alpha++")||
     165       particle == G4Proton::ProtonDefinition())
     166       
     167  {  while (i > 0)
     168     {
    191169        i--;
    192170        G4double partial = CrossSection(k,i,particle);
    193171        values.push_front(partial);
    194172        value += partial;
    195       }
    196 
    197     value *= G4UniformRand();
     173     }
     174
     175     value *= G4UniformRand();
    198176   
    199     i = nLevels;
    200 
    201     while (i > 0)
    202       {
     177     i = nLevels;
     178
     179     while (i > 0)
     180     {
    203181        i--;
    204182        if (values[i] > value) return i;
    205183        value -= values[i];
    206       }
    207     }
    208 
    209   //
     184     }
     185  }
     186
    210187  // add ONE or TWO electron-water excitation for alpha+ and helium
    211188   
     
    213190       ||
    214191       particle == instance->GetIon("helium")
    215        )
     192     )
     193  {
     194    while (i>0)
    216195    {
    217 
    218       while (i>0)
    219         {
    220196          i--;
    221197         
     
    232208          value += partial;
    233209          delete excitationXS;
    234         }
    235  
    236       value*=G4UniformRand();
    237  
    238       i=5;
    239       while (i>0)
    240         {
     210    }
     211 
     212    value*=G4UniformRand();
     213 
     214    i=5;
     215    while (i>0)
     216    {
    241217          i--;
    242218   
     
    244220 
    245221          value-=values[i];
    246         }
    247     }   
     222    }
     223  }   
    248224  //   
     225
    249226  return 0;
    250227}
    251228
     229//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     230
    252231G4double G4CrossSectionExcitationMillerGreenPartial::Sum(G4double k, const G4ParticleDefinition* particle)
    253232{
     
    255234
    256235  for (G4int i=0; i<nLevels; i++)
    257     {
    258       totalCrossSection += CrossSection(k,i,particle);
    259     }
     236  {
     237    totalCrossSection += CrossSection(k,i,particle);
     238  }
    260239  return totalCrossSection;
    261240}
    262241
     242//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    263243
    264244G4double G4CrossSectionExcitationMillerGreenPartial::S_1s(G4double t,
     
    277257
    278258
     259//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     260
    279261G4double G4CrossSectionExcitationMillerGreenPartial::S_2s(G4double t,
    280262                                                          G4double energyTransferred,
     
    292274}
    293275
     276//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    294277
    295278G4double G4CrossSectionExcitationMillerGreenPartial::S_2p(G4double t,
     
    307290}
    308291
     292//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    309293
    310294G4double G4CrossSectionExcitationMillerGreenPartial::R(G4double t,
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionHandler.cc

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionHandler.cc,v 1.18 2006/06/29 19:38:48 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBorn.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationBorn.cc,v 1.2 2007/11/08 18:51:34 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionIonisationBorn.cc,v 1.4 2008/08/20 14:51:48 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionIonisationBorn.hh"
    54 #include "G4ParticleDefinition.hh"
    55 #include "G4Electron.hh"
    56 #include "G4Proton.hh"
    57 #include "G4Track.hh"
    58 #include "G4LogLogInterpolation.hh"
    59 #include "G4SystemOfUnits.hh"
    6030
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6132
    6233G4CrossSectionIonisationBorn::G4CrossSectionIonisationBorn()
    6334{
    64 
    65   name = "IonisationBorn";
    66  
    67   // Default energy limits (defined for protection against anomalous behaviour only)
    68   lowEnergyLimitDefault = 25 * eV;
     35  lowEnergyLimitDefault = 12.61 * eV; // SI: i/o 25 eV
    6936  highEnergyLimitDefault = 30 * keV;
    7037
     
    7845  G4String proton;
    7946 
    80   // Factor to scale microscopic/macroscopic cross section data in water
    81   // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation
    8247  G4double scaleFactor = (1.e-22 / 3.343) * m*m;
    8348
     49  if (electronDef != 0)
     50  {
     51    electron = electronDef->GetParticleName();
     52    tableFile[electron] = fileElectron;
    8453
    85   // Data members for electrons
     54    lowEnergyLimit[electron] = 12.61 * eV; // SI: i/o 25 eV
     55    highEnergyLimit[electron] = 30. * keV;
    8656
    87   if (electronDef != 0)
    88     {
    89       electron = electronDef->GetParticleName();
    90       tableFile[electron] = fileElectron;
    91 
    92       // Energy limits
    93       lowEnergyLimit[electron] = 25. * eV;
    94       highEnergyLimit[electron] = 30. * keV;
    95 
    96       // Create data set with electron cross section data and load values stored in file
    97       G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    98       tableE->LoadData(fileElectron);
     57    G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     58    tableE->LoadData(fileElectron);
    9959     
    100       // Insert key-table pair in map
    101       tableData[electron] = tableE;
    102     }
     60    tableData[electron] = tableE;
     61  }
    10362  else
    104     {
    105       G4Exception("G4CrossSectionIonisationBorn Constructor: electron is not defined");
    106     }
    107 
    108   // Data members for protons
     63  {
     64    G4Exception("G4CrossSectionIonisationBorn Constructor: electron is not defined");
     65  }
    10966
    11067  if (protonDef != 0)
    111     {
    112       proton = protonDef->GetParticleName();
    113       tableFile[proton] = fileProton;
     68  {
     69    proton = protonDef->GetParticleName();
     70    tableFile[proton] = fileProton;
    11471
    115       // Energy limits
    116       lowEnergyLimit[proton] = 500. * keV;
    117       highEnergyLimit[proton] = 10. * MeV;
     72    lowEnergyLimit[proton] = 500. * keV;
     73    highEnergyLimit[proton] = 10. * MeV;
    11874
    119       // Create data set with proton cross section data and load values stored in file
    120       G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    121       tableP->LoadData(fileProton);
     75    G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     76    tableP->LoadData(fileProton);
    12277     
    123       // Insert key-table pair in map
    124       tableData[proton] = tableP;
    125     }
     78    tableData[proton] = tableP;
     79  }
    12680  else
    127     {
    128       G4Exception("G4CrossSectionIonisationBorn Constructor: proton is not defined");
    129     }
     81  {
     82    G4Exception("G4CrossSectionIonisationBorn Constructor: proton is not defined");
     83  }
    13084}
    13185
     86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    13287
    13388G4CrossSectionIonisationBorn::~G4CrossSectionIonisationBorn()
    13489{
    135    // Destroy the content of the map
    13690  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    13791  for (pos = tableData.begin(); pos != tableData.end(); ++pos)
    138     {
    139       G4DNACrossSectionDataSet* table = pos->second;
    140       delete table;
    141     }
     92  {
     93    G4DNACrossSectionDataSet* table = pos->second;
     94    delete table;
     95  }
    14296}
    14397
    144 
     98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    14599
    146100G4double G4CrossSectionIonisationBorn::CrossSection(const G4Track& track )
     
    149103  G4double k = particle->GetKineticEnergy();
    150104 
    151   // Cross section = 0 outside the energy validity limits set in the constructor
    152105  G4double sigma = 0.;
    153106
    154   // ---- MGP ---- Better handling of these limits to be set in a following design iteration
    155107  G4double lowLim = lowEnergyLimitDefault;
    156108  G4double highLim = highEnergyLimitDefault;
     
    158110  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    159111
    160   // Retrieve energy limits for the current particle type
     112  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
     113  pos1 = lowEnergyLimit.find(particleName);
    161114
    162     std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    163     pos1 = lowEnergyLimit.find(particleName);
     115  if (pos1 != lowEnergyLimit.end())
     116  {
     117    lowLim = pos1->second;
     118  }
    164119
    165     // Lower limit
    166     if (pos1 != lowEnergyLimit.end())
     120  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
     121  pos2 = highEnergyLimit.find(particleName);
     122
     123  if (pos2 != highEnergyLimit.end())
     124  {
     125    highLim = pos2->second;
     126  }
     127
     128  if (k > lowLim && k < highLim)
     129  {
     130    std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
     131    pos = tableData.find(particleName);
     132       
     133    if (pos != tableData.end())
     134    {
     135      G4DNACrossSectionDataSet* table = pos->second;
     136      if (table != 0)
    167137      {
    168         lowLim = pos1->second;
     138        sigma = table->FindValue(k);
    169139      }
     140    }
     141    else
     142    {
     143      G4Exception("G4CrossSectionIonisationBorn: attempting to calculate cross section for wrong particle");
     144    }
     145  }
    170146
    171     // Upper limit
    172     std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    173     pos2 = highEnergyLimit.find(particleName);
    174 
    175     if (pos2 != highEnergyLimit.end())
    176       {
    177         highLim = pos2->second;
    178       }
    179 
    180     // Verify that the current track is within the energy limits of validity of the cross section model
    181     if (k > lowLim && k < highLim)
    182       {
    183         std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    184         pos = tableData.find(particleName);
    185        
    186         if (pos != tableData.end())
    187           {
    188             G4DNACrossSectionDataSet* table = pos->second;
    189             if (table != 0)
    190               {
    191                 // Cross section
    192                 sigma = table->FindValue(k);
    193               }
    194           }
    195         else
    196           {
    197             // The track does not corresponds to a particle pertinent to this model
    198             G4Exception("G4CrossSectionIonisationBorn: attempting to calculate cross section for wrong particle");
    199           }
    200       }
    201 
    202     return sigma;
     147  return sigma;
    203148}
    204149
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornElectron.cc

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionIonisationBornElectron.cc,v 1.2 2007/11/08 18:51:34 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornPartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationBornPartial.cc,v 1.3 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionIonisationBornPartial.cc,v 1.5 2009/01/20 07:40:53 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionIonisationBornPartial.hh"
    54 #include "G4ParticleDefinition.hh"
    55 #include "G4Electron.hh"
    56 #include "G4Proton.hh"
    57 #include "G4Track.hh"
    58 #include "G4LogLogInterpolation.hh"
    59 #include "G4SystemOfUnits.hh"
    60 
    61 #include "Randomize.hh"
    62 
    63 #include <utility>
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6432
    6533G4CrossSectionIonisationBornPartial::G4CrossSectionIonisationBornPartial()
    6634{
    67 
    68   name = "IonisationBorn";
    69  
    70   // Default energy limits (defined for protection against anomalous behaviour only)
    71   name = "IonisationBornPartial";
    72   lowEnergyLimitDefault = 25 * eV;
     35  lowEnergyLimitDefault = 12.61 * eV;
    7336  highEnergyLimitDefault = 30 * keV;
    7437
     
    8245  G4String proton;
    8346 
    84   // Factor to scale microscopic/macroscopic cross section data in water
    85   // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation
    8647  G4double scaleFactor = (1.e-22 / 3.343) * m*m;
    8748
    88 
    89   // Data members for electrons
    90 
    9149  if (electronDef != 0)
    92     {
    93       electron = electronDef->GetParticleName();
    94       tableFile[electron] = fileElectron;
    95 
    96       // Energy limits
    97       lowEnergyLimit[electron] = 25. * eV;
    98       highEnergyLimit[electron] = 30. * keV;
    99 
    100       // Create data set with electron cross section data and load values stored in file
    101       G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    102       tableE->LoadData(fileElectron);
     50  {
     51    electron = electronDef->GetParticleName();
     52    tableFile[electron] = fileElectron;
     53
     54    lowEnergyLimit[electron] = 12.61 * eV;
     55    highEnergyLimit[electron] = 30. * keV;
     56
     57    G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     58    tableE->LoadData(fileElectron);
    10359     
    104       // Insert key-table pair in map
    105       tableData[electron] = tableE;
    106     }
     60    tableData[electron] = tableE;
     61  }
    10762  else
    108     {
    109       G4Exception("G4CrossSectionIonisationBornPartial Constructor: electron is not defined");
    110     }
    111 
    112   // Data members for protons
     63  {
     64    G4Exception("G4CrossSectionIonisationBornPartial Constructor: electron is not defined");
     65  }
    11366
    11467  if (protonDef != 0)
    115     {
    116       proton = protonDef->GetParticleName();
    117       tableFile[proton] = fileProton;
    118 
    119       // Energy limits
    120       lowEnergyLimit[proton] = 500. * keV;
    121       highEnergyLimit[proton] = 10. * MeV;
    122 
    123       // Create data set with proton cross section data and load values stored in file
    124       G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    125       tableP->LoadData(fileProton);
     68  {
     69    proton = protonDef->GetParticleName();
     70    tableFile[proton] = fileProton;
     71
     72    lowEnergyLimit[proton] = 500. * keV;
     73    highEnergyLimit[proton] = 10. * MeV;
     74
     75    G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     76    tableP->LoadData(fileProton);
    12677     
    127       // Insert key-table pair in map
    128       tableData[proton] = tableP;
    129     }
     78    tableData[proton] = tableP;
     79  }
    13080  else
    131     {
    132       G4Exception("G4CrossSectionIonisationBornPartial Constructor: proton is not defined");
    133     }
    134 }
    135 
     81  {
     82    G4Exception("G4CrossSectionIonisationBornPartial Constructor: proton is not defined");
     83  }
     84}
     85
     86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    13687
    13788G4CrossSectionIonisationBornPartial::~G4CrossSectionIonisationBornPartial()
    13889{
    139    // Destroy the content of the map
    14090  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    14191  for (pos = tableData.begin(); pos != tableData.end(); ++pos)
    142     {
    143       G4DNACrossSectionDataSet* table = pos->second;
    144       delete table;
    145     }
    146 }
    147 
     92  {
     93    G4DNACrossSectionDataSet* table = pos->second;
     94    delete table;
     95  }
     96}
     97
     98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    14899
    149100G4int G4CrossSectionIonisationBornPartial::RandomSelect(G4double k, const G4String& particle )
    150101{   
    151  
    152102  G4int level = 0;
    153103
    154   // Retrieve data table corresponding to the current particle type 
    155 
    156     std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    157     pos = tableData.find(particle);
    158 
    159     if (pos != tableData.end())
     104  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
     105  pos = tableData.find(particle);
     106
     107  if (pos != tableData.end())
     108  {
     109    G4DNACrossSectionDataSet* table = pos->second;
     110
     111    if (table != 0)
     112    {
     113      G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
     114      const size_t n(table->NumberOfComponents());
     115      size_t i(n);
     116      G4double value = 0.;
     117           
     118      while (i>0)
     119      {
     120        i--;
     121        valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
     122        value += valuesBuffer[i];
     123      }
     124           
     125      value *= G4UniformRand();
     126   
     127      i = n;
     128           
     129      while (i > 0)
    160130      {
    161         G4DNACrossSectionDataSet* table = pos->second;
    162 
    163         if (table != 0)
    164           {
    165             // C-style arrays are used in G4DNACrossSectionDataSet: this design feature was
    166             // introduced without authorization and should be replaced by the use of STL containers
    167            
    168             G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
    169            
    170             const size_t n(table->NumberOfComponents());
    171             size_t i(n);
    172             G4double value = 0.;
    173            
    174             while (i>0)
    175               {
    176                 i--;
    177                 valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
    178                 value += valuesBuffer[i];
    179               }
    180            
    181             value *= G4UniformRand();
    182            
    183             i = n;
    184            
    185             while (i > 0)
    186               {
    187                 i--;
    188                
    189                 if (valuesBuffer[i] > value)
    190                   {
    191                     delete[] valuesBuffer;
    192                     return i;
    193                   }
    194                 value -= valuesBuffer[i];
    195               }
    196            
    197             // It should never end up here
    198 
    199             // ---- MGP ---- Is the following line really necessary? 
    200             if (valuesBuffer) delete[] valuesBuffer;
    201            
    202           }
     131        i--;
     132
     133        if (valuesBuffer[i] > value)
     134        {
     135          delete[] valuesBuffer;
     136          return i;
     137        }
     138        value -= valuesBuffer[i];
    203139      }
    204     else
    205       {
    206         G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle");
    207       }
     140           
     141      if (valuesBuffer) delete[] valuesBuffer;
     142   
     143    }
     144  }
     145  else
     146  {
     147    G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle");
     148  }
    208149     
    209150  return level;
    210151}
    211152
     153//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    212154
    213155G4double G4CrossSectionIonisationBornPartial::CrossSection(const G4Track& track )
     
    218160  G4double k = particle->GetKineticEnergy();
    219161 
    220   // Cross section = 0 outside the energy validity limits set in the constructor
    221   // ---- MGP ---- Better handling of these limits to be set in a following design iteration
    222 
    223162  G4double lowLim = lowEnergyLimitDefault;
    224163  G4double highLim = highEnergyLimitDefault;
     
    226165  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    227166
    228   // Retrieve energy limits for the current particle type
    229 
    230     std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    231     pos1 = lowEnergyLimit.find(particleName);
    232 
    233     // Lower limit
    234     if (pos1 != lowEnergyLimit.end())
    235       {
    236         lowLim = pos1->second;
    237       }
    238 
    239     // Upper limit
    240     std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    241     pos2 = highEnergyLimit.find(particleName);
    242 
    243     if (pos2 != highEnergyLimit.end())
    244       {
    245         highLim = pos2->second;
    246       }
    247 
    248     // Verify that the current track is within the energy limits of validity of the cross section model
    249     if (k > lowLim && k < highLim)
    250       {
    251         std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    252         pos = tableData.find(particleName);
     167  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
     168  pos1 = lowEnergyLimit.find(particleName);
     169
     170  if (pos1 != lowEnergyLimit.end())
     171  {
     172    lowLim = pos1->second;
     173  }
     174
     175  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
     176  pos2 = highEnergyLimit.find(particleName);
     177
     178  if (pos2 != highEnergyLimit.end())
     179  {
     180     highLim = pos2->second;
     181  }
     182
     183  if (k > lowLim && k < highLim)
     184  {
     185     std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
     186     pos = tableData.find(particleName);
    253187       
    254         if (pos != tableData.end())
    255           {
    256             G4DNACrossSectionDataSet* table = pos->second;
    257             if (table != 0)
    258               {
    259                 // ---- MGP ---- Temporary
    260                 // table->PrintData();
    261 
    262                 // Cross section
    263                 sigma = table->FindValue(k);
    264               }
    265           }
    266         else
    267           {
    268             // The track corresponds to a not pertinent particle
    269             G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle");
    270           }
    271       }
    272 
    273     return sigma;
    274 }
    275 
     188     if (pos != tableData.end())
     189     {
     190       G4DNACrossSectionDataSet* table = pos->second;
     191       if (table != 0)
     192       {
     193         sigma = table->FindValue(k);
     194       }
     195     }
     196     else
     197     {
     198       G4Exception("G4CrossSectionIonisationBornPartial: attempting to calculate cross section for wrong particle");
     199     }
     200  }
     201
     202  return sigma;
     203}
     204
     205//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    276206
    277207G4double G4CrossSectionIonisationBornPartial::Sum(G4double /* energy */, const G4String& /* particle */)
    278208{
    279 
    280209  return 0;
    281210}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationBornPartialElectron.cc

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionIonisationBornPartialElectron.cc,v 1.1 2007/10/15 08:57:54 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationRudd.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationRudd.cc,v 1.2 2007/11/09 16:20:16 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionIonisationRudd.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionIonisationRudd.hh"
    54 #include "G4ParticleDefinition.hh"
    55 #include "G4Electron.hh"
    56 #include "G4Proton.hh"
    57 #include "G4Track.hh"
    58 #include "G4LogLogInterpolation.hh"
    59 #include "G4SystemOfUnits.hh"
    60 #include "G4DNAGenericIonsManager.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6132
    6233G4CrossSectionIonisationRudd::G4CrossSectionIonisationRudd()
    6334{
    64 
    65   name = "IonisationRudd";
    66  
    67   // Default energy limits (defined for protection against anomalous behaviour only)
    68   // ZERO LOW ENERGY LIMIT FOR ALLOWED KILLING
    6935  lowEnergyLimitDefault = 0 * eV;
    7036  highEnergyLimitDefault = 100 * MeV;
     
    9056  G4String helium;
    9157
    92   // Factor to scale microscopic/macroscopic cross section data in water
    93   // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation
    9458  G4double scaleFactor = 1 * m*m;
    9559
    96   // Data members for protons
    97 
    9860  if (protonDef != 0)
    99     {
    100       proton = protonDef->GetParticleName();
    101       tableFile[proton] = fileProton;
    102 
    103       // Energy limits
    104       lowEnergyLimit[proton] = 0. * eV;
    105       highEnergyLimit[proton] = 500. * keV;
    106 
    107       // Create data set with proton cross section data and load values stored in file
    108       G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
     61  {
     62    proton = protonDef->GetParticleName();
     63    tableFile[proton] = fileProton;
     64
     65    lowEnergyLimit[proton] = 0. * eV;
     66    highEnergyLimit[proton] = 500. * keV;
     67
     68    G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
    10969                                                                           eV,
    11070                                                                           scaleFactor );
    111       tableProton->LoadData(fileProton);
    112      
    113       // Insert key-table pair in map
    114       tableData[proton] = tableProton;
    115     }
    116   else
    117     {
    118       G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined");
    119     }
    120 
    121   // Data members for hydrogen
     71    tableProton->LoadData(fileProton);
     72    tableData[proton] = tableProton;
     73  }
     74  else
     75  {
     76    G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined");
     77  }
    12278
    12379  if (hydrogenDef != 0)
    124     {
    125       hydrogen = hydrogenDef->GetParticleName();
    126       tableFile[hydrogen] = fileHydrogen;
    127 
    128       // Energy limits
    129       lowEnergyLimit[hydrogen] = 0. * eV;
    130       highEnergyLimit[hydrogen] = 100. * MeV;
    131 
    132       // Create data set with hydrogen cross section data and load values stored in file
    133       G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
     80  {
     81    hydrogen = hydrogenDef->GetParticleName();
     82    tableFile[hydrogen] = fileHydrogen;
     83
     84    lowEnergyLimit[hydrogen] = 0. * eV;
     85    highEnergyLimit[hydrogen] = 100. * MeV;
     86
     87    G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
    13488                                                                             eV,
    13589                                                                             scaleFactor );
    136       tableHydrogen->LoadData(fileHydrogen);
     90    tableHydrogen->LoadData(fileHydrogen);
    13791     
    138       // Insert key-table pair in map
    139       tableData[hydrogen] = tableHydrogen;
    140     }
    141   else
    142     {
    143       G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined");
    144     }
    145 
    146   // Data members for alphaPlusPlus
     92    tableData[hydrogen] = tableHydrogen;
     93  }
     94  else
     95  {
     96    G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined");
     97  }
    14798
    14899  if (alphaPlusPlusDef != 0)
    149     {
    150       alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
    151       tableFile[alphaPlusPlus] = fileAlphaPlusPlus;
    152 
    153       // Energy limits
    154       lowEnergyLimit[alphaPlusPlus] = 0. * keV;
    155       highEnergyLimit[alphaPlusPlus] = 10. * MeV;
    156 
    157       // Create data set with hydrogen cross section data and load values stored in file
    158       G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
     100  {
     101    alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
     102    tableFile[alphaPlusPlus] = fileAlphaPlusPlus;
     103
     104    lowEnergyLimit[alphaPlusPlus] = 0. * eV;
     105    highEnergyLimit[alphaPlusPlus] = 10. * MeV;
     106
     107    G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
    159108                                                                                  eV,
    160109                                                                                  scaleFactor );
    161       tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus);
     110    tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus);
    162111     
    163       // Insert key-table pair in map
    164       tableData[alphaPlusPlus] = tableAlphaPlusPlus;
    165     }
    166   else
    167     {
    168       G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined");
    169     }
    170 
    171   // Data members for alphaPlus
     112    tableData[alphaPlusPlus] = tableAlphaPlusPlus;
     113  }
     114  else
     115  {
     116    G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined");
     117  }
    172118
    173119  if (alphaPlusDef != 0)
    174     {
    175       alphaPlus = alphaPlusDef->GetParticleName();
    176       tableFile[alphaPlus] = fileAlphaPlus;
    177 
    178       // Energy limits
    179       lowEnergyLimit[alphaPlus] = 0. * keV;
    180       highEnergyLimit[alphaPlus] = 10. * MeV;
    181 
    182       // Create data set with hydrogen cross section data and load values stored in file
    183       G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
     120  {
     121    alphaPlus = alphaPlusDef->GetParticleName();
     122    tableFile[alphaPlus] = fileAlphaPlus;
     123
     124    lowEnergyLimit[alphaPlus] = 0. * eV;
     125    highEnergyLimit[alphaPlus] = 10. * MeV;
     126
     127    G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
    184128                                                                              eV,
    185129                                                                              scaleFactor );
    186       tableAlphaPlus->LoadData(fileAlphaPlus);
    187      
    188       // Insert key-table pair in map
    189       tableData[alphaPlus] = tableAlphaPlus;
    190     }
    191   else
    192     {
    193       G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined");
    194     }
    195 
    196   // Data members for helium
     130    tableAlphaPlus->LoadData(fileAlphaPlus);
     131    tableData[alphaPlus] = tableAlphaPlus;
     132  }
     133  else
     134  {
     135    G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined");
     136  }
    197137
    198138  if (heliumDef != 0)
    199     {
    200       helium = heliumDef->GetParticleName();
    201       tableFile[helium] = fileHelium;
    202 
    203       // Energy limits
    204       lowEnergyLimit[helium] = 0. * keV;
    205       highEnergyLimit[helium] = 10. * MeV;
    206 
    207       // Create data set with hydrogen cross section data and load values stored in file
    208       G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
     139  {
     140    helium = heliumDef->GetParticleName();
     141    tableFile[helium] = fileHelium;
     142
     143    lowEnergyLimit[helium] = 0. * eV;
     144    highEnergyLimit[helium] = 10. * MeV;
     145
     146    G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation,
    209147                                                                           eV,
    210148                                                                           scaleFactor );
    211       tableHelium->LoadData(fileHelium);
    212      
    213       // Insert key-table pair in map
    214       tableData[helium] = tableHelium;
     149    tableHelium->LoadData(fileHelium);
     150    tableData[helium] = tableHelium;
    215151    }
    216152  else
    217     {
    218       G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined");
    219     }
     153  {
     154    G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined");
     155  }
    220156}
    221157
     158//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    222159
    223160G4CrossSectionIonisationRudd::~G4CrossSectionIonisationRudd()
    224161{
    225   // Destroy the content of the map
    226162  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    227163  for (pos = tableData.begin(); pos != tableData.end(); ++pos)
    228     {
    229       G4DNACrossSectionDataSet* table = pos->second;
    230       delete table;
    231     }
     164  {
     165    G4DNACrossSectionDataSet* table = pos->second;
     166    delete table;
     167  }
    232168}
    233169
    234 
     170//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    235171
    236172G4double G4CrossSectionIonisationRudd::CrossSection(const G4Track& track )
     
    252188      &&
    253189      track.GetDefinition() != instance->GetIon("helium")
    254       )
     190     )
    255191           
    256192    G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle");
    257193
    258   // Cross section = 0 outside the energy validity limits set in the constructor
    259194  G4double sigma = 0.;
    260195
    261   // ---- MGP ---- Better handling of these limits to be set in a following design iteration
    262196  G4double lowLim = lowEnergyLimitDefault;
    263197  G4double highLim = highEnergyLimitDefault;
     
    265199  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    266200
    267   // Retrieve energy limits for the current particle type
    268 
    269201  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    270202  pos1 = lowEnergyLimit.find(particleName);
    271203
    272   // Lower limit
    273204  if (pos1 != lowEnergyLimit.end())
    274     {
    275       lowLim = pos1->second;
    276     }
    277 
    278   // Upper limit
     205  {
     206    lowLim = pos1->second;
     207  }
     208
    279209  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    280210  pos2 = highEnergyLimit.find(particleName);
    281211
    282212  if (pos2 != highEnergyLimit.end())
     213  {
     214    highLim = pos2->second;
     215  }
     216
     217  if (k >= lowLim && k <= highLim)
     218  {
     219    std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
     220    pos = tableData.find(particleName);
     221       
     222    if (pos != tableData.end())
    283223    {
    284       highLim = pos2->second;
    285     }
    286 
    287   // Verify that the current track is within the energy limits of validity of the cross section model
    288   if (k >= lowLim && k <= highLim)
    289     {
    290       std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    291       pos = tableData.find(particleName);
    292        
    293       if (pos != tableData.end())
    294         {
    295           G4DNACrossSectionDataSet* table = pos->second;
    296           if (table != 0)
    297             {
    298               // Cross section
     224       G4DNACrossSectionDataSet* table = pos->second;
     225       if (table != 0)
     226       {
    299227              sigma = table->FindValue(k);
    300 
    301228
    302229              // BEGIN ELECTRON CORRECTION
     
    307234                   particle->GetDefinition() == instance->GetIon("helium")
    308235                   )
    309                 {
     236              {
    310237     
    311238                  G4DNACrossSectionDataSet* electronDataset = new G4DNACrossSectionDataSet
     
    317244
    318245                  if ( particle->GetDefinition() == instance->GetIon("alpha+") )
    319                     {
     246                  {
    320247                      G4double tmp1 = table->FindValue(k) + electronDataset->FindValue(kElectron);
    321248                      delete electronDataset;
    322249                      return tmp1;
    323                     }
     250                  }
    324251
    325252                  if ( particle->GetDefinition() == instance->GetIon("helium") )
    326                     {
     253                  {
    327254                      G4double tmp2 = table->FindValue(k) +  2. * electronDataset->FindValue(kElectron);
    328255                      delete electronDataset;
    329256                      return tmp2;
    330                     }
    331                 }     
     257                  }
     258              }     
    332259
    333260              // END ELECTRON CORRECTION
    334 
    335             }
    336         }
    337       else
    338         {
    339           // The track does not corresponds to a particle pertinent to this model
    340           G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle");
    341         }
     261       }
    342262    }
     263    else
     264    {
     265        G4Exception("G4CrossSectionIonisationRudd: attempting to calculate cross section for wrong particle");
     266    }
     267  }
    343268
    344269  return sigma;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionIonisationRuddPartial.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4CrossSectionIonisationRuddPartial.cc,v 1.3 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Geant4-DNA Cross total cross section for electron elastic scattering in water
    44 // Reference: TNS Geant4-DNA paper
    45 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    46 // design foundation and implementation of the first set of models,
    47 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    48 // Further documentation available from http://www.ge.infn.it/geant4/dna
    49 
    50 // -------------------------------------------------------------------
    51 
     26// $Id: G4CrossSectionIonisationRuddPartial.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5228
    5329#include "G4CrossSectionIonisationRuddPartial.hh"
    54 #include "G4ParticleDefinition.hh"
    55 #include "G4Electron.hh"
    56 #include "G4Proton.hh"
    57 #include "G4Track.hh"
    58 #include "G4LogLogInterpolation.hh"
    59 #include "G4SystemOfUnits.hh"
    60 #include "G4DNAGenericIonsManager.hh"
    61 
    62 #include "Randomize.hh"
    63 
    64 #include <utility>
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6532
    6633G4CrossSectionIonisationRuddPartial::G4CrossSectionIonisationRuddPartial()
    6734{
    68   name = "IonisationRudd";
    69  
    70   // Default energy limits (defined for protection against anomalous behaviour only)
    71   name = "IonisationRuddPartial";
    7235  lowEnergyLimitDefault = 100 * eV;
    7336  highEnergyLimitDefault = 100 * MeV;
     
    9356  G4String helium;
    9457
    95   // Factor to scale microscopic/macroscopic cross section data in water
    96   // ---- MGP ---- Hardcoded (taken from prototype code); to be replaced with proper calculation
    9758  G4double scaleFactor = 1 * m*m;
    9859
    99   // Data members for protons
    100 
    10160  if (protonDef != 0)
    102     {
    103       proton = protonDef->GetParticleName();
    104       tableFile[proton] = fileProton;
    105 
    106       // Energy limits
    107       lowEnergyLimit[proton] = 100. * eV;
    108       highEnergyLimit[proton] = 500. * keV;
    109 
    110       // Create data set with proton cross section data and load values stored in file
    111       G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    112       tableProton->LoadData(fileProton);
    113      
    114       // Insert key-table pair in map
    115       tableData[proton] = tableProton;
    116     }
    117   else
    118     {
    119       G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined");
    120     }
    121 
    122   // Data members for hydrogen
     61  {
     62    proton = protonDef->GetParticleName();
     63    tableFile[proton] = fileProton;
     64
     65    lowEnergyLimit[proton] = 100. * eV;
     66    highEnergyLimit[proton] = 500. * keV;
     67
     68    G4DNACrossSectionDataSet* tableProton = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     69    tableProton->LoadData(fileProton);
     70     
     71    tableData[proton] = tableProton;
     72  }
     73  else
     74  {
     75    G4Exception("G4CrossSectionIonisationRudd Constructor: proton is not defined");
     76  }
    12377
    12478  if (hydrogenDef != 0)
    125     {
    126       hydrogen = hydrogenDef->GetParticleName();
    127       tableFile[hydrogen] = fileHydrogen;
    128 
    129       // Energy limits
    130       lowEnergyLimit[hydrogen] = 100. * eV;
    131       highEnergyLimit[hydrogen] = 100. * MeV;
    132 
    133       // Create data set with hydrogen cross section data and load values stored in file
    134       G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    135       tableHydrogen->LoadData(fileHydrogen);
    136      
    137       // Insert key-table pair in map
    138       tableData[hydrogen] = tableHydrogen;
    139     }
    140   else
    141     {
    142       G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined");
    143     }
    144 
    145   // Data members for alphaPlusPlus
     79  {
     80    hydrogen = hydrogenDef->GetParticleName();
     81    tableFile[hydrogen] = fileHydrogen;
     82
     83    lowEnergyLimit[hydrogen] = 100. * eV;
     84    highEnergyLimit[hydrogen] = 100. * MeV;
     85
     86    G4DNACrossSectionDataSet* tableHydrogen = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     87    tableHydrogen->LoadData(fileHydrogen);
     88     
     89    tableData[hydrogen] = tableHydrogen;
     90  }
     91  else
     92  {
     93    G4Exception("G4CrossSectionIonisationRudd Constructor: hydrogen is not defined");
     94  }
    14695
    14796  if (alphaPlusPlusDef != 0)
    148     {
    149       alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
    150       tableFile[alphaPlusPlus] = fileAlphaPlusPlus;
    151 
    152       // Energy limits
    153       lowEnergyLimit[alphaPlusPlus] = 1. * keV;
    154       highEnergyLimit[alphaPlusPlus] = 10. * MeV;
    155 
    156       // Create data set with hydrogen cross section data and load values stored in file
    157       G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    158       tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus);
    159      
    160       // Insert key-table pair in map
    161       tableData[alphaPlusPlus] = tableAlphaPlusPlus;
    162     }
    163   else
    164     {
    165       G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined");
    166     }
    167 
    168   // Data members for alphaPlus
     97  {
     98    alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
     99    tableFile[alphaPlusPlus] = fileAlphaPlusPlus;
     100
     101    lowEnergyLimit[alphaPlusPlus] = 1. * keV;
     102    highEnergyLimit[alphaPlusPlus] = 10. * MeV;
     103
     104    G4DNACrossSectionDataSet* tableAlphaPlusPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     105    tableAlphaPlusPlus->LoadData(fileAlphaPlusPlus);
     106     
     107    tableData[alphaPlusPlus] = tableAlphaPlusPlus;
     108  }
     109  else
     110  {
     111    G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlusPlus is not defined");
     112  }
    169113
    170114  if (alphaPlusDef != 0)
    171     {
    172       alphaPlus = alphaPlusDef->GetParticleName();
    173       tableFile[alphaPlus] = fileAlphaPlus;
    174 
    175       // Energy limits
    176       lowEnergyLimit[alphaPlus] = 1. * keV;
    177       highEnergyLimit[alphaPlus] = 10. * MeV;
    178 
    179       // Create data set with hydrogen cross section data and load values stored in file
    180       G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    181       tableAlphaPlus->LoadData(fileAlphaPlus);
    182      
    183       // Insert key-table pair in map
    184       tableData[alphaPlus] = tableAlphaPlus;
    185     }
    186   else
    187     {
    188       G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined");
    189     }
    190 
    191   // Data members for helium
     115  {
     116    alphaPlus = alphaPlusDef->GetParticleName();
     117    tableFile[alphaPlus] = fileAlphaPlus;
     118
     119    lowEnergyLimit[alphaPlus] = 1. * keV;
     120    highEnergyLimit[alphaPlus] = 10. * MeV;
     121
     122    G4DNACrossSectionDataSet* tableAlphaPlus = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     123    tableAlphaPlus->LoadData(fileAlphaPlus);
     124
     125    tableData[alphaPlus] = tableAlphaPlus;
     126  }
     127  else
     128  {
     129    G4Exception("G4CrossSectionIonisationRudd Constructor: alphaPlus is not defined");
     130  }
    192131
    193132  if (heliumDef != 0)
    194     {
    195       helium = heliumDef->GetParticleName();
    196       tableFile[helium] = fileHelium;
    197 
    198       // Energy limits
    199       lowEnergyLimit[helium] = 1. * keV;
    200       highEnergyLimit[helium] = 10. * MeV;
    201 
    202       // Create data set with hydrogen cross section data and load values stored in file
    203       G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
    204       tableHelium->LoadData(fileHelium);
    205      
    206       // Insert key-table pair in map
    207       tableData[helium] = tableHelium;
    208     }
    209   else
    210     {
    211       G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined");
    212     }
    213 }
    214 
     133  {
     134    helium = heliumDef->GetParticleName();
     135    tableFile[helium] = fileHelium;
     136
     137    lowEnergyLimit[helium] = 1. * keV;
     138    highEnergyLimit[helium] = 10. * MeV;
     139
     140    G4DNACrossSectionDataSet* tableHelium = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
     141    tableHelium->LoadData(fileHelium);
     142     
     143    tableData[helium] = tableHelium;
     144  }
     145  else
     146  {
     147    G4Exception("G4CrossSectionIonisationRudd Constructor: helium is not defined");
     148  }
     149}
     150
     151//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    215152
    216153G4CrossSectionIonisationRuddPartial::~G4CrossSectionIonisationRuddPartial()
    217154{
    218   // Destroy the content of the map
    219155  std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    220156  for (pos = tableData.begin(); pos != tableData.end(); ++pos)
    221     {
    222       G4DNACrossSectionDataSet* table = pos->second;
    223       delete table;
    224     }
    225 }
    226 
     157  {
     158    G4DNACrossSectionDataSet* table = pos->second;
     159    delete table;
     160  }
     161}
     162
     163//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    227164
    228165G4int G4CrossSectionIonisationRuddPartial::RandomSelect(G4double k, const G4String& particle )
     
    243180       particle == instance->GetIon("helium")->GetParticleName()
    244181       )
    245     {     
     182  {     
    246183      electronDataset->LoadData("dna/sigma_ionisation_e_born");
    247184
     
    250187      electronComponent = electronDataset->FindValue(kElectron);
    251188       
    252     }     
     189  }     
    253190 
    254191  delete electronDataset;
     
    264201
    265202  if (pos != tableData.end())
    266     {
     203  {
    267204      G4DNACrossSectionDataSet* table = pos->second;
    268205
    269206      if (table != 0)
    270         {
    271           // C-style arrays are used in G4DNACrossSectionDataSet: this design feature was
    272           // introduced without authorization and should be replaced by the use of STL containers
    273            
     207      {
    274208          G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
    275209           
     
    279213           
    280214          while (i>0)
    281             {
     215          {
    282216              i--;
    283217              valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
     
    294228
    295229              value += valuesBuffer[i];
    296             }
     230          }
    297231           
    298232          value *= G4UniformRand();
     
    301235           
    302236          while (i > 0)
    303             {
     237          {
    304238              i--;
    305239               
    306240              if (valuesBuffer[i] > value)
    307                 {
     241              {
    308242                  delete[] valuesBuffer;
    309243                  return i;
    310                 }
     244              }
    311245              value -= valuesBuffer[i];
    312             }
    313            
    314           // It should never end up here
    315 
    316           // ---- MGP ---- Is the following line really necessary? 
     246          }
     247           
    317248          if (valuesBuffer) delete[] valuesBuffer;
    318249           
    319         }
    320     }
    321   else
    322     {
    323       G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle");
    324     }
     250      }
     251  }
     252  else
     253  {
     254    G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle");
     255  }
    325256     
    326257  return level;
    327258}
    328259
     260//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    329261
    330262G4double G4CrossSectionIonisationRuddPartial::CrossSection(const G4Track& track )
     
    335267  G4double k = particle->GetKineticEnergy();
    336268 
    337   // Cross section = 0 outside the energy validity limits set in the constructor
    338   // ---- MGP ---- Better handling of these limits to be set in a following design iteration
    339 
    340269  G4double lowLim = lowEnergyLimitDefault;
    341270  G4double highLim = highEnergyLimitDefault;
     
    343272  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    344273
    345   // Retrieve energy limits for the current particle type
    346 
    347274  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    348275  pos1 = lowEnergyLimit.find(particleName);
    349276
    350   // Lower limit
    351277  if (pos1 != lowEnergyLimit.end())
    352     {
    353       lowLim = pos1->second;
    354     }
    355 
    356   // Upper limit
     278  {
     279    lowLim = pos1->second;
     280  }
     281
    357282  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    358283  pos2 = highEnergyLimit.find(particleName);
    359284
    360285  if (pos2 != highEnergyLimit.end())
    361     {
    362       highLim = pos2->second;
    363     }
    364 
    365   // Verify that the current track is within the energy limits of validity of the cross section model
     286  {
     287    highLim = pos2->second;
     288  }
     289
    366290  if (k >= lowLim && k <= highLim)
    367     {
     291  {
    368292      std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
    369293      pos = tableData.find(particleName);
    370294       
    371295      if (pos != tableData.end())
    372         {
     296      {
    373297          G4DNACrossSectionDataSet* table = pos->second;
    374298          if (table != 0)
    375             {
    376               // ---- MGP ---- Temporary
    377               // table->PrintData();
    378 
    379               // Cross section
     299          {
    380300              sigma = table->FindValue(k);
    381             }
    382         }
     301          }
     302      }
    383303      else
    384         {
    385           // The track corresponds to a not pertinent particle
     304      {
    386305          G4Exception("G4CrossSectionIonisationRuddPartial: attempting to calculate cross section for wrong particle");
    387         }
    388     }
     306      }
     307  }
    389308
    390309  return sigma;
    391310}
    392311
     312//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    393313
    394314G4double G4CrossSectionIonisationRuddPartial::Sum(G4double /* energy */, const G4String& /* particle */)
    395315{
    396 
    397316  return 0;
    398317}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4CrossSectionKill.cc

    r819 r961  
    2626//
    2727// $Id: G4CrossSectionKill.cc,v 1.1 2007/11/09 20:26:12 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4DNACrossSectionDataSet.cc

    r819 r961  
    2727
    2828// $Id: G4DNACrossSectionDataSet.cc,v 1.7 2007/11/09 18:06:26 pia Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: Riccardo Capra <capra@ge.infn.it>
  • trunk/source/processes/electromagnetic/lowenergy/src/G4DNAGenericIonsManager.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4DNAGenericIonsManager.cc,v 1.4 2006/06/29 19:39:24 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: G4DNAGenericIonsManager.cc,v 1.5 2008/07/16 19:01:07 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2928
    3029#include "G4DNAGenericIonsManager.hh"
     
    3231#include "G4Ions.hh"
    3332
    34 G4DNAGenericIonsManager *                G4DNAGenericIonsManager :: Instance(void)
     33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     34
     35G4DNAGenericIonsManager * G4DNAGenericIonsManager :: Instance(void)
    3536{
    3637 if (!theInstance)
     
    4041}
    4142
    42 G4ParticleDefinition *                   G4DNAGenericIonsManager :: GetIon(const G4String & name)
     43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     44
     45G4ParticleDefinition * G4DNAGenericIonsManager :: GetIon(const G4String & name)
    4346{
    4447 IonsMap::const_iterator i(map.find(name));
     
    4750  return 0;
    4851 
    49 // return map[name];
    50 
    5152 return i->second;
    5253}
    5354
    54                                          G4DNAGenericIonsManager :: G4DNAGenericIonsManager()
     55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     56
     57G4DNAGenericIonsManager :: G4DNAGenericIonsManager()
    5558{
    5659 //               name             mass          width         charge
     
    6063 //             stable         lifetime    decay table
    6164
    62 
    6365 G4Ions *helium;
    6466 G4Ions *hydrogen;
    6567 G4Ions *alphaPlus;
     68 G4Ions *positronium1s;
     69 G4Ions *positronium2s;
    6670
    6771 helium=     new G4Ions("helium",    3.727417*GeV,       0.0*MeV,  +0.0*eplus,
     
    8387                               0,               0,             0,
    8488                       "nucleus",              +1,            +1,           0,
    85                       true,            -1.0,             0, false,
     89                        true,            -1.0,             0, false,
     90                              "",               0,             0.0);
     91
     92 positronium1s= new G4Ions("Ps-1s",   2*electron_mass_c2,      0.0*MeV,  +0.0*eplus,
     93                               0,               0,             0,
     94                               0,               0,             0,
     95                       "nucleus",               0,             0,           0,
     96                            true,            -1.0,             0, false,
     97                              "",               0,             0.0);
     98
     99 positronium2s= new G4Ions("Ps-2s",   2*electron_mass_c2,      0.0*MeV,  +0.0*eplus,
     100                               0,               0,             0,
     101                               0,               0,             0,
     102                       "nucleus",               0,             0,           0,
     103                            true,            -1.0,             0, false,
    86104                              "",               0,             0.0);
    87105
     
    90108 map["alpha+"]=alphaPlus;
    91109 map["alpha++"]=G4Alpha::Alpha();
     110 map["Ps-1s"]=positronium1s;
     111 map["Ps-2s"]=positronium2s;
     112
    92113}
    93114
     115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    94116
    95 G4DNAGenericIonsManager *                G4DNAGenericIonsManager::theInstance(0);
     117G4DNAGenericIonsManager * G4DNAGenericIonsManager::theInstance(0);
    96118   
  • trunk/source/processes/electromagnetic/lowenergy/src/G4DummyFinalState.cc

    r819 r961  
    2626//
    2727// $Id: G4DummyFinalState.cc,v 1.2 2007/10/15 08:36:35 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4EMDataSet.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EMDataSet.cc,v 1.12 2006/06/29 19:39:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4EMDataSet.cc,v 1.18 2008/03/17 13:40:53 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    4040#include <fstream>
    4141#include <sstream>
    42 
    43                                                  G4EMDataSet :: G4EMDataSet(G4int argZ, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergies, G4double argUnitData)
    44 :
    45  z(argZ),
    46  energies(0),
    47  data(0),
    48  algorithm(argAlgorithm),
    49  unitEnergies(argUnitEnergies),
    50  unitData(argUnitData)
    51 {
    52  if (algorithm == 0)
    53   G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0");
    54 }
    55 
    56 
    57 
    58                                                  G4EMDataSet :: G4EMDataSet(G4int argZ, G4DataVector * argEnergies, G4DataVector * argData, G4VDataSetAlgorithm * argAlgorithm, G4double argUnitEnergies, G4double argUnitData)
    59 :
    60  z(argZ),
    61  energies(argEnergies),
    62  data(argData),
    63  algorithm(argAlgorithm),
    64  unitEnergies(argUnitEnergies),
    65  unitData(argUnitData)
    66 {
    67  if (algorithm==0)
    68   G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0");
    69 
    70  if ((energies==0) ^ (data==0))
    71   G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data (zero case)");
    72 
    73  if (energies==0)
    74   return;
    75  
    76  if (energies->size()!=data->size())
    77   G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data");
    78 }
    79 
    80 
    81 
    82                                                  G4EMDataSet :: ~G4EMDataSet()
     42#include "G4Integrator.hh"
     43#include "Randomize.hh"
     44#include "G4LinInterpolation.hh"
     45
     46
     47G4EMDataSet::G4EMDataSet(G4int Z,
     48                         G4VDataSetAlgorithm* algo,
     49                         G4double xUnit,
     50                         G4double yUnit,
     51                         G4bool random):
     52  z(Z),
     53  energies(0),
     54  data(0),
     55  algorithm(algo),
     56  unitEnergies(xUnit),
     57  unitData(yUnit),
     58  pdf(0),
     59  randomSet(random)
     60{
     61  if (algorithm == 0) G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0");
     62  if (randomSet) BuildPdf();
     63}
     64
     65G4EMDataSet::G4EMDataSet(G4int argZ,
     66                         G4DataVector* dataX,
     67                         G4DataVector* dataY,
     68                         G4VDataSetAlgorithm* algo,
     69                         G4double xUnit,
     70                         G4double yUnit,
     71                         G4bool random):
     72  z(argZ),
     73  energies(dataX),
     74  data(dataY),
     75  algorithm(algo),
     76  unitEnergies(xUnit),
     77  unitData(yUnit),
     78  pdf(0),
     79  randomSet(random)
     80{
     81  if (algorithm == 0) G4Exception("G4EMDataSet::G4EMDataSet - interpolation == 0");
     82
     83  if ((energies == 0) ^ (data == 0))
     84    G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data (zero case)");
     85
     86  if (energies == 0) return;
     87 
     88  if (energies->size() != data->size())
     89    G4Exception("G4EMDataSet::G4EMDataSet - different size for energies and data");
     90
     91  if (randomSet) BuildPdf();
     92}
     93
     94G4EMDataSet::~G4EMDataSet()
    8395{
    84  delete algorithm;
    85  
    86  if (energies)
    87   delete energies;
    88 
    89  if (data)
    90   delete data;
    91 }
    92 
    93 
    94 
    95 
    96 
    97 G4double                                        G4EMDataSet :: FindValue(G4double argEnergy, G4int /* argComponentId */) const
    98 {
    99  if (!energies)
    100   G4Exception("G4EMDataSet::FindValue - energies == 0");
    101  
    102  if (energies->empty())
    103   return 0;
    104 
    105  if (argEnergy <= (*energies)[0])
    106   return (*data)[0];
    107 
    108  size_t i(energies->size()-1);
    109 
    110  if (argEnergy >= (*energies)[i])
    111   return (*data)[i];
    112 
    113  return algorithm->Calculate(argEnergy, FindLowerBound(argEnergy), *energies, *data);
    114 }
    115 
    116 
    117 
    118 
    119 
    120 void                                            G4EMDataSet :: PrintData(void) const
    121 {
    122  if (!energies)
    123  {
    124   G4cout << "Data not available." << G4endl;
    125   return;
    126  }
    127  
    128  size_t size = energies->size();
    129  
    130  for (size_t i(0); i<size; i++)
    131   G4cout << "Point: " << ((*energies)[i]/unitEnergies)
    132          << " - Data value : " << ((*data)[i]/unitData) << G4endl;
    133 }
    134 
    135 
    136 
    137 
    138 
    139 void                                            G4EMDataSet :: SetEnergiesData(G4DataVector * argEnergies, G4DataVector * argData, G4int /* argComponentId */)
    140 {
    141  if (energies)
    142   delete energies;
    143  energies=argEnergies;
    144 
    145  if (data)
    146   delete data;
    147  data=argData;
    148  
    149  if ((energies==0) ^ (data==0))
    150   G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data (zero case)");
    151 
    152  if (energies==0)
    153   return;
    154  
    155  if (energies->size()!=data->size())
    156   G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data");
    157 }
    158 
    159 
    160 
    161 
    162 
    163 G4bool                                          G4EMDataSet :: LoadData(const G4String & argFileName)
    164 {
    165  // The file is organized into two columns:
    166  // 1st column is the energy
    167  // 2nd column is the corresponding value
    168  // The file terminates with the pattern: -1   -1
    169  //                                       -2   -2
    170  
    171  G4String fullFileName(FullFileName(argFileName));
    172  std::ifstream in(fullFileName);
    173 
    174  if (!in.is_open())
    175  {
    176   G4String message("G4EMDataSet::LoadData - data file \"");
    177   message+=fullFileName;
    178   message+="\" not found";
    179   G4Exception(message);
    180  }
    181 
    182  G4DataVector * argEnergies=new G4DataVector;
    183  G4DataVector * argData=new G4DataVector;
    184 
    185  G4double a;
    186  bool energyColumn(true);
    187 
    188  do
    189  {
    190   in >> a;
    191  
    192   if (a!=-1 && a!=-2)
    193   {
    194    if (energyColumn)
    195     argEnergies->push_back(a*unitEnergies);
    196    else
    197     argData->push_back(a*unitData);
    198    energyColumn=(!energyColumn);
    199   }
    200  }
    201  while (a != -2);
    202  
    203  SetEnergiesData(argEnergies, argData, 0);
    204  
    205  return true;
    206 }
    207 
    208 
    209 
    210 G4bool                                          G4EMDataSet :: SaveData(const G4String & argFileName) const
    211 {
    212  // The file is organized into two columns:
    213  // 1st column is the energy
    214  // 2nd column is the corresponding value
    215  // The file terminates with the pattern: -1   -1
    216  //                                       -2   -2
    217  
    218  G4String fullFileName(FullFileName(argFileName));
    219  std::ofstream out(fullFileName);
    220 
    221  if (!out.is_open())
    222  {
    223   G4String message("G4EMDataSet::SaveData - cannot open \"");
    224   message+=fullFileName;
    225   message+="\"";
    226   G4Exception(message);
    227  }
    228  
    229  out.precision(10);
    230  out.width(15);
    231  out.setf(std::ofstream::left);
    232  
    233  if (energies!=0 && data!=0)
    234  {
    235   G4DataVector::const_iterator i(energies->begin());
    236   G4DataVector::const_iterator endI(energies->end());
    237   G4DataVector::const_iterator j(data->begin());
    238  
    239   while (i!=endI)
    240   {
    241    out.precision(10);
    242    out.width(15);
    243    out.setf(std::ofstream::left);
    244    out << ((*i)/unitEnergies) << ' ';
    245 
    246    out.precision(10);
    247    out.width(15);
    248    out.setf(std::ofstream::left);
    249    out << ((*j)/unitData) << std::endl;
    250 
    251    i++;
    252    j++;
    253   }
    254  }
    255  
    256  out.precision(10);
    257  out.width(15);
    258  out.setf(std::ofstream::left);
    259  out << -1.f << ' ';
    260 
    261  out.precision(10);
    262  out.width(15);
    263  out.setf(std::ofstream::left);
    264  out << -1.f << std::endl;
    265 
    266  out.precision(10);
    267  out.width(15);
    268  out.setf(std::ofstream::left);
    269  out << -2.f << ' ';
    270 
    271  out.precision(10);
    272  out.width(15);
    273  out.setf(std::ofstream::left);
    274  out << -2.f << std::endl;
    275 
    276  return true;
    277 }
    278 
    279 
    280 
    281 
    282 
    283 size_t                                          G4EMDataSet :: FindLowerBound(G4double argEnergy) const
    284 {
    285  size_t lowerBound(0);
    286  size_t upperBound(energies->size() - 1);
    287  
    288  while (lowerBound <= upperBound)
    289  {
    290   size_t midBin((lowerBound + upperBound)/2);
    291 
    292   if (argEnergy < (*energies)[midBin])
    293    upperBound = midBin-1;
     96  delete algorithm;
     97  if (energies) delete energies;
     98  if (data) delete data;
     99  if (pdf) delete pdf;
     100}
     101
     102G4double G4EMDataSet::FindValue(G4double energy, G4int /* componentId */) const
     103{
     104  if (!energies) G4Exception("G4EMDataSet::FindValue - energies == 0");
     105  if (energies->empty()) return 0;
     106  if (energy <= (*energies)[0]) return (*data)[0];
     107
     108  size_t i = energies->size()-1;
     109  if (energy >= (*energies)[i]) return (*data)[i];
     110
     111  return algorithm->Calculate(energy, FindLowerBound(energy), *energies, *data);
     112}
     113
     114
     115void G4EMDataSet::PrintData(void) const
     116{
     117  if (!energies)
     118    {
     119      G4cout << "Data not available." << G4endl;
     120    }
    294121  else
    295    lowerBound = midBin+1;
    296  }
    297  
    298  return upperBound;
    299 }
    300 
    301 
    302 
    303 
    304 
    305 G4String                                        G4EMDataSet :: FullFileName(const G4String & argFileName) const
    306 {
    307  char* path = getenv("G4LEDATA");
    308  if (!path)
    309   G4Exception("G4EMDataSet::FullFileName - G4LEDATA environment variable not set");
    310  
    311  std::ostringstream fullFileName;
    312  
    313  fullFileName << path << '/' << argFileName << z << ".dat";
     122    {
     123      size_t size = energies->size();
     124      for (size_t i(0); i<size; i++)
     125        {
     126          G4cout << "Point: " << ((*energies)[i]/unitEnergies)
     127                 << " - Data value: " << ((*data)[i]/unitData);
     128          if (pdf != 0) G4cout << " - PDF : " << (*pdf)[i];
     129          G4cout << G4endl;
     130        }
     131    }
     132}
     133
     134
     135void G4EMDataSet::SetEnergiesData(G4DataVector* dataX,
     136                                  G4DataVector* dataY,
     137                                  G4int /* componentId */)
     138{
     139  if (energies) delete energies;
     140  energies = dataX;
     141
     142  if (data) delete data;
     143  data = dataY;
     144 
     145  if ((energies == 0) ^ (data==0))
     146    G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data (zero case)");
     147
     148  if (energies == 0) return;
     149 
     150  if (energies->size() != data->size())
     151    G4Exception("G4EMDataSet::SetEnergiesData - different size for energies and data");
     152}
     153
     154G4bool G4EMDataSet::LoadData(const G4String& fileName)
     155{
     156  // The file is organized into two columns:
     157  // 1st column is the energy
     158  // 2nd column is the corresponding value
     159  // The file terminates with the pattern: -1   -1
     160  //                                       -2   -2
     161 
     162  G4String fullFileName(FullFileName(fileName));
     163  std::ifstream in(fullFileName);
     164
     165  if (!in.is_open())
     166    {
     167      G4String message("G4EMDataSet::LoadData - data file \"");
     168      message += fullFileName;
     169      message += "\" not found";
     170      G4Exception(message);
     171    }
     172
     173  G4DataVector* argEnergies=new G4DataVector;
     174  G4DataVector* argData=new G4DataVector;
     175
     176  G4double a;
     177  bool energyColumn(true);
     178
     179  do
     180    {
     181      in >> a;
     182 
     183      if (a!=-1 && a!=-2)
     184        {
     185          if (energyColumn)
     186            argEnergies->push_back(a*unitEnergies);
     187          else
     188            argData->push_back(a*unitData);
     189          energyColumn=(!energyColumn);
     190        }
     191    }
     192  while (a != -2);
     193 
     194  SetEnergiesData(argEnergies, argData, 0);
     195  if (randomSet) BuildPdf();
     196 
     197  return true;
     198}
     199
     200G4bool G4EMDataSet::SaveData(const G4String& name) const
     201{
     202  // The file is organized into two columns:
     203  // 1st column is the energy
     204  // 2nd column is the corresponding value
     205  // The file terminates with the pattern: -1   -1
     206  //                                       -2   -2
     207 
     208  G4String fullFileName(FullFileName(name));
     209  std::ofstream out(fullFileName);
     210
     211  if (!out.is_open())
     212    {
     213      G4String message("G4EMDataSet::SaveData - cannot open \"");
     214      message+=fullFileName;
     215      message+="\"";
     216      G4Exception(message);
     217    }
     218 
     219  out.precision(10);
     220  out.width(15);
     221  out.setf(std::ofstream::left);
     222 
     223  if (energies!=0 && data!=0)
     224    {
     225      G4DataVector::const_iterator i(energies->begin());
     226      G4DataVector::const_iterator endI(energies->end());
     227      G4DataVector::const_iterator j(data->begin());
     228 
     229      while (i!=endI)
     230        {
     231          out.precision(10);
     232          out.width(15);
     233          out.setf(std::ofstream::left);
     234          out << ((*i)/unitEnergies) << ' ';
     235
     236          out.precision(10);
     237          out.width(15);
     238          out.setf(std::ofstream::left);
     239          out << ((*j)/unitData) << std::endl;
     240
     241          i++;
     242          j++;
     243        }
     244    }
     245 
     246  out.precision(10);
     247  out.width(15);
     248  out.setf(std::ofstream::left);
     249  out << -1.f << ' ';
     250
     251  out.precision(10);
     252  out.width(15);
     253  out.setf(std::ofstream::left);
     254  out << -1.f << std::endl;
     255
     256  out.precision(10);
     257  out.width(15);
     258  out.setf(std::ofstream::left);
     259  out << -2.f << ' ';
     260
     261  out.precision(10);
     262  out.width(15);
     263  out.setf(std::ofstream::left);
     264  out << -2.f << std::endl;
     265
     266  return true;
     267}
     268
     269size_t G4EMDataSet::FindLowerBound(G4double x) const
     270{
     271  size_t lowerBound = 0;
     272  size_t upperBound(energies->size() - 1);
     273 
     274  while (lowerBound <= upperBound)
     275    {
     276      size_t midBin((lowerBound + upperBound) / 2);
     277
     278      if (x < (*energies)[midBin]) upperBound = midBin - 1;
     279      else lowerBound = midBin + 1;
     280    }
     281 
     282  return upperBound;
     283}
     284
     285
     286size_t G4EMDataSet::FindLowerBound(G4double x, G4DataVector* values) const
     287{
     288  size_t lowerBound = 0;;
     289  size_t upperBound(values->size() - 1);
     290 
     291  while (lowerBound <= upperBound)
     292    {
     293      size_t midBin((lowerBound + upperBound) / 2);
     294
     295      if (x < (*values)[midBin]) upperBound = midBin - 1;
     296      else lowerBound = midBin + 1;
     297    }
     298 
     299  return upperBound;
     300}
     301
     302
     303G4String G4EMDataSet::FullFileName(const G4String& name) const
     304{
     305  char* path = getenv("G4LEDATA");
     306  if (!path)
     307    G4Exception("G4EMDataSet::FullFileName - G4LEDATA environment variable not set");
     308 
     309  std::ostringstream fullFileName;
     310  fullFileName << path << '/' << name << z << ".dat";
    314311                     
    315  return G4String(fullFileName.str().c_str());
    316 }
     312  return G4String(fullFileName.str().c_str());
     313}
     314
     315
     316void G4EMDataSet::BuildPdf()
     317{
     318  pdf = new G4DataVector;
     319  G4Integrator <G4EMDataSet, G4double(G4EMDataSet::*)(G4double)> integrator;
     320
     321  G4int nData = data->size();
     322  pdf->push_back(0.);
     323
     324  // Integrate the data distribution
     325  G4int i;
     326  G4double totalSum = 0.;
     327  for (i=1; i<nData; i++)
     328    {
     329      G4double xLow = (*energies)[i-1];
     330      G4double xHigh = (*energies)[i];
     331      G4double sum = integrator.Legendre96(this, &G4EMDataSet::IntegrationFunction, xLow, xHigh);
     332      totalSum = totalSum + sum;
     333      pdf->push_back(totalSum);
     334    }
     335
     336  // Normalize to the last bin
     337  G4double tot = 0.;
     338  if (totalSum > 0.) tot = 1. / totalSum;
     339  for (i=1;  i<nData; i++)
     340    {
     341      (*pdf)[i] = (*pdf)[i] * tot;
     342    }
     343}
     344
     345
     346G4double G4EMDataSet::RandomSelect(G4int /* componentId */) const
     347{
     348  // Random select a X value according to the cumulative probability distribution
     349  // derived from the data
     350
     351  if (!pdf) G4Exception("G4EMDataSet::RandomSelect - PDF has not been created for this data set");
     352
     353  G4double value = 0.;
     354  G4double x = G4UniformRand();
     355
     356  // Locate the random value in the X vector based on the PDF
     357  size_t bin = FindLowerBound(x,pdf);
     358
     359  // Interpolate the PDF to calculate the X value:
     360  // linear interpolation in the first bin (to avoid problem with 0),
     361  // interpolation with associated data set algorithm in other bins
     362
     363  G4LinInterpolation linearAlgo;
     364  if (bin == 0) value = linearAlgo.Calculate(x, bin, *pdf, *energies);
     365  else value = algorithm->Calculate(x, bin, *pdf, *energies);
     366
     367  //  G4cout << x << " random bin "<< bin << " - " << value << G4endl;
     368  return value;
     369}
     370
     371G4double G4EMDataSet::IntegrationFunction(G4double x)
     372{
     373  // This function is needed by G4Integrator to calculate the integral of the data distribution
     374
     375  G4double y = 0;
     376
     377 // Locate the random value in the X vector based on the PDF
     378  size_t bin = FindLowerBound(x);
     379
     380  // Interpolate to calculate the X value:
     381  // linear interpolation in the first bin (to avoid problem with 0),
     382  // interpolation with associated algorithm in other bins
     383
     384  G4LinInterpolation linearAlgo;
     385 
     386  if (bin == 0) y = linearAlgo.Calculate(x, bin, *energies, *data);
     387  else y = algorithm->Calculate(x, bin, *energies, *data);
     388 
     389  return y;
     390}
     391
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateChargeDecrease.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateChargeDecrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateChargeDecrease.cc,v 1.4 2009/01/20 07:50:28 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateChargeDecrease.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 //#include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4SystemOfUnits.hh"
    61 //#include "G4ParticleMomentum.hh"
    62 #include "G4DNAGenericIonsManager.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateChargeDecrease::G4FinalStateChargeDecrease()
    6534{
    66   name = "ChargeDecrease";
    6735  lowEnergyLimit = 1 * keV;
    6836  highEnergyLimit = 10 * MeV;
    6937}
    7038
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7140
    7241G4FinalStateChargeDecrease::~G4FinalStateChargeDecrease()
    7342{}
    7443 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7545
    7646const G4FinalStateProduct& G4FinalStateChargeDecrease::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    7747{
    78   // Clear previous secondaries, energy deposit and particle kill status
    7948  product.Clear();
    8049
     
    9564 
    9665  if (outK<0)
    97     {
    98       G4String message;
    99       message="ChargeDecreaseDingfelder::GenerateFinalState - Final kinetic energy is below 0! Process ";
    100       G4Exception(message);
    101     }
     66  {
     67    G4String message;
     68    message="ChargeDecreaseDingfelder::GenerateFinalState - Final kinetic energy is below 0! Process ";
     69    G4Exception(message);
     70  }
    10271 
    103   // Primary particle
     72  //SI - Added protection against total energy deposit
     73  product.DoNotDepositEnergy();
     74  //
    10475  product.KillPrimaryParticle();
     76
    10577  product.AddEnergyDeposit(waterBindingEnergy);
    106  
    107   //Secondary particle
     78
    10879  G4DynamicParticle* aSecondary = new G4DynamicParticle(OutgoingParticleDefinition(definition, finalStateIndex),
    10980                                                        track.GetDynamicParticle()->GetMomentumDirection(),
     
    11485  return product;
    11586}
     87
     88//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11689
    11790G4int G4FinalStateChargeDecrease::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
     
    12598 
    12699  if (particleDefinition == instance->GetIon("alpha++") )
    127     {
    128       if (finalStateIndex==0)  return 1;
    129       return 2;   
    130     }
     100  {
     101    if (finalStateIndex==0)  return 1;
     102    return 2;   
     103  }
    131104 
    132105  if (particleDefinition == instance->GetIon("alpha+") ) return 1;
     
    135108}
    136109
     110//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    137111
    138112G4ParticleDefinition* G4FinalStateChargeDecrease::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition,
     
    144118 
    145119  if (particleDefinition == instance->GetIon("alpha++") )
    146     {
    147       if (finalStateIndex == 0) return instance->GetIon("alpha+");
    148 
    149       return instance->GetIon("helium");   
    150     }
     120  {
     121    if (finalStateIndex == 0) return instance->GetIon("alpha+");
     122    return instance->GetIon("helium");   
     123  }
    151124 
    152125  if (particleDefinition == instance->GetIon("alpha+") ) return instance->GetIon("helium");   
     
    155128}
    156129
     130//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    157131
    158132G4double G4FinalStateChargeDecrease::WaterBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
     
    168142
    169143  if (particleDefinition == instance->GetIon("alpha++") )
    170     {
     144  {
    171145      // Binding energy for    W+ -> W++ + e-    10.79 eV
    172146      // Binding energy for    W  -> W+  + e-    10.79 eV
     
    178152 
    179153      return 10.79*2*eV;
    180     }
     154  }
    181155
    182156  if (particleDefinition == instance->GetIon("alpha+") )
    183     {
     157  {
    184158      // Binding energy for    W+ -> W++ + e-    10.79 eV
    185159      // Binding energy for    W  -> W+  + e-    10.79 eV
     
    189163
    190164      return 10.79*eV;
    191     }
     165  }
    192166 
    193167  return 0;
    194168}
    195169
     170//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    196171
    197172G4double G4FinalStateChargeDecrease::OutgoingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
     
    203178
    204179  if (particleDefinition == instance->GetIon("alpha++") )
    205     {
     180  {
    206181      // Binding energy for    He+ -> He++ + e-    54.509 eV
    207182      // Binding energy for    He  -> He+  + e-    24.587 eV
     
    210185     
    211186      return (54.509 + 24.587)*eV;
    212     }
     187  }
    213188 
    214189  if (particleDefinition == instance->GetIon("alpha+") )
    215     {
     190  {
    216191      // Binding energy for    He+ -> He++ + e-    54.509 eV
    217192      // Binding energy for    He  -> He+  + e-    24.587 eV
    218193     
    219194      return 24.587*eV;
    220    
     195 
    221196 
    222197  return 0;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateChargeIncrease.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateChargeIncrease.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateChargeIncrease.cc,v 1.4 2009/01/20 07:50:28 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateChargeIncrease.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    57 #include "G4Electron.hh"
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4SystemOfUnits.hh"
    61 #include "G4ParticleMomentum.hh"
    62 #include "G4DNAGenericIonsManager.hh"
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateChargeIncrease::G4FinalStateChargeIncrease()
    6534{
    66   name = "ChargeIncrease";
    6735  lowEnergyLimit = 1 * keV;
    6836  highEnergyLimit = 10 * MeV;
    6937}
    7038
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7140
    7241G4FinalStateChargeIncrease::~G4FinalStateChargeIncrease()
    7342{}
    7443 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7545
    7646const G4FinalStateProduct& G4FinalStateChargeIncrease::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    7747{
    78   // Clear previous secondaries, energy deposit and particle kill status
    7948  product.Clear();
    8049
    81   // Primary particle
     50  //SI - Added protection against total energy deposit
     51  product.DoNotDepositEnergy();
     52  //
    8253  product.KillPrimaryParticle();
    8354  product.AddEnergyDeposit(0.);
     55
    8456  G4ParticleDefinition* definition = track.GetDefinition();
    8557 
    86   // Secondaries
    8758  G4double inK = track.GetDynamicParticle()->GetKineticEnergy();
    8859 
     
    10071 
    10172  if (outK<0)
    102     {
    103       G4String message;
    104       message="G4FinalStateChargeIncrease - Final kinetic energy is below 0! Process ";
    105     }
     73  {
     74    G4String message;
     75    message="G4FinalStateChargeIncrease - Final kinetic energy is below 0! Process ";
     76  }
    10677 
    10778  product.AddSecondary(new G4DynamicParticle(OutgoingParticleDefinition(definition,finalStateIndex),
     
    11283 
    11384  while (n>0)
    114     {
    115       n--;
    116    
    117       product.AddSecondary
     85  {
     86    n--;
     87    product.AddSecondary
    11888        (new G4DynamicParticle(G4Electron::Electron(), track.GetDynamicParticle()->GetMomentumDirection(), electronK));
    119     }
     89  }
    12090       
    12191  return product;
    12292}
     93
     94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    12395
    12496G4int G4FinalStateChargeIncrease::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
     
    132104 
    133105  if (particleDefinition == instance->GetIon("helium"))
    134     {    if (finalStateIndex==0) return 2;
    135     return 3;
    136     }
     106  {    if (finalStateIndex==0) return 2;
     107       return 3;
     108  }
    137109  return 0;
    138110}
    139111
     112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    140113
    141114G4ParticleDefinition*  G4FinalStateChargeIncrease::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition,
     
    163136 
    164137  if(particleDefinition == instance->GetIon("alpha+"))
    165     {
     138  {
    166139      // Binding energy for    He+ -> He++ + e-    54.509 eV
    167140      // Binding energy for    He  -> He+  + e-    24.587 eV
    168141      return 54.509*eV;
    169     }
     142  }
    170143   
    171144  if(particleDefinition == instance->GetIon("helium"))
    172     {
     145  {
    173146      // Binding energy for    He+ -> He++ + e-    54.509 eV
    174147      // Binding energy for    He  -> He+  + e-    24.587 eV
     
    176149      if (finalStateIndex==0) return 24.587*eV;
    177150      return (54.509 + 24.587)*eV;
    178    
     151 
    179152
    180153  return 0;
    181154}
    182 
    183 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateElasticBrennerZaider.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateElasticBrennerZaider.cc,v 1.1 2007/10/12 23:11:41 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateElasticBrennerZaider.cc,v 1.8 2008/12/05 11:58:16 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateElasticBrennerZaider.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4Electron.hh"
    61 #include "G4SystemOfUnits.hh"
    62 #include "G4ParticleMomentum.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateElasticBrennerZaider::G4FinalStateElasticBrennerZaider()
    6534{
    66   // These data members will be used in the next implementation iteration,
    67   // when the enriched PhysicsModel policy is implemented
    68   name = "FinalStateElasticBrennerZaider";
    69   lowEnergyLimit = 7.4 * eV;
    70   highEnergyLimit = 10 * MeV;
     35  lowEnergyLimit = 8.23 * eV; // SI : i/o of 7.4 * eV;
     36  highEnergyLimit = 200 * eV;
    7137
    7238  betaCoeff.push_back(7.51525);
     
    10066}
    10167
     68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    10269
    10370G4FinalStateElasticBrennerZaider::~G4FinalStateElasticBrennerZaider()
    104 {
    105   // empty
    106   // G4DynamicParticle objects produced are owned by client
    107 }
    108  
     71{}
     72
     73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    10974
    11075const G4FinalStateProduct& G4FinalStateElasticBrennerZaider::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    11176{
    112   // Clear previous secondaries, energy deposit and particle kill status
    11377  product.Clear();
    11478
    115   // Kinetic energy of primary particle
    11679  G4double k = track.GetDynamicParticle()->GetKineticEnergy();
     80 
     81  if ( k>= lowEnergyLimit && k<=highEnergyLimit )
     82  {
     83    G4double cosTheta = RandomizeCosTheta(k);
     84 
     85    G4double phi = 2. * pi * G4UniformRand();
    11786
    118   // Assume material = water; H2O number of electrons
    119   // ---- MGP ---- To be generalized later
    120   // const G4int z = 10;
     87    G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection();
     88    G4ThreeVector xVers = zVers.orthogonal();
     89    G4ThreeVector yVers = zVers.cross(xVers);
    12190
    122   G4double cosTheta = RandomizeCosTheta(k);
     91    G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
     92    G4double yDir = xDir;
     93    xDir *= std::cos(phi);
     94    yDir *= std::sin(phi);
     95
     96    G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
     97
     98    product.ModifyPrimaryParticle(zPrimeVers,k);
     99  }
     100
     101  if (k<lowEnergyLimit)
     102  {
     103    product.KillPrimaryParticle();
     104  }
    123105 
    124   G4double phi = 2. * pi * G4UniformRand();
    125 
    126   // G4cout << "cosTheta in GenerateFinalState = " << cosTheta << ", phi = " << phi << G4endl;
    127 
    128   G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection();
    129   G4ThreeVector xVers = zVers.orthogonal();
    130   G4ThreeVector yVers = zVers.cross(xVers);
    131 
    132   G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
    133   G4double yDir = xDir;
    134   xDir *= std::cos(phi);
    135   yDir *= std::sin(phi);
    136 
    137   // G4cout << "xDir, yDir = " << xDir <<", " << yDir << G4endl;
    138 
    139   // G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers).unit());
    140   G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
    141 
    142   // G4cout << "zPrimeVers = (" << zPrimeVers.x() << ", "<< zPrimeVers.y() << ", "<< zPrimeVers.z() << ") " << G4endl;
    143 
    144   //  product.ModifyPrimaryParticle(zPrimeVers.x(),zPrimeVers.y(),zPrimeVers.z(),k);
    145   product.ModifyPrimaryParticle(zPrimeVers,k);
    146 
    147   //  this->aParticleChange.ProposeEnergy(k);
    148   //  this->aParticleChange.ProposeMomentumDirection(zPrimeVers);
    149   //  this->aParticleChange.SetNumberOfSecondaries(0);
    150 
    151106  return product;
    152107}
     108
     109//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    153110
    154111G4double G4FinalStateElasticBrennerZaider::RandomizeCosTheta(G4double k)
     
    158115  //   d Omega           (1 + 2 gamma(K) - cos(theta))^2     (1 + 2 delta(K) + cos(theta))^2
    159116  //
    160   // Maximum is < 1/(4 gamma(K)^2) + beta(K)/(4 delta(K)^2)
     117  // Maximum is < 1/(4 gamma(K)^2) + beta(K)/((2+2delta(K))^2)
    161118  //
    162119  // Phys. Med. Biol. 29 N.4 (1983) 443-447
    163120 
    164121  // gamma(K), beta(K) and delta(K) are polynomials with coefficients for energy measured in eV
     122
    165123  k /= eV;
    166124 
    167125  G4double beta = std::exp(CalculatePolynomial(k,betaCoeff));
    168126  G4double delta = std::exp(CalculatePolynomial(k,deltaCoeff));
     127  G4double gamma;
    169128 
    170   G4double gamma;
    171129  if (k > 100.)
    172     {
    173       gamma = CalculatePolynomial(k, gamma100_200Coeff); // Only in this case it is not the exponent of the polynomial
    174     } 
     130  {
     131      gamma = CalculatePolynomial(k, gamma100_200Coeff);
     132      // Only in this case it is not the exponent of the polynomial
     133  } 
    175134  else
    176     {
     135  {
     136      if (k>10)
     137      {
     138          gamma = std::exp(CalculatePolynomial(k, gamma10_100Coeff));
     139      }
     140      else
     141      {
     142          gamma = std::exp(CalculatePolynomial(k, gamma035_10Coeff));
     143      }
     144  }
    177145
    178       if (k>10)
    179         {
    180           gamma = std::exp(CalculatePolynomial(k, gamma10_100Coeff));
    181         }
    182       else
    183         {
    184           gamma = std::exp(CalculatePolynomial(k, gamma035_10Coeff));
    185         }
    186     }
    187  
    188   // G4cout << "beta = " << beta << ", gamma = " << gamma << ", delta = " << delta << G4endl;
    189 
    190   G4double oneOverMax = 1. / (1./(4.*gamma*gamma) + beta/(4.*delta*delta));
     146  G4double oneOverMax = 1. / (1./(4.*gamma*gamma) + beta/( (2.+2.*delta)*(2.+2.*delta) ));
    191147 
    192148  G4double cosTheta = 0.;
     
    196152 
    197153  do
    198     {
     154  {
    199155      cosTheta = 2. * G4UniformRand() - 1.;
    200       leftDenominator = (1 + 2.*gamma - cosTheta);
    201       rightDenominator = (1 + 2.*delta + cosTheta);
    202       fCosTheta = oneOverMax * (1./(leftDenominator*leftDenominator) + beta/(rightDenominator*rightDenominator));
    203     }
     156      leftDenominator = (1. + 2.*gamma - cosTheta);
     157      rightDenominator = (1. + 2.*delta + cosTheta);
     158      if ( (leftDenominator * rightDenominator) != 0. )
     159      {
     160          fCosTheta = oneOverMax * (1./(leftDenominator*leftDenominator) + beta/(rightDenominator*rightDenominator));
     161      }
     162  }
    204163  while (fCosTheta < G4UniformRand());
    205164
    206   //  G4cout << "cosTheta = " << cosTheta << G4endl;
    207  
    208165  return cosTheta;
    209166}
     167
     168//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    210169
    211170G4double G4FinalStateElasticBrennerZaider::CalculatePolynomial(G4double k, std::vector<G4double>& vec)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateElasticScreenedRutherford.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateElasticScreenedRutherford.cc,v 1.2 2007/10/12 23:10:33 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateElasticScreenedRutherford.cc,v 1.4 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateElasticScreenedRutherford.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4Electron.hh"
    61 #include "G4SystemOfUnits.hh"
    62 #include "G4ParticleMomentum.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateElasticScreenedRutherford::G4FinalStateElasticScreenedRutherford()
    6534{
    66   // These data members will be used in the next implementation iteration,
    67   // when the enriched PhysicsModel policy is implemented
    68   name = "FinalStateElasticScreenedRutherford";
    69   lowEnergyLimit = 7.4 * eV;
     35  lowEnergyLimit = 200 * eV;
    7036  highEnergyLimit = 10 * MeV;
    7137}
    7238
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7340
    7441G4FinalStateElasticScreenedRutherford::~G4FinalStateElasticScreenedRutherford()
    75 {
    76   // empty
    77   // G4DynamicParticle objects produced are owned by client
    78 }
     42{}
    7943 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    8045
    81 const G4FinalStateProduct& G4FinalStateElasticScreenedRutherford::GenerateFinalState(const G4Track& track, const G4Step& step)
     46const G4FinalStateProduct& G4FinalStateElasticScreenedRutherford::GenerateFinalState(const G4Track& track, const G4Step& )
    8247{
    83   // Clear previous secondaries, energy deposit and particle kill status
    8448  product.Clear();
    8549
    86   // Kinetic energy of primary particle
    8750  G4double k = track.GetDynamicParticle()->GetKineticEnergy();
    8851
    89   // Assume material = water; H2O number of electrons
    90   // ---- MGP ---- To be generalized later
    9152  const G4int z = 10;
    9253
     
    9455 
    9556  G4double phi = 2. * pi * G4UniformRand();
    96 
    97   // G4cout << "cosTheta in GenerateFinalState = " << cosTheta << ", phi = " << phi << G4endl;
    9857
    9958  G4ThreeVector zVers = track.GetDynamicParticle()->GetMomentumDirection();
     
    10665  yDir *= std::sin(phi);
    10766
    108   // G4cout << "xDir, yDir = " << xDir <<", " << yDir << G4endl;
    109 
    110   // G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers).unit());
    11167  G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
    11268
    113   // G4cout << "zPrimeVers = (" << zPrimeVers.x() << ", "<< zPrimeVers.y() << ", "<< zPrimeVers.z() << ") " << G4endl;
    114 
    115   //  product.ModifyPrimaryParticle(zPrimeVers.x(),zPrimeVers.y(),zPrimeVers.z(),k);
    11669  product.ModifyPrimaryParticle(zPrimeVers,k);
    117 
    118   //  this->aParticleChange.ProposeEnergy(k);
    119   //  this->aParticleChange.ProposeMomentumDirection(zPrimeVers);
    120   //  this->aParticleChange.SetNumberOfSecondaries(0);
    12170
    12271  return product;
    12372}
     73
     74//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    12475
    12576G4double G4FinalStateElasticScreenedRutherford::RandomizeCosTheta(G4double k, G4int z) const
     
    14495
    14596 do
    146    {
    147      cosTheta = 2. * G4UniformRand() - 1.;
    148      fCosTheta = (1 + 2.*n - cosTheta);
    149      fCosTheta = oneOverMax / (fCosTheta*fCosTheta);
    150    }
     97 {
     98   cosTheta = 2. * G4UniformRand() - 1.;
     99   fCosTheta = (1 + 2.*n - cosTheta);
     100   fCosTheta = oneOverMax / (fCosTheta*fCosTheta);
     101 }
    151102 while (fCosTheta < G4UniformRand());
    152103 
    153104 return cosTheta;
    154105}
     106
     107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    155108
    156109G4double G4FinalStateElasticScreenedRutherford::ScreeningFactor(G4double k, G4int z) const
     
    180133  G4double result = 0.;
    181134  if (denominator != 0.)
    182     {
    183       result = numerator / denominator;
    184     }
     135  {
     136    result = numerator / denominator;
     137  }
    185138  else
    186     {
    187       // Throw an exception
    188       G4Exception("G4FinalStateElasticScreenedRutherford::ScreeningFactor - denominator = 0");
    189     }
     139  {
     140    G4Exception("G4FinalStateElasticScreenedRutherford::ScreeningFactor - denominator = 0");
     141  }
    190142  return result;
    191 
    192143}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationBorn.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationBorn.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationBorn.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateExcitationBorn.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4Electron.hh"
    61 #include "G4SystemOfUnits.hh"
    62 #include "G4ParticleMomentum.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateExcitationBorn::G4FinalStateExcitationBorn()
    6534{
    66   name = "FinalStateExcitationBorn";
    67   lowEnergyLimit = 7.4 * eV;
     35  lowEnergyLimit = 500 * keV;
    6836  highEnergyLimit = 10 * MeV;
    6937}
    7038
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7140
    7241G4FinalStateExcitationBorn::~G4FinalStateExcitationBorn()
    73 {
    74   // empty
    75   // G4DynamicParticle objects produced are owned by client
    76 }
    77  
     42{}
     43
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7845
    7946const G4FinalStateProduct& G4FinalStateExcitationBorn::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    8047{
    81   // Clear previous secondaries, energy deposit and particle kill status
    8248  product.Clear();
    8349
    8450  const G4DynamicParticle* particle = track.GetDynamicParticle();
    8551
    86   // Kinetic energy of primary particle
    8752  G4double k = particle->GetKineticEnergy();
    8853
    89   // Select excitation level on the basis of partial excitation cross section
    9054  G4int level = cross.RandomSelect(k);
    91   // Excitation energy corresponding to the selected level
    9255  G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
    9356  G4double newEnergy = k - excitationEnergy;
    9457 
    95   if (newEnergy > lowEnergyLimit)
    96     {
    97       // Deposit excitation energy locally, modify primary energy accordingly
    98       // Particle direction is unchanged
    99       product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy);
    100       product.AddEnergyDeposit(excitationEnergy);
    101     }
    102   else
    103     {
    104       // Primary particle is killed
    105       product.KillPrimaryParticle();
    106     }
     58  if (newEnergy > 0)
     59  {
     60    product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy);
     61    product.AddEnergyDeposit(excitationEnergy);
     62  }
    10763
    10864  return product;
    10965}
    11066
    111 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationEmfietzoglou.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationEmfietzoglou.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationEmfietzoglou.cc,v 1.5 2008/12/05 11:58:16 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateExcitationEmfietzoglou.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4Electron.hh"
    61 #include "G4SystemOfUnits.hh"
    62 #include "G4ParticleMomentum.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateExcitationEmfietzoglou::G4FinalStateExcitationEmfietzoglou()
    6534{
    66   name = "FinalStateExcitationEmfietzoglou";
    67   lowEnergyLimit = 7.4 * eV;
     35  lowEnergyLimit = 8.23 * eV;
    6836  highEnergyLimit = 10 * MeV;
    6937}
    7038
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7140
    7241G4FinalStateExcitationEmfietzoglou::~G4FinalStateExcitationEmfietzoglou()
    73 {
    74   // empty
    75   // G4DynamicParticle objects produced are owned by client
    76 }
     42{}
    7743 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7845
    7946const G4FinalStateProduct& G4FinalStateExcitationEmfietzoglou::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    8047{
    81   // Clear previous secondaries, energy deposit and particle kill status
    8248  product.Clear();
    8349
    8450  const G4DynamicParticle* particle = track.GetDynamicParticle();
    8551
    86   // Kinetic energy of primary particle
    8752  G4double k = particle->GetKineticEnergy();
    8853
    89   // Select excitation level on the basis of partial excitation cross section
    9054  G4int level = cross.RandomSelect(k);
    91   // Excitation energy corresponding to the selected level
     55
    9256  G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
    9357  G4double newEnergy = k - excitationEnergy;
    9458 
    95   if (newEnergy > lowEnergyLimit)
    96     {
    97       // Deposit excitation energy locally, modify primary energy accordingly
    98       // Particle direction is unchanged
     59  if (newEnergy >= lowEnergyLimit)
     60  {
    9961      product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy);
    10062      product.AddEnergyDeposit(excitationEnergy);
    101     }
    102   else
    103     {
    104       // Primary particle is killed
    105       product.KillPrimaryParticle();
    106     }
     63  }
     64 
     65  else product.KillPrimaryParticle();
    10766
    10867  return product;
    10968}
    11069
    111 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateExcitationMillerGreen.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateExcitationMillerGreen.cc,v 1.2 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
    32 // Reference: TNS Geant4-DNA paper
    33 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    34 
    35 // History:
    36 // -----------
    37 // Date         Name              Modification
    38 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    39 //
    40 // -------------------------------------------------------------------
    41 
    42 // Class description:
    43 // Reference: TNS Geant4-DNA paper
    44 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    45 // design foundation and implementation of the first set of models,
    46 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    47 // Further documentation available from http://www.ge.infn.it/geant4/dna
    48 
    49 // -------------------------------------------------------------------
    50 
     26// $Id: G4FinalStateExcitationMillerGreen.cc,v 1.3 2008/07/14 20:47:34 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5128
    5229#include "G4FinalStateExcitationMillerGreen.hh"
    53 #include "G4Track.hh"
    54 #include "G4Step.hh"
    55 #include "G4DynamicParticle.hh"
    56 #include "Randomize.hh"
    5730
    58 #include "G4ParticleTypes.hh"
    59 #include "G4ParticleDefinition.hh"
    60 #include "G4Electron.hh"
    61 #include "G4SystemOfUnits.hh"
    62 #include "G4ParticleMomentum.hh"
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6332
    6433G4FinalStateExcitationMillerGreen::G4FinalStateExcitationMillerGreen()
    6534{
    66   name = "ExcitationMillerGreen";
    6735  lowEnergyLimit = 10 * eV;
    6836  highEnergyLimit = 10 * MeV;
    6937}
    7038
     39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7140
    7241G4FinalStateExcitationMillerGreen::~G4FinalStateExcitationMillerGreen()
    7342{}
    7443 
     44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7545
    7646const G4FinalStateProduct& G4FinalStateExcitationMillerGreen::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    7747{
    78   // Clear previous secondaries, energy deposit and particle kill status
    7948  product.Clear();
    8049
    8150  const G4DynamicParticle* particle = track.GetDynamicParticle();
    8251
    83   // Kinetic energy of primary particle
    8452  G4double k = particle->GetKineticEnergy();
    8553
    86   // Select excitation level on the basis of partial excitation cross section
    8754  G4int level = cross.RandomSelect(k,track.GetDefinition());
    88   // Excitation energy corresponding to the selected level
    8955  G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
    9056  G4double newEnergy = k - excitationEnergy;
    9157 
    92   // ---- SI ---- Test on newEnergy
    9358  if (newEnergy > 0)
    94     {
    95       // Deposit excitation energy locally, modify primary energy accordingly
    96       // Particle direction is unchanged
    97       product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy);
    98       product.AddEnergyDeposit(excitationEnergy);
    99     }
    100 
    101   // ---- SI ---- Particle is not modified by default otherwise
    102 /*
    103   else
    104     {
    105       // Primary particle is killed
    106       product.KillPrimaryParticle();
    107     }
    108 */
     59  {
     60    product.ModifyPrimaryParticle(particle->GetMomentumDirection(),newEnergy);
     61    product.AddEnergyDeposit(excitationEnergy);
     62  }
    10963
    11064  return product;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateIonisationBorn.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateIonisationBorn.cc,v 1.9 2007/11/26 17:27:09 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Sebastien Incerti (incerti@cenbg.in2p3.fr)
    31 //                 Maria Grazia Pia  (Maria.Grazia.Pia@cern.ch)
    32 //
    33 // Reference: TNS Geant4-DNA paper
    34 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    35 
    36 // History:
    37 // -----------
    38 // Date         Name              Modification
    39 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    40 //    Nov 2007  S. Incerti        Implementation
    41 // 26 Nov 2007  MGP               Cleaned up std::
    42 //
    43 // -------------------------------------------------------------------
    44 
    45 // Class description:
    46 // Reference: TNS Geant4-DNA paper
    47 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    48 // design foundation and implementation of the first set of models,
    49 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    50 // Further documentation available from http://www.ge.infn.it/geant4/dna
    51 
    52 // -------------------------------------------------------------------
    53 
     26// $Id: G4FinalStateIonisationBorn.cc,v 1.16 2008/12/06 13:47:12 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5428
    5529#include "G4FinalStateIonisationBorn.hh"
    56 #include "G4Track.hh"
    57 #include "G4Step.hh"
    58 #include "G4DynamicParticle.hh"
    59 #include "Randomize.hh"
    60 
    61 #include "G4ParticleTypes.hh"
    62 #include "G4ParticleDefinition.hh"
    63 #include "G4Electron.hh"
    64 #include "G4Proton.hh"
    65 #include "G4SystemOfUnits.hh"
    66 #include "G4ParticleMomentum.hh"
    67 
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6832
    6933G4FinalStateIonisationBorn::G4FinalStateIonisationBorn()
    7034{
    71 
    72   name = "IonisationBorn";
    73 
    74   // NEW
    75   // Factor to scale microscopic/macroscopic cross section data in water
    76  
    7735  G4double scaleFactor = (1.e-22 / 3.343) * m*m;
    7836
    79   // Energy limits
    8037  G4ParticleDefinition* electronDef = G4Electron::ElectronDefinition();
    8138  G4ParticleDefinition* protonDef = G4Proton::ProtonDefinition();
     
    8441  G4String proton;
    8542
    86   // Default energy limits (defined for protection against anomalous behaviour only)
    87   lowEnergyLimitDefault = 25 * eV;
     43  lowEnergyLimitDefault = 12.61 * eV; // SI: i/o 25 eV
    8844  highEnergyLimitDefault = 10 * MeV;
    8945
     
    9349    G4Exception("G4DNACrossSectionDataSet::FullFileName - G4LEDATA environment variable not set");
    9450
    95   // Data members for electrons
    96 
    9751  if (electronDef != 0)
    98     {
    99       electron = electronDef->GetParticleName();
    100       lowEnergyLimit[electron] = 25. * eV;
    101       highEnergyLimit[electron] = 30. * keV;
    102 
    103       std::ostringstream eFullFileName;
    104       eFullFileName << path << "/dna/sigmadiff_ionisation_e_born.dat";
    105       std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
    106       // eDiffCrossSection(eFullFileName.str().c_str());
    107       if (!eDiffCrossSection)
    108         {
    109           // G4cout << "ERROR OPENING DATA FILE IN ELECTRON BORN IONIZATION !!! " << G4endl;
    110           G4Exception("G4FinalStateIonisationBorn::ERROR OPENING electron DATA FILE");
    111           while(1); // ---- MGP ---- What is this?
    112         }
     52  {
     53    electron = electronDef->GetParticleName();
     54    lowEnergyLimit[electron] = 12.61 * eV; // SI: i/o 25 eV
     55    highEnergyLimit[electron] = 30. * keV;
     56
     57    std::ostringstream eFullFileName;
     58    eFullFileName << path << "/dna/sigmadiff_ionisation_e_born.dat";
     59    std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
     60    if (!eDiffCrossSection)
     61    {
     62      G4Exception("G4FinalStateIonisationBorn::ERROR OPENING electron DATA FILE");
     63    }
    11364     
    114       eTdummyVec.push_back(0.);
    115       while(!eDiffCrossSection.eof())
    116         {
    117           double tDummy;
    118           double eDummy;
    119           eDiffCrossSection>>tDummy>>eDummy;
    120           if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
    121           for (int j=0; j<5; j++)
    122             {
    123               eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
    124               eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
    125               eVecm[tDummy].push_back(eDummy);
    126             }
    127         }
    128 
    129     }
     65    eTdummyVec.push_back(0.);
     66    while(!eDiffCrossSection.eof())
     67    {
     68      double tDummy;
     69      double eDummy;
     70      eDiffCrossSection>>tDummy>>eDummy;
     71      if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
     72      for (int j=0; j<5; j++)
     73      {
     74        eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
     75
     76        // SI - only if eof is not reached !
     77        if (!eDiffCrossSection.eof()) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
     78
     79        eVecm[tDummy].push_back(eDummy);
     80
     81      }
     82    }
     83
     84  }
    13085  else
    131     {
    132       G4Exception("G4FinalStateIonisationBorn Constructor: electron is not defined");
    133     }
    134 
    135   // Data members for protons
     86  {
     87    G4Exception("G4FinalStateIonisationBorn Constructor: electron is not defined");
     88  }
    13689
    13790  if (protonDef != 0)
    138     {
    139       proton = protonDef->GetParticleName();
    140       lowEnergyLimit[proton] = 500. * keV;
    141       highEnergyLimit[proton] = 10. * MeV;
    142 
    143       std::ostringstream pFullFileName;
    144       pFullFileName << path << "/dna/sigmadiff_ionisation_p_born.dat";
    145       std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
    146       //     pDiffCrossSection(pFullFileName.str().c_str());
    147       if (!pDiffCrossSection)
    148         {
    149           // G4cout<<"ERROR OPENING DATA FILE IN PROTON BORN IONIZATION !!! "<<G4endl;
    150           G4Exception("G4FinalStateIonisationBorn::ERROR OPENING proton DATA FILE");
    151           while(1); // ---- MGP ---- What is this?
    152         }
     91  {
     92    proton = protonDef->GetParticleName();
     93    lowEnergyLimit[proton] = 500. * keV;
     94    highEnergyLimit[proton] = 10. * MeV;
     95
     96    std::ostringstream pFullFileName;
     97    pFullFileName << path << "/dna/sigmadiff_ionisation_p_born.dat";
     98    std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
     99    if (!pDiffCrossSection)
     100    {
     101      G4Exception("G4FinalStateIonisationBorn::ERROR OPENING proton DATA FILE");
     102    }
    153103     
    154       pTdummyVec.push_back(0.);
    155       while(!pDiffCrossSection.eof())
    156         {
    157           double tDummy;
    158           double eDummy;
    159           pDiffCrossSection>>tDummy>>eDummy;
    160           if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
    161           for (int j=0; j<5; j++)
    162             {
    163               pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
    164               pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
    165               //G4cout << "j=" << j << " Tdum=" << tDummy << " Edum=" << eDummy << " pDiff=" << pDiffCrossSectionData[j][tDummy][eDummy] << G4endl;
    166               pVecm[tDummy].push_back(eDummy);
    167             }
    168         }
    169     }
     104    pTdummyVec.push_back(0.);
     105    while(!pDiffCrossSection.eof())
     106    {
     107      double tDummy;
     108      double eDummy;
     109      pDiffCrossSection>>tDummy>>eDummy;
     110      if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
     111      for (int j=0; j<5; j++)
     112      {
     113        pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
     114
     115        // SI - only if eof is not reached !
     116        if (!pDiffCrossSection.eof()) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
     117
     118        pVecm[tDummy].push_back(eDummy);
     119      }
     120    }
     121  }
    170122  else
    171     {
    172       G4Exception("G4FinalStateIonisationBorn Constructor: proton is not defined");
    173     }
    174 }
    175 
     123  {
     124    G4Exception("G4FinalStateIonisationBorn Constructor: proton is not defined");
     125  }
     126}
     127
     128//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    176129
    177130G4FinalStateIonisationBorn::~G4FinalStateIonisationBorn()
     
    181134}
    182135
     136//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    183137
    184138const G4FinalStateProduct& G4FinalStateIonisationBorn::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    185139{
    186   // Clear previous secondaries, energy deposit and particle kill status
    187140  product.Clear();
    188141
     
    196149  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    197150
    198   // Retrieve energy limits for the current particle type
    199 
    200151  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    201152  pos1 = lowEnergyLimit.find(particleName);
    202153
    203   // Lower limit
    204154  if (pos1 != lowEnergyLimit.end())
    205     {
    206       lowLim = pos1->second;
    207     }
    208 
    209   // Upper limit
     155  {
     156    lowLim = pos1->second;
     157  }
     158
    210159  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    211160  pos2 = highEnergyLimit.find(particleName);
    212161
    213162  if (pos2 != highEnergyLimit.end())
    214     {
    215       highLim = pos2->second;
    216     }
    217 
    218   // Verify that the current track is within the energy limits of validity of the cross section model
     163  {
     164    highLim = pos2->second;
     165  }
    219166
    220167  if (k >= lowLim && k <= highLim)
    221     {
    222       // Kinetic energy of primary particle
    223 
    224       G4ParticleMomentum primaryDirection = particle->GetMomentumDirection();
    225       G4double particleMass = particle->GetDefinition()->GetPDGMass();
    226       G4double totalEnergy = k + particleMass;
    227       G4double pSquare = k * (totalEnergy + particleMass);
    228       G4double totalMomentum = std::sqrt(pSquare);
    229 
    230       const G4String& particleName = particle->GetDefinition()->GetParticleName();
    231  
    232       G4int ionizationShell = cross.RandomSelect(k,particleName);
    233  
    234       G4double secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
    235  
    236       G4double bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
    237 
    238       G4double cosTheta = 0.;
    239       G4double phi = 0.;
    240       RandomizeEjectedElectronDirection(track.GetDefinition(), k,secondaryKinetic, cosTheta, phi);
    241 
    242       G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta);
    243       G4double dirX = sinTheta*std::cos(phi);
    244       G4double dirY = sinTheta*std::sin(phi);
    245       G4double dirZ = cosTheta;
    246       G4ThreeVector deltaDirection(dirX,dirY,dirZ);
    247       deltaDirection.rotateUz(primaryDirection);
    248 
    249       G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
    250 
    251       //Primary Particle Direction
    252       G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
    253       G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
    254       G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
    255       G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
    256       finalPx /= finalMomentum;
    257       finalPy /= finalMomentum;
    258       finalPz /= finalMomentum;
    259 
    260       product.ModifyPrimaryParticle(finalPx,finalPy,finalPz,k-bindingEnergy-secondaryKinetic);
    261       product.AddEnergyDeposit(bindingEnergy);
    262 
    263       G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic);
    264       product.AddSecondary(aElectron);
    265     }
     168  {
     169    G4ParticleMomentum primaryDirection = particle->GetMomentumDirection();
     170    G4double particleMass = particle->GetDefinition()->GetPDGMass();
     171    G4double totalEnergy = k + particleMass;
     172    G4double pSquare = k * (totalEnergy + particleMass);
     173    G4double totalMomentum = std::sqrt(pSquare);
     174
     175    const G4String& particleName = particle->GetDefinition()->GetParticleName();
     176 
     177    G4int ionizationShell = cross.RandomSelect(k,particleName);
     178 
     179    G4double secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
     180 
     181    G4double bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
     182
     183    G4double cosTheta = 0.;
     184    G4double phi = 0.;
     185    RandomizeEjectedElectronDirection(track.GetDefinition(), k,secondaryKinetic, cosTheta, phi);
     186
     187    G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta);
     188    G4double dirX = sinTheta*std::cos(phi);
     189    G4double dirY = sinTheta*std::sin(phi);
     190    G4double dirZ = cosTheta;
     191    G4ThreeVector deltaDirection(dirX,dirY,dirZ);
     192    deltaDirection.rotateUz(primaryDirection);
     193
     194    G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
     195
     196    G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
     197    G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
     198    G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
     199    G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
     200    finalPx /= finalMomentum;
     201    finalPy /= finalMomentum;
     202    finalPz /= finalMomentum;
     203
     204    product.ModifyPrimaryParticle(finalPx,finalPy,finalPz,k-bindingEnergy-secondaryKinetic);
     205    product.AddEnergyDeposit(bindingEnergy);
     206
     207    G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic);
     208    product.AddSecondary(aElectron);
     209  }
    266210
    267211  return product;
    268212}
    269213
     214//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    270215
    271216G4double G4FinalStateIonisationBorn::RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition,
    272                                                                     G4double k,
    273                                                                     G4int shell)
    274 {
    275 
     217G4double k, G4int shell)
     218{
    276219  if (particleDefinition == G4Electron::ElectronDefinition())
    277     {
    278 
    279       G4double maximumEnergyTransfer=0.;
    280       if ((k+waterStructure.IonisationEnergy(shell))/2. > k) maximumEnergyTransfer=k;
    281       else maximumEnergyTransfer = (k+waterStructure.IonisationEnergy(shell))/2.;
     220  {
     221    G4double maximumEnergyTransfer=0.;
     222    if ((k+waterStructure.IonisationEnergy(shell))/2. > k) maximumEnergyTransfer=k;
     223    else maximumEnergyTransfer = (k+waterStructure.IonisationEnergy(shell))/2.;
    282224   
    283       G4double crossSectionMaximum = 0.;
    284       for(G4double value=waterStructure.IonisationEnergy(shell); value<=maximumEnergyTransfer; value+=0.1*eV)
    285         {
    286           G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
    287           if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
    288         }
     225    G4double crossSectionMaximum = 0.;
     226    for(G4double value=waterStructure.IonisationEnergy(shell); value<=maximumEnergyTransfer; value+=0.1*eV)
     227    {
     228      G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
     229      if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
     230    }
    289231 
    290       G4double secondaryElectronKineticEnergy=0.;
    291       do
    292         {
    293           secondaryElectronKineticEnergy = G4UniformRand() * (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell));
    294         } while(G4UniformRand()*crossSectionMaximum >
     232    G4double secondaryElectronKineticEnergy=0.;
     233    do
     234    {
     235      secondaryElectronKineticEnergy = G4UniformRand() * (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell));
     236    } while(G4UniformRand()*crossSectionMaximum >
     237      DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
     238
     239    return secondaryElectronKineticEnergy;
     240 
     241  }
     242 
     243  if (particleDefinition == G4Proton::ProtonDefinition())
     244  {
     245    G4double maximumKineticEnergyTransfer = 4.* (electron_mass_c2 / proton_mass_c2) * k - (waterStructure.IonisationEnergy(shell));
     246
     247    G4double crossSectionMaximum = 0.;
     248    for (G4double value = waterStructure.IonisationEnergy(shell);
     249         value<=4.*waterStructure.IonisationEnergy(shell) ;
     250         value+=0.1*eV)
     251    {
     252      G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
     253      if (differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
     254    }
     255
     256    G4double secondaryElectronKineticEnergy = 0.;
     257    do
     258    {
     259      secondaryElectronKineticEnergy = G4UniformRand() * maximumKineticEnergyTransfer;
     260    } while(G4UniformRand()*crossSectionMaximum >=
    295261              DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
    296262
    297       return secondaryElectronKineticEnergy;
    298  
    299     }
    300  
    301   if (particleDefinition == G4Proton::ProtonDefinition())
    302     {
    303       G4double maximumKineticEnergyTransfer = 4.* (electron_mass_c2 / proton_mass_c2) * k - (waterStructure.IonisationEnergy(shell));
    304 
    305       G4double crossSectionMaximum = 0.;
    306       for (G4double value = waterStructure.IonisationEnergy(shell);
    307            value<=4.*waterStructure.IonisationEnergy(shell) ;
    308            value+=0.1*eV)
    309         {
    310           G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
    311           if (differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
    312         }
    313 
    314       G4double secondaryElectronKineticEnergy = 0.;
    315       do
    316         {
    317           secondaryElectronKineticEnergy = G4UniformRand() * maximumKineticEnergyTransfer;
    318         } while(G4UniformRand()*crossSectionMaximum >=
    319               DifferentialCrossSection(particleDefinition, k/eV,(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
    320 
    321       return secondaryElectronKineticEnergy;
    322     }
     263    return secondaryElectronKineticEnergy;
     264  }
    323265
    324266  return 0;
    325267}
    326268
     269//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    327270
    328271void G4FinalStateIonisationBorn::RandomizeEjectedElectronDirection(G4ParticleDefinition* particleDefinition,
     
    333276{
    334277  if (particleDefinition == G4Electron::ElectronDefinition())
    335     {
    336 
    337       phi = twopi * G4UniformRand();
    338       if (secKinetic < 50.*eV) cosTheta = (2.*G4UniformRand())-1.;
    339       else if (secKinetic <= 200.*eV)   
    340         {
    341           if (G4UniformRand() <= 0.1) cosTheta = (2.*G4UniformRand())-1.;
    342           else cosTheta = G4UniformRand()*(std::sqrt(2.)/2);
    343         }
    344       else     
    345         {
    346           G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2));
    347           cosTheta = std::sqrt(1.-sin2O);
    348         }
    349     }
     278  {
     279    phi = twopi * G4UniformRand();
     280    if (secKinetic < 50.*eV) cosTheta = (2.*G4UniformRand())-1.;
     281    else if (secKinetic <= 200.*eV)     
     282    {
     283      if (G4UniformRand() <= 0.1) cosTheta = (2.*G4UniformRand())-1.;
     284      else cosTheta = G4UniformRand()*(std::sqrt(2.)/2);
     285    }
     286    else       
     287    {
     288      G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2));
     289      cosTheta = std::sqrt(1.-sin2O);
     290    }
     291  }
    350292 
    351293  if (particleDefinition == G4Proton::ProtonDefinition())
    352     {
    353       G4double maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k;
    354       phi = twopi * G4UniformRand();
    355       cosTheta = std::sqrt(secKinetic / maxSecKinetic);
    356     }                   
    357 }
    358 
     294  {
     295    G4double maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k;
     296    phi = twopi * G4UniformRand();
     297    cosTheta = std::sqrt(secKinetic / maxSecKinetic);
     298  }                     
     299}
     300
     301//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    359302
    360303double G4FinalStateIonisationBorn::DifferentialCrossSection(G4ParticleDefinition * particleDefinition,
     
    366309
    367310  if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
    368     {
    369       G4double valueT1 = 0;
    370       G4double valueT2 = 0;
    371       G4double valueE21 = 0;
    372       G4double valueE22 = 0;
    373       G4double valueE12 = 0;
    374       G4double valueE11 = 0;
    375 
    376       G4double xs11  =  0;   
    377       G4double xs12 = 0;
    378       G4double xs21 = 0;
    379       G4double xs22 = 0;
    380 
     311  {
     312    G4double valueT1 = 0;
     313    G4double valueT2 = 0;
     314    G4double valueE21 = 0;
     315    G4double valueE22 = 0;
     316    G4double valueE12 = 0;
     317    G4double valueE11 = 0;
     318
     319    G4double xs11 = 0;   
     320    G4double xs12 = 0;
     321    G4double xs21 = 0;
     322    G4double xs22 = 0;
     323
     324    if (particleDefinition == G4Electron::ElectronDefinition())
     325    {
     326      // k should be in eV and energy transfer eV also
     327
     328      std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
     329
     330      std::vector<double>::iterator t1 = t2-1;
     331
     332      // SI : the following condition avoids situations where energyTransfer >last vector element
     333      if (energyTransfer <= eVecm[(*t1)].back())
     334      {
     335        std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
     336        std::vector<double>::iterator e11 = e12-1;
     337
     338        std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
     339        std::vector<double>::iterator e21 = e22-1;
     340
     341        valueT1  =*t1;
     342        valueT2  =*t2;
     343        valueE21 =*e21;
     344        valueE22 =*e22;
     345        valueE12 =*e12;
     346        valueE11 =*e11;
     347
     348        xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
     349        xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
     350        xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
     351        xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
     352      }
     353
     354    }
     355 
     356   if (particleDefinition == G4Proton::ProtonDefinition())
     357   {
     358      // k should be in eV and energy transfer eV also
     359      std::vector<double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),pTdummyVec.end(), k);
     360      std::vector<double>::iterator t1 = t2-1;
     361     
     362        std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),pVecm[(*t1)].end(), energyTransfer);
     363        std::vector<double>::iterator e11 = e12-1;
     364
     365        std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),pVecm[(*t2)].end(), energyTransfer);
     366        std::vector<double>::iterator e21 = e22-1;
    381367 
    382       if (particleDefinition == G4Electron::ElectronDefinition())
    383         {
    384           // k should be in eV and energy transfer eV also
    385           std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
    386           std::vector<double>::iterator t1 = t2-1;
    387           std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
    388           std::vector<double>::iterator e11 = e12-1;
    389 
    390           std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
    391           std::vector<double>::iterator e21 = e22-1;
    392 
    393           valueT1  =*t1;
    394           valueT2  =*t2;
    395           valueE21 =*e21;
    396           valueE22 =*e22;
    397           valueE12 =*e12;
    398           valueE11 =*e11;
    399 
    400           xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
    401           xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
    402           xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
    403           xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
    404 
    405         }
    406  
    407       if (particleDefinition == G4Proton::ProtonDefinition())
    408         {
    409           // k should be in eV and energy transfer eV also
    410           std::vector<double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),pTdummyVec.end(), k);
    411           std::vector<double>::iterator t1 = t2-1;
    412           std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),pVecm[(*t1)].end(), energyTransfer);
    413           std::vector<double>::iterator e11 = e12-1;
    414 
    415           std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),pVecm[(*t2)].end(), energyTransfer);
    416           std::vector<double>::iterator e21 = e22-1;
    417  
    418           valueT1  =*t1;
    419           valueT2  =*t2;
    420           valueE21 =*e21;
    421           valueE22 =*e22;
    422           valueE12 =*e12;
    423           valueE11 =*e11;
    424 
    425           xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
    426           xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
    427           xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
    428           xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
    429         }
    430  
    431       G4double xsProduct = xs11 * xs12 * xs21 * xs22;
    432       // if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0) return (0.);
    433       if (xsProduct != 0.)
    434         {
    435           sigma = QuadInterpolator(valueE11, valueE12,
     368        valueT1  =*t1;
     369        valueT2  =*t2;
     370        valueE21 =*e21;
     371        valueE22 =*e22;
     372        valueE12 =*e12;
     373        valueE11 =*e11;
     374
     375        xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
     376        xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
     377        xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
     378        xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
     379
     380   }
     381 
     382   G4double xsProduct = xs11 * xs12 * xs21 * xs22;
     383   if (xsProduct != 0.)
     384   {
     385     sigma = QuadInterpolator(     valueE11, valueE12,
    436386                                   valueE21, valueE22,
    437387                                   xs11, xs12,
     
    439389                                   valueT1, valueT2,
    440390                                   k, energyTransfer);
    441         }
    442     }
     391   }
     392 
     393 }
     394 
    443395  return sigma;
    444396}
    445397
     398//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    446399
    447400G4double G4FinalStateIonisationBorn::LogLogInterpolate(G4double e1,
     
    458411}
    459412
     413//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    460414
    461415G4double G4FinalStateIonisationBorn::QuadInterpolator(G4double e11, G4double e12,
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateIonisationRudd.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4FinalStateIonisationRudd.cc,v 1.5 2007/11/26 17:27:09 pia Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 // Contact Author: Sebastien Incerti (incerti@cenbg.in2p3.fr)
    31 //                 Maria Grazia Pia  (Maria.Grazia.Pia@cern.ch)
    32 //
    33 ///
    34 // Reference: TNS Geant4-DNA paper
    35 // Reference for implementation model: NIM. 155, pp. 145-156, 1978
    36 //
    37 // History:
    38 // -----------
    39 // Date         Name              Modification
    40 // 28 Apr 2007  M.G. Pia          Created in compliance with design described in TNS paper
    41 //    Nov 2007  S. Incerti        Implementation
    42 // 26 Nov 2007  MGP               Cleaned up std::
    43 //
    44 // -------------------------------------------------------------------
    45 
    46 // Class description:
    47 // Reference: TNS Geant4-DNA paper
    48 // S. Chauvie et al., Geant4 physics processes for microdosimetry simulation:
    49 // design foundation and implementation of the first set of models,
    50 // IEEE Trans. Nucl. Sci., vol. 54, no. 6, Dec. 2007.
    51 // Further documentation available from http://www.ge.infn.it/geant4/dna
    52 
    53 // -------------------------------------------------------------------
    54 
     26// $Id: G4FinalStateIonisationRudd.cc,v 1.8 2008/08/20 14:51:48 sincerti Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    5528
    5629#include "G4FinalStateIonisationRudd.hh"
    57 #include "G4Track.hh"
    58 #include "G4Step.hh"
    59 #include "G4DynamicParticle.hh"
    60 #include "Randomize.hh"
    61 
    62 #include "G4ParticleTypes.hh"
    63 #include "G4ParticleDefinition.hh"
    64 #include "G4Electron.hh"
    65 #include "G4Proton.hh"
    66 #include "G4SystemOfUnits.hh"
    67 #include "G4ParticleMomentum.hh"
    68 #include "G4DNAGenericIonsManager.hh"
    69 
     30
     31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7032
    7133G4FinalStateIonisationRudd::G4FinalStateIonisationRudd()
    7234{
    73   name = "IonisationBorn";
    74   // Default energy limits (defined for protection against anomalous behaviour only)
    7535  lowEnergyLimitDefault = 100 * eV;
    7636  highEnergyLimitDefault = 100 * MeV;
     
    11272}
    11373
     74//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11475
    11576G4FinalStateIonisationRudd::~G4FinalStateIonisationRudd()
    116 { }
    117 
    118 
     77{}
     78
     79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11980
    12081const G4FinalStateProduct& G4FinalStateIonisationRudd::GenerateFinalState(const G4Track& track, const G4Step& /* step */)
    12182{
    122   // Clear previous secondaries, energy deposit and particle kill status
    12383  product.Clear();
    12484
     
    13292  const G4String& particleName = particle->GetDefinition()->GetParticleName();
    13393
    134   // Retrieve energy limits for the current particle type
    135 
    13694  std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
    13795  pos1 = lowEnergyLimit.find(particleName);
    13896
    139   // Lower limit
    14097  if (pos1 != lowEnergyLimit.end())
    141     {
    142       lowLim = pos1->second;
    143     }
    144 
    145   // Upper limit
     98  {
     99    lowLim = pos1->second;
     100  }
     101
    146102  std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
    147103  pos2 = highEnergyLimit.find(particleName);
    148104
    149105  if (pos2 != highEnergyLimit.end())
    150     {
    151       highLim = pos2->second;
    152     }
    153 
    154   // Verify that the current track is within the energy limits of validity of the cross section model
     106  {
     107    highLim = pos2->second;
     108  }
    155109
    156110  if (k >= lowLim && k <= highLim)
    157     {
    158       // Kinetic energy of primary particle
    159 
     111  {
    160112      G4ParticleDefinition* definition = particle->GetDefinition();
    161113      G4ParticleMomentum primaryDirection = particle->GetMomentumDirection();
     
    186138      G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
    187139
    188       // Primary Particle Direction
    189140      G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
    190141      G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
     
    200151      G4DynamicParticle* aElectron = new G4DynamicParticle(G4Electron::Electron(),deltaDirection,secondaryKinetic);
    201152      product.AddSecondary(aElectron);
    202     }
    203 
    204   if (k < lowLim) {product.KillPrimaryParticle();product.AddEnergyDeposit(k);}
     153  }
     154
     155  if (k < lowLim)
     156  { 
     157    product.KillPrimaryParticle();
     158  }
    205159 
    206160  return product;
    207161}
    208162
    209 
     163//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    210164
    211165G4double G4FinalStateIonisationRudd::RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition,
     
    220174  if (particleDefinition == G4Proton::ProtonDefinition()
    221175      || particleDefinition == instance->GetIon("hydrogen"))
    222          
    223     {
     176  {
    224177      maximumKineticEnergyTransfer= 4.* (electron_mass_c2 / proton_mass_c2) * k;
    225     }
     178  }
    226179
    227180  if (particleDefinition == instance->GetIon("helium")
    228181      || particleDefinition == instance->GetIon("alpha+")
    229182      || particleDefinition == instance->GetIon("alpha++"))
    230     {
     183  {
    231184      maximumKineticEnergyTransfer= 4.* (0.511 / 3728) * k;
    232     }
     185  }
    233186
    234187  G4double crossSectionMaximum = 0.;
     188 
    235189  for(G4double value=waterStructure.IonisationEnergy(shell); value<=4.*waterStructure.IonisationEnergy(shell) ; value+=0.1*eV)
    236     {
     190  {
    237191      G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k, value, shell);
    238192      if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
    239     }
     193  }
     194 
    240195  G4double secElecKinetic = 0.;
    241   do{
     196 
     197  do
     198  {
    242199    secElecKinetic = G4UniformRand() * maximumKineticEnergyTransfer;
    243200  } while(G4UniformRand()*crossSectionMaximum > DifferentialCrossSection(particleDefinition,
     
    249206}
    250207
     208//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     209
    251210
    252211void G4FinalStateIonisationRudd::RandomizeEjectedElectronDirection(G4ParticleDefinition* particleDefinition,
    253212                                                                   G4double k,
    254213                                                                   G4double secKinetic,
    255                                                                    G4double cosTheta,
    256                                                                    G4double phi )
     214                                                                   G4double & cosTheta,
     215                                                                   G4double & phi )
    257216{
    258217  G4DNAGenericIonsManager *instance;
     
    263222  if (particleDefinition == G4Proton::ProtonDefinition()
    264223      || particleDefinition == instance->GetIon("hydrogen"))
    265     {
     224  {
    266225      maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k;
    267     }
     226  }
    268227 
    269228  if (particleDefinition == instance->GetIon("helium")
    270229      || particleDefinition == instance->GetIon("alpha+")
    271230      || particleDefinition == instance->GetIon("alpha++"))
    272     {
     231  {
    273232      maxSecKinetic = 4.* (0.511 / 3728) * k;
    274     }
     233  }
    275234 
    276235  phi = twopi * G4UniformRand();
    277236  cosTheta = std::sqrt(secKinetic / maxSecKinetic);
    278237}
     238
     239//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    279240
    280241
     
    314275
    315276  if (j == 4)
    316     {
     277  {
    317278      //Data For Liquid Water K SHELL from Dingfelder (Protons in Water)
    318279      A1 = 1.25;
     
    326287      D2 = 0.00;
    327288      alphaConst = 0.66;
    328     }
     289  }
    329290  else
    330     {
     291  {
    331292      //Data For Liquid Water from Dingfelder (Protons in Water)
    332293      A1 = 1.02;
     
    340301      D2 = 0.04;
    341302      alphaConst = 0.64;
    342     }
     303  }
    343304 
    344305  const G4double n = 2.;
    345306  const G4double Gj[5] = {0.99, 1.11, 1.11, 0.52, 1.};
    346 
    347   //const G4double I[5]={12.61*eV, 14.73*eV, 18.55*eV, 32.2*eV, 539.7*eV}; // for water Vapor
    348   //const G4double energyConstant[]={10.79*eV, 13.39*eV, 16.05*eV, 32.30*eV, 539.*eV};
    349307
    350308  G4DNAGenericIonsManager* instance;
     
    359317  if (particleDefinition == G4Proton::ProtonDefinition()
    360318      || particleDefinition == instance->GetIon("hydrogen"))
    361     {
     319  {
    362320      tau = (electron_mass_c2/proton_mass_c2) * k ;
    363     }
     321  }
    364322   
    365323  if ( particleDefinition == instance->GetIon("helium")
    366324       || particleDefinition == instance->GetIon("alpha+")
    367325       || particleDefinition == instance->GetIon("alpha++"))
    368     {
     326  {
    369327      tau = (0.511/3728.) * k ;
    370     }
     328  }
    371329 
    372330  G4double S = 4.*pi * Bohr_radius*Bohr_radius * n * std::pow((Ry/waterStructure.IonisationEnergy(ionizationLevelIndex)),2);
     
    390348          || particleDefinition == instance->GetIon("hydrogen")
    391349          )
    392     {
     350  {
    393351      return(sigma);
    394     }
    395 
    396   // ------------
    397  
     352  }
     353
    398354  if (particleDefinition == instance->GetIon("alpha++") )
    399     {
     355  {
    400356      slaterEffectiveCharge[0]=0.;
    401357      slaterEffectiveCharge[1]=0.;
     
    404360      sCoefficient[1]=0.;
    405361      sCoefficient[2]=0.;
    406     }
     362  }
    407363
    408364  if (particleDefinition == instance->GetIon("alpha+") )
    409     {
     365  {
    410366      slaterEffectiveCharge[0]=2.0;
    411367      slaterEffectiveCharge[1]=1.15;
     
    414370      sCoefficient[1]=0.15;
    415371      sCoefficient[2]=0.15;
    416     }
     372  }
    417373
    418374  if (particleDefinition == instance->GetIon("helium") )
    419     {
     375  {
    420376      slaterEffectiveCharge[0]=1.7;
    421377      slaterEffectiveCharge[1]=1.15;
     
    424380      sCoefficient[1]=0.25;
    425381      sCoefficient[2]=0.25;
    426     }
     382  }
    427383 
    428384  if (    particleDefinition == instance->GetIon("helium")
     
    430386          || particleDefinition == instance->GetIon("alpha++")
    431387          )
    432     {
     388  {
    433389      sigma = Gj[j] * (S/waterStructure.IonisationEnergy(ionizationLevelIndex)) * ( (F1+w*F2) / ( std::pow((1.+w),3) * ( 1.+std::exp(alphaConst*(w-wc)/v))) );
    434390   
     
    440396           
    441397      return zEff * zEff * sigma ;
    442    
     398 
    443399 
    444400  return 0;
    445401}
     402
     403//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    446404
    447405G4double G4FinalStateIonisationRudd::S_1s(G4double t,
     
    459417}
    460418
    461 
     419//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    462420
    463421G4double G4FinalStateIonisationRudd::S_2s(G4double t,
     
    476434}
    477435
    478 
     436//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    479437
    480438G4double G4FinalStateIonisationRudd::S_2p(G4double t,
     
    492450}
    493451
    494 
     452//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    495453
    496454G4double G4FinalStateIonisationRudd::R(G4double t,
     
    500458{
    501459  // tElectron = m_electron / m_alpha * t
    502   // Hardcoded in Riccardo's implementation; to be corrected
    503460  // Dingfelder, in Chattanooga 2005 proceedings, p 4
    504461
     
    509466}
    510467
    511 
     468//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    512469
    513470G4double G4FinalStateIonisationRudd::CorrectionFactor(G4ParticleDefinition* particleDefinition, G4double k)
     
    517474
    518475  if (particleDefinition == G4Proton::Proton())
    519     {
     476  {
    520477      return(1.);
    521     }
     478  }
    522479  else
    523480    if (particleDefinition == instance->GetIon("hydrogen"))
    524       {
     481    {
    525482        G4double value = (std::log(k/eV)-4.2)/0.5;
    526483        return((0.8/(1+std::exp(value))) + 0.9);
    527       }
     484    }
    528485    else
    529       {   
     486    {   
    530487        return(1.);
    531       }
    532 }
     488    }
     489}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateKill.cc

    r819 r961  
    2626//
    2727// $Id: G4FinalStateKill.cc,v 1.1 2007/11/09 20:26:12 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FinalStateProduct.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4FinalStateProduct.cc,v 1.5 2007/11/09 20:11:04 pia Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4FinalStateProduct.cc,v 1.6 2009/01/20 07:50:28 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    5353#include "G4ThreeVector.hh"
    5454
    55 G4FinalStateProduct::G4FinalStateProduct() : killStatus(false), isModified(false), localEnergyDeposit(0.), modifiedEnergy(0)
     55G4FinalStateProduct::G4FinalStateProduct() : killStatus(false), doNotDepositStatus(false), isModified(false), localEnergyDeposit(0.), modifiedEnergy(0)
    5656{
    5757  // empty
     
    6868  // Reset object status
    6969  killStatus = false;
     70  doNotDepositStatus = false;
    7071  isModified = false;
    7172  localEnergyDeposit = 0.;
     
    9899}
    99100 
     101void G4FinalStateProduct::DoNotDepositEnergy()
     102{
     103  doNotDepositStatus = true;
     104}
     105
    100106void G4FinalStateProduct::KillPrimaryParticle()
    101107{
     108 
    102109  // ---- MGP ---- To be added: Handle local energy deposit here
    103110  killStatus = true;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4FluoTransition.cc

    r819 r961  
    2626//
    2727// $Id: G4FluoTransition.cc,v 1.2 ????
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LinInterpolation.cc

    r819 r961  
    2626//
    2727// $Id: G4LinInterpolation.cc,v 1.3 2006/06/29 19:40:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LogLogInterpolation.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4LogLogInterpolation.cc,v 1.7 2006/06/29 19:40:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4LogLogInterpolation.cc,v 1.14 2008/12/12 08:50:59 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
    31 //
     31//         Sebastian Incerti (incerti@cenbg.in2p3.fr)
     32//         Nicolas A. Karakatsanis (knicolas@mail.ntua.gr)
    3233// History:
    3334// -----------
    3435// 31 Jul 2001   MGP        Created
    35 //
     36// 27 Jun 2008   SI         Add check to avoid FPE errors
     37// 08 Dec 2008   NAK        Log-Log interpolation math formula streamlined, self-test function
    3638// -------------------------------------------------------------------
    3739
     
    5759{
    5860  G4int nBins = data.size() - 1;
     61//G4double oldresult = 0.;
    5962  G4double value = 0.;
    6063  if (x < points[0])
     
    6871      G4double d1 = data[bin];
    6972      G4double d2 = data[bin+1];
    70       value = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1);
    71       value = std::pow(10.,value);
     73// Check of e1, e2, d1 and d2 values to avoid floating-point errors when estimating the interpolated value below -- S.I., Jun. 2008
     74      if ((d1 > 0.) && (d2 > 0.) && (e1 > 0.) && (e2 > 0.))
     75        {
     76// Streamline the Log-Log Interpolation formula in order to reduce the required number of log10() function calls
     77// Variable oldresult contains the result of old implementation of Log-Log interpolation -- M.G.P. Jun. 2001
     78//       oldresult = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1);
     79//       oldresult = std::pow(10.,oldresult);
     80// Variable value contains the result of new implementation, after streamlining the math operation -- N.A.K. Oct. 2008
     81         value = std::log10(d1)+(std::log10(d2/d1)/std::log10(e2/e1)*std::log10(x/e1));
     82         value = std::pow(10.,value);
     83// Test of the new implementation result (value variable) against the old one (oldresult) -- N.A.K. Dec. 2008
     84//       G4double diffResult = value - oldresult;
     85//       G4double relativeDiff = 1e-11;
     86// Comparison of the two values based on a max allowable relative difference
     87//       if ( std::fabs(diffResult) > relativeDiff*std::fabs(oldresult) )
     88//        {
     89// Abort comparison when at least one of two results is infinite
     90//           if ((!std::isinf(oldresult)) && (!std::isinf(value)))
     91//            {
     92//              G4cout << "G4LogLogInterpolation> Old Interpolated Value is:" << oldresult << G4endl;
     93//              G4cout << "G4LogLogInterpolation> New Interpolated Value is:" << value << G4endl << G4endl;
     94//              G4cerr << "G4LogLogInterpolation> Error in Interpolation:" << G4endl;
     95//              G4cerr << "The difference between new and old interpolated value is:" << diffResult << G4endl << G4endl;
     96//            }
     97//        }
     98        }
     99      else value = 0.;
    72100    }
    73101  else
     
    75103      value = data[nBins];
    76104    }
    77 
    78105  return value;
    79106}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyBremsstrahlung.cc

    r819 r961  
    2525//
    2626// $Id: G4LowEnergyBremsstrahlung.cc,v 1.71 2006/06/29 19:40:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyCompton.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LowEnergyCompton.cc,v 1.41 2006/06/29 19:40:15 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4LowEnergyCompton.cc,v 1.47 2008/12/18 13:01:28 gunter Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// Author: A. Forti
     
    6565#include "G4VRangeTest.hh"
    6666#include "G4RangeTest.hh"
     67#include "G4RangeNoTest.hh"
    6768#include "G4MaterialCutsCouple.hh"
    6869
     
    9091  meanFreePathTable = 0;
    9192
    92   rangeTest = new G4RangeTest;
     93  rangeTest = new G4RangeNoTest;
     94
     95  // For Doppler broadening
     96  shellData.SetOccupancyData();
    9397
    9498   if (verboseLevel > 0)
     
    119123  delete meanFreePathTable;
    120124  meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
     125
     126  // For Doppler broadening
     127  G4String file = "/doppler/shell-doppler";
     128  shellData.LoadData(file);
    121129}
    122130
     
    154162  G4double e0m = photonEnergy0 / electron_mass_c2 ;
    155163  G4ParticleMomentum photonDirection0 = incidentPhoton->GetMomentumDirection();
    156 
    157   // Select randomly one element in the current material
    158   const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
    159   G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy0);
    160 
    161164  G4double epsilon0 = 1. / (1. + 2. * e0m);
    162165  G4double epsilon0Sq = epsilon0 * epsilon0;
    163166  G4double alpha1 = -std::log(epsilon0);
    164167  G4double alpha2 = 0.5 * (1. - epsilon0Sq);
    165 
    166168  G4double wlPhoton = h_Planck*c_light/photonEnergy0;
     169
     170  // Select randomly one element in the current material
     171  const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
     172  G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy0);
    167173
    168174  // Sample the energy of the scattered photon
     
    196202  G4double sinTheta = std::sqrt (sinT2);
    197203  G4double phi = twopi * G4UniformRand() ;
    198   G4double dirx = sinTheta * std::cos(phi);
    199   G4double diry = sinTheta * std::sin(phi);
    200   G4double dirz = cosTheta ;
     204  G4double dirX = sinTheta * std::cos(phi);
     205  G4double dirY = sinTheta * std::sin(phi);
     206  G4double dirZ = cosTheta ;
     207
     208  // Doppler broadening -  Method based on:
     209  // Y. Namito, S. Ban and H. Hirayama,
     210  // "Implementation of the Doppler Broadening of a Compton-Scattered Photon Into the EGS4 Code"
     211  // NIM A 349, pp. 489-494, 1994
     212 
     213  // Maximum number of sampling iterations
     214  G4int maxDopplerIterations = 1000;
     215  G4double bindingE = 0.;
     216  G4double photonEoriginal = epsilon * photonEnergy0;
     217  G4double photonE = -1.;
     218  G4int iteration = 0;
     219  G4double eMax = photonEnergy0;
     220  do
     221    {
     222      iteration++;
     223      // Select shell based on shell occupancy
     224      G4int shell = shellData.SelectRandomShell(Z);
     225      bindingE = shellData.BindingEnergy(Z,shell);
     226     
     227      eMax = photonEnergy0 - bindingE;
     228     
     229      // Randomly sample bound electron momentum (memento: the data set is in Atomic Units)
     230      G4double pSample = profileData.RandomSelectMomentum(Z,shell);
     231      // Rescale from atomic units
     232      G4double pDoppler = pSample * fine_structure_const;
     233      G4double pDoppler2 = pDoppler * pDoppler;
     234      G4double var2 = 1. + oneCosT * e0m;
     235      G4double var3 = var2*var2 - pDoppler2;
     236      G4double var4 = var2 - pDoppler2 * cosTheta;
     237      G4double var = var4*var4 - var3 + pDoppler2 * var3;
     238      if (var > 0.)
     239        {
     240          G4double varSqrt = std::sqrt(var);       
     241          G4double scale = photonEnergy0 / var3; 
     242          // Random select either root
     243          if (G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale;               
     244          else photonE = (var4 + varSqrt) * scale;
     245        }
     246      else
     247        {
     248          photonE = -1.;
     249        }
     250   } while ( iteration <= maxDopplerIterations &&
     251             (photonE < 0. || photonE > eMax || photonE < eMax*G4UniformRand()) );
     252 
     253  // End of recalculation of photon energy with Doppler broadening
     254  // Revert to original if maximum number of iterations threshold has been reached
     255  if (iteration >= maxDopplerIterations)
     256    {
     257      photonE = photonEoriginal;
     258      bindingE = 0.;
     259    }
    201260
    202261  // Update G4VParticleChange for the scattered photon
    203262
    204   G4ThreeVector photonDirection1(dirx,diry,dirz);
     263  G4ThreeVector photonDirection1(dirX,dirY,dirZ);
    205264  photonDirection1.rotateUz(photonDirection0);
    206   aParticleChange.ProposeMomentumDirection(photonDirection1) ;
    207   G4double photonEnergy1 = epsilon * photonEnergy0;
     265  aParticleChange.ProposeMomentumDirection(photonDirection1);
     266 
     267  G4double photonEnergy1 = photonE;
     268  //G4cout << "--> PHOTONENERGY1 = " << photonE/keV << G4endl;
    208269
    209270  if (photonEnergy1 > 0.)
     
    218279
    219280  // Kinematics of the scattered electron
    220   G4double eKineticEnergy = photonEnergy0 - photonEnergy1;
     281  G4double eKineticEnergy = photonEnergy0 - photonEnergy1 - bindingE;
     282  G4double eTotalEnergy = eKineticEnergy + electron_mass_c2;
     283
     284  G4double electronE = photonEnergy0 * (1. - epsilon) + electron_mass_c2;
     285  G4double electronP2 = electronE*electronE - electron_mass_c2*electron_mass_c2;
     286  G4double sinThetaE = -1.;
     287  G4double cosThetaE = 0.;
     288  if (electronP2 > 0.)
     289    {
     290      cosThetaE = (eTotalEnergy + photonEnergy1 )* (1. - epsilon) / std::sqrt(electronP2);
     291      sinThetaE = -1. * std::sqrt(1. - cosThetaE * cosThetaE);
     292    }
     293 
     294  G4double eDirX = sinThetaE * std::cos(phi);
     295  G4double eDirY = sinThetaE * std::sin(phi);
     296  G4double eDirZ = cosThetaE;
    221297
    222298  // Generate the electron only if with large enough range w.r.t. cuts and safety
     
    226302  if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety))
    227303    {
    228       G4double eMomentum = std::sqrt(eKineticEnergy*(eKineticEnergy+2.*electron_mass_c2));
    229       G4ThreeVector eDirection((photonEnergy0 * photonDirection0 -
    230                                 photonEnergy1 * photonDirection1) * (1./eMomentum));
    231       G4DynamicParticle* electron = new G4DynamicParticle (G4Electron::Electron(),
    232                                                            eDirection,eKineticEnergy) ;
     304      G4ThreeVector eDirection(eDirX,eDirY,eDirZ);
     305      eDirection.rotateUz(photonDirection0);
     306
     307      G4DynamicParticle* electron = new G4DynamicParticle (G4Electron::Electron(),eDirection,eKineticEnergy) ;
    233308      aParticleChange.SetNumberOfSecondaries(1);
    234309      aParticleChange.AddSecondary(electron);
    235       aParticleChange.ProposeLocalEnergyDeposit(0.);
     310      // Binding energy deposited locally
     311      aParticleChange.ProposeLocalEnergyDeposit(bindingE);
    236312    }
    237313  else
    238314    {
    239315      aParticleChange.SetNumberOfSecondaries(0);
    240       aParticleChange.ProposeLocalEnergyDeposit(eKineticEnergy);
     316      aParticleChange.ProposeLocalEnergyDeposit(eKineticEnergy + bindingE);
    241317    }
    242318
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyGammaConversion.cc

    r819 r961  
    2727///
    2828// $Id: G4LowEnergyGammaConversion.cc,v 1.36 2006/06/29 19:40:17 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131//
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LowEnergyIonisation.cc,v 1.102 2006/06/29 19:40:19 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4LowEnergyIonisation.cc,v 1.103 2008/05/02 19:23:38 pia Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
     
    663663                  type = aSecondary->GetDefinition();
    664664                  if ( eTot + e <= eLoss &&
    665                      (type == G4Gamma::Gamma() && e>cutForPhotons ) ||
    666                      (type == G4Electron::Electron() && e>cutForElectrons)) {
     665                     ((type == G4Gamma::Gamma() && e>cutForPhotons ) ||
     666                     (type == G4Electron::Electron() && e>cutForElectrons))) {
    667667
    668668                          eTot += e;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPhotoElectric.cc

    r819 r961  
    2626//
    2727// $Id: G4LowEnergyPhotoElectric.cc,v 1.56 2006/06/29 19:40:23 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedCompton.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4LowEnergyPolarizedCompton.cc,v 1.22 2006/06/29 19:40:25 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4LowEnergyPolarizedCompton.cc,v 1.25 2008/05/02 19:23:38 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
     
    110110  rangeTest = new G4RangeTest;
    111111
     112  // For Doppler broadening
     113  shellData.SetOccupancyData();
     114
     115
    112116   if (verboseLevel > 0)
    113117     {
     
    139143  delete meanFreePathTable;
    140144  meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
     145
     146  // For Doppler broadening
     147  G4String file = "/doppler/shell-doppler";
     148  shellData.LoadData(file);
     149
    141150}
    142151
     
    327336  G4double dirz = cosTheta ;
    328337 
     338
     339  // oneCosT , eom
     340
     341
     342
     343  // Doppler broadening -  Method based on:
     344  // Y. Namito, S. Ban and H. Hirayama,
     345  // "Implementation of the Doppler Broadening of a Compton-Scattered Photon Into the EGS4 Code"
     346  // NIM A 349, pp. 489-494, 1994
     347 
     348  // Maximum number of sampling iterations
     349
     350  G4int maxDopplerIterations = 1000;
     351  G4double bindingE = 0.;
     352  G4double photonEoriginal = epsilon * gammaEnergy0;
     353  G4double photonE = -1.;
     354  G4int iteration = 0;
     355  G4double eMax = gammaEnergy0;
     356
     357  do
     358    {
     359      iteration++;
     360      // Select shell based on shell occupancy
     361      G4int shell = shellData.SelectRandomShell(Z);
     362      bindingE = shellData.BindingEnergy(Z,shell);
     363     
     364      eMax = gammaEnergy0 - bindingE;
     365     
     366      // Randomly sample bound electron momentum (memento: the data set is in Atomic Units)
     367      G4double pSample = profileData.RandomSelectMomentum(Z,shell);
     368      // Rescale from atomic units
     369      G4double pDoppler = pSample * fine_structure_const;
     370      G4double pDoppler2 = pDoppler * pDoppler;
     371      G4double var2 = 1. + onecost * E0_m;
     372      G4double var3 = var2*var2 - pDoppler2;
     373      G4double var4 = var2 - pDoppler2 * cosTheta;
     374      G4double var = var4*var4 - var3 + pDoppler2 * var3;
     375      if (var > 0.)
     376        {
     377          G4double varSqrt = std::sqrt(var);       
     378          G4double scale = gammaEnergy0 / var3; 
     379          // Random select either root
     380          if (G4UniformRand() < 0.5) photonE = (var4 - varSqrt) * scale;               
     381          else photonE = (var4 + varSqrt) * scale;
     382        }
     383      else
     384        {
     385          photonE = -1.;
     386        }
     387   } while ( iteration <= maxDopplerIterations &&
     388             (photonE < 0. || photonE > eMax || photonE < eMax*G4UniformRand()) );
     389 
     390  // End of recalculation of photon energy with Doppler broadening
     391  // Revert to original if maximum number of iterations threshold has been reached
     392  if (iteration >= maxDopplerIterations)
     393    {
     394      photonE = photonEoriginal;
     395      bindingE = 0.;
     396    }
     397
     398  gammaEnergy1 = photonE;
     399 
     400  // G4cout << "--> PHOTONENERGY1 = " << photonE/keV << G4endl;
     401
     402
     403  /// Doppler Broadeing
     404
     405
     406
     407
    329408  //
    330409  // update G4VParticleChange for the scattered photon
    331410  //
    332411
    333   gammaEnergy1 = epsilon*gammaEnergy0;
     412  //  gammaEnergy1 = epsilon*gammaEnergy0;
     413
    334414
    335415  // New polarization
     
    365445  //
    366446
    367   G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 ;
     447  G4double ElecKineEnergy = gammaEnergy0 - gammaEnergy1 -bindingE;
     448
    368449
    369450  // Generate the electron only if with large enough range w.r.t. cuts and safety
    370451
    371452  G4double safety = aStep.GetPostStepPoint()->GetSafety();
     453
    372454
    373455  if (rangeTest->Escape(G4Electron::Electron(),couple,ElecKineEnergy,safety))
     
    379461      aParticleChange.SetNumberOfSecondaries(1);
    380462      aParticleChange.AddSecondary(electron);
    381       aParticleChange.ProposeLocalEnergyDeposit(0.);
     463      //      aParticleChange.ProposeLocalEnergyDeposit(0.);
     464      aParticleChange.ProposeLocalEnergyDeposit(bindingE);
    382465    }
    383466  else
    384467    {
    385468      aParticleChange.SetNumberOfSecondaries(0);
    386       aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy);
     469      aParticleChange.ProposeLocalEnergyDeposit(ElecKineEnergy+bindingE);
    387470    }
    388471 
     
    492575  //  G4double sinsqrphi = sinPhi*sinPhi;
    493576  G4double normalisation = std::sqrt(1. - cosSqrPhi*sinSqrTh);
    494   
     577 
    495578
    496579  // Determination of Theta
    497580 
    498   G4double thetaProbability;
     581  // ---- MGP ---- Commented out the following 3 lines to avoid compilation
     582  // warnings (unused variables)
     583  // G4double thetaProbability;
    499584  G4double theta;
    500   G4double a, b;
    501   G4double cosTheta;
    502 
     585  // G4double a, b;
     586  // G4double cosTheta;
     587
     588  /*
     589
     590  depaola method
     591 
    503592  do
    504     {
     593  {
    505594      rand1 = G4UniformRand();
    506595      rand2 = G4UniformRand();
     
    515604 
    516605  G4double cosBeta = cosTheta;
     606
     607  */
     608
     609
     610  // Dan Xu method (IEEE TNS, 52, 1160 (2005))
     611
     612  rand1 = G4UniformRand();
     613  rand2 = G4UniformRand();
     614
     615  if (rand1<(epsilon+1.0/epsilon-2)/(2.0*(epsilon+1.0/epsilon)-4.0*sinSqrTh*cosSqrPhi))
     616    {
     617      if (rand2<0.5)
     618        theta = pi/2.0;
     619      else
     620        theta = 3.0*pi/2.0;
     621    }
     622  else
     623    {
     624      if (rand2<0.5)
     625        theta = 0;
     626      else
     627        theta = pi;
     628    }
     629  G4double cosBeta = std::cos(theta);
    517630  G4double sinBeta = std::sqrt(1-cosBeta*cosBeta);
    518631 
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyPolarizedRayleigh.cc

    r819 r961  
    2525//
    2626// $Id: G4LowEnergyPolarizedRayleigh.cc,v 1.7 2006/06/29 19:40:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LowEnergyRayleigh.cc

    r819 r961  
    2727//
    2828// $Id: G4LowEnergyRayleigh.cc,v 1.37 2006/06/29 19:40:29 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: A. Forti
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlung.cc

    r819 r961  
    2525//
    2626// $Id: G4PenelopeBremsstrahlung.cc,v 1.18 2006/06/29 19:40:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlungAngular.cc

    r819 r961  
    2525//
    2626// $Id: G4PenelopeBremsstrahlungAngular.cc,v 1.7 2006/06/29 19:40:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeBremsstrahlungContinuous.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PenelopeBremsstrahlungContinuous.cc,v 1.9 2006/06/29 19:40:39 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4PenelopeBremsstrahlungContinuous.cc,v 1.11 2008/12/15 09:23:06 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
     
    4040// 19 Mar 2003  L. Pandola       Bugs fixed
    4141// 17 Mar 2004  L. Pandola       Removed unnecessary calls to std::pow(a,b)
     42// 09 Dec 2008  L. Pandola       Update ReadFile() in a way to make explicit use of the units of
     43//                               measurement. Also some cosmetics to improve readibility.
    4244//----------------------------------------------------------------
    4345
     
    5153#include <sstream>
    5254
    53 G4PenelopeBremsstrahlungContinuous::G4PenelopeBremsstrahlungContinuous (G4int Zed,G4double taglio,G4double e1,
     55G4PenelopeBremsstrahlungContinuous::G4PenelopeBremsstrahlungContinuous (G4int Zed,G4double cut,
     56                                                                        G4double e1,
    5457                                                                        G4double e2,
    5558                                                                        const G4String name)  :
    56   Zmat(Zed),tCut(taglio),MinE(e1),MaxE(e2),partName(name)
     59  Zmat(Zed),tCut(cut),MinE(e1),MaxE(e2),partName(name)
    5760{
    5861  //Construct extended energy table     
     
    7174}
    7275
     76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7377
    7478G4PenelopeBremsstrahlungContinuous::~G4PenelopeBremsstrahlungContinuous()
    75 {
    76 }
     79{;}
     80
     81//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7782
    7883void G4PenelopeBremsstrahlungContinuous::LoadFromFile()
     
    9297 G4String dirFile = pathString + "/penelope/" + name;
    9398 std::ifstream file(dirFile);
    94  std::filebuf* lsdp = file.rdbuf();
    95  if (!(lsdp->is_open()))
     99 if (!file.is_open())
    96100     {
    97101      G4String excep = "G4PenelopeBremsstrahlungContinuous - data file " + name + " not found!";
    98102      G4Exception(excep);
    99103     }
    100  G4double a1;
    101  for (size_t i=0;i<NumberofEPoints;i++){
    102    file >> a1;
    103    Energies[i]=a1;
    104    for (size_t j=0;j<NumberofKPoints;j++){
     104 G4double a1 = -1.;
     105 for (size_t i=0;i<NumberofEPoints;i++)
     106   {
    105107     file >> a1;
    106      ReducedCS[i][j]=a1/millibarn; //coversion present in Penelope source
     108     //1) reads energy in MeV
     109     Energies[i]=a1*MeV;
     110     //2) read 32 cross sections in cm2
     111     for (size_t j=0;j<NumberofKPoints;j++){
     112       file >> a1;
     113       ReducedCS[i][j]=a1*cm2;
     114     }
     115     //3) read the total cross section, in cm2
     116     file >> a1;
     117     TotalCS[i]=a1*cm2;
     118     // Check closing item
     119     file >> a1;
     120     if (a1 != ((G4double) -1))
     121       {
     122         G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file "
     123           + name;
     124         G4Exception(excep);
     125       }
    107126   }
    108    file >> a1;
    109    TotalCS[i]=a1/millibarn; //conversion present in Penelope source
    110    file >> a1;
    111    if (a1 != ((G4double) -1)){
    112      G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file "+ name;
    113      G4Exception(excep);
    114    }
    115  }
    116 
    117127 file.close();
    118128}
     129
     130//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    119131
    120132void G4PenelopeBremsstrahlungContinuous::PrepareInterpolationTable()
     
    138150   
    139151    delete interpolator;
    140     G4double Fact = (millibarn/cm2)*(Energies[i]+electron_mass_c2)*(1.0/fine_structure_const)/
     152    G4double Fact = (Energies[i]+electron_mass_c2)*(1.0/fine_structure_const)*millibarn/
    141153      (classic_electr_radius*classic_electr_radius*(Energies[i]+2.0*electron_mass_c2));
    142154    G4double Normalization = TotalCS[i]/(Rsum*Fact);
    143     G4double TST = std::abs(Normalization-100.0);
     155    G4double TST = std::abs(Normalization-1.0);
    144156    if (TST > 1.0) {
    145157      G4String excep = "G4PenelopeBremsstrahlungContinuous - Check the bremms data file";
     
    181193  }
    182194 
    183   //Forse questa roba (e Pbcut come membro privato) non serve
    184  //  G4double PDF[NumberofKPoints];
    185  
    186 //   for (i=0;i<NumberofExtendedEGrid;i++){
    187 //     for (j=0;j<NumberofKPoints;j++){
    188 //       PDF[j]=p0[i][j];
    189 //     }
    190 //     G4double Xc=0;
    191 //     if (i<(NumberofExtendedEGrid-1)){
    192 //       Xc=tCut/std::exp(ExtendedLogEnergy[i+1]);
    193 //     }
    194 //     else
    195 //       {
    196 //      Xc=tCut/std::exp(ExtendedLogEnergy[NumberofExtendedEGrid-1]);
    197 //       }
     195  //All this stuff might be useful later on
     196  /*
     197  G4double PDF[NumberofKPoints];
     198 
     199  for (i=0;i<NumberofExtendedEGrid;i++){
     200    for (j=0;j<NumberofKPoints;j++){
     201      PDF[j]=p0[i][j];
     202    }
     203    G4double Xc=0;
     204    if (i<(NumberofExtendedEGrid-1)){
     205      Xc=tCut/std::exp(ExtendedLogEnergy[i+1]);
     206    }
     207    else
     208      {
     209        Xc=tCut/std::exp(ExtendedLogEnergy[NumberofExtendedEGrid-1]);
     210      }
    198211   
    199 //     G4PenelopeInterpolator* interpolator3 = new G4PenelopeInterpolator(pK,PDF,NumberofKPoints);
    200 //     Pbcut[i]=interpolator3->CalculateMomentum(Xc,-1);
    201 //     delete interpolator3;
    202 //   }
    203  
    204 }
     212    G4PenelopeInterpolator* interpolator3 = new G4PenelopeInterpolator(pK,PDF,NumberofKPoints);
     213    Pbcut[i]=interpolator3->CalculateMomentum(Xc,-1);
     214    delete interpolator3;
     215  }
     216  */
     217 
     218}
     219
     220//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    205221                       
    206 G4double G4PenelopeBremsstrahlungContinuous::CalculateStopping(G4double e1)
     222G4double G4PenelopeBremsstrahlungContinuous::CalculateStopping(G4double energy)
    207223  //Stopping power expressed in MeV/mm*2
    208224{
    209   G4double Xel=std::max(std::log(e1),ExtendedLogEnergy[0]);
     225  G4double Xel=std::max(std::log(energy),ExtendedLogEnergy[0]);
    210226  G4double Xe=1.0+(Xel-ExtendedLogEnergy[0])*DLFC;
    211227  G4int Ke = (G4int) Xe;
     
    213229 
    214230  //Global x-section factor
    215   G4double Fact=Zmat*Zmat*(e1+electron_mass_c2)*(e1+electron_mass_c2)/(e1*(e1+2.0*electron_mass_c2))
    216   *(millibarn/cm2);
    217   Fact=Fact*PositronCorrection(e1);
     231  G4double Fact=Zmat*Zmat*(energy+electron_mass_c2)*(energy+electron_mass_c2)/
     232    (energy*(energy+2.0*electron_mass_c2));
     233  Fact *= PositronCorrection(energy);
    218234
    219235  //Moments of the scaled bremss x-section
    220   G4double wcre = tCut/e1;
     236  G4double wcre = tCut/energy;
    221237  G4double pY[NumberofKPoints];
    222238  G4double pK[NumberofKPoints] = {1.0e-12,0.05,0.075,0.1,0.125,0.15,0.2,0.25,
     
    230246  G4PenelopeInterpolator* interpolator1 = new G4PenelopeInterpolator(pK,pY,NumberofKPoints);
    231247  G4double XS1A = interpolator1->CalculateMomentum(wcre,0);
    232   G4double XS2A = interpolator1->CalculateMomentum(wcre,1);
    233   delete interpolator1;
    234248  for (size_t k=0;k<NumberofKPoints;k++){
    235249    pY[k] = p0[std::min(Ke+1,(G4int) NumberofExtendedEGrid-1)][k];
     
    237251  G4PenelopeInterpolator* interpolator2 = new G4PenelopeInterpolator (pK,pY,NumberofKPoints);
    238252  G4double XS1B = interpolator2->CalculateMomentum(wcre,0);
    239   G4double XS2B = interpolator2->CalculateMomentum(wcre,1);
     253 
     254  G4double XS1 = ((1.0-Xek)*XS1A+Xek*XS1B)*Fact*energy; //weighted mean between the energy bin of the grid
     255
     256  //This is the 2nd momentum (straggling cross section). It might be useful later on
     257  /*
     258    G4double XS2A = interpolator1->CalculateMomentum(wcre,1);
     259    G4double XS2 = ((1.0-Xek)*XS2A+Xek*XS2B)*Fact*energy*energy;
     260    G4double XS2B = interpolator2->CalculateMomentum(wcre,1);
     261  */
     262
     263  delete interpolator1;
    240264  delete interpolator2;
    241  
    242   G4double XS1 = ((1.0-Xek)*XS1A+Xek*XS1B)*Fact*e1; //weighted mean between the energy bin of the grid
    243   G4double XS2 = ((1.0-Xek)*XS2A+Xek*XS2B)*Fact*e1*e1; //straggling cross section (2nd momentum);
    244   //Il secondo momento XS2 potrebbe tornare utile in seguito
    245 
    246   //XS1 is given in MeV*cm2, as in Penelope, but it must be converted in MeV*mm2
    247   XS1=XS1*cm2/mm2;
    248   //XS2 is given in MeV2*cm2, as in Penelope, but it must be converted in MeV2*mm2
    249   XS2=XS2*cm2/mm2;
    250 
    251   //Deve includere anche le famose correzioni per tenere conto
    252   //che la sezione d'urto varia sullo step!
    253   //Il valore che tira fuori va nella tabella e non viene piu' modificato
     265
    254266  return XS1;
    255267}
    256268
    257 G4double G4PenelopeBremsstrahlungContinuous::PositronCorrection(G4double en)
     269//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     270
     271G4double G4PenelopeBremsstrahlungContinuous::PositronCorrection(G4double energy)
    258272{
    259273  const G4double Coeff[7]={-1.2359e-01,6.1274e-2,-3.1516e-2,7.7446e-3,-1.0595e-3,
    260274                           7.0568e-5,-1.8080e-6};
    261   G4double T=0;
    262275  G4double correct=0;
    263276  if (partName == "e-") {
     
    265278  }
    266279  else if (partName == "e+"){
    267     T=std::log(1+((1e6*en)/(Zmat*Zmat*electron_mass_c2)));
     280    G4double T=std::log(1+((1e6*energy)/(Zmat*Zmat*electron_mass_c2)));
    268281    for (G4int i=0;i<7;i++){
    269282      correct += Coeff[i]*std::pow(T,i+1);
     
    272285    return correct;
    273286  }
    274   else //ne' elettroni ne' positroni...exception
     287  else //neither electrons nor positrons...exception
    275288    {
    276289      G4String excep = "G4PenelopeBremmstrahlungContinuous: the particle is not e- nor e+!";
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeCompton.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PenelopeCompton.cc,v 1.26 2006/06/29 19:40:41 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4PenelopeCompton.cc,v 1.33 2008/06/03 15:44:25 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// Author: Luciano Pandola
     
    4545// 17 Mar 2004 L.Pandola      Removed unnecessary calls to std::pow(a,b)
    4646// 18 Mar 2004 L.Pandola      Use of std::map (code review)
     47// 26 Mar 2008 L.Pandola      Add boolean flag to control atomic de-excitation
     48// 27 Mar 2008 L.Pandola      Re-named some variables to improve readability,
     49//                            and check for strict energy conservation
     50// 03 Jun 2008 L.Pandola      Added further protection against non-conservation
     51//                            of energy: it may happen because ionization energy
     52//                            from de-excitation manager and from Penelope internal
     53//                            database do not match (difference is <10 eV, but may
     54//                            give a e- with negative kinetic energy).
    4755//
    4856// -------------------------------------------------------------------
     
    8694    ZForIntegration(1),
    8795    nBins(200),
    88     cutForLowEnergySecondaryPhotons(250.0*eV)
     96    cutForLowEnergySecondaryPhotons(250.0*eV),
     97    fUseAtomicDeexcitation(true)
    8998{
    9099  if (lowEnergyLimit < intrinsicLowEnergyLimit ||
     
    118127  delete rangeTest;
    119128
    120   for (size_t i1=0;i1<matCrossSections->size();i1++)
    121     {
    122       delete (*matCrossSections)[i1];
     129  for (size_t i=0;i<matCrossSections->size();i++)
     130    {
     131      delete (*matCrossSections)[i];
    123132    }
    124133
     
    140149  G4DataVector energyVector;
    141150  G4double dBin = std::log10(highEnergyLimit/lowEnergyLimit)/nBins;
    142   G4int i;
    143   for (i=0;i<nBins;i++)
     151  for (G4int i=0;i<nBins;i++)
    144152    {
    145153      energyVector.push_back(std::pow(10.,std::log10(lowEnergyLimit)+i*dBin));
     
    150158  G4VDataSetAlgorithm* algo = new G4LogLogInterpolation();
    151159
    152   size_t nOfBins = energyVector.size();
    153   size_t bin=0;
     160  //size_t nOfBins = energyVector.size();
     161  //size_t bin=0;
    154162
    155163  G4DataVector* energies;
     
    158166  matCrossSections = new std::vector<G4VEMDataSet*>;
    159167
    160  
    161   G4int m;
    162   for (m=0; m<nMaterials; m++)
     168  for (G4int m=0; m<nMaterials; m++)
    163169    {
    164170      const G4Material* material= (*materialTable)[m];
     
    169175      G4VEMDataSet* setForMat = new G4CompositeEMDataSet(algo,1.,1.);
    170176
    171       for (i=0; i<nElements; i++) {
     177      for (G4int i=0; i<nElements; i++) {
    172178 
    173179        G4int Z = (G4int) (*elementVector)[i]->GetZ();
     
    178184
    179185
    180         for (bin=0; bin<nOfBins; bin++)
     186        for (size_t bin=0; bin<energyVector.size(); bin++)
    181187          {
    182188            G4double e = energyVector[bin];
     
    200206 
    201207 
    202   for (m=0; m<nMaterials; m++)
     208  for (G4int m=0; m<nMaterials; m++)
    203209    {
    204210      energies = new G4DataVector;
     
    206212      const G4Material* material= (*materialTable)[m];
    207213      material= (*materialTable)[m];
    208       for (bin=0; bin<nOfBins; bin++)
     214      for (size_t bin=0; bin<energyVector.size(); bin++)
    209215        {
    210216          G4double energy = energyVector[bin];
     
    254260  const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
    255261  const G4Material* material = couple->GetMaterial();
     262 
    256263  G4int Z = SelectRandomAtomForCompton(material,photonEnergy0);
    257264  const G4int nmax = 64;
     
    274281  a1 = std::log(ki2);
    275282  a2 = a1+2.0*ki*(1.0+ki)/(ki2*ki2);
     283  //If the incoming photon is above 5 MeV, the quicker approach based on the
     284  //pure Klein-Nishina formula is used
    276285  if (photonEnergy0 > 5*MeV)
    277286    {
     
    305314      }while((epsilon*photonEnergy0-photonEnergy0+ionEnergy) >0);
    306315    }
    307 
    308316  else //photonEnergy0<5 MeV
    309317    {
     
    359367                if (pzomc > 0)
    360368                  {
    361                     rn[i] = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*(std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
     369                    rn[i] = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
     370                                             (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
    362371                  }
    363372                else
    364373                  {
    365                     rn[i] = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*(std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
     374                    rn[i] = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
     375                                         (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
    366376                  }
    367377                S = S + occupNb*rn[i];
     
    431441    }
    432442 
    433 
    434443  G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
    435444  G4double phi = twopi * G4UniformRand() ;
     
    456465
    457466
    458   // Kinematics of the scattered electron
    459 
    460  
     467  // Kinematics of the scattered electron   
    461468  G4double diffEnergy = photonEnergy0*(1-epsilon);
    462469  ionEnergy = (*(ionizationEnergy->find(Z)->second))[iosc];
    463   //G4double eKineticEnergy = diffEnergy - ionEnergy;
    464470  G4double Q2 = photonEnergy0*photonEnergy0+photonEnergy1*(photonEnergy1-2.0*photonEnergy0*cosTheta);
    465471  G4double cosThetaE; //scattering angle for the electron
     
    473479    }
    474480  G4double sinThetaE = std::sqrt(1-cosThetaE*cosThetaE);
    475 
    476  
    477  
     481  //initialize here, then check photons created by Atomic-Deexcitation, and the final state e-
     482  G4int nbOfSecondaries = 0;
     483 
     484  std::vector<G4DynamicParticle*>* photonVector=0;
     485
    478486  const G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance();
    479487  const G4AtomicShell* shell = transitionManager->Shell(Z,iosc);
    480488  G4double bindingEnergy = shell->BindingEnergy();
    481489  G4int shellId = shell->ShellId();
    482   //G4cout << bindingEnergy/keV << " " << ionEnergy/keV << " keV" << G4endl;
    483   ionEnergy = std::max(bindingEnergy,ionEnergy); //protection against energy non-conservation
    484   G4double eKineticEnergy = diffEnergy - ionEnergy;
    485 
    486   size_t nTotPhotons=0;
    487   G4int nPhotons=0;
    488 
    489   const G4ProductionCutsTable* theCoupleTable=
    490     G4ProductionCutsTable::GetProductionCutsTable();
    491   size_t indx = couple->GetIndex();
    492   G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[indx];
    493   cutg = std::min(cutForLowEnergySecondaryPhotons,cutg);
    494 
    495   G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[indx];
    496   cute = std::min(cutForLowEnergySecondaryPhotons,cute);
    497  
    498   std::vector<G4DynamicParticle*>* photonVector=0;
    499   G4DynamicParticle* aPhoton;
    500   G4AtomicDeexcitation deexcitationManager;
    501 
    502   if (Z>5 && (ionEnergy > cutg || ionEnergy > cute))
    503     {
    504       photonVector = deexcitationManager.GenerateParticles(Z,shellId);
    505       nTotPhotons = photonVector->size();
    506       for (size_t k=0;k<nTotPhotons;k++){
    507         aPhoton = (*photonVector)[k];
    508         if (aPhoton)
    509           {
    510             G4double itsCut = cutg;
    511             if (aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute;
    512             G4double itsEnergy = aPhoton->GetKineticEnergy();
    513             if (itsEnergy > itsCut && itsEnergy <= ionEnergy)
     490  G4double ionEnergyInPenelopeDatabase = ionEnergy;
     491  ionEnergy = std::max(bindingEnergy,ionEnergyInPenelopeDatabase); //protection against energy non-conservation
     492
     493  G4double eKineticEnergy = diffEnergy - ionEnergy; //subtract the excitation energy. If not emitted by fluorescence,
     494  //the ionization energy is deposited as local energy deposition
     495  G4double localEnergyDeposit = ionEnergy;
     496  G4double energyInFluorescence = 0.; //testing purposes only
     497
     498  if (eKineticEnergy < 0)
     499    {
     500      //It means that there was some problem/mismatch between the two databases. Try to make it work
     501      //In this case available Energy (diffEnergy) < ionEnergy
     502      //Full residual energy is deposited locally
     503      localEnergyDeposit = diffEnergy;
     504      eKineticEnergy = 0.0;
     505    }
     506
     507  //the local energy deposit is what remains: part of this may be spent for fluorescence.
     508 
     509  if (fUseAtomicDeexcitation)
     510    {
     511      G4int nPhotons=0;
     512     
     513      const G4ProductionCutsTable* theCoupleTable=
     514        G4ProductionCutsTable::GetProductionCutsTable();
     515      size_t indx = couple->GetIndex();
     516
     517      G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[indx];
     518      cutg = std::max(cutForLowEnergySecondaryPhotons,cutg);
     519
     520      G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[indx];
     521      cute = std::max(cutForLowEnergySecondaryPhotons,cute);
     522     
     523      G4DynamicParticle* aPhoton;
     524      G4AtomicDeexcitation deexcitationManager;
     525     
     526      if (Z>5 && (localEnergyDeposit > cutg || localEnergyDeposit > cute))
     527        {
     528          photonVector = deexcitationManager.GenerateParticles(Z,shellId);
     529          for (size_t k=0;k<photonVector->size();k++){
     530            aPhoton = (*photonVector)[k];
     531            if (aPhoton)
    514532              {
    515                 nPhotons++;
    516                 ionEnergy -= itsEnergy;
    517               }
    518             else
    519               {
    520                 delete aPhoton;
    521                 (*photonVector)[k]=0;
     533                G4double itsCut = cutg;
     534                if (aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute;
     535                G4double itsEnergy = aPhoton->GetKineticEnergy();
     536                if (itsEnergy > itsCut && itsEnergy <= localEnergyDeposit)
     537                  {
     538                    nPhotons++;
     539                    localEnergyDeposit -= itsEnergy;
     540                    energyInFluorescence += itsEnergy;
     541                  }
     542                else
     543                  {
     544                    delete aPhoton;
     545                    (*photonVector)[k]=0;
     546                  }
    522547              }
    523548          }
    524       }
    525     }
    526   G4double energyDeposit =ionEnergy; //il deposito locale e' quello che rimane
    527   G4int nbOfSecondaries=nPhotons;
    528 
     549        }
     550      nbOfSecondaries=nPhotons;
     551    }
     552
     553 
    529554  // Generate the electron only if with large enough range w.r.t. cuts and safety
    530555  G4double safety = aStep.GetPostStepPoint()->GetSafety();
    531556  G4DynamicParticle* electron = 0;
    532   if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety))
     557  if (rangeTest->Escape(G4Electron::Electron(),couple,eKineticEnergy,safety) &&
     558      eKineticEnergy>cutForLowEnergySecondaryPhotons)
    533559    {
    534560      G4double xEl = sinThetaE * std::cos(phi+pi);
     
    543569  else
    544570    {
    545      
    546       energyDeposit += eKineticEnergy;
     571      localEnergyDeposit += eKineticEnergy;
    547572    }
    548573
    549574  aParticleChange.SetNumberOfSecondaries(nbOfSecondaries);
    550575  if (electron) aParticleChange.AddSecondary(electron);
    551   for (size_t ll=0;ll<nTotPhotons;ll++)
    552     {
    553       aPhoton = (*photonVector)[ll];
    554       if (aPhoton) aParticleChange.AddSecondary(aPhoton);
     576
     577  //This block below is executed only if there is at least one secondary photon produced by
     578  //AtomicDeexcitation
     579  if (photonVector)
     580    {
     581      for (size_t ll=0;ll<photonVector->size();ll++)
     582        {
     583          if ((*photonVector)[ll]) aParticleChange.AddSecondary((*photonVector)[ll]);
     584        }
    555585    }
    556586  delete photonVector;
    557   if (energyDeposit < 0)
     587  if (localEnergyDeposit < 0)
    558588    {
    559589      G4cout << "WARNING-"
    560590             << "G4PenelopeCompton::PostStepDoIt - Negative energy deposit"
    561591             << G4endl;
    562       energyDeposit=0;
    563     }
    564   aParticleChange.ProposeLocalEnergyDeposit(energyDeposit);
    565  
     592      localEnergyDeposit=0.;
     593    }
     594  aParticleChange.ProposeLocalEnergyDeposit(localEnergyDeposit);
     595 
     596
     597  if (verboseLevel > 1)
     598    {
     599      G4cout << "-----------------------------------------------------------" << G4endl;
     600      G4cout << "Energy balance from G4PenelopeCompton" << G4endl;
     601      G4cout << "Incoming photon energy: " << photonEnergy0/keV << " keV" << G4endl;
     602      G4cout << "-----------------------------------------------------------" << G4endl;
     603      G4cout << "Scattered photon: " << photonEnergy1/keV << " keV" << G4endl;
     604      G4double electronEnergy = 0.;
     605      if (electron)
     606        electronEnergy = eKineticEnergy;
     607      G4cout << "Scattered electron " << electronEnergy/keV << " keV" << G4endl;
     608      G4cout << "Fluorescence: " << energyInFluorescence/keV << " keV" << G4endl;
     609      G4cout << "Local energy deposit " << localEnergyDeposit/keV << " keV" << G4endl;
     610      G4cout << "Total final state: " << (photonEnergy1+electronEnergy+energyInFluorescence+localEnergyDeposit)/keV <<
     611        " keV" << G4endl;
     612      G4cout << "-----------------------------------------------------------" << G4endl;
     613    }
    566614
    567615  return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep);
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeIonisation.cc

    r819 r961  
    2525//
    2626// $Id: G4PenelopeIonisation.cc,v 1.19 2006/06/29 19:40:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopePhotoElectric.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PenelopePhotoElectric.cc,v 1.12 2006/06/29 19:40:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4PenelopePhotoElectric.cc,v 1.13 2009/01/08 09:42:54 pandola Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: L. Pandola
     
    3737// 31 May 2005  L. Pandola  Added Sauter formula for the sampling of
    3838//                          the electron direction
     39// 08 Jan 2009  L. Pandola  Check shell index to avoid mismatch between
     40//                          the Penelope cross section database and the
     41//                          G4AtomicTransitionManager database. It suppresses
     42//                          a warning from G4AtomicTransitionManager only.
     43//                          Results are unchanged.
    3944// --------------------------------------------------------------
    4045
     
    146151  // Retrieve the corresponding identifier and binding energy of the selected shell
    147152  const G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance();
     153
     154  //The number of shell cross section possibly reported in the Penelope database
     155  //might be different from the number of shells in the G4AtomicTransitionManager
     156  //(namely, Penelope may contain more shell, especially for very light elements).
     157  //In order to avoid a warning message from the G4AtomicTransitionManager, I
     158  //add this protection. Results are anyway changed, because when G4AtomicTransitionManager
     159  //has a shellID>maxID, it sets the shellID to the last valid shell.
     160  size_t numberOfShells = (size_t) transitionManager->NumberOfShells(Z);
     161  if (shellIndex >= numberOfShells)
     162    shellIndex = numberOfShells-1;
     163
    148164  const G4AtomicShell* shell = transitionManager->Shell(Z,shellIndex);
    149165  G4double bindingEnergy = shell->BindingEnergy();
  • trunk/source/processes/electromagnetic/lowenergy/src/G4PenelopeRayleigh.cc

    r819 r961  
    2727//
    2828// $Id: G4PenelopeRayleigh.cc,v 1.15 2007/09/03 09:43:14 pandola Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// Author: L. Pandola (luciano.pandola@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4RangeTest.cc

    r819 r961  
    2626//
    2727// $Id: G4RangeTest.cc,v 1.8 2006/06/29 19:41:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4SemiLogInterpolation.cc

    r819 r961  
    2626//
    2727// $Id: G4SemiLogInterpolation.cc,v 1.6 2006/06/29 19:41:18 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4ShellData.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ShellData.cc,v 1.8 2006/06/29 19:41:21 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ShellData.cc,v 1.10 2008/03/17 13:40:53 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    3838#include "G4ShellData.hh"
    3939#include "G4DataVector.hh"
     40#include "G4SystemOfUnits.hh"
    4041#include <fstream>
    4142#include <sstream>
     43#include <numeric>
     44#include <algorithm>
     45#include <valarray>
     46#include <functional>
     47#include "Randomize.hh"
     48
     49// The following deprecated header is included because <functional> seems not to be found on MGP's laptop
     50//#include "function.h"
    4251
    4352// Constructor
    4453
    45 G4ShellData::G4ShellData(G4int minZ, G4int maxZ)
    46   : zMin(minZ), zMax(maxZ)
    47 { }
     54G4ShellData::G4ShellData(G4int minZ, G4int maxZ, G4bool isOccupancy)
     55  : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
     56{  }
    4857
    4958// Destructor
    5059G4ShellData::~G4ShellData()
    5160{
    52   std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos;
    53 
     61  std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos;
    5462  for (pos = idMap.begin(); pos != idMap.end(); ++pos)
    5563    {
    56       G4DataVector* dataSet = (*pos).second;
     64      std::vector<G4double>* dataSet = (*pos).second;
    5765      delete dataSet;
    5866    }
    59   for (pos = bindingMap.begin(); pos != bindingMap.end(); ++pos)
    60     {
    61       G4DataVector* dataSet = (*pos).second;
     67
     68  std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2;
     69  for (pos2 = bindingMap.begin(); pos2 != bindingMap.end(); ++pos2)
     70    {
     71      G4DataVector* dataSet = (*pos2).second;
    6272      delete dataSet;
     73    }
     74
     75  if (occupancyData)
     76    {
     77      std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3;
     78      for (pos3 = occupancyPdfMap.begin(); pos3 != occupancyPdfMap.end(); ++pos3)
     79        {
     80          std::vector<G4double>* dataSet = (*pos3).second;
     81          delete dataSet;
     82        }
    6383    }
    6484}
     
    7898
    7999
    80 const G4DataVector& G4ShellData::ShellIdVector(G4int Z) const
    81 {
    82   std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
    83   if (Z < zMin || Z > zMax)
    84     G4Exception("G4ShellData::ShellIdVector - Z outside boundaries");
     100const std::vector<G4double>& G4ShellData::ShellIdVector(G4int Z) const
     101{
     102  std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
     103  if (Z < zMin || Z > zMax) G4Exception("G4ShellData::ShellIdVector - Z outside boundaries");
    85104  pos = idMap.find(Z);
    86   G4DataVector* dataSet = (*pos).second;
     105  std::vector<G4double>* dataSet = (*pos).second;
    87106  return *dataSet;
    88107}
    89108
     109
     110const std::vector<G4double>& G4ShellData::ShellVector(G4int Z) const
     111{
     112  std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
     113  if (Z < zMin || Z > zMax) G4Exception("G4ShellData::ShellVector - Z outside boundaries");
     114  pos = occupancyPdfMap.find(Z);
     115  std::vector<G4double>* dataSet = (*pos).second;
     116  return *dataSet;
     117}
     118
     119
    90120G4int G4ShellData::ShellId(G4int Z, G4int shellIndex) const
    91121{
     
    94124  if (Z >= zMin && Z <= zMax)
    95125    {
    96       std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
     126      std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
    97127      pos = idMap.find(Z);
    98128      if (pos!= idMap.end())
    99129        {
    100           G4DataVector dataSet = *((*pos).second);
     130          std::vector<G4double> dataSet = *((*pos).second);
    101131          G4int nData = dataSet.size();
    102132          if (shellIndex >= 0 && shellIndex < nData)
     
    108138  return n;
    109139}
     140
     141
     142G4double G4ShellData::ShellOccupancyProbability(G4int Z, G4int shellIndex) const
     143{
     144  G4double prob = -1.;
     145
     146  if (Z >= zMin && Z <= zMax)
     147    {
     148      std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
     149      pos = idMap.find(Z);
     150      if (pos!= idMap.end())
     151        {
     152          std::vector<G4double> dataSet = *((*pos).second);
     153          G4int nData = dataSet.size();
     154          if (shellIndex >= 0 && shellIndex < nData)
     155            {
     156              prob = dataSet[shellIndex];
     157            }
     158        }
     159    }
     160  return prob;
     161}
     162
    110163
    111164
     
    140193             << G4endl;
    141194      G4int nSh = nShells[Z-1];
    142       std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posId;
     195      std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posId;
    143196      posId = idMap.find(Z);
    144       G4DataVector* ids = (*posId).second;
     197      std::vector<G4double>* ids = (*posId).second;
    145198      std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posE;
    146199      posE = bindingMap.find(Z);
     
    149202        {
    150203          G4int id = (G4int) (*ids)[i];
    151           G4double e = (*energies)[i] / MeV;
    152           G4cout << i <<") Shell id: " << id
    153                  << " - Binding energy = "
    154                  << e << " MeV " << G4endl;
     204          G4double e = (*energies)[i] / keV;
     205          G4cout << i << ") ";
     206
     207          if (occupancyData)
     208            {
     209              G4cout << " Occupancy: ";
     210            }
     211          else
     212            {
     213              G4cout << " Shell id: ";
     214            }
     215          G4cout << id << " - Binding energy = "
     216                 << e << " keV ";
     217            if (occupancyData)
     218              {
     219                std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posOcc;
     220                posOcc = occupancyPdfMap.find(Z);
     221                std::vector<G4double> probs = *((*posOcc).second);
     222                G4double prob = probs[i];
     223                G4cout << "- Probability = " << prob;
     224              }
     225            G4cout << G4endl;
    155226        }
    156227      G4cout << "-------------------------------------------------"
     
    196267  G4int Z = 1;
    197268  G4DataVector* energies = new G4DataVector;
    198   G4DataVector* ids = new G4DataVector;
     269  std::vector<G4double>* ids = new std::vector<G4double>;
    199270
    200271  do {
     
    211282            nShells.push_back(n);
    212283            // Start of new shell data set
    213             ids = new G4DataVector;
     284            ids = new std::vector<G4double>;
    214285            energies = new G4DataVector;
    215286            Z++;           
     
    246317  } while (a != -2); // end of file
    247318  file.close();   
    248 }
    249 
     319
     320  // For Doppler broadening: the data set contains shell occupancy and binding energy for each shell
     321  // Build additional map with probability for each shell based on its occupancy
     322
     323  if (occupancyData)
     324    {
     325      // Build cumulative from raw shell occupancy
     326
     327      for (G4int Z=zMin; Z <= zMax; Z++)
     328        {
     329          std::vector<G4double> occupancy = ShellIdVector(Z);
     330
     331          std::vector<G4double>* prob = new std::vector<G4double>;
     332          G4double scale = 1. / G4double(Z);
     333
     334          prob->push_back(occupancy[0] * scale);
     335          for (size_t i=1; i<occupancy.size(); i++)
     336            {
     337              prob->push_back(occupancy[i]*scale + (*prob)[i-1]);
     338            }
     339          occupancyPdfMap[Z] = prob;
     340
     341          /*
     342            G4double scale = 1. / G4double(Z);
     343            //      transform((*prob).begin(),(*prob).end(),(*prob).begin(),bind2nd(multiplies<G4double>(),scale));
     344
     345            for (size_t i=0; i<occupancy.size(); i++)
     346            {
     347            (*prob)[i] *= scale;
     348            }
     349          */
     350        }
     351    }
     352}
     353
     354
     355G4int G4ShellData::SelectRandomShell(G4int Z) const
     356{
     357  if (Z < zMin || Z > zMax) G4Exception("G4ShellData::RandomSelect - Z outside boundaries");
     358
     359  G4int shellIndex = 0;   
     360  std::vector<G4double> prob = ShellVector(Z);
     361  G4double random = G4UniformRand();
     362
     363  // std::vector<G4double>::const_iterator pos;
     364  // pos = lower_bound(prob.begin(),prob.end(),random);
     365
     366  // Binary search the shell with probability less or equal random
     367
     368  G4int nShells = NumberOfShells(Z);
     369  G4int upperBound = nShells;
     370
     371  while (shellIndex <= upperBound)
     372    {
     373      G4int midShell = (shellIndex + upperBound) / 2;
     374      if ( random < prob[midShell] )
     375        upperBound = midShell - 1;
     376      else
     377        shellIndex = midShell + 1;
     378    } 
     379  if (shellIndex >= nShells) shellIndex = nShells - 1;
     380
     381  return shellIndex;
     382}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4ShellEMDataSet.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ShellEMDataSet.cc,v 1.15 2007/10/15 08:36:35 pia Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ShellEMDataSet.cc,v 1.16 2008/03/10 15:07:41 pia Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    3232// History:
    3333// -----------
    34 // 1 Aug 2001   MGP        Created
     34//  1 Aug 2001   MGP        Created
    3535// 09.10.01   V.Ivanchenko Add case z=0
     36//  9 Mar 2008   MGP        Cleaned up unreadable code modified by former developer
     37//                          (Further clean-up needed)
    3638//
    3739// -------------------------------------------------------------------
     
    4446
    4547
    46 G4ShellEMDataSet::G4ShellEMDataSet(G4int argZ, G4VDataSetAlgorithm* argAlgorithm,
    47                                    G4double argUnitEnergies,
    48                                    G4double argUnitData)
     48G4ShellEMDataSet::G4ShellEMDataSet(G4int zeta, G4VDataSetAlgorithm* algo,
     49                                   G4double eUnit,
     50                                   G4double dataUnit)
    4951  :
    50   z(argZ),
    51   algorithm(argAlgorithm),
    52   unitEnergies(argUnitEnergies),
    53   unitData(argUnitData)
    54 {
    55   if (algorithm == 0)
    56     G4Exception("G4ShellEMDataSet::G4ShellEMDataSet - interpolation == 0");
     52  z(zeta),
     53  algorithm(algo),
     54  unitEnergies(eUnit),
     55  unitData(dataUnit)
     56{
     57  if (algorithm == 0) G4Exception("G4ShellEMDataSet::G4ShellEMDataSet - interpolation == 0");
    5758}
    5859
     
    6162{
    6263  CleanUpComponents();
    63  
    64   if (algorithm)
    65     delete algorithm;
    66 }
    67 
    68 
    69 G4double G4ShellEMDataSet::FindValue(G4double argEnergy, G4int /* argComponentId */) const
     64  if (algorithm) delete algorithm;
     65}
     66
     67
     68G4double G4ShellEMDataSet::FindValue(G4double energy, G4int /* componentId */) const
    7069{
    7170  // Returns the sum over the shells corresponding to e
     
    7574  std::vector<G4VEMDataSet *>::const_iterator end(components.end());
    7675
    77   while (i!=end)
    78     {
    79       value+=(*i)->FindValue(argEnergy);
     76  while (i != end)
     77    {
     78      value += (*i)->FindValue(energy);
    8079      i++;
    8180    }
     
    8786void G4ShellEMDataSet::PrintData(void) const
    8887{
    89   const size_t n(NumberOfComponents());
     88  const size_t n = NumberOfComponents();
    9089
    9190  G4cout << "The data set has " << n << " components" << G4endl;
    9291  G4cout << G4endl;
    9392 
    94   size_t i(0);
    95  
    96   while (i<n)
     93  size_t i = 0;
     94 
     95  while (i < n)
    9796    {
    9897      G4cout << "--- Component " << i << " ---" << G4endl;
     
    103102
    104103
    105 void G4ShellEMDataSet :: SetEnergiesData(G4DataVector* argEnergies,
    106                                          G4DataVector* argData,
    107                                          G4int argComponentId)
    108 {
    109   G4VEMDataSet * component(components[argComponentId]);
     104void G4ShellEMDataSet::SetEnergiesData(G4DataVector* energies,
     105                                       G4DataVector* data,
     106                                       G4int componentId)
     107{
     108  G4VEMDataSet* component = components[componentId];
    110109 
    111110  if (component)
    112111    {
    113       component->SetEnergiesData(argEnergies, argData, 0);
     112      component->SetEnergiesData(energies, data, 0);
    114113      return;
    115114    }
    116115
    117116  std::ostringstream message;
    118   message << "G4ShellEMDataSet::SetEnergiesData - component " << argComponentId << " not found";
     117  message << "G4ShellEMDataSet::SetEnergiesData - component " << componentId << " not found";
    119118 
    120119  G4Exception(message.str().c_str());
     
    122121
    123122
    124 G4bool G4ShellEMDataSet::LoadData(const G4String& argFileName)
     123G4bool G4ShellEMDataSet::LoadData(const G4String& file)
    125124{
    126125  CleanUpComponents();
    127126
    128   G4String fullFileName(FullFileName(argFileName));
     127  G4String fullFileName = FullFileName(file);
    129128  std::ifstream in(fullFileName);
    130129
     
    132131    {
    133132      G4String message("G4ShellEMDataSet::LoadData - data file \"");
    134       message+=fullFileName;
    135       message+="\" not found";
     133      message += fullFileName;
     134      message += "\" not found";
    136135      G4Exception(message);
    137136    }
    138137
    139   G4DataVector* argEnergies(0);
    140   G4DataVector* argData(0);
    141 
    142   G4double a;
    143   G4int shellIndex(0);
    144   bool energyColumn(true);
     138  G4DataVector* energies = 0;
     139  G4DataVector* data = 0;
     140
     141  G4double a = 0.;
     142  G4int shellIndex = 0;
     143  bool energyColumn = true;
    145144
    146145  do
     
    150149      if (a == -1)
    151150        {
    152           if (energyColumn && argEnergies!=0)
     151          if (energyColumn && energies!=0)
    153152            {
    154               AddComponent(new G4EMDataSet(shellIndex, argEnergies, argData, algorithm->Clone(), unitEnergies, unitData));
    155               argEnergies=0;
    156               argData=0;
     153              AddComponent(new G4EMDataSet(shellIndex, energies, data, algorithm->Clone(), unitEnergies, unitData));
     154              energies = 0;
     155              data = 0;
    157156            }
    158157   
    159           energyColumn=(!energyColumn);
     158          energyColumn = (!energyColumn);
    160159        }
    161       else if (a!=-2)
     160      else if (a != -2)
    162161        {
    163           if (argEnergies==0)
     162          if (energies == 0)
    164163            {
    165               argEnergies=new G4DataVector;
    166               argData=new G4DataVector;
     164              energies = new G4DataVector;
     165              data = new G4DataVector;
    167166            }
    168167 
    169168          if (energyColumn)
    170             argEnergies->push_back(a*unitEnergies);
     169            energies->push_back(a * unitEnergies);
    171170          else
    172             argData->push_back(a*unitData);
    173 
    174           energyColumn=(!energyColumn);
     171            data->push_back(a * unitData);
     172
     173          energyColumn = (!energyColumn);
    175174        }
    176175    }
     
    181180
    182181
    183 G4bool G4ShellEMDataSet::SaveData(const G4String& argFileName) const
    184 {
    185   G4String fullFileName(FullFileName(argFileName));
     182G4bool G4ShellEMDataSet::SaveData(const G4String& file) const
     183{
     184  G4String fullFileName = FullFileName(file);
    186185  std::ofstream out(fullFileName);
    187186
     
    189188    {
    190189      G4String message("G4EMDataSet::SaveData - cannot open \"");
    191       message+=fullFileName;
    192       message+="\"";
     190      message += fullFileName;
     191      message += "\"";
    193192      G4Exception(message);
    194193    }
    195194 
    196   const size_t n(NumberOfComponents());
    197   size_t k(0);
    198  
    199   while (k<n)
    200     {
    201       const G4VEMDataSet * component=GetComponent(k);
     195  const size_t n = NumberOfComponents();
     196  size_t k = 0;
     197 
     198  while (k < n)
     199    {
     200      const G4VEMDataSet* component = GetComponent(k);
    202201 
    203202      if (component)
    204203        {
    205           const G4DataVector & energies(component->GetEnergies(0));
    206           const G4DataVector & data(component->GetData(0));
    207  
    208           G4DataVector::const_iterator i(energies.begin());
    209           G4DataVector::const_iterator endI(energies.end());
    210           G4DataVector::const_iterator j(data.begin());
    211  
    212           while (i!=endI)
     204          const G4DataVector& energies = component->GetEnergies(0);
     205          const G4DataVector& data = component->GetData(0);
     206 
     207          G4DataVector::const_iterator i = energies.begin();
     208          G4DataVector::const_iterator endI = energies.end();
     209          G4DataVector::const_iterator j = data.begin();
     210 
     211          while (i != endI)
    213212            {
    214213              out.precision(10);
     
    253252
    254253
    255 
    256 
    257 
    258254void G4ShellEMDataSet::CleanUpComponents(void)
    259255{
    260256  while (!components.empty())
    261257    {
    262       if (components.back())
    263         delete components.back();
    264 
     258      if (components.back()) delete components.back();
    265259      components.pop_back();
    266260    }
     
    268262
    269263
    270 
    271 
    272 
    273 G4String G4ShellEMDataSet::FullFileName(const G4String & argFileName) const
     264G4String G4ShellEMDataSet::FullFileName(const G4String& fileName) const
    274265{
    275266  char* path = getenv("G4LEDATA");
     
    279270  std::ostringstream fullFileName;
    280271 
    281   fullFileName << path << '/' << argFileName << z << ".dat";
     272  fullFileName << path << '/' << fileName << z << ".dat";
    282273                     
    283274  return G4String(fullFileName.str().c_str());
  • trunk/source/processes/electromagnetic/lowenergy/src/G4VCrossSectionHandler.cc

    r819 r961  
    2626//
    2727// $Id: G4VCrossSectionHandler.cc,v 1.17 2006/06/29 19:41:42 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4VLowEnergyDiscretePhotonProcess.cc

    r819 r961  
    2525//
    2626// $Id: G4VLowEnergyDiscretePhotonProcess.cc,v 1.5 2006/06/29 19:41:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4VeLowEnergyLoss.cc

    r819 r961  
    2626//
    2727// $Id: G4VeLowEnergyLoss.cc,v 1.25 2006/06/29 19:41:50 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/lowenergy/src/G4WaterExcitationStructure.cc

    r819 r961  
    2626//
    2727// $Id: G4WaterExcitationStructure.cc,v 1.1 2007/10/15 08:57:54 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4WaterIonisationStructure.cc

    r819 r961  
    2626//
    2727// $Id: G4WaterIonisationStructure.cc,v 1.1 2007/11/08 20:39:35 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eBremsstrahlungSpectrum.cc

    r819 r961  
    2525//
    2626// $Id: G4eBremsstrahlungSpectrum.cc,v 1.15 2006/06/29 19:41:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eCrossSectionExcitationEmfietzoglou.cc

    r819 r961  
    2626//
    2727// $Id: G4eCrossSectionExcitationEmfietzoglou.cc,v 1.1 2007/05/04 10:16:06 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
    3131// $Id: G4eCrossSectionExcitationEmfietzoglou.cc,v 1.1 2007/05/04 10:16:06 pia Exp $
    32 // GEANT4 tag $Name: $
     32// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3333//
    3434// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eCrossSectionScreenedRutherford.cc

    r819 r961  
    2626//
    2727// $Id: G4eCrossSectionScreenedRutherford.cc,v 1.3 2007/10/12 12:27:19 pia Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Contact Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationCrossSectionHandler.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eIonisationCrossSectionHandler.cc,v 1.11 2006/06/29 19:42:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eIonisationCrossSectionHandler.cc,v 1.12 2009/01/29 08:13:34 pandola Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4242// 19 Jul 2002   VI          Create composite data set for material
    4343// 21 Jan 2003  V.Ivanchenko Cut per region
     44// 28 Jan 2009  L.Pandola    Added public method to make a easier migration of
     45//                           G4LowEnergyIonisation to G4LivermoreIonisationModel
    4446//
    4547// -------------------------------------------------------------------
     
    98100    G4int nElements = material->GetNumberOfElements();
    99101
    100     if(verbose > 0) {
    101       G4cout << "eIonisation CS for " << m << "th material "
    102              << material->GetName()
    103              << "  eEl= " << nElements << G4endl;
    104     }
     102    if(verbose > 0)
     103      {
     104        G4cout << "eIonisation CS for " << m << "th material "
     105               << material->GetName()
     106               << "  eEl= " << nElements << G4endl;
     107      }
    105108
    106109    G4double tcut  = (*energyCuts)[m];
     
    129132            value += cross * p * density;
    130133
    131             if(verbose>0 && m == 0 && e>=1. && e<=0.) {
     134            if(verbose>0 && m == 0 && e>=1. && e<=0.)
     135            {
    132136              G4cout << "G4eIonCrossSH: e(MeV)= " << e/MeV
    133137                     << " n= " << n
     
    139143                     << " Z= " << Z
    140144                     << G4endl;
    141             }
     145              }
    142146
    143147          }
     
    155159}
    156160
    157 
     161G4double G4eIonisationCrossSectionHandler::GetCrossSectionAboveThresholdForElement(G4double energy,
     162                                                                                   G4double cutEnergy,
     163                                                                                   G4int Z)
     164{
     165  G4int nShells = NumberOfComponents(Z);
     166  G4double value = 0.;
     167  if(energy > cutEnergy)
     168    {
     169      for (G4int n=0; n<nShells; n++) {
     170        G4double cross = FindValue(Z, energy, n);
     171        G4double p = theParam->Probability(Z, cutEnergy, energy, energy, n);
     172        value += cross * p;
     173      }
     174    }
     175  return value;
     176}
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationParameters.cc

    r819 r961  
    2626//
    2727// $Id: G4eIonisationParameters.cc,v 1.23 2006/06/29 19:42:02 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eIonisationSpectrum.cc

    r819 r961  
    2525//
    2626// $Id: G4eIonisationSpectrum.cc,v 1.25 2006/06/29 19:42:04 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4eLowEnergyLoss.cc

    r819 r961  
    2626//
    2727// $Id: G4eLowEnergyLoss.cc,v 1.35 2006/06/29 19:42:06 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929// 
    3030// -----------------------------------------------------------
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hLowEnergyIonisation.cc

    r819 r961  
    15011501              type = aSecondary->GetDefinition();
    15021502              if ( etot + e <= eLoss &&
    1503                    (type == G4Gamma::Gamma() && e > minGammaEnergy ) ||
    1504                    (type == G4Electron::Electron() && e > minElectronEnergy)) {
     1503                   ( (type == G4Gamma::Gamma() && e > minGammaEnergy ) ||
     1504                   (type == G4Electron::Electron() && e > minElectronEnergy) ) ) {
    15051505
    15061506                     etot += e;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hLowEnergyLoss.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4hLowEnergyLoss.cc,v 1.23 2006/06/29 19:42:23 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4hLowEnergyLoss.cc,v 1.28 2009/02/20 10:49:54 sincerti Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -----------------------------------------------------------
     
    145145G4double G4hLowEnergyLoss::HighestKineticEnergy= 100.*GeV;
    146146G4int    G4hLowEnergyLoss::TotBin = 360;
    147 G4double G4hLowEnergyLoss::RTable,G4hLowEnergyLoss::LOGRTable;
     147G4double G4hLowEnergyLoss::RTable =1.1;
     148G4double G4hLowEnergyLoss::LOGRTable = 1.1;
    148149
    149150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    772773    theRangeTable = theRangepbarTable ;
    773774  }
    774  
    775775  G4double R2 = RTable*RTable ;
    776776  G4double R1 = RTable+1.;
     
    796796      else
    797797      {
    798         Tim = Ti/RTable ;
     798        // ---- MGP ---- Modified to avoid a floating point exception
     799        // The correction is just a temporary patch, the whole class should be redesigned
     800        // Original: Tim = Ti/RTable  results in 0./0.
     801        if (RTable != 0.)
     802          {
     803            Tim = Ti/RTable ;
     804          }
     805        else
     806          {
     807            Tim = 0.;
     808          }
    799809        Rim = rangeVector->GetValue(Tim,isOut);
    800810      }
     
    806816        Rip = rangeVector->GetValue(Tip,isOut);
    807817      }
    808       Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
     818      if (Ti!=0) Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti); else Value=0;
    809819
    810820      aVector->PutValue(i,Value);
     
    868878      else
    869879      {
    870         Tim = Ti/RTable ;
     880        if (RTable!=0) Tim = Ti/RTable ; else Tim =0;
    871881        Rim = rangeVector->GetValue(Tim,isOut);
    872882      }
     
    878888        Rip = rangeVector->GetValue(Tip,isOut);
    879889      }
    880       Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
     890      if (Ti!=0) Value = (w1*Rip + w2*Ri + w3*Rim)/Ti; else Value=0;
    881891
    882892      aVector->PutValue(i,Value);
     
    939949      else
    940950      {
    941         Tim = Ti/RTable ;
     951        if (RTable!=0) Tim = Ti/RTable ; else Tim=0;
    942952        Rim = rangeVector->GetValue(Tim,isOut);
    943953      }
     
    10521062{
    10531063  G4double LowEdgeRange,A,B,C,discr,KineticEnergy ;
    1054   G4double Tbin = LowestKineticEnergy/RTable ;
     1064  G4double Tbin = 0;
     1065  if (RTable !=0.) Tbin = LowestKineticEnergy/RTable ;
    10551066  G4double rangebin = 0.0 ;
    10561067  G4int binnumber = -1 ;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionDoubleExp.cc

    r819 r961  
    4141// Empiric Model for shell cross sections in proton ionisation
    4242// -------------------------------------------------------------------
    43 // $Id: G4hShellCrossSectionDoubleExp.cc,v 1.8 2006/06/29 19:42:35 gunter Exp $
    44 // GEANT4 tag $Name: $
     43// $Id: G4hShellCrossSectionDoubleExp.cc,v 1.9 2008/06/26 18:19:10 sincerti Exp $
     44// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4545
    4646#include "globals.hh"
     
    187187 
    188188  std::vector<G4double> kProbability;//(0);
    189   kProbability.push_back(GetCrossSectionDoubleExp(Z,incidentEnergy)/atomTotalCrossSection);
    190   // ---- MGP ---- Next line corrected to kProbability[0] instead of [1], which is not initialized!
    191   kProbability.push_back(1 - kProbability[0]);
     189 
     190 
     191  if (atomTotalCrossSection!=0.) // SI - 26 june 2008
     192 
     193  {
     194    kProbability.push_back(GetCrossSectionDoubleExp(Z,incidentEnergy)/atomTotalCrossSection);
     195    // ---- MGP ---- Next line corrected to kProbability[0] instead of [1], which is not initialized!
     196    kProbability.push_back(1 - kProbability[0]);
     197  }
    192198
    193199  return kProbability;
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionDoubleExpData.cc

    r819 r961  
    3434// -------------------------------------------------------------------
    3535// $Id: G4hShellCrossSectionDoubleExpData.cc,v 1.4 2006/06/29 19:42:38 gunter Exp $
    36 // GEANT4 tag $Name: $
     36// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3737
    3838#include "G4hShellCrossSectionDoubleExpData.hh"
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionExp.cc

    r819 r961  
    4141// Empiric Model for shell cross sections in proton ionisation
    4242// -------------------------------------------------------------------
    43 // $Id: G4hShellCrossSectionExp.cc,v 1.5 2006/06/29 19:42:40 gunter Exp $
    44 // GEANT4 tag $Name: $
     43// $Id: G4hShellCrossSectionExp.cc,v 1.6 2008/05/02 19:23:38 pia Exp $
     44// GEANT4 tag $Name: geant4-09-02-ref-02 $
    4545
    4646#include "globals.hh"
     
    104104      crossSectionsInBarn = a*(std::pow(b,(1./incidentEnergyInMeV)))*(std::pow(incidentEnergyInMeV,c));
    105105    }         
    106   else if(Z<66 && Z>=26 || Z==17)
     106  else if((Z<66 && Z>=26) || Z==17)
    107107    {
    108108      crossSectionsInBarn = std::exp(a+(b/incidentEnergyInMeV)+(c*std::log(incidentEnergyInMeV)));
  • trunk/source/processes/electromagnetic/lowenergy/src/G4hShellCrossSectionExpData.cc

    r819 r961  
    3434// -------------------------------------------------------------------
    3535// $Id: G4hShellCrossSectionExpData.cc,v 1.3 2006/06/29 19:42:42 gunter Exp $
    36 // GEANT4 tag $Name: $
     36// GEANT4 tag $Name: geant4-09-02-ref-02 $
    3737
    3838#include "G4hShellCrossSectionExpData.hh"
  • trunk/source/processes/electromagnetic/muons/History

    r819 r961  
    1 $Id: History,v 1.106 2007/11/12 10:34:23 vnivanch Exp $
     1$Id: History,v 1.126 2009/02/26 11:04:20 vnivanch Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     2026 February 09: V.Ivant (emmuons-V09-02-01)
     21G4MuIonisation - fixed initialisation alowing to configure external model
     22                 of fluctuations
     23
     2420 February 09: V.Ivant (emmuons-V09-02-00)
     25- Cleanup: improved comments, move virtual methods from .hh to .cc
     26
     2712 November 08: V.Ivant (emmuons-V09-01-15)
     28G4EnergyLossForExtrapolator - added method TrueStepLength; fixed initialisation
     29                              before a step
     30
     3127 October 08: V.Ivant (emmuons-V09-01-14)
     32G4EnergyLossForExtrapolator - make method ComputeTrueStep public and cleanup
     33
     3416 October 08: V.Ivant (emmuons-V09-01-13)
     35G4MuMscModel - remove obsolete
     36G4EnergyLossForExtrapolator - added spline option
     37G4MuIonisation, G4MuBremsstrahlung, G4MuPairProduction,
     38G4MuMultipleScattering - change SubType and improved cout
     39
     404 August 08: V.Ivant (emmuons-V09-01-12)
     41G4MuMscModel - added protection for ions
     42
     4331 July 08: V.Ivant (emmuons-V09-01-11)
     44G4MuMscModel - do not define min and max energy in constructor but use Set
     45               methods
     46G4MuMultipleScattering - added cout of model names
     47
     4821 April 08:  V.Ivanchenko (emmuons-V09-01-10)
     49G4MuBremsstrahlungModel, G4MuPairProductionModel - use CrossSectionPerVolume
     50                    from the base class, do not use A in CrossSEctionPerAtom
     51G4MuMscModel - do not use A in SetupTarget
     52
     5304 April 08:  V.Ivanchenko (emmuons-V09-01-09)
     54G4MuMultipleScattering - use G4WentzelVIModel model
     55                         build table for particles with mass < GeV
     56
     5704 April 08:  V.Ivanchenko (emmuons-V09-01-08)
     58- G4MuBremsstrahlungModel - instead of static const use members of a class,
     59                            this allows to reuse the model for different
     60                            particle type
     61
     6227 March 08:  V.Ivanchenko (emmuons-V09-01-07)
     63- G4MuPairProductionModel - fixed nan value at initialisation
     64  of the sampling table
     65
     6626 March 08:  V.Ivanchenko (emmuons-V09-01-06)
     67- G4MuMscModel - fixed outstanding bug in sampling of scattering
     68
     6925 March 08:  V.Ivanchenko (emmuons-V09-01-05)
     70- G4MuMscModel - added shift along particle direction for displacement
     71- G4MuBetheBlochModel - update computation of correction
     72
     7317 March 08:  V.Ivanchenko (emmuons-V09-01-04)
     74- G4MuMscModel - fixed sampling
     75
     7614 March 08:  V.Ivanchenko (emmuons-V09-01-03)
     77- G4MuMscModel - use G4VMscModel interface
     78
     7906 March 08:  V.Ivanchenko (emmuons-V09-01-02)
     80- G4MuBremsstrahlungModel - remove ignoreCut flag, remove obsolete methods
     81                            and members, set some members protected to
     82                            be used by G4hBremsstrahlungModel
     83- G4MuPairProductionModel - remove ignoreCut flag,  set some members protected
     84                            to be used by G4hBremsstrahlungModel
     85- SubType for all processes is initialized
     86
     8722 February 08:  V.Ivanchenko (emmuons-V09-01-01)
     88G4MuMscModel - added sampling of tail distribution
     89
     9014 January 08:  V.Ivanchenko (emmuons-V09-01-00)
     91G4MuMscModel - added computation of the second moment of the distribution;
     92               fixed sampling
     93G4MuMultipleScattering - modified default RangeFactor
    1994
    209512 November 07:  V.Ivanchenko (emmuons-V09-00-04)
  • trunk/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EnergyLossForExtrapolator.hh,v 1.9 2007/07/28 13:44:25 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4EnergyLossForExtrapolator.hh,v 1.12 2008/11/13 14:14:07 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//---------------------------------------------------------------------------
     
    8181
    8282  G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
    83                             const G4Material*, const G4ParticleDefinition*);
     83                            const G4Material*, const G4ParticleDefinition*);
     84
     85  G4double TrueStepLength(G4double kinEnergy, G4double step,
     86                          const G4Material*, const G4ParticleDefinition* part);
    8487
    8588  inline G4double EnergyAfterStep(G4double kinEnergy, G4double step,
    86                            const G4Material*, const G4String& particleName);
     89                                  const G4Material*, const G4String& particleName);
    8790
    8891  inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
    89                             const G4Material*, const G4String& particleName);
     92                                   const G4Material*, const G4String& particleName);
    9093
    9194  inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
    92                                   const G4Material*, const G4ParticleDefinition* part);
     95                                         const G4Material*,
     96                                         const G4ParticleDefinition* part);
    9397
    9498  inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
    95                                          const G4Material*, const G4String& particleName);
     99                                         const G4Material*,
     100                                         const G4String& particleName);
     101
     102  inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
     103                                  G4double kinEnergy, G4double stepLength);
    96104
    97105  inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
    98                             const G4Material*, const G4ParticleDefinition*);
     106                                   const G4Material*, const G4ParticleDefinition*);
    99107
    100108  inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
     
    113121  void Initialisation();
    114122
     123  G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
     124                         G4double kinEnergy);
     125
    115126  G4PhysicsTable* PrepareTable();
    116127
     
    123134  void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
    124135
    125   G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
    126                            G4double kinEnergy, G4double stepLength);
     136  void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table);
    127137
    128138  inline G4double ComputeValue(G4double x, const G4PhysicsTable* table);
    129 
    130   inline G4double ComputeScatteringAngle(G4double x);
    131139
    132140  // hide assignment operator
     
    158166  G4PhysicsTable*          invRangeMuon;
    159167  G4PhysicsTable*          invRangeProton;
     168  G4PhysicsTable*          mscElectron;
    160169
    161170  const G4Material* currentMaterial;
     
    214223//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    215224
    216 inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
    217                                                               G4double step,
    218                                                               const G4Material* mat,
    219                                                               const G4String& name)
     225inline G4double
     226G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
     227                                              G4double step,
     228                                              const G4Material* mat,
     229                                              const G4String& name)
    220230{
    221231  return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
     
    224234//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    225235
    226 inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
    227                                                              G4double stepLength,
    228                                                              const G4Material* mat,
    229                                                              const G4ParticleDefinition* part)
    230 {
    231   if(!isInitialised) Initialisation();
     236inline G4double
     237G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
     238                                                    G4double stepLength,
     239                                                    const G4Material* mat,
     240                                                    const G4ParticleDefinition* part)
     241{
    232242  G4double theta = 0.0;
    233   if(mat && part && kinEnergy > 0.0) {
    234     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
    235     if(step > 0.001*radLength) theta = ComputeScatteringAngle(stepLength);
     243  if(SetupKinematics(part, mat, kinEnergy)) {
     244    G4double t = stepLength/radLength;
     245    G4double y = std::max(0.001, t);
     246    theta = 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass);
    236247  }
    237248  return theta;
     
    240251//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    241252
    242 inline G4double G4EnergyLossForExtrapolator::ComputeScatteringAngle(G4double x)
    243 {
    244   G4double t = x/radLength;
    245   return 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(t))/(beta2*gam*mass);
    246 }
     253inline G4double
     254G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
     255                                             const G4ParticleDefinition* part,
     256                                             G4double kinEnergy,
     257                                             G4double stepLength)
     258{
     259  G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
     260  return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
     261}
    247262
    248263//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    249264 
    250 inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(
    251                                                        G4double kinEnergy,
     265inline
     266G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
    252267                                                       G4double stepLength,
    253268                                                       const G4Material* mat,
    254269                                                       const G4ParticleDefinition* part)
    255270{
    256   if(!isInitialised) Initialisation();
    257271  G4double sig2 = 0.0;
    258   if(mat && part ) {
     272  if(SetupKinematics(part, mat, kinEnergy)) {
    259273    G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
    260     sig2 = (1.0/beta2 - 0.5)* twopi_mc2_rcl2 * tmax*step * electronDensity * charge2;
     274    sig2 = (1.0/beta2 - 0.5)*twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
    261275  }
    262276  return sig2;
     
    269283{
    270284  G4double res = 0.0;
    271   bool b;
    272   res = ((*table)[index])->GetValue(x, b);
     285  G4bool b;
     286  if(table) res = ((*table)[index])->GetValue(x, b);
    273287  return res;
    274288}
  • trunk/source/processes/electromagnetic/muons/include/G4MuBetheBlochModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBetheBlochModel.hh,v 1.17 2007/05/22 17:35:58 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MuBetheBlochModel.hh,v 1.18 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7676  virtual ~G4MuBetheBlochModel();
    7777
    78   void Initialise(const G4ParticleDefinition*, const G4DataVector&);
     78  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7979
    80   G4double MinEnergyCut(const G4ParticleDefinition*,
    81                         const G4MaterialCutsCouple*);
     80  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     81                                const G4MaterialCutsCouple*);
    8282                       
    8383  virtual G4double ComputeCrossSectionPerElectron(
     
    113113protected:
    114114
    115   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    116                                     G4double kinEnergy);
     115  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     116                                      G4double kinEnergy);
    117117
    118118private:
    119119
    120   void SetParticle(const G4ParticleDefinition* p);
     120  inline void SetParticle(const G4ParticleDefinition* p);
    121121
    122122  // hide assignment operator
     
    141141};
    142142
    143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    144144
    145 inline G4double G4MuBetheBlochModel::MaxSecondaryEnergy(
    146           const G4ParticleDefinition*,
    147                 G4double kinEnergy)
     145inline void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)
    148146{
    149   G4double tau  = kinEnergy/mass;
    150   G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
    151                   (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
    152   return tmax;
     147  if(!particle) {
     148    particle = p;
     149    mass = particle->GetPDGMass();
     150    massSquare = mass*mass;
     151    ratio = electron_mass_c2/mass;
     152  }
    153153}
    154154
  • trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlung.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBremsstrahlung.hh,v 1.29 2007/05/23 08:49:32 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuBremsstrahlung.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8686  virtual ~G4MuBremsstrahlung();
    8787
    88   G4bool IsApplicable(const G4ParticleDefinition& p);
     88  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    8989
    90   G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    91                             const G4Material*,
    92                             G4double cut);
     90  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     91                                    const G4Material*,
     92                                    G4double cut);
    9393
    9494  // Print out of the class parameters
    95   void PrintInfo();
     95  virtual void PrintInfo();
    9696
    9797protected:
    9898
    99   void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
    100                                    const G4ParticleDefinition*);
     99  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
     100                                           const G4ParticleDefinition*);
    101101
    102102private:
     
    114114
    115115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    117 
    118 inline G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
    119 {
    120   return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
    121 }
    122 
    123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    124 
    125 inline G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
    126                                                      const G4Material*,
    127                                                            G4double)
    128 {
    129   return lowestKinEnergy;
    130 }
    131 
    132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    133116
    134117#endif
  • trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlungModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBremsstrahlungModel.hh,v 1.17 2007/10/11 09:25:31 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuBremsstrahlungModel.hh,v 1.22 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4545// 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
    4646// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
    47 // 13-02-06 add ComputeCrossSectionPerAtom (mma)
     47// 13-02-06 Add ComputeCrossSectionPerAtom (mma)
    4848// 11-10-07 Add ignoreCut flag (V.Ivanchenko)
     49// 28-02-08 Reorganized protected methods and members (V.Ivanchenko)
     50// 06-03-08 Remove obsolete methods and members (V.Ivanchenko)
    4951//
    5052
     
    5254// Class Description:
    5355//
    54 // Implementation of energy loss for gamma emission by muons
     56// Implementation of bremssrahlung by muons
    5557
    5658// -------------------------------------------------------------------
     
    6163
    6264#include "G4VEmModel.hh"
     65#include "G4NistManager.hh"
    6366
    6467class G4Element;
     
    7578  virtual ~G4MuBremsstrahlungModel();
    7679
    77   void SetParticle(const G4ParticleDefinition*);
     80  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7881
    79   void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    80 
    81   void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;};
    82 
    83   G4double MinEnergyCut(const G4ParticleDefinition*,
    84                         const G4MaterialCutsCouple*);
     82  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     83                                const G4MaterialCutsCouple*);
    8584                             
    8685  virtual G4double ComputeCrossSectionPerAtom(
     
    9089                                 G4double cutEnergy,
    9190                                 G4double maxEnergy);
    92                                  
    93   virtual G4double CrossSectionPerVolume(const G4Material*,
    94                          const G4ParticleDefinition*,
    95                                G4double kineticEnergy,
    96                                G4double cutEnergy,
    97                                G4double maxEnergy);
    98                                
     91                                                               
    9992  virtual G4double ComputeDEDXPerVolume(const G4Material*,
    10093                                const G4ParticleDefinition*,
     
    10295                                G4double cutEnergy);
    10396                             
    104   void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    105                          const G4MaterialCutsCouple*,
    106                          const G4DynamicParticle*,
    107                          G4double tmin,
    108                          G4double maxEnergy);
     97  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
     98                                 const G4MaterialCutsCouple*,
     99                                 const G4DynamicParticle*,
     100                                 G4double tmin,
     101                                 G4double maxEnergy);
     102
     103  inline void SetLowestKineticEnergy(G4double e);
    109104
    110105protected:
    111106
    112   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    113                               G4double kineticEnergy);
     107  G4double ComputMuBremLoss(G4double Z, G4double tkin, G4double cut);
     108 
     109  G4double ComputeMicroscopicCrossSection(G4double tkin,
     110                                          G4double Z,
     111                                          G4double cut);
    114112
    115 public:
     113  virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
     114                                                   G4double Z,
     115                                                   G4double gammaEnergy);
    116116
    117  G4double ComputMuBremLoss(G4double Z, G4double A, G4double tkin, G4double cut);
    118 
    119  G4double ComputeMicroscopicCrossSection(G4double tkin,
    120                                            G4double Z,
    121                                            G4double A,
    122                                            G4double cut);
    123 
    124  G4double ComputeDMicroscopicCrossSection(G4double tkin,
    125                                           G4double Z,
    126                                           G4double A,
    127                                           G4double gammaEnergy);
    128 
    129   inline void SetIgnoreCutFlag(G4bool);
    130 
    131   inline G4bool IgnoreCutFlag() const;
     117  inline void SetParticle(const G4ParticleDefinition*);
    132118
    133119private:
    134120
    135  G4DataVector* ComputePartialSumSigma(const G4Material* material,
    136                                       G4double tkin, G4double cut);
     121  G4DataVector* ComputePartialSumSigma(const G4Material* material,
     122                                       G4double tkin, G4double cut);
    137123
    138  const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const;
    139 
    140  void MakeSamplingTables();
    141 
     124  const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const;
    142125
    143126  // hide assignment operator
     
    145128  G4MuBremsstrahlungModel(const  G4MuBremsstrahlungModel&);
    146129
     130protected:
     131
     132  const G4ParticleDefinition* particle;
     133  G4NistManager* nist;
     134  G4double mass;
     135  G4double rmass;
     136  G4double cc;
     137  G4double coeff;
     138  G4double sqrte;
     139  G4double bh;
     140  G4double bh1;
     141  G4double btf;
     142  G4double btf1;
     143
     144private:
     145
    147146  G4ParticleDefinition*       theGamma;
    148   const G4ParticleDefinition* particle;
    149147  G4ParticleChangeForLoss*    fParticleChange;
    150148
     
    153151  G4double lowestKinEnergy;
    154152  G4double minThreshold;
    155   G4double mass;
    156 
    157   // tables for sampling
    158   G4int nzdat,ntdat,NBIN;
    159   static G4double zdat[5],adat[5],tdat[8];
    160   G4double ya[1001], proba[5][8][1001];
    161   G4double cutFixed;
    162 
    163   G4bool  ignoreCut;
    164153
    165154  std::vector<G4DataVector*> partialSumSigma;
    166   G4bool  samplingTablesAreFilled;
    167 
    168155};
    169156
    170157//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    171158
    172 inline G4double G4MuBremsstrahlungModel::MaxSecondaryEnergy(
    173                                  const G4ParticleDefinition*,
    174                                  G4double kineticEnergy)
     159inline void G4MuBremsstrahlungModel::SetLowestKineticEnergy(G4double e)
    175160{
    176   return kineticEnergy;
     161  lowestKinEnergy = e;
    177162}
    178163
    179164//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    180165
    181 inline void G4MuBremsstrahlungModel::SetIgnoreCutFlag(G4bool val)
     166inline
     167void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p)
    182168{
    183   ignoreCut = val;
    184 }
    185 
    186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    187 
    188 inline G4bool G4MuBremsstrahlungModel::IgnoreCutFlag() const
    189 {
    190   return ignoreCut;
     169  if(!particle) {
     170    particle = p;
     171    mass = particle->GetPDGMass();
     172    rmass=mass/electron_mass_c2 ;
     173    cc=classic_electr_radius/rmass ;
     174    coeff= 16.*fine_structure_const*cc*cc/3. ;
     175  }
    191176}
    192177
  • trunk/source/processes/electromagnetic/muons/include/G4MuIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuIonisation.hh,v 1.30 2007/05/23 08:49:32 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MuIonisation.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    9595  virtual ~G4MuIonisation();
    9696
    97   G4bool IsApplicable(const G4ParticleDefinition& p);
     97  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    9898
    99   G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    100                             const G4Material*, G4double cut);
     99  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     100                                    const G4Material*, G4double cut);
    101101
    102102  // Print out of the class parameters
    103   void PrintInfo();
     103  virtual void PrintInfo();
    104104
    105105protected:
     
    127127
    128128//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    130 
    131 inline G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)
    132 {
    133   return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
    134 }
    135 
    136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    137 
    138 inline G4double G4MuIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
    139                                                  const G4Material*,
    140                                                  G4double cut)
    141 {
    142   G4double x = 0.5*cut/electron_mass_c2;
    143   G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
    144   return mass*(g - 1.0);
    145 }
    146 
    147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    148129
    149130#endif
  • trunk/source/processes/electromagnetic/muons/include/G4MuMultipleScattering.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuMultipleScattering.hh,v 1.1 2007/10/26 09:52:37 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuMultipleScattering.hh,v 1.2 2008/04/13 17:19:13 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    6060//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6161
    62 class G4MuMscModel;
     62class G4VMscModel;
    6363
    6464class G4MuMultipleScattering : public G4VMultipleScattering
     
    9494private:        // data members
    9595
    96   G4MuMscModel* mscModel;
     96  G4VMscModel* mscModel;
    9797
    9898  G4double thetaLimit;
  • trunk/source/processes/electromagnetic/muons/include/G4MuPairProduction.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuPairProduction.hh,v 1.29 2007/05/23 08:49:32 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuPairProduction.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8484  virtual ~G4MuPairProduction();
    8585
    86   G4bool IsApplicable(const G4ParticleDefinition& p);
     86  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    8787
    88   G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    89                             const G4Material*, G4double cut);
     88  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     89                                    const G4Material*, G4double cut);
    9090
    9191  // Print out of the class parameters
    92   void PrintInfo();
     92  virtual void PrintInfo();
    9393
    9494protected:
    9595
    96   void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
    97                                    const G4ParticleDefinition*);
     96  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
     97                                           const G4ParticleDefinition*);
    9898
    9999private:
     
    113113
    114114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    116 
    117 inline G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
    118 {
    119   return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
    120 }
    121 
    122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    123 
    124 inline G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
    125                                                      const G4Material*,
    126                                                            G4double)
    127 {
    128   return lowestKinEnergy;
    129 }
    130 
    131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    132115
    133116#endif
  • trunk/source/processes/electromagnetic/muons/include/G4MuPairProductionModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuPairProductionModel.hh,v 1.24 2007/10/11 13:52:03 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuPairProductionModel.hh,v 1.28 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4848// 12-05-06 Add parameter to SelectRandomAtom (A.Bogdanov)
    4949// 11-10-07 Add ignoreCut flag (V.Ivanchenko)
     50// 28-02-08 Reorganized protected methods and members (V.Ivanchenko)
    5051
    5152//
     
    6263
    6364#include "G4VEmModel.hh"
     65#include "G4NistManager.hh"
    6466#include <vector>
    6567
     
    7072class G4MuPairProductionModel : public G4VEmModel
    7173{
    72 
    7374public:
    7475
     
    7879  virtual ~G4MuPairProductionModel();
    7980
    80   void SetParticle(const G4ParticleDefinition*);
    81 
    82   void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    83 
    84   void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;};
    85 
    86   G4double MinEnergyCut(const G4ParticleDefinition*,
    87                         const G4MaterialCutsCouple*);
     81  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
     82
    8883                       
    8984  virtual G4double ComputeCrossSectionPerAtom(
     
    9489                                 G4double maxEnergy);
    9590                                 
    96   virtual G4double CrossSectionPerVolume(const G4Material*,
    97                          const G4ParticleDefinition*,
    98                                G4double kineticEnergy,
    99                                G4double cutEnergy,
    100                                G4double maxEnergy);
    101                                
    10291  virtual G4double ComputeDEDXPerVolume(const G4Material*,
    10392                                const G4ParticleDefinition*,
     
    10594                                G4double cutEnergy);
    10695
    107   void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    108                          const G4MaterialCutsCouple*,
    109                          const G4DynamicParticle*,
    110                          G4double tmin,
    111                          G4double maxEnergy);
     96  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
     97                                 const G4MaterialCutsCouple*,
     98                                 const G4DynamicParticle*,
     99                                 G4double tmin,
     100                                 G4double maxEnergy);
     101
     102  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     103                               const G4MaterialCutsCouple*);
     104
     105  inline void SetLowestKineticEnergy(G4double e);
     106
     107  inline void SetParticle(const G4ParticleDefinition*);
    112108
    113109protected:
    114 
    115   inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    116                                      G4double kineticEnergy);
    117 
    118 
    119 public:
    120110
    121111  G4double ComputMuPairLoss(G4double Z, G4double tkin, G4double cut,
     
    126116                                          G4double cut);
    127117
    128   G4double ComputeDMicroscopicCrossSection(G4double tkin,
    129                                            G4double Z,
    130                                            G4double pairEnergy);
    131 
    132   inline void SetIgnoreCutFlag(G4bool);
    133 
    134   inline G4bool IgnoreCutFlag() const;
     118  virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
     119                                                   G4double Z,
     120                                                   G4double pairEnergy);
     121
     122  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     123                                      G4double kineticEnergy);
     124
     125  inline void SetCurrentElement(G4double Z);
    135126
    136127private:
     
    144135  void MakeSamplingTables();
    145136
    146   void SetCurrentElement(G4double Z);
    147 
    148137  inline G4double InterpolatedIntegralCrossSection(
    149138                     G4double dt, G4double dz, G4int iz,
     
    154143  G4MuPairProductionModel(const  G4MuPairProductionModel&);
    155144
    156   G4ParticleDefinition*       theElectron;
    157   G4ParticleDefinition*       thePositron;
    158   G4ParticleChangeForLoss*    fParticleChange;
    159   G4ParticleChangeForGamma*   gParticleChange;
    160 
    161   G4double minPairEnergy;
    162   G4double lowestKinEnergy;
     145protected:
     146
     147  const G4ParticleDefinition* particle;
     148  G4NistManager*              nist;
    163149
    164150  G4double factorForCross;
     
    170156  G4double lnZ;
    171157
    172   const G4ParticleDefinition* particle;
     158  static G4double xgi[8],wgi[8];
     159
     160private:
     161
     162  G4ParticleDefinition*       theElectron;
     163  G4ParticleDefinition*       thePositron;
     164  G4ParticleChangeForLoss*    fParticleChange;
     165
     166  G4double minPairEnergy;
     167  G4double lowestKinEnergy;
    173168
    174169  // tables for sampling
     
    177172  G4int nbiny;
    178173  size_t nmaxElements;
    179   static G4double zdat[5],adat[5],tdat[8],xgi[8],wgi[8];
     174  static G4double zdat[5],adat[5],tdat[8];
    180175  G4double ya[1001],proba[5][8][1001];
    181176
     
    184179  G4double dy;
    185180
    186   G4bool  ignoreCut;
    187 
    188181  G4bool  samplingTablesAreFilled;
    189182  std::vector<G4double>   partialSum;
     
    192185//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    193186
    194 inline G4double G4MuPairProductionModel::MaxSecondaryEnergy(
    195                                  const G4ParticleDefinition*,
    196                                        G4double kineticEnergy)
    197 {
    198   G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13);
    199   return maxPairEnergy;
     187inline void G4MuPairProductionModel::SetLowestKineticEnergy(G4double e)
     188{
     189  lowestKinEnergy = e;
     190}
     191
     192//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     193
     194inline
     195void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p)
     196{
     197  if(!particle) {
     198    particle = p;
     199    particleMass = particle->GetPDGMass();
     200  }
    200201}
    201202
     
    206207  if(Z != currentZ) {
    207208    currentZ = Z;
    208     z13 = std::pow(Z,0.333333333);
     209    G4int iz = G4int(Z);
     210    z13 = nist->GetZ13(iz);
    209211    z23 = z13*z13;
    210     lnZ = std::log(Z);
     212    lnZ = nist->GetLOGZ(iz);
    211213  }
    212214}
     
    229231//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    230232
    231 inline void G4MuPairProductionModel::SetIgnoreCutFlag(G4bool val)
    232 {
    233   ignoreCut = val;
    234 }
    235 
    236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    237 
    238 inline G4bool G4MuPairProductionModel::IgnoreCutFlag() const
    239 {
    240   return ignoreCut;
    241 }
    242 
    243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    244 
    245233#endif
  • trunk/source/processes/electromagnetic/muons/src/G4EnergyLossForExtrapolator.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.13 2007/07/28 13:44:25 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4EnergyLossForExtrapolator.cc,v 1.18 2008/11/13 14:14:07 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//---------------------------------------------------------------------------
     
    6767#include "G4MuBremsstrahlungModel.hh"
    6868#include "G4ProductionCuts.hh"
     69#include "G4LossTableManager.hh"
     70#include "G4WentzelVIModel.hh"
    6971
    7072//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8890  delete invRangePositron;
    8991  delete invRangeProton;
     92  delete mscElectron;
    9093  delete cuts;
    9194}
     
    100103  if(!isInitialised) Initialisation();
    101104  G4double kinEnergyFinal = kinEnergy;
    102   if(mat && part) {
    103     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     105  if(SetupKinematics(part, mat, kinEnergy)) {
     106    G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
    104107    G4double r  = ComputeRange(kinEnergy,part);
    105108    if(r <= step) {
     
    125128  G4double kinEnergyFinal = kinEnergy;
    126129
    127   if(mat && part) {
    128     G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     130  if(SetupKinematics(part, mat, kinEnergy)) {
     131    G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
    129132    G4double r  = ComputeRange(kinEnergy,part);
    130133
     
    141144//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    142145
    143 G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
    144                                                       const G4ParticleDefinition* part,
    145                                                       G4double kinEnergy, G4double stepLength)
    146 {
     146G4double G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
     147                                                     G4double stepLength,
     148                                                     const G4Material* mat,
     149                                                     const G4ParticleDefinition* part)
     150{
     151  G4double res = stepLength;
     152  if(!isInitialised) Initialisation();
     153  if(SetupKinematics(part, mat, kinEnergy)) {
     154    if(part == electron || part == positron) {
     155      G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
     156      if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0);
     157      else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/x;
     158      else res = ComputeRange(kinEnergy,part);
     159   
     160    } else {
     161      res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
     162    }
     163  }
     164  return res;
     165}
     166
     167//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     168
     169G4bool G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
     170                                                    const G4Material* mat,
     171                                                    G4double kinEnergy)
     172{
     173  if(!part || !mat || kinEnergy < keV) return false;
    147174  if(!isInitialised) Initialisation();
    148175  G4bool flag = false;
     
    182209    if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer;
    183210  }
    184   G4double theta = ComputeScatteringAngle(stepLength);
    185   return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
     211  return true;
    186212}
    187213
     
    231257  invRangeMuon     = PrepareTable();
    232258  invRangeProton   = PrepareTable();
     259  mscElectron      = PrepareTable();
    233260
    234261  G4LossTableBuilder builder;
     
    262289  builder.BuildInverseRangeTable(rangeProton, invRangeProton); 
    263290
     291  ComputeTrasportXS(electron, mscElectron);
    264292}
    265293
     
    273301
    274302    G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
     303    v->SetSpline(G4LossTableManager::Instance()->SplineFlag());
    275304    table->push_back(v);
    276305  }
     
    488517//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    489518
     519void G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
     520                                                    G4PhysicsTable* table)
     521{
     522  G4DataVector v;
     523  G4WentzelVIModel* msc = new G4WentzelVIModel();
     524  msc->SetPolarAngleLimit(CLHEP::pi);
     525  msc->Initialise(part, v);
     526
     527  mass    = part->GetPDGMass();
     528  charge2 = 1.0;
     529  currentParticle = part;
     530
     531  const G4MaterialTable* mtable = G4Material::GetMaterialTable();
     532
     533  if(0<verbose) {
     534    G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for " << part->GetParticleName()
     535           << G4endl;
     536  }
     537 
     538  for(G4int i=0; i<nmat; i++) { 
     539
     540    const G4Material* mat = (*mtable)[i];
     541    if(1<verbose)
     542      G4cout << "i= " << i << "  mat= " << mat->GetName() << G4endl;
     543    G4PhysicsVector* aVector = (*table)[i];
     544    for(G4int j=0; j<nbins; j++) {
     545       
     546       G4double e = aVector->GetLowEdgeEnergy(j);
     547       G4double xs = msc->CrossSectionPerVolume(mat,part,e);
     548       aVector->PutValue(j,xs);
     549       if(1<verbose) {
     550         G4cout << "j= " << j << "  e(MeV)= " << e/MeV 
     551                << " xs(1/mm)= " << xs*mm << G4endl;
     552       }
     553    }
     554  }
     555  delete msc;
     556}
     557
     558//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     559
  • trunk/source/processes/electromagnetic/muons/src/G4MuBetheBlochModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBetheBlochModel.cc,v 1.23 2007/05/22 17:35:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuBetheBlochModel.cc,v 1.25 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8888  theElectron = G4Electron::Electron();
    8989  corr = G4LossTableManager::Instance()->EmCorrections();
     90  fParticleChange = 0;
    9091
    9192  if(p) SetParticle(p);
     
    99100//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    100101
    101 void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)
    102 {
    103   if(!particle) {
    104     particle = p;
    105     mass = particle->GetPDGMass();
    106     massSquare = mass*mass;
    107     ratio = electron_mass_c2/mass;
    108   }
    109 }
    110 
    111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    112 
    113102G4double G4MuBetheBlochModel::MinEnergyCut(const G4ParticleDefinition*,
    114103                                           const G4MaterialCutsCouple* couple)
     
    117106}
    118107
     108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     109
     110G4double G4MuBetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
     111                                                 G4double kinEnergy)
     112{
     113  G4double tau  = kinEnergy/mass;
     114  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
     115                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
     116  return tmax;
     117}
     118
    119119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    120120
     
    124124  if(p) SetParticle(p);
    125125
    126   if(pParticleChange)
    127     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    128                                                              (pParticleChange);
    129   else
    130     fParticleChange = new G4ParticleChangeForLoss();
     126  if(!fParticleChange) {
     127    if(pParticleChange) {
     128      fParticleChange =
     129        reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
     130    } else {
     131      fParticleChange = new G4ParticleChangeForLoss();
     132    }
     133  }
    131134}
    132135
     
    275278
    276279  //High order corrections
    277   dedx += corr->HighOrderCorrections(p,material,kineticEnergy);
     280  dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
    278281
    279282  return dedx;
  • trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlung.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBremsstrahlung.cc,v 1.38 2007/05/22 17:35:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuBremsstrahlung.cc,v 1.42 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8282    lowestKinEnergy(1.*GeV),
    8383    isInitialised(false)
    84 {}
     84{
     85  SetProcessSubType(fBremsstrahlung);
     86}
    8587
    8688//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    9193//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    9294
    93 void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
    94                                                      const G4ParticleDefinition*)
     95G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
     96{
     97  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
     98}
     99
     100//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     101
     102G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
     103                                              const G4Material*,
     104                                              G4double)
     105{
     106  return lowestKinEnergy;
     107}
     108
     109//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     110
     111void G4MuBremsstrahlung::InitialiseEnergyLossProcess(
     112                                 const G4ParticleDefinition* part,
     113                                 const G4ParticleDefinition*)
    95114{
    96115  if(!isInitialised) {
     
    105124    em->SetLowestKineticEnergy(lowestKinEnergy);
    106125
    107     G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
    108     em->SetLowEnergyLimit(0.1*keV);
    109     em->SetHighEnergyLimit(100.0*TeV);
     126    G4VEmFluctuationModel* fm = 0;
     127    em->SetLowEnergyLimit(MinKinEnergy());
     128    em->SetHighEnergyLimit(MaxKinEnergy());
    110129    AddEmModel(1, em, fm);
    111130  }
     
    115134
    116135void G4MuBremsstrahlung::PrintInfo()
    117 {
    118   G4cout << "      Parametrised model "
    119          << G4endl;
    120 }
     136{}
    121137
    122138//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlungModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuBremsstrahlungModel.cc,v 1.24 2007/11/08 11:48:28 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuBremsstrahlungModel.cc,v 1.33 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4646// 13-02-03 Add name (V.Ivanchenko)
    4747// 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
    48 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
    49 // 03-08-05 Angular correlations according to PRM (V.Ivantchenko)
     48// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
     49// 03-08-05 Angular correlations according to PRM (V.Ivanchenko)
    5050// 13-02-06 add ComputeCrossSectionPerAtom (mma)
    5151// 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI)
    5252// 07-11-07 Improve sampling of final state (A.Bogdanov)
     53// 28-02-08 Use precomputed Z^1/3 and Log(A) (V.Ivanchenko)
    5354//
    5455
     
    7475
    7576//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    76 
    77 // static members
    78 //
    79 G4double G4MuBremsstrahlungModel::zdat[]={1., 4., 13., 29., 92.};
    80 G4double G4MuBremsstrahlungModel::adat[]={1.01, 9.01, 26.98, 63.55, 238.03};
    81 G4double G4MuBremsstrahlungModel::tdat[]={1.e3, 1.e4, 1.e5, 1.e6, 1.e7, 1.e8,
    82                                           1.e9, 1.e10};
    83 
    8477//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    8578
     
    9083  : G4VEmModel(nam),
    9184    particle(0),
     85    sqrte(sqrt(exp(1.))),
     86    bh(202.4),
     87    bh1(446.),
     88    btf(183.),
     89    btf1(1429.),
     90    fParticleChange(0),
    9291    lowestKinEnergy(1.0*GeV),
    93     minThreshold(1.0*keV),
    94     nzdat(5),
    95     ntdat(8),
    96     NBIN(1000),
    97     cutFixed(0.98*keV),
    98     ignoreCut(false),
    99     samplingTablesAreFilled(false)
     92    minThreshold(1.0*keV)
    10093{
    10194  theGamma = G4Gamma::Gamma();
     95  nist = G4NistManager::Instance();
    10296  if(p) SetParticle(p);
    10397}
     
    125119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    126120
    127 void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p)
    128 {
    129   if(!particle) {
    130     particle = p;
    131     mass = particle->GetPDGMass();
    132   }
    133 }
    134 
    135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    136 
    137121void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
    138122                                         const G4DataVector& cuts)
     
    142126  highKinEnergy = HighEnergyLimit();
    143127
     128  // partial cross section is computed for fixed energy
    144129  G4double fixedEnergy = 0.5*highKinEnergy;
    145130
     
    148133  if(theCoupleTable) {
    149134    G4int numOfCouples = theCoupleTable->GetTableSize();
    150    
     135
     136    // clear old data   
    151137    G4int nn = partialSumSigma.size();
    152138    G4int nc = cuts.size();
    153139    if(nn > 0) {
    154140      for (G4int ii=0; ii<nn; ii++){
    155         G4DataVector* a=partialSumSigma[ii];
     141        G4DataVector* a = partialSumSigma[ii];
    156142        if ( a )  delete a;   
    157143      }
    158144      partialSumSigma.clear();
    159145    }
     146    // fill new data
    160147    if (numOfCouples>0) {
    161148      for (G4int i=0; i<numOfCouples; i++) {
    162149        G4double cute = DBL_MAX;
     150
     151        // protection for usage with extrapolator
    163152        if(i < nc) cute = cuts[i];
    164         if(cute < cutFixed || ignoreCut) cute = cutFixed;
     153
    165154        const G4MaterialCutsCouple* couple =
    166155          theCoupleTable->GetMaterialCutsCouple(i);
     
    171160    }
    172161  }
    173   if(!samplingTablesAreFilled) MakeSamplingTables();
    174   if(pParticleChange)
    175     fParticleChange =
    176       reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
    177   else
    178     fParticleChange = new G4ParticleChangeForLoss();
     162
     163  // define pointer to G4ParticleChange
     164  if(!fParticleChange) {
     165    if(pParticleChange)
     166      fParticleChange =
     167        reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
     168    else
     169      fParticleChange = new G4ParticleChangeForLoss();
     170  }
    179171}
    180172
     
    188180{
    189181  G4double dedx = 0.0;
    190   if (kineticEnergy <= lowestKinEnergy || ignoreCut) return dedx;
     182  if (kineticEnergy <= lowestKinEnergy) return dedx;
    191183
    192184  G4double tmax = kineticEnergy;
    193   G4double cut  = min(cutEnergy,tmax);
    194   if(cut < cutFixed) cut = cutFixed;
     185  G4double cut  = std::min(cutEnergy,tmax);
     186  if(cut < minThreshold) cut = minThreshold;
    195187
    196188  const G4ElementVector* theElementVector = material->GetElementVector();
    197189  const G4double* theAtomicNumDensityVector =
    198                                           material->GetAtomicNumDensityVector();
     190    material->GetAtomicNumDensityVector();
    199191
    200192  //  loop for elements in the material
    201193  for (size_t i=0; i<material->GetNumberOfElements(); i++) {
    202194
    203     G4double Z = (*theElementVector)[i]->GetZ();
    204     G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
    205 
    206     G4double loss = ComputMuBremLoss(Z, A, kineticEnergy, cut);
     195    G4double loss =
     196      ComputMuBremLoss((*theElementVector)[i]->GetZ(), kineticEnergy, cut);
    207197
    208198    dedx += loss*theAtomicNumDensityVector[i];
    209199  }
     200  //  G4cout << "BR e= " << kineticEnergy << "  dedx= " << dedx << G4endl;
    210201  if(dedx < 0.) dedx = 0.;
    211202  return dedx;
     
    214205//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    215206
    216 G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, G4double A,
     207G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z,
    217208                                                   G4double tkin, G4double cut)
    218209{
     
    239230    {
    240231      G4double ep = (aa + xgi[i]*hhh)*totalEnergy;
    241       loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A, ep);
     232      loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
    242233    }
    243234    aa += hhh;
     
    254245                                           G4double tkin,
    255246                                           G4double Z,
    256                                            G4double A,
    257247                                           G4double cut)
    258248{
     
    272262  G4double bbb = log(vmax);
    273263  G4int    kkk = (G4int)((bbb-aaa)/ak1)+k2 ;
    274   G4double hhh = (bbb-aaa)/float(kkk);
     264  G4double hhh = (bbb-aaa)/G4double(kkk);
    275265
    276266  G4double aa = aaa;
     
    281271    {
    282272      G4double ep = exp(aa + xgi[i]*hhh)*totalEnergy;
    283       cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A, ep);
     273      cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
    284274    }
    285275    aa += hhh;
     
    287277
    288278  cross *=hhh;
     279
     280  //G4cout << "BR e= " << tkin<< "  cross= " << cross/barn << G4endl;
    289281
    290282  return cross;
     
    296288                                           G4double tkin,
    297289                                           G4double Z,
    298                                            G4double A,
    299290                                           G4double gammaEnergy)
    300291//  differential cross section
    301292{
    302   static const G4double sqrte=sqrt(exp(1.)) ;
    303   static const G4double bh=202.4,bh1=446.,btf=183.,btf1=1429. ;
    304   static const G4double rmass=mass/electron_mass_c2 ;
    305   static const G4double cc=classic_electr_radius/rmass ;
    306   static const G4double coeff= 16.*fine_structure_const*cc*cc/3. ;
    307 
    308293  G4double dxsection = 0.;
    309294
     
    315300  G4double rab0=delta*sqrte ;
    316301
    317   G4double z13 = exp(-log(Z)/3.) ;
    318   G4double dn  = 1.54*exp(0.27*log(A)) ;
     302  G4int iz = G4int(Z);
     303  if(iz < 1) iz = 1;
     304
     305  G4double z13 = 1.0/nist->GetZ13(iz);
     306  G4double dn  = 1.54*nist->GetA27(iz);
    319307
    320308  G4double b,b1,dnstar ;
    321309
    322   if(Z<1.5)
     310  if(1 == iz)
    323311  {
    324     b=bh;
    325     b1=bh1;
    326     dnstar=dn ;
     312    b  = bh;
     313    b1 = bh1;
     314    dnstar = dn;
    327315  }
    328316  else
    329317  {
    330     b=btf;
    331     b1=btf1;
    332     dnstar = exp((1.-1./Z)*log(dn)) ;
     318    b  = btf;
     319    b1 = btf1;
     320    dnstar = dn/std::pow(dn, 1./Z);
    333321  }
    334322
     
    359347                                           const G4ParticleDefinition*,
    360348                                                 G4double kineticEnergy,
    361                                                  G4double Z, G4double A,
     349                                                 G4double Z, G4double,
    362350                                                 G4double cutEnergy,
    363                                                  G4double)
    364 {
    365   G4double cut  = min(cutEnergy, kineticEnergy);
    366   if(cut < cutFixed || ignoreCut) cut = cutFixed;
    367   G4double cross =
    368     ComputeMicroscopicCrossSection (kineticEnergy, Z, A/(g/mole), cut);
    369   return cross;
    370 }
    371 
    372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    373 
    374 G4double G4MuBremsstrahlungModel::CrossSectionPerVolume(
    375                                                const G4Material* material,
    376                                                const G4ParticleDefinition*,
    377                                                      G4double kineticEnergy,
    378                                                      G4double cutEnergy,
    379                                                      G4double maxEnergy)
     351                                                 G4double maxEnergy)
    380352{
    381353  G4double cross = 0.0;
    382   if (cutEnergy >= maxEnergy || kineticEnergy <= lowestKinEnergy) return cross;
    383  
    384   G4double tmax = min(maxEnergy, kineticEnergy);
    385   G4double cut  = min(cutEnergy, tmax);
    386   if(cut < cutFixed || ignoreCut) cut = cutFixed;
    387 
    388   const G4ElementVector* theElementVector = material->GetElementVector();
    389   const G4double* theAtomNumDensityVector =
    390                                           material->GetAtomicNumDensityVector();
    391 
    392   for (size_t i=0; i<material->GetNumberOfElements(); i++) {
    393 
    394     G4double Z = (*theElementVector)[i]->GetZ();
    395     G4double A = (*theElementVector)[i]->GetA()/(g/mole);
    396 
    397     G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut);
    398 
    399     if(tmax < kineticEnergy) {
    400       cr -= ComputeMicroscopicCrossSection(kineticEnergy, Z, A, tmax);
    401     }
    402     cross += theAtomNumDensityVector[i] * cr;
    403   }
    404 
     354  if (kineticEnergy <= lowestKinEnergy) return cross;
     355  G4double tmax = std::min(maxEnergy, kineticEnergy);
     356  G4double cut  = std::min(cutEnergy, kineticEnergy);
     357  if(cut < minThreshold) cut = minThreshold;
     358  if (cut >= tmax) return cross;
     359
     360  cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
     361  if(tmax < kineticEnergy) {
     362    cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
     363  }
    405364  return cross;
    406365}
     
    410369G4DataVector* G4MuBremsstrahlungModel::ComputePartialSumSigma(
    411370                                       const G4Material* material,
    412                                              G4double kineticEnergy,
    413                                              G4double cut)
    414 
    415 // Build the table of cross section per element. The table is built for MATERIAL
    416 // This table is used by DoIt to select randomly an element in the material.
     371                                       G4double kineticEnergy,
     372                                       G4double cut)
     373
     374// Build the table of cross section per element.
     375// The table is built for material
     376// This table is used to select randomly an element in the material.
    417377{
    418378  G4int nElements = material->GetNumberOfElements();
    419379  const G4ElementVector* theElementVector = material->GetElementVector();
    420380  const G4double* theAtomNumDensityVector =
    421                                           material->GetAtomicNumDensityVector();
     381    material->GetAtomicNumDensityVector();
    422382
    423383  G4DataVector* dv = new G4DataVector();
     
    426386
    427387  for (G4int i=0; i<nElements; i++ ) {
    428 
    429     G4double Z = (*theElementVector)[i]->GetZ();
    430     G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
    431388    cross += theAtomNumDensityVector[i]
    432              * ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut);
     389      * ComputeMicroscopicCrossSection(kineticEnergy,
     390                                       (*theElementVector)[i]->GetZ(), cut);
    433391    dv->push_back(cross);
    434392  }
     
    438396//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    439397
    440 void G4MuBremsstrahlungModel::MakeSamplingTables()
    441 {
    442 
    443   G4double AtomicNumber,AtomicWeight,KineticEnergy,
    444            TotalEnergy,Maxep;
    445 
    446   for (G4int iz=0; iz<nzdat; iz++)
    447    {
    448      AtomicNumber = zdat[iz];
    449      AtomicWeight = adat[iz]*g/mole ;
    450 
    451      for (G4int it=0; it<ntdat; it++)
    452      {
    453        KineticEnergy = tdat[it];
    454        TotalEnergy = KineticEnergy + mass;
    455        Maxep = KineticEnergy ;
    456 
    457        G4double CrossSection = 0.0 ;
    458 
    459        // calculate the differential cross section
    460        // numerical integration in
    461        //  log ...............
    462        G4double c = log(Maxep/cutFixed) ;
    463        G4double ymin = -5. ;
    464        G4double ymax = 0. ;
    465        G4double dy = (ymax-ymin)/NBIN ;
    466 
    467        G4double y = ymin - 0.5*dy ;
    468        G4double yy = ymin - dy ;
    469        G4double x = exp(y);
    470        G4double fac = exp(dy);
    471        G4double dx = exp(yy)*(fac - 1.0);
    472 
    473        for (G4int i=0 ; i<NBIN; i++)
    474        {
    475          y += dy ;
    476          x *= fac;
    477          dx*= fac;
    478          G4double ep = cutFixed*exp(c*x) ;
    479 
    480          CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
    481                                                  KineticEnergy,AtomicNumber,
    482                                                  AtomicWeight,ep) ;
    483          ya[i]=y ;
    484          proba[iz][it][i] = CrossSection ;
    485 
    486        }
    487 
    488        proba[iz][it][NBIN] = CrossSection ;
    489        ya[NBIN] = 0. ;   //   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    490 
    491        if(CrossSection > 0.)
    492        {
    493          for(G4int ib=0; ib<=NBIN; ib++)
    494          {
    495            proba[iz][it][ib] /= CrossSection ;
    496          }
    497        }
    498      }
    499    }
    500   samplingTablesAreFilled = true;
    501 }
    502 
    503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    504 
    505 void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
    506                                                 const G4MaterialCutsCouple* couple,
    507                                                 const G4DynamicParticle* dp,
    508                                                 G4double minEnergy,
    509                                                 G4double maxEnergy)
     398void G4MuBremsstrahlungModel::SampleSecondaries(
     399                              std::vector<G4DynamicParticle*>* vdp,
     400                              const G4MaterialCutsCouple* couple,
     401                              const G4DynamicParticle* dp,
     402                              G4double minEnergy,
     403                              G4double maxEnergy)
    510404{
    511405  G4double kineticEnergy = dp->GetKineticEnergy();
    512406  // check against insufficient energy
    513   G4double tmax = min(kineticEnergy, maxEnergy);
    514   G4double tmin = min(kineticEnergy, minEnergy);
    515   if(tmin < cutFixed || ignoreCut) tmin = cutFixed;
     407  G4double tmax = std::min(kineticEnergy, maxEnergy);
     408  G4double tmin = std::min(kineticEnergy, minEnergy);
     409  if(tmin < minThreshold) tmin = minThreshold;
    516410  if(tmin >= tmax) return;
    517411
    518   // ===== the begining of a new code  ======
    519412  // ===== sampling of energy transfer ======
    520413
     
    523416  // select randomly one element constituing the material
    524417  const G4Element* anElement = SelectRandomAtom(couple);
     418  G4double Z = anElement->GetZ();
    525419
    526420  G4double totalEnergy   = kineticEnergy + mass;
    527421  G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass));
    528422
    529   G4double AtomicNumber = anElement->GetZ();
    530   G4double AtomicWeight = anElement->GetA()/(g/mole);
    531 
    532   G4double func1 = tmin*ComputeDMicroscopicCrossSection(
    533                                     kineticEnergy,AtomicNumber,
    534                                     AtomicWeight,tmin);
     423  G4double func1 = tmin*
     424    ComputeDMicroscopicCrossSection(kineticEnergy,Z,tmin);
    535425
    536426  G4double lnepksi, epksi;
    537427  G4double func2;
    538   G4double ksi2;
    539428
    540429  do {
    541430    lnepksi = log(tmin) + G4UniformRand()*log(kineticEnergy/tmin);
    542431    epksi   = exp(lnepksi);
    543     func2   = epksi*ComputeDMicroscopicCrossSection(
    544                                 kineticEnergy,AtomicNumber,
    545                                 AtomicWeight,epksi);
    546     ksi2 = G4UniformRand();
    547 
    548   } while(func2/func1 < ksi2);
    549 
    550   // ===== the end of a new code =====
    551 
    552   // create G4DynamicParticle object for the Gamma
     432    func2   = epksi*ComputeDMicroscopicCrossSection(kineticEnergy,Z,epksi);
     433
     434  } while(func2 < func1*G4UniformRand());
     435
    553436  G4double gEnergy = epksi;
    554437
    555   // sample angle
     438  // ===== sample angle =====
     439
    556440  G4double gam  = totalEnergy/mass;
    557   G4double rmax = gam*min(1.0, totalEnergy/gEnergy - 1.0);
    558   rmax *= rmax;
    559   G4double x = G4UniformRand()*rmax/(1.0 + rmax);
     441  G4double rmax = gam*std::min(1.0, totalEnergy/gEnergy - 1.0);
     442  G4double rmax2= rmax*rmax;
     443  G4double x = G4UniformRand()*rmax2/(1.0 + rmax2);
    560444
    561445  G4double theta = sqrt(x/(1.0 - x))/gam;
     
    577461
    578462  // save secondary
    579   G4DynamicParticle* aGamma = new G4DynamicParticle(theGamma,gDirection,gEnergy);
     463  G4DynamicParticle* aGamma =
     464    new G4DynamicParticle(theGamma,gDirection,gEnergy);
    580465  vdp->push_back(aGamma);
    581466}
  • trunk/source/processes/electromagnetic/muons/src/G4MuIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuIonisation.cc,v 1.54 2007/05/22 17:35:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuIonisation.cc,v 1.59 2009/02/26 11:04:20 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8686#include "G4MuBetheBlochModel.hh"
    8787#include "G4UniversalFluctuation.hh"
     88#include "G4IonFluctuations.hh"
    8889#include "G4BohrFluctuations.hh"
    8990#include "G4UnitsTable.hh"
     
    99100    isInitialised(false)
    100101{
    101   SetStepFunction(0.2, 1*mm);
    102   SetIntegral(true);
    103   SetVerboseLevel(1);
     102  //  SetStepFunction(0.2, 1*mm);
     103  //SetIntegral(true);
     104  //SetVerboseLevel(1);
     105  SetProcessSubType(fIonisation);
    104106}
    105107
     
    108110G4MuIonisation::~G4MuIonisation()
    109111{}
     112
     113//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     114
     115G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)
     116{
     117  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
     118}
     119
     120//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     121
     122G4double G4MuIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
     123                                          const G4Material*,
     124                                          G4double cut)
     125{
     126  G4double x = 0.5*cut/electron_mass_c2;
     127  G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
     128  return mass*(g - 1.0);
     129}
    110130
    111131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    122142    SetSecondaryParticle(G4Electron::Electron());
    123143
    124     flucModel = new G4UniversalFluctuation();
     144    // Bragg peak model
     145    if (!EmModel(1)) SetEmModel(new G4BraggModel(),1);
     146    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
     147    EmModel(1)->SetHighEnergyLimit(0.2*MeV);
     148    AddEmModel(1, EmModel(1), new G4IonFluctuations());
    125149
    126     G4VEmModel* em = new G4BraggModel();
    127     em->SetLowEnergyLimit(0.1*keV);
    128     em->SetHighEnergyLimit(0.2*MeV);
    129     AddEmModel(1, em, flucModel);
    130     G4VEmModel* em1 = new G4BetheBlochModel();
    131     em1->SetLowEnergyLimit(0.2*MeV);
    132     em1->SetHighEnergyLimit(1.0*GeV);
    133     AddEmModel(2, em1, flucModel);
    134     G4VEmModel* em2 = new G4MuBetheBlochModel();
    135     em2->SetLowEnergyLimit(1.0*GeV);
    136     em2->SetHighEnergyLimit(100.0*TeV);
    137     AddEmModel(3, em2, flucModel);
     150    // high energy fluctuation model
     151    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
     152
     153    // moderate energy model
     154    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);
     155    EmModel(2)->SetLowEnergyLimit(0.2*MeV);
     156    EmModel(2)->SetHighEnergyLimit(1.0*GeV);
     157    AddEmModel(2, EmModel(2), FluctModel());
     158
     159    // high energy model
     160    if (!EmModel(3)) SetEmModel(new G4MuBetheBlochModel(),3);
     161    EmModel(3)->SetLowEnergyLimit(1.0*GeV);
     162    EmModel(3)->SetHighEnergyLimit(MaxKinEnergy());
     163    AddEmModel(3, EmModel(3), FluctModel());
    138164
    139165    ratio = electron_mass_c2/mass;
     
    145171
    146172void G4MuIonisation::PrintInfo()
    147 {
    148   G4cout << "      Bether-Bloch model for E > 0.2 MeV, "
    149          << "parametrisation of Bragg peak below, "
    150          << G4endl;
    151   G4cout << "      radiative corrections for E > 1 GeV" << G4endl;
    152 }
     173{}
    153174
    154175//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/muons/src/G4MuMultipleScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuMultipleScattering.cc,v 1.3 2007/11/09 19:48:10 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuMultipleScattering.cc,v 1.12 2008/10/16 13:37:04 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    4747
    4848#include "G4MuMultipleScattering.hh"
    49 #include "G4MuMscModel.hh"
     49#include "G4WentzelVIModel.hh"
    5050#include "G4MscStepLimitType.hh"
    5151
     
    6161  samplez           = false ;
    6262  isInitialized     = false; 
    63   SetRangeFactor(0.04);
     63  SetRangeFactor(0.2);
    6464  SetLateralDisplasmentFlag(true);
    6565}
     
    8484  if(isInitialized) {
    8585
    86     if (p->GetParticleType() != "nucleus") {
     86    if (p->GetParticleType() != "nucleus" && p->GetPDGMass() < GeV) {
    8787      mscModel->SetStepLimitType(StepLimitType());
    8888      mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
    89       //mscModel->SetThetaLimit(thetaLimit);
    9089      mscModel->SetRangeFactor(RangeFactor());
    9190    }
     91    mscModel->SetPolarAngleLimit(PolarAngleLimit());
    9292    return;
    9393  }
    9494
    95   if (p->GetParticleType() == "nucleus") {
     95  if (p->GetParticleType() == "nucleus" || p->GetPDGMass() > GeV) {
    9696    SetLateralDisplasmentFlag(false);
    9797    SetBuildLambdaTable(false);
    98     //    SetRangeFactor(0.2);
    9998  }
    10099
    101   // initialisation of parameters
    102   //  G4String part_name = p->GetParticleName();
    103   mscModel = new G4MuMscModel(RangeFactor(),thetaLimit);
     100  // initialisation of the model
     101
     102  mscModel = new G4WentzelVIModel();
     103  mscModel->SetStepLimitType(StepLimitType());
    104104  mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
     105  mscModel->SetRangeFactor(RangeFactor());
     106  mscModel->SetPolarAngleLimit(PolarAngleLimit());
     107  mscModel->SetLowEnergyLimit(MinKinEnergy());
     108  mscModel->SetHighEnergyLimit(MaxKinEnergy());
    105109
    106110  AddEmModel(1,mscModel);
     
    112116void G4MuMultipleScattering::PrintInfo()
    113117{
    114   G4cout << "      Boundary/stepping algorithm is active with RangeFactor= "
    115          << RangeFactor()
    116          << "  Step limit type " << StepLimitType()
    117         << G4endl;
     118  G4cout << "      RangeFactor= " << RangeFactor()
     119         << ", step limit type: " << StepLimitType()
     120         << ", lateralDisplacement: " << LateralDisplasmentFlag()
     121        << G4endl;
    118122}
    119123
  • trunk/source/processes/electromagnetic/muons/src/G4MuPairProduction.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuPairProduction.cc,v 1.48 2007/05/22 17:35:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuPairProduction.cc,v 1.52 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8989    lowestKinEnergy(1.*GeV),
    9090    isInitialised(false)
    91 {}
     91{
     92  SetProcessSubType(fPairProdByCharged);
     93}
    9294
    9395//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    98100//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    99101
    100 void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
    101                                                      const G4ParticleDefinition*)
     102G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
     103{
     104  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
     105}
     106
     107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     108
     109G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
     110                                              const G4Material*,
     111                                              G4double)
     112{
     113  return lowestKinEnergy;
     114}
     115
     116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     117
     118void G4MuPairProduction::InitialiseEnergyLossProcess(
     119                         const G4ParticleDefinition* part,
     120                         const G4ParticleDefinition*)
    102121{
    103122  if (!isInitialised) {
     
    110129    G4MuPairProductionModel* em = new G4MuPairProductionModel();
    111130    em->SetLowestKineticEnergy(lowestKinEnergy);
    112     G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
    113     em->SetLowEnergyLimit(0.1*keV);
    114     em->SetHighEnergyLimit(100.0*TeV);
     131    G4VEmFluctuationModel* fm = 0;
     132    em->SetLowEnergyLimit(MinKinEnergy());
     133    em->SetHighEnergyLimit(MaxKinEnergy());
    115134    AddEmModel(1, em, fm);
    116135  }
     
    120139
    121140void G4MuPairProduction::PrintInfo()
    122 {
    123   G4cout << "      Parametrised model "
    124          << G4endl;
    125 }
     141{}
    126142
    127143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/muons/src/G4MuPairProductionModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MuPairProductionModel.cc,v 1.35 2007/10/11 13:52:04 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MuPairProductionModel.cc,v 1.40 2009/02/20 14:48:16 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    104104                                                 const G4String& nam)
    105105  : G4VEmModel(nam),
    106   minPairEnergy(4.*electron_mass_c2),
    107   lowestKinEnergy(1.*GeV),
    108   factorForCross(4.*fine_structure_const*fine_structure_const
     106    particle(0),
     107    factorForCross(4.*fine_structure_const*fine_structure_const
    109108                   *classic_electr_radius*classic_electr_radius/(3.*pi)),
    110109    sqrte(sqrt(exp(1.))),
    111110    currentZ(0),
    112     particle(0),
     111    fParticleChange(0),
     112    minPairEnergy(4.*electron_mass_c2),
     113    lowestKinEnergy(1.*GeV),
    113114    nzdat(5),
    114115    ntdat(8),
     
    118119    ymax(0.),
    119120    dy((ymax-ymin)/nbiny),
    120     ignoreCut(false),
    121121    samplingTablesAreFilled(false)
    122122{
    123123  SetLowEnergyLimit(minPairEnergy);
     124  nist = G4NistManager::Instance();
    124125
    125126  theElectron = G4Electron::Electron();
     
    144145//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    145146
    146 void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p)
    147 {
    148   if(!particle) {
    149     particle = p;
    150     particleMass = particle->GetPDGMass();
    151   }
     147G4double G4MuPairProductionModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
     148                                                     G4double kineticEnergy)
     149{
     150  G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13);
     151  return maxPairEnergy;
    152152}
    153153
     
    161161    MakeSamplingTables();
    162162  }
    163   if(pParticleChange) {
    164     if(ignoreCut) {
    165       gParticleChange =
    166         reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    167       fParticleChange = 0;
    168     } else {
     163  if(!fParticleChange) {
     164    if(pParticleChange)
    169165      fParticleChange =
    170166        reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
    171       gParticleChange = 0;
    172     }
    173   } else {
    174     fParticleChange = new G4ParticleChangeForLoss();
    175     gParticleChange = 0;
     167    else
     168      fParticleChange = new G4ParticleChangeForLoss();
    176169  }
    177170}
     
    186179{
    187180  G4double dedx = 0.0;
    188   if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy
    189       || ignoreCut)
     181  if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy)
    190182    return dedx;
    191183
     
    216208  G4double loss = 0.0;
    217209
    218   G4double cut  = min(cutEnergy,tmax);
     210  G4double cut = std::min(cutEnergy,tmax);
    219211  if(cut <= minPairEnergy) return loss;
    220212
     
    251243                                           G4double Z,
    252244                                           G4double cut)
    253 
    254 {
    255   G4double cross = 0. ;
    256 
     245{
     246  G4double cross = 0.;
    257247  SetCurrentElement(Z);
    258248  G4double tmax = MaxSecondaryEnergy(particle, tkin);
    259 
    260249  if (tmax <= cut) return cross;
    261250
     
    400389                                                 G4double Z, G4double,
    401390                                                 G4double cutEnergy,
    402                                                  G4double)
    403 {
    404   G4double cut  = max(minPairEnergy,cutEnergy);
    405   if(ignoreCut) cut = minPairEnergy;
    406   G4double cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
    407   return cross;
    408 }
    409 
    410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    411 
    412 G4double G4MuPairProductionModel::CrossSectionPerVolume(
    413                                                const G4Material* material,
    414                                                const G4ParticleDefinition*,
    415                                                      G4double kineticEnergy,
    416                                                      G4double cutEnergy,
    417                                                      G4double maxEnergy)
     391                                                 G4double maxEnergy)
    418392{
    419393  G4double cross = 0.0;
    420394  if (kineticEnergy <= lowestKinEnergy) return cross;
    421395
    422   maxEnergy += particleMass;
    423 
    424   const G4ElementVector* theElementVector = material->GetElementVector();
    425   const G4double* theAtomNumDensityVector = material->
    426                                                     GetAtomicNumDensityVector();
    427 
    428   for (size_t i=0; i<material->GetNumberOfElements(); i++) {
    429     G4double Z = (*theElementVector)[i]->GetZ();
    430     SetCurrentElement(Z);
    431     G4double tmax = min(maxEnergy,MaxSecondaryEnergy(particle, kineticEnergy));
    432     G4double cut  = max(minPairEnergy,cutEnergy);
    433     if(ignoreCut) cut = minPairEnergy;
    434     if(cut < tmax) {
    435       G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, cut)
    436                   - ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
    437 
    438       cross += theAtomNumDensityVector[i] * cr;
    439     }
     396  SetCurrentElement(Z);
     397  G4double tmax = std::min(maxEnergy, kineticEnergy);
     398  G4double cut  = std::min(cutEnergy, kineticEnergy);
     399  if(cut < minPairEnergy) cut = minPairEnergy;
     400  if (cut >= tmax) return cross;
     401
     402  cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
     403  if(tmax < kineticEnergy) {
     404    cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
    440405  }
    441406  return cross;
     
    451416    SetCurrentElement(Z);
    452417
    453     for (G4int it=0; it<ntdat; it++)
    454     {
     418    for (G4int it=0; it<ntdat; it++) {
     419
    455420      G4double kineticEnergy = tdat[it];
    456421      G4double maxPairEnergy = MaxSecondaryEnergy(particle,kineticEnergy);
    457 
     422      // G4cout << "Z= " << currentZ << " z13= " << z13
     423      //<< " mE= " << maxPairEnergy << G4endl;
    458424      G4double CrossSection = 0.0 ;
    459425
    460       G4double y = ymin - 0.5*dy ;
    461       G4double yy = ymin - dy ;
    462       G4double x = exp(y);
    463       G4double fac = exp(dy);
    464       G4double dx = exp(yy)*(fac - 1.0);
    465 
    466       G4double c = log(maxPairEnergy/minPairEnergy);
    467 
    468       for (G4int i=0 ; i<nbiny; i++)
    469       {
    470         y += dy ;
    471         if(c > 0.0) {
    472           x *= fac;
    473           dx*= fac;
    474           G4double ep = minPairEnergy*exp(c*x) ;
    475           CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
    476                                       kineticEnergy, Z, ep);
    477         }
    478         ya[i] = y;
    479         proba[iz][it][i] = CrossSection;
     426      if(maxPairEnergy > minPairEnergy) {
     427
     428        G4double y = ymin - 0.5*dy ;
     429        G4double yy = ymin - dy ;
     430        G4double x = exp(y);
     431        G4double fac = exp(dy);
     432        G4double dx = exp(yy)*(fac - 1.0);
     433
     434        G4double c = log(maxPairEnergy/minPairEnergy);
     435
     436        for (G4int i=0 ; i<nbiny; i++) {
     437          y += dy ;
     438          if(c > 0.0) {
     439            x *= fac;
     440            dx*= fac;
     441            G4double ep = minPairEnergy*exp(c*x) ;
     442            CrossSection +=
     443              ep*dx*ComputeDMicroscopicCrossSection(kineticEnergy, Z, ep);
     444          }
     445          ya[i] = y;
     446          proba[iz][it][i] = CrossSection;
     447        }
     448       
     449      } else {
     450        for (G4int i=0 ; i<nbiny; i++) {
     451          proba[iz][it][i] = CrossSection;
     452        }
    480453      }
    481454
    482455      ya[nbiny]=ymax;
    483 
    484456      proba[iz][it][nbiny] = CrossSection;
    485457
     
    515487  G4double maxEnergy     = std::min(tmax, maxPairEnergy);
    516488  G4double minEnergy     = std::max(tmin, minPairEnergy);
    517   if(ignoreCut)minEnergy = minPairEnergy;
     489
    518490  if(minEnergy >= maxEnergy) return;
    519491  //G4cout << "emin= " << minEnergy << " emax= " << maxEnergy
     
    618590  // primary change
    619591  kineticEnergy -= (ElectronEnergy + PositronEnergy);
    620   if(fParticleChange)
    621     fParticleChange->SetProposedKineticEnergy(kineticEnergy);
    622   else
    623     gParticleChange->SetProposedKineticEnergy(kineticEnergy);
     592  fParticleChange->SetProposedKineticEnergy(kineticEnergy);
    624593
    625594  vdp->push_back(aParticle1);
     
    655624    G4double maxPairEnergy = MaxSecondaryEnergy(particle,kinEnergy);
    656625    G4double minEnergy     = std::max(tmin, minPairEnergy);
    657     if(ignoreCut)minEnergy = minPairEnergy;
    658626
    659627    G4int iz;
  • trunk/source/processes/electromagnetic/polarisation/History

    r819 r961  
    1 $Id: History,v 1.15 2007/11/05 10:53:13 schaelic Exp $
     1$Id: History,v 1.16 2008/10/30 22:34:23 schaelic Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
    19 
     1930 October 08: A.Schaelicke (empolar-V09-01-01)
     20   For all process classes set sub-types according to the enumeration
    202105 November 07: A.Schaelicke (empolar-V09-00-02)
    212201 November 07: A.Schaelicke
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizationHelper.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizationHelper.hh,v 1.2 2007/11/01 17:30:25 schaelic Exp $
    27 // tag $Name: $
     27// tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class header file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizationManager.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizationManager.hh,v 1.1 2006/09/21 21:35:10 vnivanch Exp $
    27 // tag $Name: $
     27// tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class header file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizationMessenger.hh

    r819 r961  
    2727//
    2828// $Id: G4PolarizationMessenger.hh,v 1.2 2006/12/13 15:44:33 gunter Exp $
    29 // tag $Name: $
     29// tag $Name: geant4-09-02-ref-02 $
    3030//
    3131// GEANT4 Class header file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedAnnihilationCrossSection.hh

    r819 r961  
    2626// -------------------------------------------------------------------
    2727// $Id: G4PolarizedAnnihilationCrossSection.hh,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929// -------------------------------------------------------------------
    3030//
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedAnnihilationModel.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedAnnihilationModel.hh,v 1.3 2007/07/10 09:38:17 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedBhabhaCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedBhabhaCrossSection.hh,v 1.2 2006/11/17 14:14:17 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedBremsstrahlungCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedBremsstrahlungCrossSection.hh,v 1.3 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedComptonCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedComptonCrossSection.hh,v 1.3 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedComptonModel.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedComptonModel.hh,v 1.2 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedGammaConversion.hh

    r819 r961  
    2626//
    2727// $Id: G4PolarizedGammaConversion.hh,v 1.2 2007/05/23 08:52:20 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedGammaConversionModel.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedGammaConversionModel.hh,v 1.2 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedMollerBhabhaModel.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedMollerBhabhaModel.hh,v 1.3 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// -------------------------------------------------------------------
    2929//
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedMollerCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedMollerCrossSection.hh,v 1.3 2006/12/13 15:44:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedPEEffectCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPEEffectCrossSection.hh,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedPEEffectModel.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPEEffectModel.hh,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedPairProductionCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPairProductionCrossSection.hh,v 1.3 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/include/G4PolarizedPhotoElectricEffect.hh

    r819 r961  
    2626//
    2727// $Id: G4PolarizedPhotoElectricEffect.hh,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/polarisation/include/G4StokesVector.hh

    r819 r961  
    2525//
    2626// $Id: G4StokesVector.hh,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class header file
  • trunk/source/processes/electromagnetic/polarisation/include/G4VPolarizedCrossSection.hh

    r819 r961  
    2525//
    2626// $Id: G4VPolarizedCrossSection.hh,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// File name:     G4VPolarizedCrossSection
  • trunk/source/processes/electromagnetic/polarisation/include/G4ePolarizedBremsstrahlung.hh

    r819 r961  
    2525//
    2626// $Id: G4ePolarizedBremsstrahlung.hh,v 1.2 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4ePolarizedBremsstrahlungModel.hh

    r819 r961  
    2525//
    2626// $Id: G4ePolarizedBremsstrahlungModel.hh,v 1.2 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/include/G4ePolarizedIonisation.hh

    r819 r961  
    2525//
    2626// $Id: G4ePolarizedIonisation.hh,v 1.3 2007/06/11 13:37:56 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// -------------------------------------------------------------------
    2929//
  • trunk/source/processes/electromagnetic/polarisation/include/G4eplusPolarizedAnnihilation.hh

    r819 r961  
    2525//
    2626// $Id: G4eplusPolarizedAnnihilation.hh,v 1.3 2007/06/11 13:37:56 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizationHelper.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizationHelper.cc,v 1.4 2007/11/01 17:30:25 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizationManager.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizationManager.cc,v 1.1 2006/09/21 21:35:11 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizationMessenger.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizationMessenger.cc,v 1.1 2006/09/21 21:35:11 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedAnnihilationCrossSection.cc

    r819 r961  
    2626// -------------------------------------------------------------------
    2727// $Id: G4PolarizedAnnihilationCrossSection.cc,v 1.6 2007/11/01 17:32:34 schaelic Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929// -------------------------------------------------------------------
    3030//
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedAnnihilationModel.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedAnnihilationModel.cc,v 1.6 2007/07/10 09:38:17 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedBhabhaCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedBhabhaCrossSection.cc,v 1.5 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// -------------------------------------------------------------------
    2929//
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedBremsstrahlungCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedBremsstrahlungCrossSection.cc,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedCompton.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PolarizedCompton.cc,v 1.7 2007/07/10 09:35:37 schaelic Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4PolarizedCompton.cc,v 1.9 2008/10/30 22:34:23 schaelic Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    8181  SetMinKinEnergy(0.1*keV);
    8282  SetMaxKinEnergy(100.0*GeV);
     83  SetProcessSubType(fComptonScattering);
    8384}
    8485
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedComptonCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedComptonCrossSection.cc,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedComptonModel.cc

    r819 r961  
    2626//
    2727// $Id: G4PolarizedComptonModel.cc,v 1.4 2007/05/23 08:52:20 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedGammaConversion.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PolarizedGammaConversion.cc,v 1.3 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4PolarizedGammaConversion.cc,v 1.5 2008/10/30 22:34:23 schaelic Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555  SetMinKinEnergy(2.0*electron_mass_c2);
    5656  SetMaxKinEnergy(100.0*GeV);
     57  SetProcessSubType(fGammaConversion);
    5758}
    5859
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedGammaConversionModel.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedGammaConversionModel.cc,v 1.6 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedMollerBhabhaModel.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedMollerBhabhaModel.cc,v 1.4 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// -------------------------------------------------------------------
    2929//
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedMollerCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedMollerCrossSection.cc,v 1.5 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// -------------------------------------------------------------------
    2929//
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedPEEffectCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPEEffectCrossSection.cc,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedPEEffectModel.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPEEffectModel.cc,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedPairProductionCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4PolarizedPairProductionCrossSection.cc,v 1.5 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4PolarizedPhotoElectricEffect.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PolarizedPhotoElectricEffect.cc,v 1.1 2007/11/01 17:29:09 schaelic Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4PolarizedPhotoElectricEffect.cc,v 1.3 2008/10/30 22:34:23 schaelic Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    4646  G4ProcessType type):G4VEmProcess (processName, type),
    4747    isInitialised(false)
    48 {}
     48{
     49  SetProcessSubType(fPhotoElectricEffect);
     50}
    4951
    5052//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/polarisation/src/G4StokesVector.cc

    r819 r961  
    2525//
    2626// $Id: G4StokesVector.cc,v 1.3 2006/11/17 11:59:03 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// GEANT4 Class file
  • trunk/source/processes/electromagnetic/polarisation/src/G4VPolarizedCrossSection.cc

    r819 r961  
    2525//
    2626// $Id: G4VPolarizedCrossSection.cc,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828// File name:     G4VPolarizedCrossSection
    2929//
  • trunk/source/processes/electromagnetic/polarisation/src/G4ePolarizedBremsstrahlung.cc

    r819 r961  
    2525//
    2626// $Id: G4ePolarizedBremsstrahlung.cc,v 1.3 2007/05/23 08:52:20 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4ePolarizedBremsstrahlungModel.cc

    r819 r961  
    2525//
    2626// $Id: G4ePolarizedBremsstrahlungModel.cc,v 1.4 2007/11/01 17:32:34 schaelic Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/polarisation/src/G4ePolarizedIonisation.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ePolarizedIonisation.cc,v 1.5 2007/07/10 09:35:37 schaelic Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ePolarizedIonisation.cc,v 1.7 2008/10/30 22:34:23 schaelic Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929// -------------------------------------------------------------------
    3030//
     
    8282  SetMaxKinEnergy(100.0*TeV);
    8383  //  PrintInfoDefinition();
     84  SetProcessSubType(fIonisation);
    8485}
    8586
  • trunk/source/processes/electromagnetic/polarisation/src/G4eplusPolarizedAnnihilation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eplusPolarizedAnnihilation.cc,v 1.6 2007/10/02 11:36:44 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eplusPolarizedAnnihilation.cc,v 1.8 2008/10/30 22:34:23 schaelic Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7878{
    7979  enableAtRestDoIt = true;
     80  SetProcessSubType(fAnnihilation);
    8081}
    8182
  • trunk/source/processes/electromagnetic/standard/History

    r819 r961  
    1 $Id: History,v 1.363.2.1 2008/04/25 00:22:53 vnivanch Exp $
     1$Id: History,v 1.432 2009/02/20 12:11:37 vnivanch Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
    20 25 April 08: V.Ivant (emstand-V09-00-23)
    21 G4UrbanMscModel90, G4UrbanMscModel - fixed assymetry of lateral displacement
    22 G4ionIonisation - use linLossLimit 0.15 as it was in 9.1
    23 G4IonFluctuations - fixed discontinuity of width of the energy loss for small
    24                     velocities (very long alpha events)
     2020 February 09: V.Ivant (emstand-V09-02-00)
     21- Move all virtual methods from inline to source
     22G4PEEffectModel - substitute ComputeMeanFreePath by CrossSectionPerVolume
     23                  (minor CPU speadup for compound materials)
     24G4PAIModel, G4PAIPhotonModel - remove usage of random numbers at
     25                   initialisation (potential non-reproducibility)
     26G4WentzelVIModel - use generic methods of G4VMscModel to access safety
     27                   and other geometry information
     28
     2924 November 08: V.Ivant (emstand-V09-01-45)
     30G4PSTARStopping, G4ASTARStopping - fixed non-initialized variable
     31   introduced in the previous tag
     32
     3319 November 08: V.Ivant (emstand-V09-01-44)
     34G4WentzelVIModel - minor fix in lateral displacement
     35
     3613 November 08: A. Schaelicke (emstand-V09-01-43)
     37G4eBremsstrahlung - activate LPM switch for high energy model
     38G4eBremsstrahlungRelModel - revised LPMconstant
     39G4eBremsstrahlungModel, G4eBremsstrahlungRelModel - (VI) use LPM flag
     40                                from the base class
     41
     4213 November 08: V.Ivant (emstand-V09-01-42)
     43G4PSTARStopping - fixed SiO2 and TEFLON data
     44G4ASTARStopping - fixed GRAFITE data
     45
     4629 October 08: V.Ivant (emstand-V09-01-41)
     47G4UrbanMscModel, G4UrbanMscModel2, G4UrbanMscModel90, G4WentzelVIModel
     48  use StepStatus from preStepPoint to identify first step for a given track
     49  instaed of step number in order to address ATLAS problem of small step
     50  limits happen with suspended tracks
     51
     5227 October 08: V.Ivant (emstand-V09-01-40)
     53G4UrbanMscModel2 - extra protection for "UseDistanceToBoundary" option
     54G4WentzelVIModel - fixed cross section factor for single scattering
     55
     5623 October 08: V.Ivant (emstand-V09-01-39)
     57G4eCoulombScatteringModel and G4WentzelVIModel - added protection against
     58    precision loss in computation of cross section at high energy
     59G4UrbanMscModel2 - fixed screening parameter of the single scattering part
     60G4eMultipleScattering - set default RangeFactor = 0.04
     61
     6222 October 08: V.Ivant (emstand-V09-01-38)
     63G4IonFluctuations - added G4UniversalFluctuation model, which are used for
     64    high energy; added comments and cleanup
     65G4BetheBlochModel, G4BraggIonModel - take into account effective change
     66    change over the step
     67G4hIonisation - switch off nuclear stopping for pi and K mesons   
     68
     6920 October 08: V.Ivant (emstand-V09-01-37)
     70G4UrbanMscModel2 - return back ref-08 version
     71G4IronStopping, G4MaterialStopping, G4SimpleMaterialStopping moved to materials
     72G4eBremsstrahlungHEModel - temporary model is removed   
     73
     7417 October 08: V.Ivant (emstand-V09-01-36)
     75G4UrbanMscModel2 - use logic of 9.1 version for step limitation
     76                   option "UseSafety" to fix CPU penalty in sampling
     77                   calorimeters (L.Urban)
     78G4UrbanMscModel2, G4UrbanMscModel, G4UrbanMscModel90 added protection
     79                   against sampling scattering angle with zero transport
     80                   cross section   
     81
     8215 October 08: V.Ivant (emstand-V09-01-35)
     83For all process classes set sub-types according to the enumeration
     84of G4EmProcessSubType.hh, improved cout
     85G4UrbanMscModel2 - use screning function from G4eCoulombScatteringModel
     86G4eBremsstrahlung - set relativistic model above 1 GeV by default
     87G4eBremsstrahlungModel, G4eBremsstrahlungRelModel removed private member
     88   highEnergyTh and use access method to this threshold in the base class
     89
     9021 September 08: V.Ivant (emstand-V09-01-34)
     91G4BetheBlochModel, G4BraggModel, G4BraggIonModel - simplified new methods
     92G4ionIonisation - use the same low-energy model for He ions and GenericIons
     93                  (like it was in 9.2beta)
     94
     9516 September 08: V.Ivant (emstand-V09-01-33)
     96G4UrbanMscModel, G4UrbanMscModel2, G4UrbanMscModel90 - do not use
     97   string comparison when compute transport cross section, instead
     98   compare masses (G.Cosmo)
     99
     10012 September 08: V.Ivant (emstand-V09-01-32)
     101Improved verbose output for processes
     102G4IonFluctuations - do not use Poisson sampling
     103G4BetheBlochModel, G4BraggModel, G4BraggIonModel - added methods
     104   GetParticleCharge, GetChargeSquareRatio, CorrectionsAlongStep
     105   needed for ions; define low and high energy limits inside the model
     106G4ionIonisation, G4hIonisation - remove InitialiseMassCharge and
     107                                 CorrectionsAlongStep methods;
     108                                 limits of kinetic energy for models
     109                                 taken from the base class and from
     110                                 models; separate trietment He ions
     111
     11209 September 08: V.Ivant (emstand-V09-01-31)
     113G4WaterStopping, G4IronStopping, G4MaterialStopping,
     114G4SimpleMaterialStopping - use mass number instead of atomic mass
     115                           (A.Lechner proposal)
     116G4eBremsstrahlungModel - Migdal constant set to the vavue of
     117                         G4eBremsstrahlungRelModel (A.Schaelicke)
     118
     11928 August 08: V.Ivant (emstand-V09-01-30)
     120G4WaterStopping, G4IronStopping - add method AddData to speeed up
     121     compillation and cleanup
     122G4WentzelVIModel - fixed bug in lateral displacement
     123
     12426 August 08: A.Schaelicke
     125G4eBremsstrahlungRelModel
     126   * define threshold energy for LPM effect
     127   * fix LPM calculation
     128   * define Thomas-fermi FF (ala Tsai)
     129   * some speed improvements
     130
     13125 August 08: V.Ivant (emstand-V09-01-29)
     132G4MaterialStopping, G4SimpleMaterialStopping - fixed compillation
     133    problem at Windows by adding a new method AddData 
     134
     13525 August 08: V.Ivant (emstand-V09-01-28)
     13623 August 08: V.Ivant (emstand-V09-01-27)
     137G4UrbanMscModel2 - fixed NaN in sampling of cosine theta for 50 GeV e-
     138
     13922 August 08: V.Ivant (emstand-V09-01-26)
     140Added new classes with stopping data G4MaterialStopping,
     141      G4SimpleMaterialStopping, G4IronStopping
     142
     14313 August 08: V.Ivant (emstand-V09-01-25)
     144G4eCoulombScatteringModel - added extra protection for precision lost in
     145                            computation of recoil energy
     146G4eBremsstrahlungModel, G4eBremsstrahlungHEModel - define more precise names
     147                          of models
     148
     14911 August 08: V.Ivant (emstand-V09-01-24)
     150G4IonFluctuations - do not perform loop over elements of material but use
     151                    effetive Z
     152G4UrbanMscModel2 - bug fix in ComputeTruePathLengthLimit (L.Urban)
     153
     1544 August 08: V.Ivant (emstand-V09-01-23)
     155G4eMultipleScattering - allowed to be applied for all changed particles
     156G4UrbanMscModel2 - changed name to "UrbanMscUni2"
     157G4eCoulombScatteringModel and G4WentzelVIModel - added protections for ions
     158G4WaterStopping - added extra data
     159
     16031 July 08: V.Ivant (emstand-V09-01-22)
     161G4WentzelVIModel, G4eCoulombScatteringModel, G4CoulombScatteringModel -
     162           do not define min and max energy in constructor but use Set
     163           methods
     164G4MultipleScattering, G4eMultipleScattering, G4hMultipleScattering -
     165           added cout of model names
     166G4CoulombScattering - set angular limit of models by Set method
     167
     16824 July 08: V.Ivant (emstand-V09-01-21)
     169G4UrbanMscModel2 - central part of scattering angle (theta0) and
     170           tail of the scattering angle distribution have been tuned
     171           using some e- and proton scattering data (L.Urban)
     172
     17321 July 08: V.Ivant (emstand-V09-01-20)
     174G4eCoulombScatteringModel, G4CoulombScatteringModel  - added usage of
     175         G4ElementSelector vector, do not use A in SetupTarget method
     176G4WentzelVIModel - do not use A in SetupTarget method
     177                           
     17816 June 08: V.Ivant (emstand-V09-01-19)
     179G4PAIPhotonModel - change model name
     180G4MultipleScattering71 - move inline virtual method to source to avoid
     181                         compillation warning
     182
     18314 June 08: V.Ivant (emstand-V09-01-18)
     184- G4CoulombScattering - added SetHEModelLimit method to provide more easy
     185                        initialisation
     186
     18711 June 08: V.Ivant (emstand-V09-01-17)
     188- G4eCoulombScatteringModel - SelectIsotope method moved from the derived
     189    class and sampling of the recoil ion is performed
     190- G4CoulombScatteringModel - SelectIsotope method moved to the base class
     191- G4PAIxSection - new functions for resonance and Rutherford collisions
     192- G4IonFluctuations - fixed index
     193- G4ionIonisation - use G4BraggModel for low-energy ions heavier than He
     194- G4hIonisation - build separate tables for kaons to allow use hadron
     195                  bremsstrahlung and pair production by kaons
     196
     1972 June 08: V.Ivant (emstand-V09-01-16)
     198- G4IonFluctuations - added method SetParticleAndCharge
     199- G4ionIonisation, G4ionGasIonisation - added pointer to G4IonFluctuations
     200             and use of method SetParticleAndCharge; compute nuclear
     201             stopping before adding corrections
     202
     20320 May 08: V.Ivant (emstand-V09-01-15)
     204- G4IonFluctuations - summed fluctuation of components of a mixture instead
     205                      of computation for average Z
     206- G4BetheBlochModel - added projectile form-factor in computation of max
     207                      energy transfer and in sampling of the energy of e-
     208
     20913 May 08: A.Schaelicke
     210- G4eBremsstrahlungHEModel - new model, which is an extension of the standard
     211                             bremsstrahlung model using a more sophisticated
     212                             LPM approach
     213
     21409 May 08: V.Ivant (emstand-V09-01-14)
     215- G4hMultipleScattering - added method AlongStepGetPhysicalInteractionLength
     216    in which for ions scaled energy normalized to one nucleon is used
     217- G4ionGasIonisation - fixed bug in update of the dynamic charge of
     218                        an ion
     219
     22021 April 08: V.Ivant (emstand-V09-01-13)
     221- G4WentzelVIModel - new model of multiple scattering
     222- G4WaterStopping - use spline
     223- G4hMultipleScattering - do not build tables for particles with mass > GeV
     224- G4ionIonisation, G4ionGasIonisation - updated usage of high order
     225                                        corrections
     226- G4CoulombScattering, G4eCoulombScatteringModel - use new parameter
     227                                                   polarAngleLimit
     228
     2299 April 08: V.Ivant (emstand-V09-01-12)
     230- G4UrbanMscModel, G4UrbanMscModel90 - fixed assymetry in transverse
     231    displacement
     232- G4eCoulombScatteringModel - fixed bug for compounds
     233
     23431 March 08: V.Ivant (emstand-V09-01-11)
     235- G4eCoulombScatteringModel - use SelectAtomRandomly method
     236- G4UrbanMscModel2 (L.Urban):
     237           - Simplification of step limitation in ComputeTruePathLengthLimit,
     238             + tlimitmin is the same for UseDistancetoBoundary and UseSafety       
     239           - Reorganization of SampleCosineTheta + new method SimpleScattering
     240             SimpleScattering is used if the relative energy loss is too big
     241             or theta0 is too big (see data members rellossmax, theta0max)
     242           - Tuning of the correction factor in ComputeTheta0
     243           - exponent c of the 'tail' model function is not equal to 2 any more,
     244             value of c has been extracted from some e- scattering data
     245           - Step limitation in ComputeTruePathLengthLimit has been
     246             simplified further + some data members have been removed
     247
     24825 March 08: V.Ivant (emstand-V09-01-10)
     249- G4BetheBlochModel - use formfactor for sampling
     250- G4eCoulombScatteringModel - remove unsued array
     251
     25225 March 08: V.Ivant (emstand-V09-01-09)
     253- G4ionIonisation - use default linLossLimit of 9.1
     254- G4hIonisation - use G4IonFluctuations at low energies
     255- G4IonFluctuations - fixed computation of corrections
     256- G4BetheBlochModel - finite size correction is taken into
     257  account both for delta-electron cross section and DEDX
     258- G4eCoulombScatteringModel - reorganize and cleanup computation
     259  of cross section
     260
     26114 March 08: V.Ivant (emstand-V09-01-08)
     262- G4UrbanMscModel2 - L.Urban fix assymetry in lateral displacement
     263- G4UrbanMscModel90, G4MscModel71 - fixed warnings for gcc 4.3.0
     264
     26510 March 08: V.Ivant (emstand-V09-01-07)
     266- G4MultipleScattering, G4hMultipleScattering, G4UrbanMscModel,
     267  G4UrbanMscModel2, G4UrbanMscModel90 uses G4VMscModel interface
     268- G4eMultipleScattering - new process specialized for e+,e-
     269
     27006 March 08: V.Ivant (emstand-V09-01-06)
     271- G4UrbanMscModel2 is cloned from G4UrbanMscModel
     272- SubType for all processes is initialized
     273
     27420 February 08: V.Ivant (emstand-V09-01-05)
     275G4eCoulombScatteringModel - speedup run-time computations using
     276  precomputed nuclear form-factors per element
     277
     27814 February 08: V.Ivant (emstand-V09-01-04)
     279- G4ionIonisation, G4ionGasIonisation - use new method to compute
     280  corrections: IonHighOrderCorrections
     281- G4BetheBlochModel - when computing dedx for ions use new
     282  method IonBarkasCorrection
     283- G4IonFluctuations - added protection to the computation of
     284  the correction factor to dispersion which provide smooth
     285  transition to small velocities of an ion
     286
     28704 February 08: V.Ivant (emstand-V09-01-03)
     288- G4hIonisation, G4ionIonisation, G4ionGasIonisation - add extra
     289   protections in computation of non-ionizing energy loss
     290
     29104 February 08: V.Ivant (emstand-V09-01-02)
     292G4IonFluctuations - added protection in computation of dispersion
     293  on allowing have a corrected dispersion below Bohr value
    25294
    2629516 January 08: V.Ivant (emstand-V09-01-01)
    27 G4PAIModel, G4PAIPhotonModel - added an extra protection garanteed
    28  correct usage of the last bin of the table of nergy transfers
     296G4PAIModel, G4PAIPhotonModel - added an extra protection guaranteed
     297 correct usage of the last bin of the table of energy transfers
    29298
    3029914 January 08: V.Ivant (emstand-V09-01-00)
    31300- G4hIonisation, G4ionIonisation, G4ionGasIonisation - fixed
    32    computation of non-ionizing energy loss: at the last ioniztion step
     301   computation of non-ionizing energy loss: at the last ionization step
    33302   and at energies above 2 MeV for protons;
    34 - G4eCoulombScatteringModel - use more safe numerical espression
     303- G4eCoulombScatteringModel - use more safe numerical expression
    35304
    3630507 December 07: V.Ivant (emstand-V09-00-22)
     
    82351           particle type (electron, muons, others)
    83352         - tuning ComputeGeomPathLength in order to get better low
    84            energy behaviour for heavy particles (mu, hadrons)
     353           energy behavior for heavy particles (mu, hadrons)
    85354         - small modification of theta0 in ComputeTheta0 (based on data)
    86355         - some old inconsistency/bug has been cured in SampleCosineTheta
     
    115384- G4eCoulombScatteringModel and G4CoulombScatteringModel - fixed bug in
    116385  computation of screening parameters in SampleSecondary method;
    117   reorganised initialisation of kinematics and screening parameters;
     386  reorganized initialisation of kinematics and screening parameters;
    118387  used Z(Z+1) factor to take into account scattering off e-
    119388
     
    149418- G4ionIonisation - remove obsolete method DefineMassCharge
    150419- G4ionGasIonisation - new ion ionisation process with descrete ion charge and
    151                        no equilibrium btween ion and media
     420                       no equilibrium between ion and media
    152421- G4BraggModel, G4BraggIonModel - more safe computation of scattering angle
    153422
     
    190459  void, extra parameter std::vector<G4DynamicParticle*>*, all
    191460  classes using or inhereting this interface are modified.
    192   About 5% speadup of EM shower simulation
     461  About 5% speedup of EM shower simulation
    193462
    19446321 May 07:  V.Ivanchenko (emstand-V08-03-05)
     
    203472
    20447318 May 07:  V.Ivanchenko (emstand-V08-03-02)
    205 - G4MultipleScattering, G4hMultipleScattering - reorganise methods
     474- G4MultipleScattering, G4hMultipleScattering - reorganized methods
    206475                                                for setting msc
    207476                                                parameters
    208 - G4UrbanMscModel - reorganise initialisation; use G4MscStepLimitType
     477- G4UrbanMscModel - reorganized initialisation; use G4MscStepLimitType
    209478                    enumerator to choose step limit algorithm
    210479                                               
  • trunk/source/processes/electromagnetic/standard/include/G4ASTARStopping.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ASTARStopping.hh,v 1.5 2006/06/29 19:49:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4ASTARStopping.hh,v 1.6 2008/11/13 12:04:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929#ifndef G4ASTARStopping_h
     
    8686  G4double e[74][78], kinE[78];
    8787  G4double effZ[74];
    88   G4int Znum[74];
    8988};
    9089
  • trunk/source/processes/electromagnetic/standard/include/G4BetheBlochModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BetheBlochModel.hh,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4BetheBlochModel.hh,v 1.17 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4545// 12-11-03 Fix for GenericIons (V.Ivanchenko)
    4646// 24-03-05 Add G4EmCorrections (V.Ivanchenko)
    47 // 11-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
     47// 11-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
    4848// 11-04-04 Move MaxSecondaryEnergy to models (V.Ivanchenko)
    4949// 11-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
     50// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     51//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    5052
    5153//
     
    6567class G4EmCorrections;
    6668class G4ParticleChangeForLoss;
     69class G4NistManager;
     70
    6771
    6872class G4BetheBlochModel : public G4VEmModel
     
    7882  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7983
    80   G4double MinEnergyCut(const G4ParticleDefinition*,
    81                         const G4MaterialCutsCouple*);
     84  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     85                                const G4MaterialCutsCouple*);
    8286                       
    8387  virtual G4double ComputeCrossSectionPerElectron(
     
    105109                                        G4double cutEnergy);
    106110
     111  virtual G4double GetChargeSquareRatio(const G4ParticleDefinition* p,
     112                                        const G4Material* mat,
     113                                        G4double kineticEnergy);
     114
     115  virtual G4double GetParticleCharge(const G4ParticleDefinition* p,
     116                                     const G4Material* mat,
     117                                     G4double kineticEnergy);
     118
     119  virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
     120                                    const G4DynamicParticle*,
     121                                    G4double& eloss,
     122                                    G4double& niel,
     123                                    G4double length);
     124
    107125  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
    108126                                 const G4MaterialCutsCouple*,
     
    113131protected:
    114132
    115   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    116                               G4double kinEnergy);
     133  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     134                                      G4double kinEnergy);
    117135
    118136private:
     
    125143
    126144  const G4ParticleDefinition* particle;
     145  const G4Material*           currentMaterial;
    127146  G4ParticleDefinition*       theElectron;
    128147  G4EmCorrections*            corr;
    129148  G4ParticleChangeForLoss*    fParticleChange;
     149  G4NistManager*              nist;
    130150
    131151  G4double mass;
    132152  G4double tlimit;
    133153  G4double spin;
     154  G4double magMoment2;
    134155  G4double chargeSquare;
    135156  G4double ratio;
     157  G4double formfact;
    136158  G4double twoln10;
    137159  G4double bg2lim;
    138160  G4double taulim;
     161  G4double corrFactor;
    139162  G4bool   isIon;
     163  G4bool   isInitialised;
    140164};
    141165
    142166//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    143167
    144 inline G4double G4BetheBlochModel::MaxSecondaryEnergy(
    145           const G4ParticleDefinition* pd,
    146                 G4double kinEnergy)
    147 {
    148   if(isIon) SetParticle(pd);
    149   G4double tau  = kinEnergy/mass;
    150   G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
    151                   (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
    152   return std::min(tmax,tlimit);
    153 }
    154 
    155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    156 
    157 inline void G4BetheBlochModel::SetParticle(const G4ParticleDefinition* p)
    158 {
    159   if(particle != p) {
    160     particle = p;
    161     mass = particle->GetPDGMass();
    162     spin = particle->GetPDGSpin();
    163     G4double q = particle->GetPDGCharge()/eplus;
    164     chargeSquare = q*q;
    165     ratio = electron_mass_c2/mass;
    166     if(mass > 120.*MeV) tlimit = 51.2*GeV*std::pow(proton_mass_c2/mass,0.66667);
    167   }
    168 }
    169 
    170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    171 
    172168#endif
  • trunk/source/processes/electromagnetic/standard/include/G4BetheHeitlerModel.hh

    r819 r961  
    2525//
    2626// $Id: G4BetheHeitlerModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/include/G4BohrFluctuations.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BohrFluctuations.hh,v 1.3 2007/09/27 13:53:11 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BohrFluctuations.hh,v 1.4 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7979  void InitialiseMe(const G4ParticleDefinition*);
    8080
    81 protected:
    82 
    8381private:
    8482
     
    103101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    104102
    105 
    106 inline G4double G4BohrFluctuations::Dispersion(
    107                           const G4Material* material,
    108                           const G4DynamicParticle* dp,
    109                                 G4double& tmax,
    110                                 G4double& length)
    111 {
    112   if(!particle) InitialiseMe(dp->GetDefinition());
    113 
    114   G4double electronDensity = material->GetElectronDensity();
    115   kineticEnergy = dp->GetKineticEnergy();
    116   G4double etot = kineticEnergy + particleMass;
    117   beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
    118   G4double siga  = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
    119                  * electronDensity * chargeSquare;
    120 
    121   return siga;
    122 }
    123 
    124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    125 
    126103#endif
    127104
  • trunk/source/processes/electromagnetic/standard/include/G4BraggIonModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggIonModel.hh,v 1.8 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggIonModel.hh,v 1.12 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4343// 15-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
    4444// 25-04-06 Add stopping data from ASTAR (V.Ivanchenko)
     45// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     46//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    4547
    4648//
     
    4850//
    4951// Implementation of energy loss and delta-electron production
    50 // by heavy slow charged particles using eveluated data
     52// by heavy slow charged particles using ICRU'49 and NIST evaluated data
     53// for He4 ions
    5154
    5255// -------------------------------------------------------------------
     
    6063
    6164class G4ParticleChangeForLoss;
     65class G4EmCorrections;
    6266
    6367class G4BraggIonModel : public G4VEmModel
     
    7377  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7478
    75   G4double MinEnergyCut(const G4ParticleDefinition*,
    76                         const G4MaterialCutsCouple*);
     79  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     80                                const G4MaterialCutsCouple*);
    7781                       
    7882  virtual G4double ComputeCrossSectionPerElectron(
     
    106110                                 G4double maxEnergy);
    107111
     112  // Compute ion charge
     113  virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*,
     114                                        const G4Material*,
     115                                        G4double kineticEnergy);
     116
     117  virtual G4double GetParticleCharge(const G4ParticleDefinition* p,
     118                                     const G4Material* mat,
     119                                     G4double kineticEnergy);
     120
     121  // add correction to energy loss and ompute non-ionizing energy loss
     122  virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
     123                                    const G4DynamicParticle*,
     124                                    G4double& eloss,
     125                                    G4double& niel,
     126                                    G4double length);
     127
    108128protected:
    109129
    110   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    111                               G4double kinEnergy);
     130  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     131                                      G4double kinEnergy);
    112132
    113133private:
     
    133153  G4double DEDX(const G4Material* material, G4double kineticEnergy);
    134154
     155  G4EmCorrections*            corr;
     156
    135157  const G4ParticleDefinition* particle;
    136158  G4ParticleDefinition*       theElectron;
     
    144166  G4double massRate;
    145167  G4double ratio;
    146   G4double highKinEnergy;
    147   G4double lowKinEnergy;
    148168  G4double lowestKinEnergy;
    149169  G4double HeMass;
    150170  G4double massFactor;
     171  G4double corrFactor;
    151172  G4double rateMassHe2p;
    152173  G4double theZieglerFactor;
     
    154175  G4int    iMolecula;          // index in the molecula's table
    155176  G4bool   isIon;
     177  G4bool   isInitialised;
    156178};
    157 
    158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    159 
    160 inline G4double G4BraggIonModel::MaxSecondaryEnergy(
    161           const G4ParticleDefinition* pd,
    162                 G4double kinEnergy)
    163 {
    164   if(pd != particle) SetParticle(pd);
    165   G4double tau  = kinEnergy/mass;
    166   G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
    167                   (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
    168   return tmax;
    169 }
    170179
    171180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/include/G4BraggModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggModel.hh,v 1.10 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggModel.hh,v 1.13 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4545// 11-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
    4646// 15-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
    47 // 25-04-06 Add stopping data from PSTAR (V.Ivanchenko)
     47// 25-04-06 Added stopping data from PSTAR (V.Ivanchenko)
     48// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     49//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    4850
    4951//
     
    5153//
    5254// Implementation of energy loss and delta-electron production
    53 // by heavy slow charged particles using eveluated data
     55// by heavy slow charged particles using ICRU'49 and NIST evaluated data
     56// for protons
    5457
    5558// -------------------------------------------------------------------
     
    6366
    6467class G4ParticleChangeForLoss;
     68class G4EmCorrections;
    6569
    6670class G4BraggModel : public G4VEmModel
     
    7680  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7781
    78   G4double MinEnergyCut(const G4ParticleDefinition*,
    79                         const G4MaterialCutsCouple*);
     82  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     83                                const G4MaterialCutsCouple*);
    8084                       
    8185  virtual G4double ComputeCrossSectionPerElectron(
     
    109113                                 G4double maxEnergy);
    110114
     115  // Compute ion charge
     116  virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*,
     117                                        const G4Material*,
     118                                        G4double kineticEnergy);
     119
     120  virtual G4double GetParticleCharge(const G4ParticleDefinition* p,
     121                                     const G4Material* mat,
     122                                     G4double kineticEnergy);
     123
     124  // add correction to energy loss and compute non-ionizing energy loss
     125  virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
     126                                    const G4DynamicParticle*,
     127                                    G4double& eloss,
     128                                    G4double& niel,
     129                                    G4double length);
     130
    111131protected:
    112132
    113   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    114                               G4double kinEnergy);
     133  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     134                                      G4double kinEnergy);
    115135
    116136private:
    117137
    118   void SetParticle(const G4ParticleDefinition* p);
     138  inline void SetParticle(const G4ParticleDefinition* p);
    119139
    120140  G4bool HasMaterial(const G4Material* material);
     
    139159  G4BraggModel & operator=(const  G4BraggModel &right);
    140160  G4BraggModel(const  G4BraggModel&);
     161
     162
     163  G4EmCorrections*            corr;
    141164
    142165  const G4ParticleDefinition* particle;
     
    150173  G4double massRate;
    151174  G4double ratio;
    152   G4double highKinEnergy;
    153   G4double lowKinEnergy;
    154175  G4double lowestKinEnergy;
    155176  G4double protonMassAMU;
     
    159180  G4int    iMolecula;          // index in the molecula's table
    160181  G4bool   isIon;
     182  G4bool   isInitialised;
    161183};
    162 
    163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    164 
    165 inline G4double G4BraggModel::MaxSecondaryEnergy(
    166                                             const G4ParticleDefinition* pd,
    167                                                   G4double kinEnergy)
    168 {
    169   if(pd != particle) SetParticle(pd);
    170   G4double tau  = kinEnergy/mass;
    171   G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
    172                   (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
    173   return tmax;
    174 }
    175184
    176185//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/include/G4ComptonScattering.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4ComptonScattering.hh,v 1.20 2007/05/23 08:47:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4ComptonScattering.hh,v 1.21 2009/02/20 12:06:37 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//------------------ G4ComptonScattering physics process -----------------------
     
    8282
    8383  // true for Gamma only. 
    84   G4bool IsApplicable(const G4ParticleDefinition&);
     84  virtual G4bool IsApplicable(const G4ParticleDefinition&);
    8585 
    8686  // Print few lines of informations about the process: validity range,
    8787  virtual void PrintInfo();
    88 
    8988
    9089protected:
     
    9796};
    9897
    99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    101 
    102 inline
    103 G4bool G4ComptonScattering::IsApplicable(const G4ParticleDefinition& p)
    104 {
    105   return (&p == G4Gamma::Gamma());
    106 }
    107 
    10898//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    10999 
  • trunk/source/processes/electromagnetic/standard/include/G4ComptonScattering52.hh

    r819 r961  
    2626//
    2727// $Id: G4ComptonScattering52.hh,v 1.4 2007/05/16 14:00:56 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//------------------ G4ComptonScattering52 physics process -----------------------
  • trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CoulombScattering.hh,v 1.8 2007/07/31 17:24:04 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4CoulombScattering.hh,v 1.12 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6565  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    6666
    67   void SetThetaMin(G4double);
     67  inline void SetThetaMin(G4double);
    6868
    69   void SetThetaMax(G4double);
     69  inline void SetThetaMax(G4double);
    7070
    71   void SetQ2Max(G4double);
     71  inline void SetQ2Max(G4double);
     72
     73  // Set energy above which high energy model will be used
     74  inline void SetHEModelLimit(G4double);
    7275
    7376  // obsolete method to be removed
    74   void SetBuildTableFlag(G4bool);
     77  inline void SetBuildTableFlag(G4bool);
    7578
    7679  // Print out of the class parameters
     
    101104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    102105
    103 inline G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
    104 {
    105   return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
    106 }
    107 
    108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    109 
    110106inline void G4CoulombScattering::SetThetaMin(G4double val)
    111107{
     
    132128{}
    133129
     130//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     131
     132inline void G4CoulombScattering::SetHEModelLimit(G4double val)
     133{
     134  thEnergy = val;
     135  thEnergyElec = val;
     136}
     137
    134138//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    135139
  • trunk/source/processes/electromagnetic/standard/include/G4CoulombScatteringModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CoulombScatteringModel.hh,v 1.11 2007/10/09 08:16:29 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4CoulombScatteringModel.hh,v 1.15 2008/07/31 13:11:34 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4444// 19.10.06 V.Ivanchenko use inheritance from G4eCoulombScatteringModel
    4545// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
     46// 09.06.08 V.Ivanchenko SelectIsotope is moved to the base class
    4647//
    4748// Class Description:
     
    6465#include "globals.hh"
    6566
    66 class G4ParticleTable;
    67 class G4NistManager;
    68 
    6967class G4CoulombScatteringModel : public G4eCoulombScatteringModel
    7068{
     
    7270public:
    7371
    74   G4CoulombScatteringModel(G4double thetaMin = 0.0, G4double thetaMax = pi,
    75                            G4bool build = false, G4double tlim = TeV*TeV,
    76                            const G4String& nam = "CoulombScattering");
     72  G4CoulombScatteringModel(const G4String& nam = "CoulombScattering");
    7773 
    7874  virtual ~G4CoulombScatteringModel();
     
    9490private:
    9591
    96   G4double SelectIsotope(const G4Element*);
    97 
    9892  // hide assignment operator
    9993  G4CoulombScatteringModel & operator=(const G4CoulombScatteringModel &right);
    10094  G4CoulombScatteringModel(const  G4CoulombScatteringModel&);
    10195
    102   G4ParticleTable*            theParticleTable;
    103   const G4NistManager*        theMatManager;
    10496};
    10597
  • trunk/source/processes/electromagnetic/standard/include/G4GammaConversion.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4GammaConversion.hh,v 1.22 2007/05/23 08:47:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4GammaConversion.hh,v 1.23 2009/02/20 12:06:37 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    8585
    8686  // true for Gamma only.
    87   G4bool IsApplicable(const G4ParticleDefinition&);
     87  virtual G4bool IsApplicable(const G4ParticleDefinition&);
    8888
    8989  // Print few lines of informations about the process: validity range,
     
    9999};
    100100
    101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    103 
    104 inline G4bool G4GammaConversion::IsApplicable(const G4ParticleDefinition& p)
    105 {
    106   return (&p == G4Gamma::Gamma());
    107 }
    108 
    109101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    110102 
  • trunk/source/processes/electromagnetic/standard/include/G4InitXscPAI.hh

    r819 r961  
    2626//
    2727// $Id: G4InitXscPAI.hh,v 1.8 2006/06/29 19:50:22 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/standard/include/G4IonFluctuations.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4IonFluctuations.hh,v 1.3 2007/09/27 13:53:11 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4IonFluctuations.hh,v 1.9 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4141//
    4242// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
     43// 01-06-08 Added initialisation of effective charge prestep (V.Ivanchenko)
    4344//
    4445// Class Description:
     
    5455
    5556#include "G4VEmFluctuationModel.hh"
     57#include "G4ParticleDefinition.hh"
     58#include "G4UniversalFluctuation.hh"
    5659
    5760class G4IonFluctuations : public G4VEmFluctuationModel
     
    6467  virtual ~G4IonFluctuations();
    6568
     69  // Sample fluctuations
    6670  G4double SampleFluctuations(const G4Material*,
    6771                              const G4DynamicParticle*,
    68                                     G4double&,
    69                                     G4double&,
    70                                     G4double&);
     72                              G4double& tmax,
     73                              G4double& length,
     74                              G4double& meanLoss);
    7175
    72   G4double Dispersion(    const G4Material*,
    73                           const G4DynamicParticle*,
    74                                 G4double&,
    75                                 G4double&);
     76  // Compute dispertion
     77  G4double Dispersion(const G4Material*,
     78                      const G4DynamicParticle*,
     79                      G4double& tmax,
     80                      G4double& length);
    7681
     82  // Initialisation prerun
    7783  void InitialiseMe(const G4ParticleDefinition*);
     84
     85  // Initialisation prestep
     86  void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
    7887
    7988private:
    8089
    81   G4double CoeffitientA(G4double&);
    82   G4double CoeffitientB(const G4Material*, G4double&);
    83   G4double RelativisticFactor(const G4Material*, G4double&);
     90  G4double Factor(const G4Material*, G4double Zeff);
     91  G4double RelativisticFactor(const G4Material*, G4double Zeff);
    8492
    8593  // hide assignment operator
     
    8795  G4IonFluctuations(const  G4IonFluctuations&);
    8896
     97  G4UniversalFluctuation      uniFluct;
    8998  const G4ParticleDefinition* particle;
    9099
     
    92101  G4double charge;
    93102  G4double chargeSquare;
    94   G4double chargeSqRatio;
     103  G4double effChargeSquare;
    95104
    96105  // data members to speed up the fluctuation calculation
     106  G4double parameter;
    97107  G4double minNumberInteractionsBohr;
    98108  G4double theBohrBeta2;
  • trunk/source/processes/electromagnetic/standard/include/G4KleinNishinaCompton.hh

    r819 r961  
    2525//
    2626// $Id: G4KleinNishinaCompton.hh,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/include/G4MollerBhabhaModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MollerBhabhaModel.hh,v 1.19 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MollerBhabhaModel.hh,v 1.20 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7474  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7575
    76   G4double MinEnergyCut(const G4ParticleDefinition*,
    77                         const G4MaterialCutsCouple*);
     76  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     77                                const G4MaterialCutsCouple*);
    7878                               
    7979  virtual G4double ComputeCrossSectionPerElectron(
     
    109109protected:
    110110
    111   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    112                               G4double kinEnergy);
     111  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
     112                                      G4double kinEnergy);
    113113                             
    114   void SetParticle(const G4ParticleDefinition* p);                           
     114  inline void SetParticle(const G4ParticleDefinition* p);                             
    115115
    116116  const G4ParticleDefinition* particle;
     
    127127  G4MollerBhabhaModel & operator=(const  G4MollerBhabhaModel &right);
    128128  G4MollerBhabhaModel(const  G4MollerBhabhaModel&);
     129
     130  G4bool   isInitialised;
     131
    129132};
    130133
    131134//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    132135
    133 inline G4double G4MollerBhabhaModel::MaxSecondaryEnergy(
    134                                                    const G4ParticleDefinition*,
    135                                                          G4double kinEnergy)
     136inline void G4MollerBhabhaModel::SetParticle(const G4ParticleDefinition* p)
    136137{
    137   G4double tmax = kinEnergy;
    138   if(isElectron) tmax *= 0.5;
    139   return tmax;
     138  particle = p;
     139  if(p != theElectron) isElectron = false;
    140140}
    141141
  • trunk/source/processes/electromagnetic/standard/include/G4MscModel71.hh

    r819 r961  
    2525//
    2626// $Id: G4MscModel71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/include/G4MultipleScattering.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MultipleScattering.hh,v 1.35 2007/05/18 18:43:32 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MultipleScattering.hh,v 1.36 2008/03/10 10:39:21 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    100100//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    101101
    102 class G4UrbanMscModel;
     102class G4VMscModel;
    103103
    104104class G4MultipleScattering : public G4VMultipleScattering
     
    133133private:        // data members
    134134
    135   G4UrbanMscModel* mscUrban;
     135  G4VMscModel* mscUrban;
    136136
    137137  G4double lambdalimit;
  • trunk/source/processes/electromagnetic/standard/include/G4MultipleScattering71.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MultipleScattering71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MultipleScattering71.hh,v 1.6 2008/07/16 11:27:41 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    5858//------------------------------------------------------------------------------
    5959//
    60 // $Id: G4MultipleScattering71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
    61 // GEANT4 tag $Name: $
     60// $Id: G4MultipleScattering71.hh,v 1.6 2008/07/16 11:27:41 vnivanch Exp $
     61// GEANT4 tag $Name: geant4-09-02-ref-02 $
    6262
    6363// class description
     
    180180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    181181
    182 inline G4double G4MultipleScattering71::GetContinuousStepLimit(
    183                                           const G4Track& track,
    184                                                 G4double,
    185                                                 G4double currentMinimalStep,
    186                                                 G4double&)
    187 {
    188   DefineMaterial(track.GetMaterialCutsCouple());
    189   const G4MaterialCutsCouple* couple = CurrentMaterialCutsCouple();
    190   G4double e = track.GetKineticEnergy();
    191   model = dynamic_cast<G4MscModel71*>(SelectModel(e));
    192   const G4ParticleDefinition* p = track.GetDefinition();
    193   G4double lambda0 = GetLambda(p, e);
    194   range =  G4LossTableManager::Instance()->GetRangeFromRestricteDEDX(p,e,couple);
    195   if(range < currentMinimalStep) currentMinimalStep = range;
    196   truePathLength = TruePathLengthLimit(track,lambda0,currentMinimalStep);
    197   //  G4cout << "StepLimit: tpl= " << truePathLength << " lambda0= "
    198   //       << lambda0 << " range= " << currentRange
    199   //       << " currentMinStep= " << currentMinimalStep << G4endl;
    200   if (truePathLength < currentMinimalStep) valueGPILSelectionMSC = CandidateForSelection;
    201   geomPathLength = model->GeomPathLength(LambdaTable(),couple,
    202            p,e,lambda0,range,truePathLength);
    203   if(geomPathLength > lambda0) geomPathLength = lambda0;
    204   return geomPathLength;
    205 }
    206 
    207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    208 
    209182inline G4VParticleChange* G4MultipleScattering71::AlongStepDoIt(
    210183                                                        const G4Track&,
  • trunk/source/processes/electromagnetic/standard/include/G4PAIModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
     26// $Id: G4PAIModel.hh,v 1.22 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2628//
    2729// -------------------------------------------------------------------
     
    7577  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7678
    77   virtual void InitialiseMe(const G4ParticleDefinition*) {};
    78 
    79   virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
     79  virtual void InitialiseMe(const G4ParticleDefinition*);
     80
     81  virtual G4double ComputeDEDXPerVolume(const G4Material*,
    8082                               const G4ParticleDefinition*,
    8183                               G4double kineticEnergy,
    8284                               G4double cutEnergy);
    8385
    84   virtual G4double CrossSection(const G4MaterialCutsCouple*,
     86  virtual G4double CrossSectionPerVolume(const G4Material*,
    8587                                const G4ParticleDefinition*,
    8688                                G4double kineticEnergy,
     
    118120
    119121  void SetVerboseLevel(G4int verbose){fVerbose=verbose;};
    120 
    121 
    122122
    123123protected:
     
    192192};
    193193
    194 /////////////////////////////////////////////////////////////////////
    195 
    196 inline G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
    197                                                       G4double kinEnergy)
    198 {
    199   G4double tmax = kinEnergy;
    200   if(p == fElectron) tmax *= 0.5;
    201   else if(p != fPositron) {
    202     G4double mass = p->GetPDGMass();
    203     G4double ratio= electron_mass_c2/mass;
    204     G4double gamma= kinEnergy/mass + 1.0;
    205     tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
    206                   (1. + 2.0*gamma*ratio + ratio*ratio);
    207   }
    208   return tmax;
    209 }
    210 
    211 ///////////////////////////////////////////////////////////////
    212 
    213 inline  void G4PAIModel::DefineForRegion(const G4Region* r)
    214 {
    215   fPAIRegionVector.push_back(r);
    216 }
    217 
    218194#endif
    219195
  • trunk/source/processes/electromagnetic/standard/include/G4PAIPhotonModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
     26// $Id: G4PAIPhotonModel.hh,v 1.12 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2628//
    2729// -------------------------------------------------------------------
     
    6870public:
    6971
    70   G4PAIPhotonModel(const G4ParticleDefinition* p = 0, const G4String& nam = "PAI");
     72  G4PAIPhotonModel(const G4ParticleDefinition* p = 0, const G4String& nam = "PAIPhoton");
    7173
    7274  virtual ~G4PAIPhotonModel();
     
    7476  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7577 
    76   virtual void InitialiseMe(const G4ParticleDefinition*) {};
    77 
    78   virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
    79                                const G4ParticleDefinition*,
    80                                G4double kineticEnergy,
    81                                G4double cutEnergy);
    82 
    83   virtual G4double CrossSection(const G4MaterialCutsCouple*,
    84                                 const G4ParticleDefinition*,
    85                                 G4double kineticEnergy,
    86                                 G4double cutEnergy,
    87                                 G4double maxEnergy);
     78  virtual void InitialiseMe(const G4ParticleDefinition*);
     79
     80  virtual G4double ComputeDEDXPerVolume(const G4Material*,
     81                                        const G4ParticleDefinition*,
     82                                        G4double kineticEnergy,
     83                                        G4double cutEnergy);
     84
     85  virtual G4double CrossSectionPerVolume(const G4Material*,
     86                                         const G4ParticleDefinition*,
     87                                         G4double kineticEnergy,
     88                                         G4double cutEnergy,
     89                                         G4double maxEnergy);
    8890
    8991  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
     
    122124                             G4double position, G4int iTransfer );
    123125
    124 
    125 
    126126protected:
    127127
    128128  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    129                                     G4double kinEnergy);
     129                              G4double kinEnergy);
    130130
    131131private:
     
    145145  G4int                fVerbose;
    146146  G4PhysicsLogVector*  fProtonEnergyVector ;
    147 
    148 
    149147
    150148  // vectors
     
    204202};
    205203
    206 /////////////////////////////////////////////////////////////////////
    207 
    208 inline G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
    209                                                       G4double kinEnergy)
    210 {
    211   G4double tmax = kinEnergy;
    212   if(p == fElectron) tmax *= 0.5;
    213   else if(p != fPositron) {
    214     G4double mass = p->GetPDGMass();
    215     G4double ratio= electron_mass_c2/mass;
    216     G4double gamma= kinEnergy/mass + 1.0;
    217     tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
    218                   (1. + 2.0*gamma*ratio + ratio*ratio);
    219   }
    220   return tmax;
    221 }
    222 
    223 ///////////////////////////////////////////////////////////////
    224 
    225 inline  void G4PAIPhotonModel::DefineForRegion(const G4Region* r)
    226 {
    227   fPAIRegionVector.push_back(r);
    228 }
    229 
    230204#endif
    231205
  • trunk/source/processes/electromagnetic/standard/include/G4PAIxSection.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PAIxSection.hh,v 1.12 2006/06/29 19:50:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4PAIxSection.hh,v 1.15 2008/05/30 16:04:40 grichine Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    7474         
    7575  G4PAIxSection( G4int materialIndex,
    76                          G4double maxEnergyTransfer   ) ;
     76                         G4double maxEnergyTransfer   );
    7777         
    7878  G4PAIxSection( G4int materialIndex,           // for proton loss table
    7979                         G4double maxEnergyTransfer,
    8080                         G4double betaGammaSq ,
    81                          G4double** photoAbsCof, G4int intNumber         ) ;
     81                         G4double** photoAbsCof, G4int intNumber         );
    8282
    8383  G4PAIxSection( G4int materialIndex,           // test constructor
    8484                         G4double maxEnergyTransfer,
    85                          G4double betaGammaSq          ) ;
    86          
    87           // G4PAIxSection(const G4PAIxSection& right) ;
     85                         G4double betaGammaSq          );
     86         
     87          // G4PAIxSection(const G4PAIxSection& right);
    8888         
    8989          // Destructor
    9090         
    91           ~G4PAIxSection() ;
     91          ~G4PAIxSection();
    9292         
    9393          // Operators
    94           // G4PAIxSection& operator=(const G4PAIxSection& right) ;
    95           // G4int operator==(const G4PAIxSection& right)const ;
    96           // G4int operator!=(const G4PAIxSection& right)const ;
     94          // G4PAIxSection& operator=(const G4PAIxSection& right);
     95          // G4int operator==(const G4PAIxSection& right)const;
     96          // G4int operator!=(const G4PAIxSection& right)const;
    9797         
    9898          // Methods
     
    100100          // General control functions
    101101         
    102           void InitPAI() ;
    103 
    104           void NormShift( G4double betaGammaSq ) ;
    105 
    106           void SplainPAI( G4double betaGammaSq ) ;
     102          void InitPAI();
     103
     104          void NormShift( G4double betaGammaSq );
     105
     106          void SplainPAI( G4double betaGammaSq );
    107107                 
    108108          // Physical methods
     
    111111          G4double RutherfordIntegral( G4int intervalNumber,
    112112                                       G4double limitLow,
    113                                        G4double limitHigh     ) ;
     113                                       G4double limitHigh     );
    114114
    115115          G4double ImPartDielectricConst( G4int intervalNumber,
    116                                           G4double energy        ) ;
    117 
    118           G4double RePartDielectricConst(G4double energy) ;
     116                                          G4double energy        );
     117
     118          G4double GetPhotonRange( G4double energy );
     119          G4double GetElectronRange( G4double energy );
     120
     121          G4double RePartDielectricConst(G4double energy);
    119122
    120123          G4double DifPAIxSection( G4int intervalNumber,
    121                                    G4double betaGammaSq    ) ;
     124                                   G4double betaGammaSq    );
    122125
    123126          G4double PAIdNdxCerenkov( G4int intervalNumber,
    124                                    G4double betaGammaSq    ) ;
     127                                   G4double betaGammaSq    );
     128          G4double PAIdNdxMM( G4int intervalNumber,
     129                                   G4double betaGammaSq    );
    125130
    126131          G4double PAIdNdxPlasmon( G4int intervalNumber,
    127                                    G4double betaGammaSq    ) ;
    128 
    129           void     IntegralPAIxSection() ;
    130           void     IntegralCerenkov() ;
    131           void     IntegralPlasmon() ;
    132 
    133           G4double SumOverInterval(G4int intervalNumber) ;
    134           G4double SumOverIntervaldEdx(G4int intervalNumber) ;
    135           G4double SumOverInterCerenkov(G4int intervalNumber) ;
    136           G4double SumOverInterPlasmon(G4int intervalNumber) ;
     132                                   G4double betaGammaSq    );
     133
     134          G4double PAIdNdxResonance( G4int intervalNumber,
     135                                   G4double betaGammaSq    );
     136
     137          void     IntegralPAIxSection();
     138          void     IntegralCerenkov();
     139          void     IntegralMM();
     140          void     IntegralPlasmon();
     141          void     IntegralResonance();
     142
     143          G4double SumOverInterval(G4int intervalNumber);
     144          G4double SumOverIntervaldEdx(G4int intervalNumber);
     145          G4double SumOverInterCerenkov(G4int intervalNumber);
     146          G4double SumOverInterMM(G4int intervalNumber);
     147          G4double SumOverInterPlasmon(G4int intervalNumber);
     148          G4double SumOverInterResonance(G4int intervalNumber);
    137149
    138150          G4double SumOverBorder( G4int intervalNumber,
    139                                   G4double energy          ) ;
     151                                  G4double energy          );
    140152          G4double SumOverBorderdEdx( G4int intervalNumber,
    141                                   G4double energy          ) ;
     153                                  G4double energy          );
    142154          G4double SumOverBordCerenkov( G4int intervalNumber,
    143                                         G4double energy          ) ;
     155                                        G4double energy          );
     156          G4double SumOverBordMM( G4int intervalNumber,
     157                                        G4double energy          );
    144158          G4double SumOverBordPlasmon( G4int intervalNumber,
    145                                        G4double energy          ) ;
    146 
    147           G4double GetStepEnergyLoss( G4double step ) ;
    148           G4double GetStepCerenkovLoss( G4double step ) ;
    149           G4double GetStepPlasmonLoss( G4double step ) ;
     159                                       G4double energy          );
     160          G4double SumOverBordResonance( G4int intervalNumber,
     161                                       G4double energy          );
     162
     163          G4double GetStepEnergyLoss( G4double step );
     164          G4double GetStepCerenkovLoss( G4double step );
     165          G4double GetStepMMLoss( G4double step );
     166          G4double GetStepPlasmonLoss( G4double step );
     167          G4double GetStepResonanceLoss( G4double step );
     168         
     169          G4double GetEnergyTransfer();
     170          G4double GetCerenkovEnergyTransfer();
     171          G4double GetMMEnergyTransfer();
     172          G4double GetPlasmonEnergyTransfer();
     173          G4double GetResonanceEnergyTransfer();
     174          G4double GetRutherfordEnergyTransfer();
    150175         
    151176          // Inline access functions
    152177
    153           G4int GetNumberOfGammas() const { return fNumberOfGammas ; }
    154          
    155           G4int GetSplineSize() const { return fSplineNumber ; }
    156          
    157           G4int GetIntervalNumber() const { return fIntervalNumber ; }
    158 
    159           G4double GetEnergyInterval(G4int i){ return fEnergyInterval[i] ; }
    160 
    161           G4double GetDifPAIxSection(G4int i){ return fDifPAIxSection[i] ; }
    162           G4double GetPAIdNdxCrenkov(G4int i){ return fdNdxCerenkov[i] ; }
    163           G4double GetPAIdNdxPlasmon(G4int i){ return fdNdxPlasmon[i] ; }
    164          
    165           G4double GetMeanEnergyLoss() const {return fIntegralPAIxSection[0] ; }
    166           G4double GetMeanCerenkovLoss() const {return fIntegralCerenkov[0] ; }
    167           G4double GetMeanPlasmonLoss() const {return fIntegralPlasmon[0] ; }
    168 
    169           G4double GetNormalizationCof() const { return fNormalizationCof ; }
     178          G4int GetNumberOfGammas() const { return fNumberOfGammas; }
     179         
     180          G4int GetSplineSize() const { return fSplineNumber; }
     181         
     182          G4int GetIntervalNumber() const { return fIntervalNumber; }
     183
     184          G4double GetEnergyInterval(G4int i){ return fEnergyInterval[i]; }
     185
     186          G4double GetDifPAIxSection(G4int i){ return fDifPAIxSection[i]; }
     187          G4double GetPAIdNdxCerenkov(G4int i){ return fdNdxCerenkov[i]; }
     188          G4double GetPAIdNdxMM(G4int i){ return fdNdxMM[i]; }
     189          G4double GetPAIdNdxPlasmon(G4int i){ return fdNdxPlasmon[i]; }
     190          G4double GetPAIdNdxResonance(G4int i){ return fdNdxResonance[i]; }
     191         
     192          G4double GetMeanEnergyLoss() const {return fIntegralPAIxSection[0]; }
     193          G4double GetMeanCerenkovLoss() const {return fIntegralCerenkov[0]; }
     194          G4double GetMeanMMLoss() const {return fIntegralMM[0]; }
     195          G4double GetMeanPlasmonLoss() const {return fIntegralPlasmon[0]; }
     196          G4double GetMeanResonanceLoss() const {return fIntegralResonance[0]; }
     197
     198          G4double GetNormalizationCof() const { return fNormalizationCof; }
    170199         
    171           inline G4double GetPAItable(G4int i,G4int j) const ;
    172 
    173           inline G4double    GetLorentzFactor(G4int i) const ;
     200          inline G4double GetPAItable(G4int i,G4int j) const;
     201
     202          inline G4double GetLorentzFactor(G4int i) const;
    174203                 
    175           inline G4double GetSplineEnergy(G4int i) const ;
    176          
    177           inline G4double GetIntegralPAIxSection(G4int i) const ;
    178           inline G4double GetIntegralPAIdEdx(G4int i) const ;
    179           inline G4double GetIntegralCerenkov(G4int i) const ;
    180           inline G4double GetIntegralPlasmon(G4int i) const ;
     204          inline G4double GetSplineEnergy(G4int i) const;
     205         
     206          inline G4double GetIntegralPAIxSection(G4int i) const;
     207          inline G4double GetIntegralPAIdEdx(G4int i) const;
     208          inline G4double GetIntegralCerenkov(G4int i) const;
     209          inline G4double GetIntegralMM(G4int i) const;
     210          inline G4double GetIntegralPlasmon(G4int i) const;
     211          inline G4double GetIntegralResonance(G4int i) const;
    181212
    182213protected :
     
    186217// Local class constants
    187218 
    188 static const G4double fDelta ; // energy shift from interval border = 0.001
    189 static const G4double fError ; // error in lin-log approximation = 0.005
    190 
    191 static       G4int fNumberOfGammas ;         // = 111 ;
    192 static const G4double fLorentzFactor[112] ;  //  static gamma array
     219static const G4double fDelta; // energy shift from interval border = 0.001
     220static const G4double fError; // error in lin-log approximation = 0.005
     221
     222static       G4int fNumberOfGammas;         // = 111;
     223static const G4double fLorentzFactor[112];  //  static gamma array
    193224
    194225static
    195 const G4int fRefGammaNumber  ; // The number of gamma for creation of spline (15)
    196 
    197 G4int    fIntervalNumber  ;    //  The number of energy intervals
    198 G4double fNormalizationCof ;   // Normalization cof for PhotoAbsorptionXsection
    199 
    200 // G4double fBetaGammaSq ;        // (beta*gamma)^2
    201 
    202 G4double fDensity ;            // Current density
    203 G4double fElectronDensity ;    // Current electron (number) density
    204 G4int    fSplineNumber ;       // Current size of spline
     226const G4int fRefGammaNumber ; // The number of gamma for creation of spline (15)
     227
     228G4int    fIntervalNumber ;    //  The number of energy intervals
     229G4double fNormalizationCof;   // Normalization cof for PhotoAbsorptionXsection
     230
     231// G4double fBetaGammaSq;        // (beta*gamma)^2
     232
     233  G4int fMaterialIndex;  // current material index
     234  G4double fDensity;            // Current density
     235  G4double fElectronDensity;    // Current electron (number) density
     236  G4int    fSplineNumber;       // Current size of spline
    205237
    206238// Arrays of Sandia coefficients
     
    209241  G4SandiaTable*  fSandia;
    210242
    211 G4double* fEnergyInterval ;
    212 G4double* fA1 ;
    213 G4double* fA2 ;
    214 G4double* fA3 ;
    215 G4double* fA4 ;
     243G4double* fEnergyInterval;
     244G4double* fA1;
     245G4double* fA2;
     246G4double* fA3;
     247G4double* fA4;
    216248
    217249static
    218 const G4int   fMaxSplineSize  ;          // Max size of output splain arrays = 500
     250const G4int   fMaxSplineSize ;          // Max size of output splain arrays = 500
    219251
    220252/* ******************
    221 G4double*          fSplineEnergy ;   // energy points of splain
    222 G4double* fRePartDielectricConst ;   // Real part of dielectric const
    223 G4double* fImPartDielectricConst ;   // Imaginary part of dielectric const
    224 G4double*          fIntegralTerm ;   // Integral term in PAI cross section
    225 G4double*        fDifPAIxSection ;   // Differential PAI cross section
    226 G4double*   fIntegralPAIxSection ;   // Integral PAI cross section  ?
     253G4double*          fSplineEnergy;   // energy points of splain
     254G4double* fRePartDielectricConst;   // Real part of dielectric const
     255G4double* fImPartDielectricConst;   // Imaginary part of dielectric const
     256G4double*          fIntegralTerm;   // Integral term in PAI cross section
     257G4double*        fDifPAIxSection;   // Differential PAI cross section
     258G4double*   fIntegralPAIxSection;   // Integral PAI cross section  ?
    227259*/ ///////////////
    228260
    229261
    230 G4double          fSplineEnergy[500] ;   // energy points of splain
    231 G4double fRePartDielectricConst[500] ;   // Real part of dielectric const
    232 G4double fImPartDielectricConst[500] ;   // Imaginary part of dielectric const
    233 G4double          fIntegralTerm[500] ;   // Integral term in PAI cross section
    234 G4double        fDifPAIxSection[500] ;   // Differential PAI cross section
    235 G4double          fdNdxCerenkov[500] ;   // dNdx of Cerenkov collisions
    236 G4double          fdNdxPlasmon[500] ;   // dNdx of Plasmon collisions
    237 
    238 G4double   fIntegralPAIxSection[500] ;   // Integral PAI cross section  ?
    239 G4double   fIntegralPAIdEdx[500] ;   // Integral PAI dEdx  ?
    240 G4double   fIntegralCerenkov[500] ;   // Integral Cerenkov N>omega  ?
    241 G4double   fIntegralPlasmon[500] ;   // Integral Plasmon N>omega  ?
    242 
    243 G4double fPAItable[500][112] ; // Output array
    244 
    245 } ;   
     262G4double          fSplineEnergy[500];   // energy points of splain
     263G4double fRePartDielectricConst[500];   // Real part of dielectric const
     264G4double fImPartDielectricConst[500];   // Imaginary part of dielectric const
     265G4double          fIntegralTerm[500];   // Integral term in PAI cross section
     266G4double        fDifPAIxSection[500];   // Differential PAI cross section
     267G4double          fdNdxCerenkov[500];   // dNdx of Cerenkov collisions
     268G4double          fdNdxMM[500];   // dNdx of MM-Cerenkov collisions
     269G4double          fdNdxPlasmon[500];   // dNdx of Plasmon collisions
     270G4double          fdNdxResonance[500];   // dNdx of resonance collisions
     271
     272G4double   fIntegralPAIxSection[500];   // Integral PAI cross section  ?
     273G4double   fIntegralPAIdEdx[500];   // Integral PAI dEdx  ?
     274G4double   fIntegralCerenkov[500];   // Integral Cerenkov N>omega  ?
     275G4double   fIntegralMM[500];   // Integral MM-Cerenkov N>omega  ?
     276G4double   fIntegralPlasmon[500];   // Integral Plasmon N>omega  ?
     277G4double   fIntegralResonance[500];   // Integral resonance N>omega  ?
     278
     279G4double fPAItable[500][112]; // Output array
     280
     281};   
    246282
    247283////////////////  Inline methods //////////////////////////////////
     
    251287inline G4double G4PAIxSection::GetPAItable(G4int i, G4int j) const
    252288{
    253    return fPAItable[i][j] ;
     289   return fPAItable[i][j];
    254290}
    255291
    256292inline G4double G4PAIxSection::GetLorentzFactor(G4int j) const
    257293{
    258    return fLorentzFactor[j] ;
     294   return fLorentzFactor[j];
    259295}
    260296
     
    265301      G4Exception("Invalid argument in G4PAIxSection::GetSplineEnergy");
    266302   }
    267    return fSplineEnergy[i] ;
     303   return fSplineEnergy[i];
    268304}
    269305         
     
    274310    G4Exception("Invalid argument in G4PAIxSection::GetIntegralPAIxSection");
    275311   }
    276    return fIntegralPAIxSection[i] ;
     312   return fIntegralPAIxSection[i];
    277313}
    278314
     
    283319    G4Exception("Invalid argument in G4PAIxSection::GetIntegralPAIxSection");
    284320   }
    285    return fIntegralPAIdEdx[i] ;
     321   return fIntegralPAIdEdx[i];
    286322}
    287323
     
    292328    G4Exception("Invalid argument in G4PAIxSection::GetIntegralCerenkov");
    293329   }
    294    return fIntegralCerenkov[i] ;
     330   return fIntegralCerenkov[i];
     331}
     332
     333inline G4double G4PAIxSection::GetIntegralMM(G4int i) const
     334{
     335   if(i < 1 || i > fSplineNumber)
     336   {
     337    G4Exception("Invalid argument in G4PAIxSection::GetIntegralMM");
     338   }
     339   return fIntegralMM[i];
    295340}
    296341
     
    301346    G4Exception("Invalid argument in G4PAIxSection::GetIntegralPlasmon");
    302347   }
    303    return fIntegralPlasmon[i] ;
     348   return fIntegralPlasmon[i];
     349}
     350
     351inline G4double G4PAIxSection::GetIntegralResonance(G4int i) const
     352{
     353   if(i < 1 || i > fSplineNumber)
     354   {
     355    G4Exception("Invalid argument in G4PAIxSection::GetIntegralResonance");
     356   }
     357   return fIntegralResonance[i];
    304358}
    305359
  • trunk/source/processes/electromagnetic/standard/include/G4PAIySection.hh

    r819 r961  
    2626//
    2727// $Id: G4PAIySection.hh,v 1.1 2007/10/01 17:45:14 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/standard/include/G4PEEffectModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PEEffectModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4PEEffectModel.hh,v 1.7 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4141//
    4242// 06.02.2006 : added ComputeMeanFreePath()  (mma)
     43// 20.02.2009 : move virtual inline to .cc, substitute
     44//              ComputeMeanFreePath() by CrossSectionPerVolume (VI)
    4345//
    4446// Class Description:
     
    7072  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7173
    72   G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
    73                                       G4double kinEnergy,
    74                                       G4double Z,
    75                                       G4double A,
    76                                       G4double, G4double);
     74  virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
     75                                              G4double kinEnergy,
     76                                              G4double Z,
     77                                              G4double A,
     78                                              G4double, G4double);
    7779                                     
    78   G4double ComputeMeanFreePath( const G4ParticleDefinition*,
    79                                       G4double kinEnergy,
    80                                 const G4Material* material,     
    81                                       G4double, G4double);
     80  virtual G4double CrossSectionPerVolume(const G4Material*,
     81                                         const G4ParticleDefinition*,
     82                                         G4double kineticEnergy,
     83                                         G4double cutEnergy,
     84                                         G4double maxEnergy);
    8285
    8386  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
     
    100103};
    101104
    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
    103 
    104 inline G4double G4PEEffectModel::ComputeCrossSectionPerAtom(
    105                                        const G4ParticleDefinition*,
    106                                              G4double energy,
    107                                              G4double Z, G4double,
    108                                              G4double, G4double)
    109 {
    110  G4double* SandiaCof = G4SandiaTable::GetSandiaCofPerAtom((G4int)Z, energy);
    111 
    112  G4double energy2 = energy*energy, energy3 = energy*energy2,
    113           energy4 = energy2*energy2;
    114 
    115  return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
    116         SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
    117 }
    118 
    119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    120 
    121 inline G4double G4PEEffectModel::ComputeMeanFreePath(
    122                                        const G4ParticleDefinition*,
    123                                              G4double energy,
    124                                        const G4Material* material,
    125                                              G4double, G4double)
    126 {
    127  G4double* SandiaCof = material->GetSandiaTable()
    128                                 ->GetSandiaCofForMaterial(energy);
    129                                
    130  G4double energy2 = energy*energy, energy3 = energy*energy2,
    131           energy4 = energy2*energy2;
    132          
    133  G4double cross = SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
    134                   SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
    135  
    136  G4double mfp = DBL_MAX;
    137  if (cross > 0.) mfp = 1./cross;
    138  return mfp;
    139 }
    140 
    141105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    142106
  • trunk/source/processes/electromagnetic/standard/include/G4PSTARStopping.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PSTARStopping.hh,v 1.4 2006/06/29 19:50:48 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4PSTARStopping.hh,v 1.5 2008/11/13 12:04:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929#ifndef G4PSTARStopping_h
     
    8585  G4double currentE, res;
    8686  G4double e[74][60], kinE[60];
    87   G4int Znum[74];
    8887};
    8988
  • trunk/source/processes/electromagnetic/standard/include/G4PhotoElectricEffect.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PhotoElectricEffect.hh,v 1.24 2007/05/23 08:47:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4PhotoElectricEffect.hh,v 1.25 2009/02/20 12:06:37 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    9191
    9292  // true for Gamma only.
    93   G4bool IsApplicable(const G4ParticleDefinition&);
     93  virtual G4bool IsApplicable(const G4ParticleDefinition&);
    9494
    9595  // Print few lines of informations about the process: validity range,
    96   void PrintInfo();
     96  virtual void PrintInfo();
    9797
    9898protected:
    9999
    100   void InitialiseProcess(const G4ParticleDefinition*);
     100  virtual void InitialiseProcess(const G4ParticleDefinition*);
    101101
    102102private:
     
    105105};
    106106
    107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    109 
    110 inline
    111 G4bool G4PhotoElectricEffect::IsApplicable(const G4ParticleDefinition& p)
    112 {
    113   return (&p == G4Gamma::Gamma());
    114 }
    115 
    116107//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    117108
  • trunk/source/processes/electromagnetic/standard/include/G4PolarizedComptonScattering.hh

    r819 r961  
    2626//
    2727// $Id: G4PolarizedComptonScattering.hh,v 1.9 2006/06/29 19:51:14 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------- G4PolarizedComptonScattering physics process ----------------------
  • trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UniversalFluctuation.hh,v 1.5 2007/04/03 11:08:36 urban Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4UniversalFluctuation.hh,v 1.8 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5959
    6060#include "G4VEmFluctuationModel.hh"
     61#include "G4ParticleDefinition.hh"
    6162
    6263class G4UniversalFluctuation : public G4VEmFluctuationModel
     
    6970  virtual ~G4UniversalFluctuation();
    7071
    71   G4double SampleFluctuations(const G4Material*,
    72                           const G4DynamicParticle*,
    73                                 G4double&,
    74                                 G4double&,
    75                                 G4double&);
     72  virtual G4double SampleFluctuations(const G4Material*,
     73                                      const G4DynamicParticle*,
     74                                      G4double&,
     75                                      G4double&,
     76                                      G4double&);
    7677
    77   G4double Dispersion(    const G4Material*,
    78                           const G4DynamicParticle*,
    79                                 G4double&,
    80                                 G4double&);
     78  virtual G4double Dispersion(    const G4Material*,
     79                                  const G4DynamicParticle*,
     80                                  G4double&,
     81                                  G4double&);
    8182
    82   void InitialiseMe(const G4ParticleDefinition*);
     83  // Initialisation before the run
     84  virtual void InitialiseMe(const G4ParticleDefinition*);
    8385
    84 protected:
     86  // Initialisation prestep
     87  virtual void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
    8588
    8689private:
  • trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UrbanMscModel.hh,v 1.31 2007/10/29 08:42:43 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4UrbanMscModel.hh,v 1.33 2008/03/10 10:39:21 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    9191//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    9292
    93 #include "G4VEmModel.hh"
     93#include "G4VMscModel.hh"
    9494#include "G4PhysicsTable.hh"
    9595#include "G4MscStepLimitType.hh"
     
    101101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    102102
    103 class G4UrbanMscModel : public G4VEmModel
     103class G4UrbanMscModel : public G4VMscModel
    104104{
    105105
    106106public:
    107107
    108   G4UrbanMscModel(G4double facrange, G4double dtrl, G4double lambdalimit,
    109                   G4double facgeom,G4double skin,
    110                   G4bool samplez, G4MscStepLimitType stepAlg,
    111                   const G4String& nam = "UrbanMscUni");
     108  G4UrbanMscModel(const G4String& nam = "UrbanMscUni");
    112109
    113110  virtual ~G4UrbanMscModel();
    114111
    115   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    116 
     112  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
     113                                         
    117114  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
    118115                                      G4double KineticEnergy,
     
    142139                         G4double KineticEnergy);
    143140
    144   void SetStepLimitType(G4MscStepLimitType);
    145 
    146   void SetLateralDisplasmentFlag(G4bool val);
    147 
    148   void SetRangeFactor(G4double);
    149 
    150   void SetGeomFactor(G4double);
    151 
    152   void SetSkin(G4double);
    153 
    154141private:
    155142
     
    160147  G4double LatCorrelation();
    161148
    162   G4double GetLambda(G4double kinEnergy);
    163 
    164149  void GeomLimit(const G4Track& track);
    165150
    166   void SetParticle(const G4ParticleDefinition* p);
     151  inline G4double GetLambda(G4double kinEnergy);
     152
     153  inline void SetParticle(const G4ParticleDefinition*);
    167154
    168155  //  hide assignment operator
     
    178165  G4LossTableManager*         theManager;
    179166
    180 
    181167  G4double mass;
    182168  G4double charge;
     
    188174  G4double taulim;
    189175  G4double currentTau;
    190   G4double dtrl;
    191 
    192   G4double lambdalimit;
    193   G4double facrange;
    194176  G4double frscaling1,frscaling2;
    195177  G4double tlimit;
     
    201183  G4double geommin;
    202184  G4double geomlimit;
    203   G4double facgeom;
    204   G4double skin;
    205185  G4double skindepth;
    206186  G4double smallstep;
    207187
    208188  G4double presafety;
    209   G4double facsafety;
    210189
    211190  G4double lambda0;
     
    213192  G4double tPathLength;
    214193  G4double zPathLength;
    215   G4double par1,par2,par3 ;
    216 
    217   G4double stepmin ;
     194  G4double par1,par2,par3;
     195
     196  G4double stepmin;
    218197
    219198  G4double currentKinEnergy;
     
    225204  G4int    currentMaterialIndex;
    226205
    227   G4MscStepLimitType steppingAlgorithm;
    228 
    229   G4bool   samplez;
    230   G4bool   latDisplasment;
    231206  G4bool   isInitialized;
    232 
    233207  G4bool   inside;
    234208  G4bool   insideskin;
    235209
    236210};
    237 
    238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    240 
    241 inline
    242 void G4UrbanMscModel::SetLateralDisplasmentFlag(G4bool val)
    243 {
    244   latDisplasment = val;
    245 }
    246 
    247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    248 
    249 inline
    250 void G4UrbanMscModel::SetSkin(G4double val)
    251 {
    252   skin = val;
    253   stepmin       = tlimitminfix;
    254   skindepth     = skin*stepmin;
    255 }
    256 
    257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    258 
    259 inline
    260 void G4UrbanMscModel::SetRangeFactor(G4double val)
    261 {
    262   facrange = val;
    263 }
    264 
    265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    266 
    267 inline
    268 void G4UrbanMscModel::SetGeomFactor(G4double val)
    269 {
    270   facgeom = val;
    271 }
    272 
    273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    274 
    275 inline
    276 void G4UrbanMscModel::SetStepLimitType(G4MscStepLimitType val)
    277 {
    278   steppingAlgorithm = val;
    279 }
    280211
    281212//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel90.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UrbanMscModel90.hh,v 1.1 2007/12/07 17:35:52 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4UrbanMscModel90.hh,v 1.4 2008/10/29 14:15:30 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5656
    57 #include "G4VEmModel.hh"
     57#include "G4VMscModel.hh"
    5858#include "G4PhysicsTable.hh"
    5959#include "G4MscStepLimitType.hh"
     
    6565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6666
    67 class G4UrbanMscModel90 : public G4VEmModel
     67class G4UrbanMscModel90 : public G4VMscModel
    6868{
    6969
    7070public:
    7171
    72   G4UrbanMscModel90(G4double facrange, G4double dtrl, G4double lambdalimit,
    73                   G4double facgeom,G4double skin,
    74                   G4bool samplez, G4MscStepLimitType stepAlg,
    75                   const G4String& nam = "UrbanMscUni");
     72  G4UrbanMscModel90(const G4String& nam = "UrbanMscUni90");
    7673
    7774  virtual ~G4UrbanMscModel90();
    7875
    79   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
     76  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    8077
    8178  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
     
    106103                         G4double KineticEnergy);
    107104
    108   void SetStepLimitType(G4MscStepLimitType);
    109 
    110   void SetLateralDisplasmentFlag(G4bool val);
    111 
    112   void SetRangeFactor(G4double);
    113 
    114   void SetGeomFactor(G4double);
    115 
    116   void SetSkin(G4double);
    117 
    118105private:
    119106
     
    124111  G4double LatCorrelation();
    125112
    126   G4double GetLambda(G4double kinEnergy);
    127 
    128113  void GeomLimit(const G4Track& track);
    129114
    130   void SetParticle(const G4ParticleDefinition* p);
     115  inline G4double GetLambda(G4double kinEnergy);
     116
     117  inline void SetParticle(const G4ParticleDefinition*);
    131118
    132119  //  hide assignment operator
     
    142129  G4LossTableManager*         theManager;
    143130
    144 
    145131  G4double mass;
    146132  G4double charge;
     
    152138  G4double taulim;
    153139  G4double currentTau;
    154   G4double dtrl;
    155 
    156   G4double lambdalimit;
    157   G4double facrange;
    158140  G4double frscaling1,frscaling2;
    159141  G4double tlimit;
     
    165147  G4double geommin;
    166148  G4double geomlimit;
    167   G4double facgeom;
    168   G4double skin;
    169149  G4double skindepth;
    170150  G4double smallstep;
    171151
    172152  G4double presafety;
    173   G4double facsafety;
    174153
    175154  G4double lambda0;
     
    177156  G4double tPathLength;
    178157  G4double zPathLength;
    179   G4double par1,par2,par3 ;
    180 
    181   G4double stepmin ;
     158  G4double par1,par2,par3;
     159
     160  G4double stepmin;
    182161
    183162  G4double currentKinEnergy;
     
    189168  G4int    currentMaterialIndex;
    190169
    191   G4MscStepLimitType steppingAlgorithm;
    192 
    193   G4bool   samplez;
    194   G4bool   latDisplasment;
    195170  G4bool   isInitialized;
    196 
    197171  G4bool   inside;
    198172  G4bool   insideskin;
    199173
    200174};
    201 
    202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    204 
    205 inline
    206 void G4UrbanMscModel90::SetLateralDisplasmentFlag(G4bool val)
    207 {
    208   latDisplasment = val;
    209 }
    210 
    211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    212 
    213 inline
    214 void G4UrbanMscModel90::SetSkin(G4double val)
    215 {
    216   skin = val;
    217   stepmin       = tlimitminfix;
    218   skindepth     = skin*stepmin;
    219 }
    220 
    221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    222 
    223 inline
    224 void G4UrbanMscModel90::SetRangeFactor(G4double val)
    225 {
    226   facrange = val;
    227 }
    228 
    229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    230 
    231 inline
    232 void G4UrbanMscModel90::SetGeomFactor(G4double val)
    233 {
    234   facgeom = val;
    235 }
    236 
    237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    238 
    239 inline
    240 void G4UrbanMscModel90::SetStepLimitType(G4MscStepLimitType val)
    241 {
    242   steppingAlgorithm = val;
    243 }
    244175
    245176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/include/G4WaterStopping.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4WaterStopping.hh,v 1.2 2006/06/29 19:51:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4WaterStopping.hh,v 1.6 2008/09/09 09:30:58 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929#ifndef G4WaterStopping_h
     
    6060public:
    6161
    62   G4WaterStopping(G4EmCorrections* corr = 0);
     62  G4WaterStopping(G4EmCorrections* corr = 0, G4bool splineFlag = true);
    6363
    6464  ~G4WaterStopping();
     
    7070  void Initialise(G4EmCorrections*);
    7171
     72  void AddData(G4double* energy, G4double* stoppower, G4double factor);
     73
    7274  // hide assignment operator
    7375  G4WaterStopping & operator=(const  G4WaterStopping &right);
    7476  G4WaterStopping(const  G4WaterStopping&);
    7577
    76   G4int    Z[8];
    77   G4int    A[8];
     78  G4bool   spline;
     79  G4int    Z[16];
     80  G4double A[16];
    7881  std::vector<G4LPhysicsFreeVector*>  dedx;
    7982};
  • trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlung.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eBremsstrahlung.hh,v 1.36 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eBremsstrahlung.hh,v 1.37 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8989  virtual ~G4eBremsstrahlung();
    9090
    91   G4bool IsApplicable(const G4ParticleDefinition& p);
     91  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    9292
    9393  // Print out of the class parameters
     
    111111
    112112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    114 
    115 inline G4bool G4eBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
    116 {
    117   return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
    118 }
    119 
    120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    121113
    122114#endif
  • trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eBremsstrahlungModel.hh,v 1.22 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eBremsstrahlungModel.hh,v 1.26 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6969
    7070  G4eBremsstrahlungModel(const G4ParticleDefinition* p = 0,
    71                          const G4String& nam = "StandBrem");
     71                         const G4String& nam = "eBrem");
    7272
    7373  virtual ~G4eBremsstrahlungModel();
     
    7575  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
    7676
    77   G4double MinEnergyCut(const G4ParticleDefinition*,
    78                         const G4MaterialCutsCouple*);
     77  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     78                                const G4MaterialCutsCouple*);
    7979
    8080  virtual G4double ComputeDEDXPerVolume(const G4Material*,
     
    101101                                 G4double maxEnergy);
    102102
    103   inline void SetLPMflag(G4bool val);
    104   inline G4bool LPMflag() const;
    105 
    106   inline void SetEnergyThreshold(G4double val);
    107   inline G4double EnergyThreshold() const;
    108 
    109103protected:
    110 
    111   inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    112                                      G4double kineticEnergy);
    113104
    114105  const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple);
     
    154145  G4double MigdalConstant;
    155146  G4double LPMconstant;
    156   G4double highEnergyTh;
    157   G4bool   theLPMflag;
    158147  G4bool   isInitialised;
    159148
     
    199188//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    200189
    201 inline
    202 G4double G4eBremsstrahlungModel::MaxSecondaryEnergy(
    203                                  const G4ParticleDefinition*,
    204                                        G4double kineticEnergy)
    205 {
    206   return kineticEnergy;
    207 }
    208 
    209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    210 
    211 inline
    212 void G4eBremsstrahlungModel::SetLPMflag(G4bool val)
    213 {
    214   theLPMflag = val;
    215 }
    216 
    217 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    218 
    219 inline
    220 G4bool G4eBremsstrahlungModel::LPMflag() const
    221 {
    222   return theLPMflag;
    223 }
    224 
    225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    226 
    227 inline
    228 void G4eBremsstrahlungModel::SetEnergyThreshold(G4double val)
    229 {
    230   highEnergyTh = val;
    231 }
    232 
    233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    234 
    235 inline
    236 G4double G4eBremsstrahlungModel::EnergyThreshold() const
    237 {
    238   return highEnergyTh;
    239 }
    240 
    241 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    242 
    243190#endif
  • trunk/source/processes/electromagnetic/standard/include/G4eCoulombScatteringModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eCoulombScatteringModel.hh,v 1.20 2007/10/24 10:42:05 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eCoulombScatteringModel.hh,v 1.36 2008/08/04 08:49:09 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4545//                       make some members protected
    4646// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
     47// 09.06.08 V.Ivanchenko add SelectIsotope and sampling of the recoil ion
    4748//
    4849// Class Description:
     
    7576public:
    7677
    77   G4eCoulombScatteringModel(G4double thetaMin = 0.0, G4double thetaMax = pi,
    78                            G4bool build = false, G4double tlim = TeV*TeV,
    79                            const G4String& nam = "eCoulombScattering");
     78  G4eCoulombScatteringModel(const G4String& nam = "eCoulombScattering");
    8079 
    8180  virtual ~G4eCoulombScatteringModel();
     
    9796                                 G4double maxEnergy);
    9897
     98  inline void SetRecoilThreshold(G4double eth);
     99
    99100protected:
    100101
    101   G4double ComputeElectronXSectionPerAtom(
    102                                  const G4ParticleDefinition*,
    103                                  G4double kinEnergy,
    104                                  G4double Z,
    105                                  G4double A,
    106                                  G4double cut);
    107 
    108   virtual G4double CalculateCrossSectionPerAtom(
    109                                  const G4ParticleDefinition*,
    110                                  G4double kinEnergy,
    111                                  G4double Z, G4double A);
     102  G4double CrossSectionPerAtom();
     103
     104  G4double SampleCosineTheta();
     105
     106  inline void DefineMaterial(const G4MaterialCutsCouple*);
    112107
    113108  inline void SetupParticle(const G4ParticleDefinition*);
    114109
    115   inline void SetupKinematic(G4double kinEnergy);
     110  inline void SetupKinematic(G4double kinEnergy, G4double cut);
    116111 
    117   inline void SetupTarget(G4double Z, G4double A, G4double kinEnergy);
     112  inline void SetupTarget(G4double Z, G4double kinEnergy);
    118113
    119114private:
     115
     116  void ComputeMaxElectronScattering(G4double cut);
    120117
    121118  // hide assignment operator
     
    124121
    125122protected:
    126 
     123 
    127124  const G4ParticleDefinition* theProton;
    128125  const G4ParticleDefinition* theElectron;
    129126  const G4ParticleDefinition* thePositron;
    130127
     128  G4ParticleTable*          theParticleTable;
    131129  G4ParticleChangeForGamma* fParticleChange;
    132130  G4NistManager*            fNistManager;
     131  const G4DataVector*       currentCuts;
     132
     133  const G4MaterialCutsCouple* currentCouple;
     134  const G4Material*           currentMaterial;
     135  const G4Element*            currentElement;
     136  G4int                       currentMaterialIndex;
    133137
    134138  G4double                  coeff;
     
    136140  G4double                  cosThetaMin;
    137141  G4double                  cosThetaMax;
     142  G4double                  cosTetMinNuc;
    138143  G4double                  cosTetMaxNuc;
     144  G4double                  cosTetMaxNuc2;
    139145  G4double                  cosTetMaxElec;
     146  G4double                  cosTetMaxElec2;
    140147  G4double                  q2Limit;
     148  G4double                  recoilThreshold;
    141149  G4double                  elecXSection;
    142150  G4double                  nucXSection;
     
    152160  G4double                  mom2;
    153161  G4double                  invbeta2;
     162  G4double                  etag;
     163  G4double                  lowEnergyLimit;
    154164
    155165  // target
    156166  G4double                  targetZ;
    157   G4double                  targetA;
    158167  G4double                  screenZ;
    159168  G4double                  formfactA;
     169  G4int                     idxelm;
    160170
    161171private:
    162172
    163   G4PhysicsTable*           theCrossSectionTable;
    164 
    165173  G4double                  a0;
    166   G4double                  lowKEnergy;
    167   G4double                  highKEnergy;
    168174  G4double                  alpha2;
    169175  G4double                  faclim;
    170 
    171   G4int                     nbins;
    172   G4int                     nmax;
    173   G4int                     index[100];
    174 
    175   G4bool                    buildTable;             
     176  G4double                  FF[100];
     177
    176178  G4bool                    isInitialised;             
    177179};
     180
     181//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     182
     183inline
     184void G4eCoulombScatteringModel::DefineMaterial(const G4MaterialCutsCouple* cup)
     185{
     186  if(cup != currentCouple) {
     187    currentCouple = cup;
     188    currentMaterial = cup->GetMaterial();
     189    currentMaterialIndex = currentCouple->GetIndex();
     190  }
     191}
    178192
    179193//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    190204    chargeSquare = q*q;
    191205    tkin = 0.0;
     206    lowEnergyLimit = keV*mass/electron_mass_c2;
    192207  }
    193208}
     
    195210//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    196211
    197 inline void G4eCoulombScatteringModel::SetupKinematic(G4double ekin)
    198 {
    199   if(ekin != tkin) {
    200     tkin  = ekin;
    201     mom2  = tkin*(tkin + 2.0*mass);
     212inline void G4eCoulombScatteringModel::SetupKinematic(G4double ekin,
     213                                                      G4double cut)
     214{
     215  if(ekin != tkin || ecut != cut) {
     216    tkin = ekin;
     217    mom2 = tkin*(tkin + 2.0*mass);
    202218    invbeta2 = 1.0 +  mass*mass/mom2;
    203   }
     219    cosTetMinNuc = cosThetaMin;
     220    cosTetMaxNuc = cosThetaMax;
     221    if(ekin <= 10.*cut && mass < MeV && cosThetaMin < 1.0) {
     222      cosTetMinNuc = ekin*(cosThetaMin + 1.0)/(10.*cut) - 1.0;
     223    }
     224    ComputeMaxElectronScattering(cut);
     225  }
    204226}
    205227
    206228//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    207229 
    208 inline void G4eCoulombScatteringModel::SetupTarget(G4double Z, G4double A,
    209                                                    G4double e)
    210 {
    211   if(e != tkin || Z != targetZ || A != targetA) {
     230inline void G4eCoulombScatteringModel::SetupTarget(G4double Z, G4double e)
     231{
     232  if(Z != targetZ || e != etag) {
     233    etag    = e;
    212234    targetZ = Z;
    213     targetA = A;
    214     SetupKinematic(e);
    215     cosTetMaxNuc = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
    216     G4double x = fNistManager->GetZ13(Z);
    217     screenZ = a0*x*x*(1.13 + 3.76*invbeta2*Z*Z*chargeSquare*alpha2)/mom2;
    218     if(particle == theProton && A < 1.5 && cosTetMaxNuc < 0.0)
    219       cosTetMaxNuc = 0.0;
     235    G4int iz= G4int(Z);
     236    if(iz > 99) iz = 99;
     237    G4double x = fNistManager->GetZ13(iz);
     238    screenZ = a0*x*x/mom2;
     239    if(iz > 1) screenZ *=(1.13 + 3.76*invbeta2*Z*Z*chargeSquare*alpha2);
     240    //screenZ = a0*x*x*(1.13 + 3.76*Z*Z*chargeSquare*alpha2)/mom2;
    220241    // A.V. Butkevich et al., NIM A 488 (2002) 282
    221     x =  fNistManager->GetLOGA(A);
    222     formfactA = mom2*constn*std::exp(0.54*x);
     242    formfactA = FF[iz];
     243    if(formfactA == 0.0) {
     244      x = fNistManager->GetA27(iz);
     245      formfactA = constn*x*x;
     246      FF[iz] = formfactA;
     247    }
     248    formfactA *= mom2;
     249    cosTetMaxNuc2 = cosTetMaxNuc;
     250    if(particle == theProton && 1 == iz && cosTetMaxNuc2 < 0.0) {
     251      cosTetMaxNuc2 = 0.0;
     252    }
     253    /*
     254    G4double ee = 10.*eV*Z;
     255    if(1 == iz) ee *= 2.0;
     256    G4double z = std::min(cosTetMaxElec, 1.0 - std::max(ecut,ee)*amu_c2
     257                          *fNistManager->GetAtomicMassAmu(iz)/mom2);
     258    cosTetMaxElec2 = std::max(cosTetMaxNuc2, z);
     259    */
     260    cosTetMaxElec2 = cosTetMaxElec;
    223261  }
    224262}
     
    226264//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    227265
     266inline void G4eCoulombScatteringModel::SetRecoilThreshold(G4double eth)
     267{
     268  recoilThreshold = eth;
     269}
     270
     271//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     272
    228273#endif
  • trunk/source/processes/electromagnetic/standard/include/G4eIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eIonisation.hh,v 1.35 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eIonisation.hh,v 1.36 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8888  virtual ~G4eIonisation();
    8989
    90   G4bool IsApplicable(const G4ParticleDefinition& p);
     90  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    9191
    9292  // Print out of the class parameters
     
    9898                                           const G4ParticleDefinition*);
    9999
    100   G4double MinPrimaryEnergy(const G4ParticleDefinition*,
    101                             const G4Material*, G4double cut);
     100  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
     101                                    const G4Material*, G4double cut);
    102102
    103103private:
     
    114114};
    115115
    116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    118 
    119 inline G4double G4eIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
    120                                                 const G4Material*,
    121                                                 G4double cut)
    122 {
    123   G4double x = cut;
    124   if(isElectron) x += cut;
    125   return x;
    126 }
    127 
    128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    129 
    130 inline G4bool G4eIonisation::IsApplicable(const G4ParticleDefinition& p)
    131 {
    132   return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
    133 }
    134 
    135116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    136117
  • trunk/source/processes/electromagnetic/standard/include/G4eeToTwoGammaModel.hh

    r819 r961  
    2525//
    2626// $Id: G4eeToTwoGammaModel.hh,v 1.14 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/include/G4eplusAnnihilation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eplusAnnihilation.hh,v 1.23 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eplusAnnihilation.hh,v 1.24 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7373  virtual ~G4eplusAnnihilation();
    7474
    75   G4bool IsApplicable(const G4ParticleDefinition& p);
     75  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    7676
    7777  virtual G4VParticleChange* AtRestDoIt(
     
    7979                             const G4Step& stepData);
    8080
    81   G4double AtRestGetPhysicalInteractionLength(
     81  virtual G4double AtRestGetPhysicalInteractionLength(
    8282                             const G4Track& track,
    8383                             G4ForceCondition* condition
     
    9696};
    9797
    98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    100 
    101 inline G4bool G4eplusAnnihilation::IsApplicable(const G4ParticleDefinition& p)
    102 {
    103   return (&p == G4Positron::Positron());
    104 }
    105 
    106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    107 
    108 inline
    109 G4double G4eplusAnnihilation::AtRestGetPhysicalInteractionLength(
    110                               const G4Track&, G4ForceCondition* condition)
    111 {
    112   *condition = NotForced;
    113   return 0.0;
    114 }
    115 
    11698//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    11799
  • trunk/source/processes/electromagnetic/standard/include/G4hIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hIonisation.hh,v 1.38 2008/01/14 11:59:45 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4hIonisation.hh,v 1.42 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6363// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
    6464// 11-04-04 Move MaxSecondaryEnergy to models (V.Ivanchenko)
     65// 12-09-08 Removed CorrectionsAlongStep (VI)
    6566//
    6667// Class Description:
     
    8081#include "G4Positron.hh"
    8182#include "globals.hh"
    82 #include "G4VEmModel.hh"
    83 #include "G4EmCorrections.hh"
    8483
    8584class G4Material;
     
    9493  virtual ~G4hIonisation();
    9594
    96   G4bool IsApplicable(const G4ParticleDefinition& p);
     95  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    9796
    98   G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    99                             const G4Material*, G4double cut);
     97  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     98                                    const G4Material*, G4double cut);
    10099
    101100  // Print out of the class parameters
     
    105104
    106105protected:
    107 
    108   void CorrectionsAlongStep(
    109                            const G4MaterialCutsCouple*,
    110                            const G4DynamicParticle*,
    111                                  G4double& eloss,
    112                                  G4double& length);
    113106
    114107  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
     
    121114  G4hIonisation(const G4hIonisation&);
    122115
     116  G4bool     isInitialised;
     117  G4bool     nuclearStopping;
     118
    123119  G4double   mass;
    124120  G4double   ratio;
    125 
    126   const G4ParticleDefinition* theParticle;
    127   const G4ParticleDefinition* theBaseParticle;
    128   G4EmCorrections*            corr;
    129 
    130   G4bool                      isInitialised;
    131   G4bool                      nuclearStopping;
    132 
    133   G4double                    eth;
    134   G4double                    ethnuc;
    135   G4double                    massratio;
    136 
     121  G4double   eth;
    137122};
    138 
    139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    141 
    142 inline G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p)
    143 {
    144   return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV &&
    145          !p.IsShortLived());
    146 }
    147 
    148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    149 
    150 inline G4double G4hIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
    151                                                 const G4Material*,
    152                                                 G4double cut)
    153 {
    154   G4double x = 0.5*cut/electron_mass_c2;
    155   G4double y = electron_mass_c2/mass;
    156   G4double g = x*y + std::sqrt((1. + x)*(1. + x*y*y));
    157   return mass*(g - 1.0);
    158 }
    159123
    160124//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/standard/include/G4hMultipleScattering.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hMultipleScattering.hh,v 1.4 2007/12/07 17:35:52 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4hMultipleScattering.hh,v 1.6 2008/05/09 08:23:44 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    6060//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6161
    62 class G4UrbanMscModel90;
     62class G4VMscModel;
    6363
    6464class G4hMultipleScattering : public G4VMultipleScattering
     
    8686  void SetLambdalimit(G4double value) { lambdalimit = value;};
    8787
     88  // The function overloads the corresponding function of the base
     89  // class.It limits the step near to boundaries only
     90  // and invokes the method GetMscContinuousStepLimit at every step.
     91  G4double AlongStepGetPhysicalInteractionLength(
     92                                            const G4Track&,
     93                                            G4double  previousStepSize,
     94                                            G4double  currentMinimalStep,
     95                                            G4double& currentSafety,
     96                                            G4GPILSelection* selection);
     97
    8898protected:
    8999
     
    93103private:        // data members
    94104
    95   G4UrbanMscModel90* mscUrban;
     105  G4VMscModel* mscUrban;
    96106
    97107  G4double lambdalimit;
     
    100110  G4bool   samplez;
    101111  G4bool   isInitialized;
     112  G4bool   isIon;
    102113
    103114};
  • trunk/source/processes/electromagnetic/standard/include/G4ionGasIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionGasIonisation.hh,v 1.2 2007/08/13 06:13:30 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionGasIonisation.hh,v 1.4 2008/09/12 16:26:34 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555#include "G4ionIonisation.hh"
    5656
    57 class G4Material;
    58 
    5957class G4ionGasIonisation : public G4ionIonisation
    6058{
     
    6563  virtual ~G4ionGasIonisation();
    6664
    67   virtual void PrintInfo();
    68 
    69 protected:
    70 
    71   // Initialise process before run
    72   virtual void InitialiseEnergyLossProcess(
    73                                    const G4ParticleDefinition*,
    74                                    const G4ParticleDefinition*);
    75 
    76   // Initialise dynamic charge before step
    77   virtual void InitialiseMassCharge(const G4Track&);
    78 
    79   // Apply correction after step and modify dynamic charge
    80   virtual void CorrectionsAlongStep(
    81                            const G4MaterialCutsCouple*,
    82                            const G4DynamicParticle*,
    83                                  G4double& eloss,
    84                                  G4double& length);
    85 
    8665private:
    87 
    88   // Sample change of charge of the projectile ion
    89   G4double SampleChargeAfterStep(G4double qeff, G4double xeff);
    9066
    9167  // hide assignment operator
    9268  G4ionGasIonisation & operator=(const G4ionGasIonisation &right);
    9369  G4ionGasIonisation(const G4ionGasIonisation&);
    94 
    95   const G4ParticleDefinition* currParticle;
    96   const G4ParticleDefinition* baseParticle;
    97 
    98   G4double                    basePartMass;
    99   G4double                    currMassRatio;
    100   G4double                    atomXS;
    101   G4double                    preStepKinEnergy;
    102 
    103   G4int                       currentIonZ;
    104   G4int                       ionZ;
    105 
    106   G4bool                      initialised;
    107 
    10870};
    10971
  • trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionIonisation.hh,v 1.50 2007/11/09 11:45:45 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionIonisation.hh,v 1.57 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5757// 22-07-06 Remove obsolete method (V.Ivantchenko)
    5858// 07-11-07 Moved CorrectionsAlongStep to cc (V.Ivantchenko)
     59// 12-09-08 Removed InitialiseMassCharge and CorrectionsAlongStep (VI)
    5960//
    6061// Class Description:
     
    7273
    7374#include "G4VEnergyLossProcess.hh"
    74 #include "G4ionEffectiveCharge.hh"
    75 #include "G4VEmModel.hh"
    76 #include "G4EmCorrections.hh"
    7775
    7876class G4Material;
    79 class G4PhysicsVector;
    80 class G4BraggIonModel;
     77class G4EmCorrections;
    8178
    8279class G4ionIonisation : public G4VEnergyLossProcess
     
    8885  virtual ~G4ionIonisation();
    8986
    90   inline G4bool IsApplicable(const G4ParticleDefinition& p);
     87  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
    9188
    9289  // Print out of the class parameters
     
    9491
    9592  void AddStoppingData(G4int Z, G4int A, const G4String& materialName,
    96                        G4PhysicsVector& dVector);
     93                       G4PhysicsVector* dVector);
    9794
    9895  void ActivateStoppingData(G4bool);
     
    105102                                           const G4ParticleDefinition*);
    106103
    107   virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
    108                                     const G4DynamicParticle*,
    109                                     G4double& eloss,
    110                                     G4double& length);
    111 
    112   inline void InitialiseMassCharge(const G4Track&);
    113 
    114   inline G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
     104  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
    115105                                   const G4Material*, G4double cut);
    116106
     
    118108
    119109  inline G4bool NuclearStoppingFlag();
    120 
    121   // protected pointers
    122   G4ionEffectiveCharge*       effCharge;
    123   G4EmCorrections*            corr;
    124110
    125111private:
     
    129115  G4ionIonisation(const G4ionIonisation&);
    130116
    131   // cash
    132   const G4Material*           curMaterial;
    133   const G4ParticleDefinition* curParticle;
     117  G4EmCorrections*            corr;
     118
    134119  const G4ParticleDefinition* theParticle;
    135   const G4ParticleDefinition* theBaseParticle;
    136120
    137   G4double                    preKinEnergy;
     121  G4double   eth;
    138122
    139   G4double                    eth;
    140   G4double                    baseMass;
    141   G4double                    massRatio;
    142   G4double                    massFactor;
    143   G4double                    charge2;
    144 
    145   G4bool                      isInitialised;
    146   G4bool                      stopDataActive;
    147   G4bool                      nuclearStopping;
     123  G4bool     isInitialised;
     124  G4bool     stopDataActive;
     125  G4bool     nuclearStopping;
    148126};
    149127
    150128//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    152 
    153 inline G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p)
    154 {
    155   return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() &&
    156           p.GetParticleType() == "nucleus");
    157 }
    158 
    159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    160 
    161 inline G4double G4ionIonisation::MinPrimaryEnergy(
    162           const G4ParticleDefinition*, const G4Material*, G4double cut)
    163 {
    164   G4double x = 0.5*cut/electron_mass_c2;
    165   G4double g = std::sqrt(1. + x);
    166   return proton_mass_c2*(g - 1.0);
    167 }
    168 
    169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    170 
    171 inline void G4ionIonisation::InitialiseMassCharge(const G4Track& track)
    172 {
    173   preKinEnergy = track.GetKineticEnergy();
    174   massRatio    = baseMass/track.GetDynamicParticle()->GetMass();
    175   charge2      = effCharge->EffectiveChargeSquareRatio(track.GetDefinition(),
    176                                                        track.GetMaterial(),
    177                                                        preKinEnergy);
    178   SetDynamicMassCharge(massRatio, charge2);
    179 }
    180 
    181129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    182130
  • trunk/source/processes/electromagnetic/standard/src/G4ASTARStopping.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ASTARStopping.cc,v 1.6 2006/06/29 19:52:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4ASTARStopping.cc,v 1.8 2008/11/24 18:28:09 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929//---------------------------------------------------------------------------
     
    5353G4ASTARStopping::G4ASTARStopping()
    5454{
     55  currentE = 0.0;
    5556  currentMaterial = 0;
    5657  index = 0;
     
    7273  for (G4int i=0; i<74; i++){
    7374    if (matName == name[i]){
    74       matIndex= -1;
     75      matIndex = i;
    7576      currentMaterial = mat;
    7677      return i;
     
    102103      return res;
    103104    } else if (energy >= kinE[77]) {
    104       index = 58;
     105      index = 76;
    105106      res = e[matIndex][77];
    106107      return res;
     
    134135 for(i=0; i<74; i++) {effZ[i]=Z[i];}
    135136 
    136 name [0] = "G4_A-150_TISSUE";
    137 Znum [0] = 0;
    138  
     137name [0] = "G4_A-150_TISSUE"; 
    139138G4double T0[78] = { 0.001, 0.0015, 0.002, 0.0025, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01, 0.0125, 0.015, 0.0175, 0.02, 0.0225, 0.025, 0.0275, 0.03, 0.035, 0.04, 0.045, 0.05, 0.055, 0.06, 0.065, 0.07, 0.075, 0.08, 0.085, 0.09, 0.095, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10 };
    140139 
     
    145144 
    146145name [1] = "G4_ACETYLENE";
    147 Znum [1] = 0;
    148  
    149146G4double e1[78] = { 192.2, 229.4, 260.2, 287, 311, 353.1, 389.7, 422.5, 452.4, 480.1, 506, 530.3, 585.9, 635.7, 681.2, 723.2, 762.5, 799.4, 834.3, 867.5, 929.6, 986.9, 1040, 1090, 1137, 1182, 1224, 1265, 1304, 1341, 1376, 1411, 1444, 1475, 1619, 1741, 1847, 1938, 2017, 2085, 2144, 2195, 2275, 2331, 2367, 2388, 2397, 2395, 2386, 2370, 2350, 2326, 2299, 2271, 2241, 2210, 2056, 1913, 1783, 1666, 1562, 1468, 1384, 1308, 1177, 1072, 986.8, 915.5, 855, 802.8, 757.2, 717.1, 681.4, 649.5, 620.7, 594.7, 570.9, 549.2 };
    150147 
     
    152149 
    153150name [2] = "G4_ADIPOSE_TISSUE_ICRP";
    154 Znum [2] = 0;
    155  
    156151G4double e2[78] = { 169.4, 204.2, 233.3, 258.8, 281.8, 322.4, 358.1, 390.2, 419.7, 447.2, 472.9, 497.2, 552.9, 603.2, 649.4, 692.4, 732.7, 770.7, 806.8, 841.3, 906, 966.1, 1022, 1075, 1125, 1173, 1219, 1262, 1304, 1344, 1383, 1420, 1456, 1491, 1650, 1787, 1907, 2012, 2104, 2185, 2256, 2317, 2417, 2489, 2539, 2571, 2588, 2592, 2587, 2573, 2554, 2529, 2500, 2468, 2434, 2398, 2213, 2035, 1874, 1731, 1605, 1499, 1408, 1328, 1197, 1091, 1004, 932.2, 870.7, 817.8, 771.5, 730.8, 694.5, 662.1, 632.9, 606.4, 582.3, 560.2 };
    157152 
     
    159154 
    160155name [3] = "G4_Ag";
    161 Znum [3] = 47;
    162  
    163156G4double e3[78] = { 31.26, 38.13, 43.91, 48.98, 53.56, 61.66, 68.79, 75.21, 81.11, 86.6, 91.74, 96.6, 107.7, 117.8, 127, 135.6, 143.6, 151.2, 158.4, 165.3, 178.2, 190.2, 201.4, 212, 222, 231.6, 240.7, 249.5, 257.9, 266, 273.9, 281.4, 288.8, 295.9, 328.8, 357.8, 383.8, 407.4, 428.8, 448.4, 466.3, 482.8, 511.8, 536.2, 556.6, 573.5, 587.3, 598.4, 607.2, 613.8, 618.5, 621.6, 623.4, 623.8, 623.3, 621.8, 604.4, 578.7, 550.8, 523.3, 497.6, 474.4, 453.6, 435, 402.7, 375.9, 353.2, 333.6, 316.9, 302, 288.8, 276.9, 266.2, 256.5, 247.7, 239.5, 232, 225.1 };
    164157 
     
    166159 
    167160name [4] = "G4_AIR";
    168 Znum [4] = 0;
    169  
    170161G4double e4[78] = { 87.5, 108.6, 126.7, 142.7, 157.3, 183.5, 206.7, 227.9, 247.5, 265.9, 283.2, 299.6, 337.7, 372.3, 404.3, 434.3, 462.6, 489.4, 515, 539.5, 585.8, 629, 669.6, 708.1, 744.8, 779.8, 813.4, 845.7, 876.8, 906.8, 935.9, 964, 991.3, 1018, 1140, 1247, 1343, 1429, 1506, 1575, 1637, 1693, 1787, 1861, 1918, 1961, 1990, 2008, 2017, 2019, 2013, 2002, 1987, 1968, 1946, 1922, 1774, 1625, 1494, 1382, 1287, 1205, 1133, 1072, 968.6, 885.9, 818, 760.7, 711.7, 669.6, 632.7, 600.2, 571.2, 545.3, 521.9, 500.6, 481.2, 463.4 };
    171162 
     
    173164 
    174165name [5] = "G4_Al";
    175 Znum [5] = 13;
    176  
    177166G4double e5[78] = { 55.8, 71.89, 86.05, 98.92, 110.9, 132.7, 152.5, 170.9, 188.2, 204.5, 220.1, 235.1, 270.1, 302.5, 332.8, 361.5, 388.6, 414.6, 439.4, 463.3, 508.4, 550.4, 589.6, 626.5, 661.1, 693.7, 724.3, 753.2, 780.3, 805.9, 830.1, 852.8, 874.3, 894.5, 980, 1045, 1096, 1136, 1168, 1195, 1216, 1234, 1262, 1280, 1291, 1297, 1298, 1297, 1293, 1286, 1279, 1269, 1259, 1248, 1237, 1225, 1161, 1098, 1039, 984.9, 937.6, 895.4, 856.8, 821, 756.1, 698.6, 647.8, 604.8, 567.8, 535.7, 507.4, 482.4, 460, 439.8, 421.6, 405.1, 389.9, 376 };
    178167 
     
    180169 
    181170name [6] = "G4_ALUMINUM_OXIDE";
    182 Znum [6] = 0;
    183  
    184171G4double e6[78] = { 71.39, 88.59, 103.3, 116.4, 128.4, 149.9, 169, 186.5, 202.8, 218, 232.3, 246, 277.7, 306.6, 333.4, 358.5, 382.1, 404.6, 426, 446.5, 485, 520.9, 554.3, 585.8, 615.5, 643.5, 670, 695.2, 719.1, 741.9, 763.6, 784.3, 804, 822.9, 905.9, 974, 1031, 1080, 1122, 1159, 1191, 1220, 1267, 1304, 1332, 1353, 1368, 1378, 1383, 1385, 1384, 1381, 1376, 1370, 1362, 1352, 1308, 1253, 1187, 1115, 1044, 982.5, 928.4, 880, 801.2, 737, 683.4, 638.1, 599.1, 565.2, 535.4, 508.9, 485.3, 464, 444.8, 427.3, 411.4, 396.7 };
    185172 
     
    187174 
    188175name [7] = "G4_Ar";
    189 Znum [7] = 40;
    190  
    191176G4double e7[78] = { 34.54, 44.56, 53.39, 61.42, 68.88, 82.53, 94.95, 106.5, 117.3, 127.6, 137.4, 146.8, 168.8, 189.3, 208.5, 226.7, 244.1, 260.8, 276.8, 292.3, 321.9, 349.8, 376.5, 401.9, 426.4, 450, 472.8, 494.9, 516.3, 537.1, 557.3, 577, 596.1, 614.8, 702.1, 780.3, 850.8, 914.4, 971.9, 1024, 1070, 1111, 1181, 1233, 1272, 1298, 1314, 1321, 1321, 1315, 1305, 1291, 1276, 1258, 1240, 1222, 1130, 1047, 974, 911.2, 856.7, 809, 767, 729.8, 666.1, 613.2, 569.7, 532.7, 501, 473.4, 449.1, 427.4, 408.3, 391, 375.4, 361.1, 348.1, 336 };
    192177 
     
    194179 
    195180name [8] = "G4_Au";
    196 Znum [8] = 79;
    197  
    198181G4double e8[78] = { 11.5, 14.55, 17.2, 19.57, 21.76, 25.72, 29.27, 32.54, 35.59, 38.46, 41.18, 43.78, 49.83, 55.39, 60.56, 65.44, 70.06, 74.46, 78.68, 82.74, 90.45, 97.69, 104.5, 111.1, 117.3, 123.3, 129.1, 134.6, 140, 145.2, 150.3, 155.2, 160, 164.7, 186.4, 205.8, 223.5, 239.5, 254.2, 267.7, 280.1, 291.5, 311.6, 328.5, 342.6, 354.3, 363.8, 371.5, 377.5, 382.1, 385.5, 387.8, 389.1, 389.6, 389.4, 388.7, 384.4, 375.7, 362.6, 346.8, 330.5, 316.4, 304, 293, 274.1, 258.4, 245, 233.4, 223.1, 214, 205.8, 198.4, 191.6, 185.5, 179.7, 174.5, 169.6, 165 };
    199182 
     
    201184 
    202185name [9] = "G4_B-100_BONE";
    203 Znum [9] = 0;
    204  
    205186G4double e9[78] = { 138.6, 167.7, 192, 213.3, 232.4, 266.3, 296, 322.7, 347.2, 369.9, 391.2, 411.3, 457.3, 498.8, 536.8, 572, 605, 636.1, 665.7, 693.8, 746.5, 795.4, 841, 883.9, 924.5, 963.1, 999.9, 1035, 1069, 1101, 1133, 1163, 1192, 1220, 1348, 1460, 1557, 1643, 1719, 1786, 1845, 1897, 1983, 2047, 2093, 2124, 2142, 2149, 2148, 2139, 2125, 2106, 2084, 2059, 2031, 2003, 1861, 1726, 1600, 1484, 1379, 1290, 1214, 1147, 1035, 945.3, 871.8, 810, 757.7, 712.5, 672.9, 638.1, 607, 579.2, 554.1, 531.3, 510.5, 491.5 };
    206187 
     
    208189 
    209190name [10] = "G4_Be";
    210 Znum [10] = 4;
    211  
    212191G4double e10[78] = { 146.3, 177.1, 202.9, 225.4, 245.6, 281.3, 312.5, 340.6, 366.2, 390, 412.2, 433.2, 481.1, 524.1, 563.3, 599.7, 633.6, 665.4, 695.6, 724.2, 777.7, 827, 872.7, 915.5, 955.7, 993.7, 1030, 1064, 1096, 1128, 1157, 1186, 1213, 1239, 1356, 1453, 1534, 1602, 1659, 1706, 1745, 1776, 1821, 1846, 1856, 1855, 1845, 1829, 1809, 1785, 1759, 1732, 1703, 1674, 1645, 1617, 1499, 1406, 1326, 1254, 1189, 1129, 1075, 1024, 935.3, 858.7, 792.9, 737.6, 690, 648.7, 612.5, 580.4, 552, 526.4, 503.3, 482.4, 463.3, 445.8 };
    213192 
     
    215194 
    216195name [11] = "G4_BONE_COMPACT_ICRU";
    217 Znum [11] = 0;
    218  
    219196G4double e11[78] = { 125.9, 152.6, 175, 194.8, 212.5, 244.1, 271.8, 296.8, 319.8, 341.1, 361.2, 380.2, 423.8, 463.1, 499.3, 533, 564.6, 594.5, 622.8, 649.9, 700.8, 748.1, 792.4, 834.2, 873.7, 911.4, 947.4, 981.9, 1015, 1047, 1078, 1107, 1136, 1164, 1291, 1401, 1498, 1584, 1660, 1727, 1787, 1839, 1926, 1991, 2039, 2072, 2092, 2103, 2105, 2100, 2089, 2075, 2056, 2035, 2011, 1986, 1846, 1705, 1576, 1460, 1358, 1271, 1196, 1130, 1020, 931.6, 859.4, 798.8, 747.4, 702.9, 664, 629.7, 599.1, 571.7, 547.1, 524.7, 504.3, 485.6 };
    220197 
     
    222199 
    223200name [12] = "G4_C";
    224 Znum [12] = 6;
    225  
    226201G4double e12[78] = { 190.6, 225.6, 254.3, 279, 300.9, 339.2, 372.1, 401.4, 427.9, 452.3, 475, 496.2, 544.3, 586.9, 625.5, 661, 693.8, 724.6, 753.5, 780.8, 831.5, 877.9, 920.8, 960.6, 998, 1033, 1066, 1098, 1128, 1156, 1184, 1210, 1235, 1259, 1366, 1455, 1531, 1595, 1650, 1698, 1738, 1772, 1825, 1862, 1886, 1900, 1906, 1906, 1901, 1892, 1880, 1866, 1850, 1833, 1814, 1795, 1684, 1571, 1466, 1372, 1288, 1213, 1145, 1085, 981.9, 898.2, 829.6, 772, 722.9, 680.4, 643.1, 610.2, 580.8, 554.4, 530.6, 509, 489.2, 471.2 };
    227202 
     
    229204 
    230205name [13] = "G4_C_Graphite";
    231 Znum [13] = 0;
    232  
    233206G4double e13[78] = { 192.3, 228.9, 259, 285.1, 308.3, 348.9, 384, 415.3, 443.7, 469.9, 494.2, 517, 568.9, 615.1, 657, 695.5, 731.3, 764.8, 796.3, 826.2, 881.8, 932.7, 979.8, 1024, 1065, 1104, 1141, 1175, 1209, 1240, 1271, 1300, 1327, 1354, 1473, 1574, 1658, 1731, 1793, 1845, 1890, 1929, 1987, 2027, 2051, 2063, 2065, 2060, 2049, 2034, 2015, 1993, 1969, 1944, 1917, 1891, 1751, 1620, 1502, 1400, 1310, 1231, 1161, 1099, 994.3, 909, 839.2, 780.7, 730.8, 687.6, 649.8, 616.4, 586.6, 559.8, 535.7, 513.8, 493.8, 475.5 };
    234207 
     
    236209 
    237210name [14] = "G4_ETHYLENE";
    238 Znum [14] = 0;
    239  
    240211G4double e14[78] = { 159.8, 195.8, 226, 252.7, 276.8, 319.7, 357.4, 391.5, 422.9, 452.1, 479.5, 505.4, 565.1, 619, 668.6, 714.8, 758.1, 799.1, 838.1, 875.3, 945.4, 1011, 1072, 1130, 1185, 1237, 1288, 1336, 1383, 1428, 1471, 1514, 1555, 1594, 1779, 1945, 2094, 2230, 2354, 2468, 2571, 2666, 2830, 2961, 3060, 3130, 3172, 3189, 3185, 3164, 3129, 3086, 3038, 2986, 2931, 2876, 2578, 2306, 2084, 1907, 1763, 1642, 1539, 1450, 1303, 1185, 1089, 1010, 941.9, 883.6, 832.8, 788.1, 748.4, 712.9, 680.9, 652, 625.7, 601.7 };
    241212 
     
    243214 
    244215name [15] = "G4_C-552";
    245 Znum [15] = 0;
    246  
    247216G4double e15[78] = { 124.1, 148.8, 169.3, 187.2, 203.3, 231.5, 256.1, 278.2, 298.4, 317.1, 334.5, 351, 388.6, 422.4, 453.2, 481.8, 508.4, 533.5, 557.3, 579.9, 622.2, 661.3, 697.8, 732, 764.3, 794.9, 824, 851.9, 878.5, 904.1, 928.7, 952.4, 975.2, 997.3, 1097, 1184, 1259, 1325, 1384, 1435, 1481, 1521, 1588, 1639, 1678, 1706, 1726, 1738, 1744, 1745, 1743, 1736, 1727, 1716, 1703, 1688, 1603, 1511, 1421, 1338, 1261, 1190, 1126, 1067, 965.5, 883.8, 816.4, 759.6, 711.1, 669.1, 632.3, 599.9, 571, 545, 521.6, 500.3, 480.9, 463.1 };
    248217 
     
    250219 
    251220name [16] = "G4_CARBON_DIOXIDE";
    252 Znum [16] = 0;
    253  
    254221G4double e16[78] = { 93.28, 114.2, 131.9, 147.5, 161.6, 186.6, 208.6, 228.5, 246.8, 263.8, 279.8, 295, 329.8, 361.2, 390.2, 417.1, 442.4, 466.4, 489.1, 510.8, 551.8, 589.8, 625.6, 659.4, 691.5, 722.2, 751.6, 779.8, 807.1, 833.4, 858.9, 883.7, 907.7, 931.1, 1040, 1137, 1225, 1306, 1380, 1449, 1513, 1571, 1676, 1763, 1834, 1891, 1933, 1961, 1977, 1982, 1978, 1967, 1952, 1932, 1911, 1888, 1752, 1614, 1490, 1383, 1290, 1209, 1139, 1077, 973.3, 890, 821.5, 764, 714.9, 672.6, 635.5, 602.6, 573.5, 547.3, 523.7, 502.4, 482.9, 465 };
    255222 
     
    257224 
    258225name [17] = "G4_CALCIUM_FLUORIDE";
    259 Znum [17] = 0;
    260  
    261226G4double e17[78] = { 72.78, 90.74, 106.1, 119.8, 132.3, 154.7, 174.6, 192.8, 209.7, 225.5, 240.4, 254.5, 287.2, 317, 344.6, 370.4, 394.6, 417.6, 439.5, 460.5, 499.9, 536.5, 570.8, 603.1, 633.6, 662.6, 690.1, 716.4, 741.5, 765.6, 788.6, 810.8, 832.1, 852.6, 944.4, 1022, 1088, 1145, 1194, 1237, 1275, 1308, 1361, 1401, 1431, 1453, 1467, 1476, 1481, 1481, 1479, 1474, 1466, 1458, 1447, 1436, 1352, 1256, 1166, 1086, 1016, 954.4, 900.2, 852.3, 772.1, 708.1, 655.5, 610.7, 573.3, 540.6, 511.9, 486.6, 464, 443.8, 425.4, 408.7, 393.4, 379.4 };
    262227 
     
    264229 
    265230name [18] = "G4_CERIC_SULFATE";
    266 Znum [18] = 0;
    267  
    268231G4double e18[78] = { 99.73, 123.7, 144.1, 162.3, 178.8, 208.3, 234.6, 258.5, 280.5, 301.2, 320.6, 339.1, 381.8, 420.6, 456.5, 490, 521.6, 551.5, 580.1, 607.4, 658.9, 707, 752.2, 795, 835.7, 874.6, 911.8, 947.6, 982, 1015, 1047, 1078, 1109, 1138, 1273, 1391, 1497, 1591, 1676, 1753, 1822, 1884, 1990, 2074, 2140, 2190, 2227, 2251, 2266, 2273, 2272, 2266, 2254, 2238, 2220, 2198, 2049, 1886, 1737, 1607, 1495, 1399, 1315, 1242, 1120, 1023, 942.8, 875.6, 818.4, 769.2, 726.1, 688, 654.2, 624, 596.7, 572, 549.5, 528.9 };
    269232 
     
    271234 
    272235name [19] = "G4_CELLULOSE_NITRATE";
    273 Znum [19] = 0;
    274  
    275236G4double e19[78] = { 157.6, 186.4, 209.9, 230.3, 248.3, 279.7, 306.8, 330.8, 352.6, 372.6, 391.2, 408.7, 448.1, 483.2, 514.9, 544.1, 571.1, 596.4, 620.3, 642.8, 684.8, 723.2, 758.8, 792, 823.2, 852.7, 880.6, 907.2, 932.6, 956.9, 980.2, 1003, 1024, 1045, 1139, 1220, 1290, 1353, 1408, 1457, 1502, 1541, 1608, 1662, 1704, 1736, 1761, 1778, 1789, 1796, 1798, 1796, 1790, 1782, 1772, 1760, 1674, 1574, 1476, 1385, 1302, 1227, 1160, 1099, 993.8, 909.3, 839.7, 781.1, 731.2, 688.1, 650.2, 616.7, 587, 560.3, 536.2, 514.4, 494.5, 476.2 };
    276237 
     
    278239 
    279240name [20] = "G4_BONE_CORTICAL_ICRP";
    280 Znum [20] = 0;
    281  
    282241G4double e20[78] = { 109.1, 132.8, 152.8, 170.4, 186.2, 214.4, 239.3, 261.7, 282.4, 301.6, 319.7, 336.8, 376.1, 411.7, 444.5, 475, 503.6, 530.7, 556.5, 581.1, 627.4, 670.4, 710.8, 748.9, 785, 819.4, 852.4, 883.9, 914.3, 943.5, 971.7, 999, 1025, 1051, 1168, 1270, 1360, 1440, 1511, 1574, 1630, 1680, 1763, 1826, 1872, 1905, 1927, 1939, 1943, 1941, 1933, 1921, 1905, 1887, 1866, 1844, 1720, 1593, 1475, 1369, 1274, 1193, 1123, 1062, 959.2, 877.1, 809.7, 753, 704.9, 663.4, 627, 594.9, 566.3, 540.6, 517.5, 496.5, 477.4, 459.8 };
    283242 
     
    285244 
    286245name [21] = "G4_CESIUM_IODIDE";
    287 Znum [21] = 0;
    288  
    289246G4double e21[78] = { 40.6, 48.54, 55.16, 60.95, 66.15, 75.33, 83.38, 90.64, 97.29, 103.5, 109.3, 114.8, 127.3, 138.7, 149.2, 158.9, 168, 176.7, 184.9, 192.8, 207.6, 221.3, 234.2, 246.4, 258, 269.1, 279.7, 289.9, 299.7, 309.2, 318.3, 327.1, 335.7, 344, 382.3, 415.8, 445.6, 472.1, 495.7, 516.7, 535.4, 551.8, 578.9, 599.2, 613.8, 623.8, 629.9, 633, 633.6, 632.3, 629.5, 625.5, 620.6, 615.1, 609.1, 602.8, 567.7, 533, 501.8, 474.4, 450.3, 429, 410.1, 393.3, 364.6, 340.9, 321, 304, 289.2, 275.9, 264.1, 253.6, 243.9, 235, 226.7, 218.9, 211.9, 205.4 };
    290247 
     
    292249 
    293250name [22] = "G4_Cu";
    294 Znum [22] = 29;
    295  
    296251G4double e22[78] = { 29.51, 36.49, 42.42, 47.68, 52.45, 60.98, 68.54, 75.4, 81.74, 87.65, 93.23, 98.51, 110.7, 121.8, 132, 141.5, 150.5, 159, 167.2, 174.9, 189.5, 203.2, 216, 228.1, 239.7, 250.7, 261.3, 271.4, 281.2, 290.7, 299.8, 308.7, 317.3, 325.6, 364.2, 398.4, 429.1, 456.8, 482.1, 505.1, 526.2, 545.4, 579, 607, 630.1, 649.1, 664.4, 676.6, 686.2, 693.4, 698.8, 702.4, 704.6, 705.7, 705.7, 704.9, 692.5, 672.6, 650.3, 627.6, 606, 585.6, 566.3, 548, 514, 483.4, 455.8, 431, 408.4, 388, 369.6, 353.7, 339.1, 325.7, 313.4, 302, 291.7, 282.3 };
    297252 
     
    299254 
    300255name [23] = "G4_Fe";
    301 Znum [23] = 26;
    302  
    303256G4double e23[78] = { 54.06, 65.42, 74.91, 83.2, 90.66, 103.8, 115.3, 125.6, 135.1, 143.8, 152, 159.8, 177.4, 193.3, 207.8, 221.3, 233.9, 245.7, 256.9, 267.6, 287.7, 306.2, 323.5, 339.8, 355.2, 369.8, 383.8, 397.1, 410, 422.3, 434.2, 445.7, 456.9, 467.6, 517.1, 560.6, 599.4, 634.3, 665.9, 694.6, 720.8, 744.8, 786.6, 821.5, 850.4, 874.1, 893.1, 908.1, 919.6, 928, 933.6, 936.8, 938, 937.3, 935.1, 931.5, 899.9, 856.7, 810.9, 766.9, 727.3, 691.9, 660.2, 631.5, 581.8, 540.1, 504.6, 473.9, 447.2, 423.6, 402.6, 383.5, 366.9, 352, 338.3, 325.7, 314.1, 303.6 };
    304257 
     
    306259 
    307260name [24] = "G4_FERROUS_SULFATE";
    308 Znum [24] = 0;
    309  
    310261G4double e24[78] = { 99.58, 123.5, 144, 162.1, 178.6, 208.1, 234.3, 258.2, 280.2, 300.8, 320.3, 338.7, 381.4, 420.2, 456, 489.5, 521, 551, 579.5, 606.8, 658.3, 706.3, 751.5, 794.2, 834.9, 873.7, 910.9, 946.6, 981, 1014, 1046, 1077, 1108, 1137, 1271, 1390, 1495, 1590, 1675, 1751, 1820, 1882, 1988, 2072, 2138, 2188, 2225, 2250, 2265, 2271, 2271, 2264, 2253, 2237, 2218, 2197, 2048, 1886, 1738, 1609, 1497, 1401, 1317, 1244, 1122, 1025, 944.6, 877.4, 820, 770.7, 727.5, 689.3, 655.4, 625.2, 597.8, 573.1, 550.5, 529.9 };
    311262 
     
    313264 
    314265name [25] = "G4_Gd";
    315 Znum [25] = 64;
    316  
    317266G4double e25[78] = { 38.11, 45.4, 51.41, 56.61, 61.25, 69.34, 76.36, 82.61, 88.29, 93.53, 98.41, 103, 113.4, 122.7, 131.1, 138.9, 146.1, 152.9, 159.3, 165.4, 176.7, 187.1, 196.8, 205.9, 214.4, 222.5, 230.3, 237.6, 244.7, 251.5, 258, 264.3, 270.3, 276.2, 303.1, 326.6, 347.4, 366.2, 383.1, 398.5, 412.5, 425.4, 447.8, 466.5, 482.1, 494.8, 505.1, 513.2, 519.4, 523.9, 526.9, 528.6, 529.1, 528.6, 527.3, 525.2, 505.6, 481, 456.8, 434.6, 414.6, 396.6, 380.5, 366, 340.9, 319.7, 301.6, 285.8, 272, 259.8, 248.8, 239, 230.1, 222, 214.6, 207.7, 201.4, 195.6 };
    318267 
     
    320269 
    321270name [26] = "G4_Ge";
    322 Znum [26] = 32;
    323  
    324271G4double e26[78] = { 47.65, 57.57, 65.83, 73.05, 79.53, 90.94, 100.9, 109.9, 118, 125.6, 132.7, 139.4, 154.6, 168.3, 180.8, 192.3, 203.1, 213.3, 222.9, 232, 249.1, 264.8, 279.5, 293.2, 306.1, 318.4, 330, 341.1, 351.7, 361.8, 371.5, 380.8, 389.8, 398.4, 437.2, 469.9, 497.8, 521.7, 542.3, 560.1, 575.5, 588.9, 610.7, 627.4, 640.1, 649.9, 657.3, 662.8, 666.8, 669.6, 671.4, 672.3, 672.4, 671.9, 670.9, 669.4, 656.9, 639.5, 619.8, 599.4, 578.4, 557.6, 537.5, 518.5, 483.6, 452.9, 425.8, 401.8, 380.5, 361.5, 344.3, 328.6, 315.1, 303.1, 292.1, 282, 272.6, 263.8 };
    325272 
     
    327274 
    328275name [27] = "G4_Pyrex_Glass";
    329 Znum [27] = 0;
    330    
    331276G4double e27[78] = { 83.85, 102.1, 117.5, 131, 143.3, 165, 184.1, 201.3, 217.2, 232, 245.9, 259, 289.2, 316.5, 341.5, 364.8, 386.7, 407.4, 427.1, 445.8, 481.1, 513.8, 544.4, 573.2, 600.6, 626.6, 651.5, 675.3, 698.1, 720.1, 741.3, 761.7, 781.5, 800.6, 888, 963.9, 1031, 1090, 1142, 1189, 1231, 1268, 1330, 1378, 1414, 1441, 1460, 1473, 1481, 1485, 1484, 1481, 1475, 1466, 1456, 1445, 1389, 1323, 1249, 1171, 1095, 1029, 971.4, 920.7, 835.9, 768, 711.5, 663.8, 622.8, 587.4, 556.1, 528.4, 503.7, 481.5, 461.4, 443.2, 426.5, 411.2 };
    332277 
     
    334279 
    335280name [28] = "G4_H";
    336 Znum [28] = 1;
    337  
    338281G4double e28[78] = { 212, 275.4, 331.7, 383, 430.9, 518.8, 599.2, 674, 744.5, 811.5, 875.6, 937.1, 1082, 1217, 1344, 1465, 1580, 1691, 1798, 1901, 2098, 2285, 2463, 2634, 2798, 2956, 3108, 3256, 3399, 3538, 3674, 3805, 3933, 4058, 4637, 5152, 5610, 6019, 6383, 6705, 6988, 7235, 7632, 7915, 8100, 8203, 8240, 8222, 8161, 8067, 7947, 7808, 7655, 7494, 7327, 7157, 6345, 5647, 5068, 4588, 4188, 3860, 3585, 3351, 2971, 2675, 2438, 2242, 2078, 1939, 1818, 1713, 1620, 1538, 1464, 1398, 1337, 1283 };
    339282 
     
    341284 
    342285name [29] = "G4_HELIUM";
    343 Znum [29] = 2;
    344  
    345286G4double e29[78] = { 87.26, 110.8, 131.3, 149.8, 166.8, 197.7, 225.5, 251.1, 275, 297.5, 318.9, 339.4, 387, 430.9, 471.8, 510.4, 547, 581.9, 615.3, 647.5, 708.7, 766.1, 820.5, 872.3, 921.8, 969.3, 1015, 1059, 1102, 1143, 1183, 1221, 1259, 1296, 1465, 1614, 1748, 1867, 1975, 2071, 2156, 2233, 2361, 2460, 2535, 2588, 2624, 2644, 2652, 2650, 2639, 2621, 2598, 2571, 2540, 2507, 2323, 2139, 1976, 1832, 1706, 1593, 1493, 1402, 1249, 1130, 1033, 953.8, 886.8, 829.5, 779.8, 736.4, 697.9, 663.7, 632.9, 605.2, 580, 557 };
    346287 
     
    348289 
    349290name [30] = "G4_KAPTON";
    350 Znum [30] = 0;
    351  
    352291G4double e30[78] = { 165.5, 197.6, 224.2, 247.2, 267.8, 304, 335.4, 363.5, 389.1, 412.8, 434.8, 455.6, 502.9, 545.2, 583.8, 619.4, 652.6, 683.8, 713.3, 741.2, 793.5, 841.6, 886.3, 928.2, 967.7, 1005, 1041, 1074, 1107, 1138, 1167, 1196, 1223, 1250, 1369, 1471, 1560, 1636, 1703, 1762, 1812, 1857, 1928, 1981, 2018, 2042, 2056, 2062, 2061, 2054, 2043, 2028, 2010, 1990, 1969, 1946, 1819, 1688, 1565, 1451, 1350, 1264, 1190, 1125, 1017, 929.8, 858.3, 798.2, 747, 702.8, 664, 629.8, 599.3, 571.9, 547.2, 524.8, 504.4, 485.7 };
    353292 
     
    355294 
    356295name [31] = "G4_Kr";
    357 Znum [31] = 36;
    358  
    359296G4double e31[78] = { 10.15, 13.69, 16.93, 19.96, 22.84, 28.23, 33.29, 38.08, 42.66, 47.08, 51.35, 55.5, 65.43, 74.84, 83.85, 92.52, 100.9, 109.1, 117, 124.7, 139.7, 154.1, 168, 181.5, 194.6, 207.4, 219.9, 232.1, 244, 255.7, 267.2, 278.4, 289.5, 300.3, 351.9, 399.6, 443.7, 484.4, 522.1, 556.7, 588.4, 617.2, 666.6, 705.7, 735.5, 757, 771.4, 779.9, 783.4, 783, 779.4, 773.6, 765.9, 757, 747.2, 736.9, 683.7, 635.6, 595.2, 561.5, 533, 508.6, 487.3, 468.5, 439.9, 417.9, 398.8, 381.4, 364.9, 349.2, 334.2, 319.8, 306.2, 293.7, 282.8, 272.8, 263.6, 255.2 };
    360297 
     
    362299 
    363300name [32] = "G4_LITHIUM_TETRABORATE";
    364 Znum [32] = 0;
    365  
    366301G4double e32[78] = { 132.7, 159.4, 181.6, 200.9, 218.2, 248.6, 275, 298.7, 320.4, 340.4, 359.1, 376.6, 416.8, 452.7, 485.5, 515.8, 544, 570.6, 595.8, 619.7, 664.3, 705.6, 743.9, 779.9, 813.9, 846.1, 876.8, 906.1, 934.2, 961.1, 987, 1012, 1036, 1059, 1166, 1258, 1338, 1410, 1474, 1531, 1583, 1628, 1706, 1767, 1814, 1849, 1874, 1891, 1899, 1902, 1899, 1891, 1875, 1852, 1825, 1795, 1638, 1494, 1375, 1276, 1193, 1121, 1058, 1002, 908.8, 833.2, 770.5, 717.6, 672.4, 633.2, 598.8, 568.3, 541.2, 516.9, 494.8, 474.9, 456.6, 439.9 };
    367302 
     
    369304 
    370305name [33] = "G4_LITHIUM_FLUORIDE";
    371 Znum [33] = 0;
    372  
    373306G4double e33[78] = { 118.7, 142.6, 162.5, 179.7, 195.2, 222.4, 246, 267.2, 286.5, 304.3, 321, 336.6, 372.4, 404.4, 433.5, 460.4, 485.5, 509.1, 531.4, 552.6, 592.1, 628.5, 662.4, 694.1, 724.1, 752.4, 779.4, 805.1, 829.6, 853.2, 875.9, 897.6, 918.7, 938.9, 1031, 1110, 1179, 1240, 1294, 1341, 1383, 1421, 1483, 1530, 1566, 1592, 1610, 1621, 1627, 1627, 1624, 1618, 1609, 1598, 1585, 1571, 1483, 1387, 1296, 1214, 1140, 1074, 1015, 962.2, 872, 799.7, 739.5, 688.5, 644.8, 606.9, 573.7, 544.4, 518.3, 494.9, 473.6, 454.3, 436.7, 420.6 };
    374307 
     
    376309 
    377310name [34] = "G4_M3_WAX";
    378 Znum [34] = 0;
    379  
    380311G4double e34[78] = { 173.6, 209, 238.5, 264.3, 287.6, 328.7, 364.7, 397.1, 426.9, 454.5, 480.4, 504.9, 561, 611.6, 658, 701.1, 741.6, 779.8, 816, 850.6, 915.4, 975.6, 1032, 1085, 1135, 1182, 1228, 1271, 1313, 1353, 1392, 1429, 1465, 1499, 1657, 1792, 1910, 2012, 2101, 2179, 2247, 2305, 2398, 2463, 2507, 2533, 2544, 2544, 2534, 2517, 2494, 2468, 2437, 2405, 2371, 2335, 2154, 1981, 1825, 1686, 1564, 1460, 1372, 1295, 1167, 1064, 980.4, 910.2, 850.4, 798.9, 753.8, 714.2, 678.9, 647.3, 618.8, 593, 569.4, 547.9 };
    381312 
     
    383314 
    384315name [35] = "G4_MS20_TISSUE";
    385 Znum [35] = 0;
    386  
    387316G4double e35[78] = { 163.5, 196.6, 224.1, 248.2, 269.8, 308, 341.4, 371.4, 398.9, 424.4, 448.3, 470.9, 522.5, 569, 611.6, 651.1, 688, 722.9, 756, 787.5, 846.6, 901.2, 952.3, 1000, 1046, 1089, 1130, 1169, 1207, 1243, 1278, 1311, 1344, 1375, 1516, 1638, 1744, 1836, 1916, 1986, 2048, 2101, 2185, 2247, 2288, 2314, 2327, 2330, 2325, 2312, 2295, 2273, 2249, 2222, 2193, 2163, 2002, 1845, 1703, 1575, 1463, 1368, 1286, 1215, 1097, 1001, 923.2, 857.7, 802, 753.9, 711.7, 674.6, 641.6, 611.9, 585.2, 561, 539, 518.8 };
    388317 
     
    390319 
    391320name [36] = "G4_METHANE";
    392 Znum [36] = 0;
    393  
    394321G4double e36[78] = { 197.5, 241.8, 279.3, 312.2, 342, 394.9, 441.5, 483.7, 522.4, 558.5, 592.4, 624.4, 698.1, 764.8, 826, 883.1, 936.6, 987.3, 1035, 1081, 1168, 1249, 1324, 1396, 1464, 1529, 1591, 1650, 1708, 1764, 1818, 1870, 1920, 1970, 2198, 2402, 2586, 2754, 2907, 3047, 3175, 3291, 3492, 3652, 3773, 3856, 3905, 3921, 3899, 3849, 3783, 3708, 3627, 3544, 3460, 3378, 2998, 2685, 2432, 2226, 2055, 1911, 1789, 1683, 1508, 1370, 1257, 1163, 1084, 1015, 955.9, 903.7, 857.5, 816.2, 779.1, 745.5, 714.9, 687.1 };
    395322 
     
    397324 
    398325name [37] = "G4_Mo";
    399 Znum [37] = 42;
    400  
    401326G4double e37[78] = { 58.22, 68.98, 77.79, 85.4, 92.16, 103.9, 114.1, 123.1, 131.3, 138.8, 145.8, 152.4, 167.3, 180.5, 192.5, 203.5, 213.8, 223.4, 232.4, 241, 256.9, 271.6, 285.1, 297.8, 309.8, 321.1, 331.8, 342.1, 351.9, 361.3, 370.3, 379, 387.4, 395.5, 432.4, 464.5, 492.9, 518.2, 541, 561.6, 580.4, 597.4, 626.9, 651.2, 671.2, 687.3, 700.1, 710, 717.3, 722.3, 725.4, 726.7, 726.5, 725, 722.3, 718.8, 690.9, 655, 617.8, 582.6, 552.1, 525.7, 502.3, 481.5, 445.5, 415.5, 389.9, 367.7, 348.1, 330.6, 314.8, 300.9, 288.6, 277.3, 266.9, 257.6, 249, 241.2 };
    402327 
     
    404329 
    405330name [38] = "G4_MUSCLE_WITH_SUCROSE";
    406 Znum [38] = 0;
    407  
    408331G4double e38[78] = { 111.7, 137.5, 159.4, 178.8, 196.5, 227.9, 255.7, 281, 304.4, 326.2, 346.7, 366.2, 411.2, 452, 489.7, 525, 558.1, 589.5, 619.5, 648.1, 702.2, 752.5, 799.9, 844.6, 887.2, 927.9, 966.8, 1004, 1040, 1075, 1108, 1141, 1172, 1203, 1343, 1467, 1576, 1674, 1762, 1841, 1912, 1975, 2081, 2165, 2230, 2277, 2310, 2331, 2342, 2344, 2339, 2329, 2313, 2293, 2270, 2244, 2074, 1896, 1739, 1607, 1494, 1398, 1314, 1241, 1120, 1022, 942.4, 875.3, 818.1, 768.9, 725.8, 687.7, 653.9, 623.7, 596.4, 571.7, 549.2, 528.6 };
    409332 
     
    411334 
    412335name [39] = "G4_MUSCLE_WITHOUT_SUCROSE";
    413 Znum [39] = 0;
    414  
    415336G4double e39[78] = { 108.2, 133.5, 155, 174.1, 191.4, 222.4, 249.8, 274.8, 297.8, 319.3, 339.6, 358.9, 403.3, 443.7, 481, 515.9, 548.7, 579.8, 609.5, 637.9, 691.4, 741.4, 788.3, 832.7, 875, 915.3, 953.9, 991.1, 1027, 1061, 1095, 1127, 1158, 1189, 1328, 1451, 1560, 1658, 1745, 1824, 1895, 1958, 2065, 2150, 2215, 2263, 2298, 2320, 2332, 2335, 2331, 2321, 2306, 2287, 2265, 2240, 2075, 1901, 1746, 1613, 1501, 1404, 1320, 1247, 1125, 1027, 946.2, 878.8, 821.4, 772, 728.6, 690.4, 656.4, 626.1, 598.7, 573.9, 551.3, 530.6 };
    416337 
     
    418339 
    419340name [40] = "G4_MUSCLE_SKELETAL_ICRP";
    420 Znum [40] = 0;
    421  
    422341G4double e40[78] = { 104.5, 129.2, 150.2, 168.8, 185.8, 216.1, 242.9, 267.4, 290, 311.1, 331, 349.8, 393.5, 433.1, 469.7, 503.9, 536.2, 566.7, 595.9, 623.7, 676.3, 725.4, 771.5, 815.1, 856.6, 896.2, 934.1, 970.6, 1006, 1040, 1072, 1104, 1135, 1165, 1302, 1422, 1530, 1626, 1712, 1790, 1860, 1922, 2029, 2113, 2178, 2228, 2263, 2286, 2299, 2304, 2302, 2293, 2280, 2262, 2242, 2218, 2059, 1888, 1735, 1604, 1492, 1396, 1312, 1240, 1118, 1021, 941.1, 874.1, 817, 767.9, 724.9, 686.8, 653.1, 622.9, 595.7, 571, 548.6, 528 };
    423342 
     
    425344 
    426345name [41] = "G4_MUSCLE_STRIATED_ICRU";
    427 Znum [41] = 0;
    428  
    429346G4double e41[78] = { 104.7, 129.4, 150.5, 169.2, 186.2, 216.5, 243.4, 267.9, 290.5, 311.7, 331.6, 350.5, 394.2, 433.9, 470.6, 504.9, 537.2, 567.8, 596.9, 624.9, 677.5, 726.7, 772.8, 816.5, 858.1, 897.8, 935.8, 972.3, 1007, 1041, 1074, 1106, 1137, 1167, 1304, 1425, 1532, 1629, 1715, 1793, 1863, 1925, 2032, 2116, 2181, 2230, 2265, 2289, 2302, 2306, 2304, 2295, 2282, 2264, 2244, 2220, 2063, 1894, 1742, 1611, 1498, 1401, 1318, 1244, 1123, 1025, 944.5, 877.2, 819.9, 770.6, 727.3, 689.2, 655.3, 625, 597.7, 572.9, 550.4, 529.7 };
    430347 
     
    432349 
    433350name [42] = "G4_N";
    434 Znum [42] = 7;
    435  
    436351G4double e42[78] = { 82.8, 103.7, 121.6, 137.7, 152.3, 178.7, 202.3, 223.8, 243.8, 262.5, 280.2, 297.1, 336.2, 372, 405.1, 436.2, 465.5, 493.4, 520.1, 545.7, 594.1, 639.3, 682, 722.5, 761, 797.9, 833.4, 867.4, 900.3, 932, 962.8, 992.5, 1021, 1049, 1179, 1293, 1395, 1486, 1567, 1640, 1706, 1765, 1864, 1940, 1999, 2041, 2069, 2086, 2093, 2091, 2083, 2069, 2051, 2030, 2005, 1978, 1819, 1660, 1522, 1406, 1308, 1224, 1151, 1088, 982.9, 898.5, 829.5, 771.1, 721.3, 678.5, 641, 608, 578.6, 552.3, 528.5, 506.9, 487.2, 469.1 };
    437352 
     
    439354 
    440355name [43] = "G4_SODIUM_IODIDE";
    441 Znum [43] = 0;
    442  
    443356G4double e43[78] = { 35.86, 44.19, 51.24, 57.48, 63.13, 73.21, 82.12, 90.2, 97.64, 104.6, 111.1, 117.3, 131.6, 144.5, 156.4, 167.6, 178, 187.9, 197.3, 206.3, 223.3, 239.1, 253.9, 268, 281.3, 294, 306.2, 317.9, 329.2, 340.1, 350.6, 360.8, 370.6, 380.2, 424.5, 463.5, 498.4, 529.9, 558.2, 583.8, 607, 627.8, 663.4, 691.6, 713.4, 729.6, 740.9, 748.1, 751.7, 752.4, 750.7, 747, 741.7, 735.1, 727.6, 719.5, 664.4, 611.2, 569.4, 538.3, 514, 491.6, 472.1, 454, 422.9, 393.7, 370.2, 349.6, 331.4, 315.3, 301.2, 288.5, 276.8, 266.1, 256.3, 247.1, 238.9, 231.5 };
    444357 
     
    446359 
    447360name [44] = "G4_Ne";
    448 Znum [44] = 10;
    449  
    450361G4double e44[78] = { 68.73, 83.7, 96.26, 107.3, 117.2, 134.8, 150.3, 164.2, 177, 188.8, 199.9, 210.4, 234.5, 256.2, 276.1, 294.6, 311.9, 328.3, 343.8, 358.6, 386.3, 412, 436.1, 458.8, 480.3, 500.8, 520.3, 539.1, 557.1, 574.5, 591.2, 607.5, 623.2, 638.4, 708.4, 770.3, 825.6, 875.7, 921.2, 962.8, 1001, 1036, 1098, 1150, 1194, 1230, 1260, 1285, 1304, 1319, 1330, 1338, 1343, 1344, 1344, 1341, 1296, 1229, 1160, 1095, 1035, 981.4, 932.6, 888.5, 812.1, 748.3, 695.6, 650.4, 611.3, 577, 546.8, 520, 496, 474.4, 454.8, 437, 420.7, 405.7 };
    451362 
     
    453364 
    454365name [45] = "G4_NYLON-6/6";
    455 Znum [45] = 0;
    456  
    457366G4double e45[78] = { 167.4, 201.6, 230.3, 255.4, 278, 317.9, 352.9, 384.4, 413.4, 440.3, 465.5, 489.3, 544, 593.3, 638.6, 680.6, 720.1, 757.3, 792.7, 826.4, 889.7, 948.5, 1003, 1055, 1104, 1151, 1195, 1238, 1279, 1318, 1356, 1392, 1427, 1461, 1617, 1750, 1867, 1969, 2059, 2138, 2207, 2267, 2363, 2433, 2482, 2512, 2527, 2531, 2525, 2511, 2491, 2467, 2439, 2408, 2375, 2340, 2160, 1987, 1830, 1690, 1567, 1463, 1374, 1297, 1169, 1066, 981.3, 910.8, 850.9, 799.3, 754.1, 714.4, 679, 647.4, 618.9, 593, 569.5, 547.9 };
    458367 
     
    460369 
    461370name [46] = "G4_O";
    462 Znum [46] = 8;
    463  
    464371G4double e46[78] = { 105.8, 117.3, 257.6, 1.139e-05, 5.976e-06, 0.005, 248.1, 71.83, 352, 3.186e-05, 2.012e-05, 0.015, 412.7, 40.96, 503.1, 6.782e-05, 5.098e-05, 0.035, 610.6, 24.07, 700.7, 0.0001156, 9.613e-05, 0.07, 820, 15.89, 884.2, 0.0001583, 0.0001354, 0.125, 1124, 8.719, 1280, 0.0002775, 0.0002641, 0.3, 1573, 4.478, 1697, 0.0004528, 0.000448, 0.65, 1818, 2.655, 1822, 0.0006468, 0.0006403, 1, 1667, 1.474, 1431, 0.00138, 0.001539, 2.75, 1038, 0.7076, 860.9, 0.003906, 0.004519, 6, 616.1, 0.3845, 556.8, 0.009419, 0.01034, 9.5, 452, 0.2295, 334.7, 0.03447, 0.04325, 27.5, 196.3, 0.09039, 156.5, 0.1784, 0.2149, 60 };
    465372 
     
    467374 
    468375name [47] = "G4_PARAFFIN";
    469 Znum [47] = 0;
    470  
    471376G4double e47[78] = { 193.8, 233, 265.8, 294.4, 320.3, 365.9, 405.9, 441.9, 475, 505.7, 534.5, 561.7, 624.2, 680.6, 732.3, 780.4, 825.5, 868.2, 908.6, 947.2, 1020, 1087, 1150, 1209, 1265, 1319, 1370, 1419, 1465, 1510, 1554, 1595, 1636, 1675, 1852, 2004, 2137, 2253, 2354, 2442, 2518, 2584, 2688, 2762, 2810, 2837, 2848, 2845, 2831, 2810, 2782, 2749, 2713, 2674, 2633, 2592, 2381, 2184, 2007, 1851, 1714, 1598, 1500, 1414, 1272, 1158, 1066, 988.4, 922.7, 866.1, 816.7, 773.2, 734.5, 699.9, 668.8, 640.6, 614.9, 591.4 };
    472377 
     
    474379 
    475380name [48] = "G4_Pb";
    476 Znum [48] = 82;
    477  
    478381G4double e48[78] = { 17.96, 22.18, 25.76, 28.92, 31.8, 36.93, 41.47, 45.6, 49.4, 52.95, 56.3, 59.46, 66.77, 73.41, 79.52, 85.23, 90.6, 95.69, 100.5, 105.2, 113.9, 122, 129.7, 136.9, 143.8, 150.3, 156.6, 162.7, 168.5, 174.1, 179.5, 184.8, 189.9, 194.9, 217.7, 237.9, 256, 272.3, 287, 300.4, 312.6, 323.6, 342.6, 358.2, 370.7, 380.6, 388.3, 394.2, 398.4, 401.3, 403.1, 404, 404.1, 403.5, 402.4, 401, 392.5, 380.4, 365.3, 348.6, 332, 317.6, 304.9, 293.7, 274.4, 258.3, 244.7, 232.9, 222.5, 213.2, 205, 197.5, 190.7, 184.4, 178.7, 173.4, 168.4, 163.9 };
    479382 
     
    481384 
    482385name [49] = "G4_PHOTOGRAPHIC_EMULSION";
    483 Znum [49] = 0;
    484  
    485386G4double e49[78] = { 46.69, 57.18, 66.06, 73.91, 81.04, 93.75, 105, 115.2, 124.7, 133.5, 141.8, 149.6, 167.8, 184.3, 199.6, 213.8, 227.3, 240, 252.1, 263.8, 285.7, 306.2, 325.4, 343.6, 361, 377.5, 393.4, 408.7, 423.3, 437.5, 451.2, 464.5, 477.3, 489.8, 547, 597.3, 641.7, 681.2, 716.3, 747.6, 775.5, 800.2, 841.5, 873.5, 897.8, 915.8, 928.6, 937.1, 940, 938.4, 933.8, 927, 918.6, 909.2, 899.1, 888.5, 833.7, 781.8, 735.1, 693.7, 657.1, 624.6, 595.5, 569.4, 524.5, 487.2, 455.6, 428.5, 404.9, 383.9, 365.2, 348.6, 333.8, 320.5, 308.3, 297.2, 287, 277.8 };
    486387 
     
    488389 
    489390name [50] = "G4_PLASTIC_SC_VINYLTOLUENE";
    490 Znum [50] = 0;
    491  
    492391G4double e50[78] = { 192.4, 229.8, 260.8, 287.8, 312, 354.4, 391.4, 424.6, 454.8, 482.8, 509, 533.7, 590, 640.5, 686.6, 729.3, 769.2, 806.7, 842.2, 876, 939.2, 997.5, 1052, 1103, 1151, 1197, 1240, 1281, 1321, 1359, 1395, 1430, 1464, 1497, 1644, 1769, 1878, 1971, 2053, 2123, 2184, 2236, 2319, 2377, 2414, 2436, 2445, 2443, 2433, 2417, 2396, 2371, 2343, 2314, 2283, 2251, 2091, 1936, 1791, 1657, 1537, 1435, 1349, 1273, 1148, 1047, 964.8, 895.9, 837.3, 786.7, 742.4, 703.5, 668.8, 637.7, 609.7, 584.3, 561.2, 540 };
    493392 
     
    495394 
    496395name [51] = "G4_POLYCARBONATE";
    497 Znum [51] = 0;
    498  
    499396G4double e51[78] = { 146.3, 178.1, 204.7, 228.1, 249.2, 286.4, 319.1, 348.5, 375.5, 400.6, 424.1, 446.2, 497, 542.8, 584.7, 623.5, 659.9, 694.2, 726.6, 757.6, 815.5, 869.1, 919, 965.9, 1010, 1052, 1092, 1130, 1167, 1202, 1235, 1268, 1299, 1329, 1465, 1581, 1681, 1768, 1843, 1908, 1965, 2013, 2090, 2144, 2180, 2201, 2210, 2209, 2202, 2188, 2170, 2149, 2125, 2099, 2072, 2044, 1912, 1785, 1661, 1543, 1433, 1340, 1261, 1191, 1076, 982.4, 906, 842, 787.5, 740.5, 699.2, 662.9, 630.5, 601.5, 575.3, 551.6, 529.9, 510.1 };
    500397 
     
    502399 
    503400name [52] = "G4_POLYETHYLENE";
    504 Znum [52] = 0;
    505  
    506401G4double e52[78] = { 168.2, 205.8, 237.5, 265.4, 290.7, 335.4, 374.8, 410.5, 443.2, 473.7, 502.3, 529.3, 591.4, 647.6, 699.1, 747.1, 792.1, 834.6, 874.9, 913.5, 985.9, 1053, 1116, 1175, 1232, 1285, 1336, 1385, 1432, 1478, 1521, 1564, 1604, 1644, 1825, 1983, 2122, 2246, 2355, 2453, 2539, 2615, 2740, 2833, 2899, 2940, 2962, 2967, 2958, 2938, 2908, 2871, 2829, 2782, 2732, 2681, 2418, 2183, 1987, 1826, 1691, 1577, 1480, 1396, 1257, 1145, 1053, 977.1, 912.4, 856.5, 807.8, 764.9, 726.7, 692.6, 661.8, 633.9, 608.6, 585.4 };
    507402 
     
    509404 
    510405name [53] = "G4_MYLAR";
    511 Znum [53] = 0;
    512  
    513406G4double e53[78] = { 163.2, 195.3, 221.8, 244.9, 265.6, 301.9, 333.5, 361.8, 387.6, 411.5, 433.8, 454.8, 502.7, 545.7, 584.8, 621, 654.8, 686.6, 716.7, 745.3, 798.7, 847.9, 893.8, 936.8, 977.4, 1016, 1052, 1087, 1121, 1153, 1183, 1213, 1241, 1269, 1393, 1500, 1593, 1673, 1744, 1806, 1860, 1908, 1985, 2042, 2083, 2110, 2126, 2133, 2133, 2126, 2115, 2100, 2082, 2061, 2038, 2014, 1874, 1731, 1599, 1482, 1379, 1290, 1215, 1148, 1038, 948.5, 875.3, 813.8, 761.5, 716.3, 676.6, 641.6, 610.5, 582.5, 557.3, 534.4, 513.6, 494.5 };
    514407 
     
    516409 
    517410name [54] = "G4_PLEXIGLASS";
    518 Znum [54] = 0;
    519  
    520411G4double e54[78] = { 118.7, 146.6, 170.3, 191.4, 210.4, 244.5, 274.7, 302.1, 327.3, 350.9, 373.1, 394.2, 442.7, 486.8, 527.4, 565.2, 600.9, 634.6, 666.7, 697.4, 755.1, 808.9, 859.3, 906.9, 952, 995, 1036, 1075, 1113, 1150, 1185, 1219, 1252, 1283, 1428, 1554, 1665, 1762, 1848, 1923, 1990, 2049, 2144, 2216, 2266, 2300, 2320, 2328, 2327, 2318, 2302, 2282, 2259, 2232, 2203, 2173, 2008, 1847, 1702, 1574, 1464, 1369, 1288, 1217, 1099, 1004, 925.6, 860.1, 804.4, 756.3, 714.1, 676.9, 643.8, 614.2, 587.4, 563.2, 541.1, 520.8 };
    521412 
     
    523414 
    524415name [55] = "G4_POLYPROPYLENE";
    525 Znum [55] = 0;
    526  
    527416G4double e55[78] = { 193.7, 232.8, 265.4, 293.9, 319.6, 365, 404.8, 440.6, 473.4, 503.9, 532.5, 559.6, 621.6, 677.5, 728.8, 776.5, 821.2, 863.4, 903.5, 941.8, 1014, 1080, 1142, 1201, 1257, 1309, 1360, 1408, 1454, 1499, 1541, 1583, 1622, 1661, 1836, 1986, 2117, 2231, 2331, 2417, 2492, 2557, 2660, 2732, 2779, 2806, 2817, 2814, 2801, 2780, 2752, 2720, 2684, 2646, 2606, 2565, 2359, 2165, 1991, 1836, 1700, 1585, 1488, 1403, 1263, 1150, 1058, 981.3, 916.1, 860, 810.9, 767.8, 729.5, 695.1, 664.3, 636.2, 610.8, 587.5 };
    528417 
     
    530419 
    531420name [56] = "G4_POLYSTYRENE";
    532 Znum [56] = 0;
    533  
    534421G4double e56[78] = { 153, 187.5, 216.6, 242.2, 265.3, 306.5, 342.7, 375.5, 405.6, 433.6, 460, 484.9, 542.1, 593.8, 641.3, 685.4, 726.9, 766, 803.1, 838.5, 905, 966.6, 1024, 1078, 1130, 1178, 1225, 1269, 1312, 1352, 1392, 1429, 1466, 1501, 1661, 1797, 1915, 2017, 2106, 2183, 2249, 2305, 2394, 2454, 2492, 2511, 2516, 2509, 2494, 2471, 2443, 2410, 2376, 2339, 2301, 2262, 2070, 1895, 1742, 1609, 1493, 1395, 1312, 1239, 1119, 1021, 941.4, 874.6, 817.8, 768.7, 725.7, 687.9, 654.1, 623.9, 596.6, 571.9, 549.4, 528.7 };
    535422 
     
    537424 
    538425name [57] = "G4_TEFLON";
    539 Znum [57] = 0;
    540  
    541426G4double e57[78] = { 82.7, 99.97, 114.4, 127.1, 138.4, 158.5, 176.2, 192, 206.5, 220, 232.6, 244.5, 271.9, 296.4, 319, 339.8, 359.4, 377.8, 395.3, 412, 443.3, 472.2, 499.3, 524.7, 548.8, 571.7, 593.6, 614.5, 634.6, 653.9, 672.5, 690.4, 707.8, 724.6, 801.6, 868.9, 928.6, 981.9, 1030, 1073, 1112, 1148, 1209, 1260, 1301, 1334, 1361, 1382, 1397, 1408, 1415, 1419, 1420, 1418, 1414, 1409, 1399, 1373, 1319, 1246, 1165, 1095, 1034, 979.4, 887.4, 813.7, 752.5, 700.8, 656.5, 618.1, 584.5, 554.8, 528.3, 504.6, 483, 463.5, 445.6, 429.3 };
    542427 
     
    544429 
    545430name [58] = "G4_POLYVINYL_CHLORIDE";
    546 Znum [58] = 0;
    547  
    548431G4double e58[78] = { 94.27, 114.4, 131.3, 146.3, 159.9, 184, 205.5, 224.9, 242.9, 259.7, 275.5, 290.5, 325.3, 357, 386.3, 413.7, 439.5, 464.1, 487.6, 510.1, 552.6, 592.4, 629.9, 665.5, 699.4, 731.8, 762.9, 792.9, 821.8, 849.7, 876.7, 902.9, 928.2, 952.9, 1067, 1167, 1255, 1335, 1405, 1468, 1525, 1574, 1657, 1719, 1764, 1795, 1814, 1823, 1824, 1818, 1807, 1792, 1774, 1753, 1731, 1708, 1591, 1482, 1385, 1299, 1222, 1153, 1092, 1037, 941.7, 862.4, 795.8, 739.8, 692.3, 651.2, 615.4, 583.7, 555.6, 530.3, 507.5, 486.9, 468, 450.8 };
    549432 
     
    551434 
    552435name [59] = "G4_PROPANE";
    553 Znum [59] = 0;
    554  
    555436G4double e59[78] = { 194.5, 234.7, 268.4, 298, 324.7, 372, 413.6, 451.2, 485.8, 518, 548.2, 576.8, 642.6, 702.2, 756.9, 808, 855.9, 901.2, 944.4, 985.6, 1063, 1135, 1203, 1267, 1327, 1385, 1440, 1492, 1543, 1592, 1639, 1684, 1728, 1770, 1964, 2131, 2277, 2404, 2516, 2613, 2698, 2771, 2887, 2969, 3022, 3053, 3065, 3061, 3046, 3021, 2990, 2953, 2912, 2868, 2822, 2775, 2564, 2372, 2191, 2022, 1868, 1739, 1629, 1534, 1377, 1252, 1150, 1065, 993, 931.1, 877.2, 829.9, 787.8, 750.2, 716.4, 685.8, 658, 632.5 };
    556437 
     
    558439 
    559440name [60] = "G4_Pt";
    560 Znum [60] = 78;
    561  
    562441G4double e60[78] = { 14.45, 17.87, 20.78, 23.37, 25.71, 29.9, 33.61, 36.99, 40.1, 43.01, 45.75, 48.35, 54.36, 59.81, 64.84, 69.54, 73.97, 78.17, 82.17, 86, 93.22, 99.96, 106.3, 112.3, 118, 123.5, 128.7, 133.8, 138.7, 143.4, 147.9, 152.4, 156.7, 160.8, 180.3, 197.6, 213.3, 227.7, 240.9, 253, 264.3, 274.7, 293.2, 309, 322.4, 333.7, 343.1, 350.7, 356.8, 361.6, 365.1, 367.6, 369.1, 369.8, 369.9, 369.3, 364.7, 357, 347.3, 336.6, 325.5, 314.4, 303.6, 293.2, 274.3, 258.5, 245.1, 233.4, 223.1, 214, 205.8, 198.4, 191.6, 185.4, 179.7, 174.4, 169.5, 164.9 };
    563442 
     
    565444 
    566445name [61] = "G4_Si";
    567 Znum [61] = 14;
    568  
    569446G4double e61[78] = { 47.32, 61.63, 74.34, 85.98, 96.82, 116.8, 135.1, 152.1, 168.2, 183.4, 198.1, 212.1, 245.3, 276.1, 305.2, 332.7, 359.1, 384.4, 408.7, 432.2, 477, 519.3, 559.4, 597.5, 633.9, 668.6, 701.9, 733.7, 764.3, 793.5, 821.6, 848.5, 874.4, 899.1, 1008, 1097, 1168, 1225, 1270, 1307, 1336, 1359, 1390, 1408, 1416, 1417, 1413, 1405, 1395, 1383, 1370, 1356, 1341, 1326, 1310, 1295, 1218, 1146, 1081, 1023, 970.6, 923.9, 881.4, 842.4, 773.1, 713.1, 661.2, 617.4, 579.7, 547, 518.2, 492.7, 470, 449.5, 430.9, 414, 398.6, 384.4 };
    570447 
     
    572449 
    573450name [62] = "G4_SILICON_DIOXIDE";
    574 Znum [62] = 0;
    575  
    576451G4double e62[78] = { 68.9, 85.1, 98.85, 111, 122.1, 141.8, 159.3, 175.1, 189.8, 203.4, 216.3, 228.5, 256.6, 282.1, 305.7, 327.6, 348.3, 367.9, 386.5, 404.4, 437.9, 469.2, 498.5, 526.3, 552.6, 577.7, 601.7, 624.7, 646.9, 668.2, 688.8, 708.7, 728, 746.7, 832.2, 906.8, 972.6, 1031, 1083, 1129, 1170, 1207, 1268, 1315, 1351, 1377, 1396, 1409, 1417, 1421, 1421, 1419, 1414, 1406, 1397, 1387, 1349, 1301, 1237, 1163, 1087, 1021, 964, 913.7, 829.4, 762.2, 706.3, 659, 618.4, 583.3, 552.3, 524.9, 500.4, 478.4, 458.5, 440.4, 423.9, 408.7 };
    577452 
     
    579454 
    580455name [63] = "G4_STILBENE";
    581 Znum [63] = 0;
    582  
    583456G4double e63[78] = { 192, 228.9, 259.4, 286, 309.7, 351.2, 387.4, 419.7, 449.2, 476.4, 501.9, 525.8, 580.4, 629.2, 673.8, 714.9, 753.3, 789.4, 823.5, 856, 916.5, 972.3, 1024, 1073, 1119, 1162, 1203, 1243, 1280, 1316, 1351, 1384, 1416, 1446, 1585, 1703, 1805, 1892, 1968, 2034, 2090, 2139, 2215, 2268, 2303, 2323, 2331, 2330, 2321, 2307, 2287, 2265, 2240, 2212, 2184, 2155, 1995, 1841, 1703, 1582, 1477, 1385, 1305, 1233, 1113, 1015, 936, 869.6, 813, 764.1, 721.3, 683.7, 650.1, 620, 592.9, 568.3, 545.9, 525.4 };
    584457 
     
    586459 
    587460name [64] = "G4_Ti";
    588 Znum [64] = 22;
    589  
    590461G4double e64[78] = { 59.24, 72.81, 84.28, 94.41, 103.6, 119.9, 134.3, 147.4, 159.4, 170.6, 181.1, 191.1, 214, 234.7, 253.8, 271.6, 288.3, 304.1, 319.1, 333.5, 360.5, 385.5, 409, 431.2, 452.2, 472.2, 491.4, 509.7, 527.3, 544.3, 560.6, 576.4, 591.7, 606.5, 674.2, 733.1, 785, 831, 871.7, 907.9, 940, 968.3, 1015, 1051, 1077, 1095, 1106, 1112, 1114, 1112, 1107, 1100, 1092, 1082, 1071, 1059, 995.6, 933.7, 877.6, 827.9, 785.2, 747.8, 714.5, 684.4, 631.9, 587.1, 548.3, 514.3, 484.2, 457.3, 433.4, 412.5, 393.7, 376.7, 361.5, 347.6, 334.9, 323.2 };
    591462 
     
    593464 
    594465name [65] = "G4_Sn";
    595 Znum [65] = 50;
    596  
    597466G4double e65[78] = { 27.39, 33.96, 39.55, 44.52, 49.04, 57.11, 64.28, 70.8, 76.82, 82.45, 87.76, 92.79, 104.4, 115, 124.8, 133.9, 142.5, 150.6, 158.4, 165.8, 179.8, 192.9, 205.2, 216.8, 227.8, 238.4, 248.4, 258.1, 267.4, 276.4, 285.1, 293.5, 301.6, 309.5, 345.7, 377.3, 405.3, 430.1, 452.1, 471.8, 489.3, 504.8, 530.7, 550.9, 566.3, 577.9, 586.3, 592.2, 596.1, 598.4, 599.3, 599.1, 598.1, 596.4, 594.2, 591.5, 573.8, 552.8, 531.2, 510.1, 488.3, 467, 447, 428.6, 396.3, 369.4, 346.8, 327.7, 311.4, 297.1, 283.9, 271.9, 260.8, 250.6, 241.7, 233.6, 226, 218.9 };
    598467 
     
    600469 
    601470name [66] = "G4_TISSUE_METHANE";
    602 Znum [66] = 0;
    603  
    604471G4double e66[78] = { 135.1, 165.6, 191.3, 213.9, 234.4, 270.7, 302.8, 331.8, 358.4, 383.2, 406.5, 428.6, 479.3, 525.2, 567.4, 606.7, 643.6, 678.5, 711.7, 743.4, 803.1, 858.6, 910.7, 960.1, 1007, 1052, 1095, 1136, 1176, 1214, 1251, 1287, 1322, 1356, 1514, 1655, 1783, 1899, 2006, 2104, 2193, 2275, 2418, 2535, 2626, 2693, 2737, 2760, 2764, 2752, 2728, 2695, 2655, 2612, 2566, 2519, 2278, 2060, 1878, 1727, 1602, 1494, 1403, 1323, 1191, 1085, 998.2, 926, 864.6, 811.7, 765.6, 724.9, 688.8, 656.5, 627.4, 601.1, 577.1, 555.2 };
    605472 
     
    607474 
    608475name [67] = "G4_TISSUE_PROPANE";
    609 Znum [67] = 0;
    610  
    611476G4double e67[78] = { 149.7, 181.5, 208.2, 231.7, 252.8, 290.4, 323.5, 353.4, 380.9, 406.5, 430.5, 453.3, 505.7, 553, 596.6, 637.2, 675.4, 711.5, 745.8, 778.6, 840.4, 897.8, 951.6, 1003, 1051, 1097, 1141, 1183, 1224, 1263, 1301, 1337, 1372, 1407, 1563, 1701, 1822, 1929, 2024, 2109, 2185, 2252, 2362, 2446, 2507, 2549, 2573, 2583, 2581, 2569, 2550, 2524, 2494, 2461, 2426, 2389, 2211, 2043, 1887, 1744, 1616, 1507, 1415, 1334, 1201, 1094, 1006, 933.3, 871.4, 818.1, 771.5, 730.5, 694.1, 661.5, 632.1, 605.6, 581.4, 559.3 };
    612477 
     
    614479 
    615480name [68] = "G4_TOLUENE";
    616 Znum [68] = 0;
    617  
    618481G4double e68[78] = { 192.5, 230, 261, 288.1, 312.3, 354.9, 392, 425.3, 455.6, 483.7, 510, 534.8, 591.3, 642.1, 688.4, 731.3, 771.4, 809.1, 844.8, 878.8, 942.4, 1001, 1056, 1107, 1155, 1201, 1245, 1287, 1327, 1365, 1401, 1437, 1471, 1504, 1652, 1779, 1888, 1983, 2065, 2136, 2197, 2250, 2333, 2392, 2430, 2452, 2461, 2459, 2449, 2433, 2411, 2386, 2358, 2328, 2296, 2264, 2109, 1960, 1817, 1683, 1560, 1456, 1368, 1291, 1163, 1060, 976.6, 906.6, 847.1, 795.7, 750.8, 711.3, 676.1, 644.6, 616.2, 590.5, 567, 545.6 };
    619482 
     
    621484 
    622485name [69] = "G4_U";
    623 Znum [69] = 92;
    624  
    625486G4double e69[78] = { 13.2, 16.72, 19.77, 22.52, 25.04, 29.61, 33.73, 37.51, 41.03, 44.35, 47.5, 50.51, 57.52, 63.96, 69.97, 75.62, 80.99, 86.11, 91.01, 95.73, 104.7, 113.1, 121.1, 128.7, 136, 143, 149.8, 156.3, 162.6, 168.8, 174.7, 180.5, 186.2, 191.7, 217.4, 240.5, 261.5, 280.8, 298.5, 314.8, 329.8, 343.7, 368, 388.4, 405.3, 419, 429.8, 438.1, 444.2, 448.4, 450.8, 451.8, 451.6, 450.3, 448.2, 445.4, 420, 390.1, 362.9, 339.6, 319.8, 303.1, 288.9, 276.7, 256.9, 241.7, 229.4, 218.6, 209.1, 200.6, 193, 186.1, 179.8, 174, 168.6, 163.7, 159.1, 154.8 };
    626487 
     
    628489 
    629490name [70] = "G4_W";
    630 Znum [70] = 74;
    631  
    632491G4double e70[78] = { 20.75, 25.23, 28.99, 32.29, 35.26, 40.51, 45.11, 49.26, 53.06, 56.59, 59.9, 63.02, 70.18, 76.63, 82.54, 88.02, 93.16, 98.01, 102.6, 107, 115.2, 122.9, 130, 136.7, 143.1, 149.2, 155, 160.6, 165.9, 171.1, 176.1, 180.9, 185.6, 190.1, 211.1, 229.6, 246.2, 261.3, 275.1, 287.7, 299.3, 310, 328.8, 344.7, 358.1, 369.2, 378.3, 385.6, 391.3, 395.6, 398.7, 400.6, 401.7, 401.9, 401.4, 400.4, 389.5, 374.8, 359.5, 344.8, 331, 318.3, 306.5, 295.7, 276.7, 260.8, 247.3, 235.5, 225.2, 216.1, 207.8, 200.3, 193.5, 187.3, 181.5, 176.2, 171.3, 166.7 };
    633492 
     
    635494 
    636495name [71] = "G4_WATER";
    637 Znum [71] = 0;
    638  
    639496G4double e71[78] = { 98.91, 122.7, 143.1, 161.1, 177.5, 206.9, 233, 256.8, 278.8, 299.3, 318.6, 337, 379.5, 418.1, 453.8, 487.1, 518.6, 548.3, 576.7, 603.9, 655.2, 703, 748, 790.5, 831, 869.6, 906.6, 942.2, 976.4, 1009, 1041, 1072, 1102, 1131, 1265, 1383, 1488, 1582, 1666, 1743, 1811, 1873, 1978, 2062, 2128, 2178, 2215, 2240, 2255, 2262, 2262, 2256, 2245, 2230, 2211, 2190, 2050, 1896, 1752, 1624, 1511, 1414, 1329, 1255, 1132, 1034, 952.7, 884.8, 826.9, 777.1, 733.4, 694.9, 660.7, 630.1, 602.5, 577.6, 554.8, 534 };
    640497 
     
    642499 
    643500name [72] = "G4_WATER_VAPOR";
    644 Znum [72] = 0;
    645  
    646501G4double e72[78] = { 126.3, 154.7, 178.7, 199.8, 218.8, 252.7, 282.5, 309.5, 334.3, 357.3, 379, 399.5, 446.7, 489.3, 528.5, 565, 599.2, 631.6, 662.4, 691.9, 747.3, 798.8, 847.2, 892.9, 936.3, 977.8, 1018, 1056, 1093, 1128, 1163, 1196, 1228, 1260, 1405, 1535, 1652, 1758, 1855, 1942, 2022, 2094, 2216, 2309, 2377, 2422, 2446, 2455, 2453, 2446, 2436, 2423, 2409, 2392, 2371, 2346, 2169, 1971, 1797, 1653, 1537, 1437, 1351, 1275, 1149, 1049, 965.8, 896.6, 837.6, 786.9, 742.5, 703.3, 668.6, 637.5, 609.5, 584.2, 561.1, 539.9 };
    647502 
     
    649504 
    650505name [73] = "G4_Xe";
    651 Znum [73] = 54;
    652  
    653506G4double e73[78] = { 18.11, 23.3, 27.86, 31.99, 35.83, 42.84, 49.2, 55.1, 60.63, 65.87, 70.87, 75.65, 86.89, 97.3, 107.1, 116.3, 125.1, 133.5, 141.7, 149.5, 164.4, 178.6, 192, 204.9, 217.3, 229.2, 240.7, 251.8, 262.6, 273.1, 283.4, 293.3, 303, 312.5, 356.7, 396.5, 432.5, 465.2, 494.9, 521.8, 546.1, 567.9, 604.7, 633.2, 654.5, 669.3, 678.8, 683.6, 684.6, 682.5, 678, 671.7, 663.9, 655.1, 645.6, 635.6, 584.6, 538.7, 500.4, 468.8, 446.7, 430.5, 417.1, 405.3, 383.9, 364, 344.9, 326.8, 309.7, 294.6, 281.3, 269.5, 258.7, 248.8, 239.6, 231.1, 223.2, 216.2 };
    654507 
  • trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BetheBlochModel.cc,v 1.13 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4BetheBlochModel.cc,v 1.25 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4545// 13-02-03 Add name (V.Ivanchenko)
    4646// 24-03-05 Add G4EmCorrections (V.Ivanchenko)
    47 // 11-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
     47// 11-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
    4848// 11-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
    4949// 12-02-06 move G4LossTableManager::Instance()->EmCorrections()
    5050//          in constructor (mma)
     51// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     52//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    5153//
    5254// -------------------------------------------------------------------
     
    6365#include "G4EmCorrections.hh"
    6466#include "G4ParticleChangeForLoss.hh"
     67#include "G4NistManager.hh"
    6568
    6669//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7174                                     const G4String& nam)
    7275  : G4VEmModel(nam),
    73   particle(0),
    74   tlimit(DBL_MAX),
    75   twoln10(2.0*log(10.0)),
    76   bg2lim(0.0169),
    77   taulim(8.4146e-3),
    78   isIon(false)
    79 {
     76    particle(0),
     77    tlimit(DBL_MAX),
     78    twoln10(2.0*log(10.0)),
     79    bg2lim(0.0169),
     80    taulim(8.4146e-3),
     81    isIon(false),
     82    isInitialised(false)
     83{
     84  fParticleChange = 0;
    8085  if(p) SetParticle(p);
    8186  theElectron = G4Electron::Electron();
    8287  corr = G4LossTableManager::Instance()->EmCorrections(); 
     88  nist = G4NistManager::Instance();
     89  SetLowEnergyLimit(2.0*MeV);
    8390}
    8491
     
    102109{
    103110  if (!particle) SetParticle(p);
    104   G4String pname = particle->GetParticleName();
    105   if (particle->GetParticleType() == "nucleus" &&
    106      pname != "deuteron" && pname != "triton") isIon = true;
    107 
    108   if (pParticleChange)
    109     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    110                                                               (pParticleChange);
    111   else
    112     fParticleChange = new G4ParticleChangeForLoss();
    113 }
    114 
    115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    116 
    117 G4double G4BetheBlochModel::ComputeCrossSectionPerElectron(
    118                                            const G4ParticleDefinition* p,
    119                                                  G4double kineticEnergy,
    120                                                  G4double cutEnergy,
    121                                                  G4double maxKinEnergy)                                           
     111
     112  corrFactor = chargeSquare;
     113  // always false before the run
     114  SetDeexcitationFlag(false);
     115
     116  if(!isInitialised) {
     117    isInitialised = true;
     118
     119    if(!fParticleChange) {
     120      if (pParticleChange) {
     121        fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
     122          (pParticleChange);
     123      } else {
     124        fParticleChange = new G4ParticleChangeForLoss();
     125      }
     126    }
     127  }
     128}
     129
     130//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     131
     132void G4BetheBlochModel::SetParticle(const G4ParticleDefinition* p)
     133{
     134  if(particle != p) {
     135    particle = p;
     136    G4String pname = particle->GetParticleName();
     137    if (particle->GetParticleType() == "nucleus" &&
     138        pname != "deuteron" && pname != "triton") {
     139      isIon = true;
     140    }
     141   
     142    mass = particle->GetPDGMass();
     143    spin = particle->GetPDGSpin();
     144    G4double q = particle->GetPDGCharge()/eplus;
     145    chargeSquare = q*q;
     146    ratio = electron_mass_c2/mass;
     147    G4double magmom = particle->GetPDGMagneticMoment()
     148      *mass/(0.5*eplus*hbar_Planck*c_squared);
     149    magMoment2 = magmom*magmom - 1.0;
     150    formfact = 0.0;
     151    if(particle->GetLeptonNumber() == 0) {
     152      G4double x = 0.8426*GeV;
     153      if(spin == 0.0 && mass < GeV) {x = 0.736*GeV;}
     154      else if(mass > GeV) {
     155        x /= nist->GetZ13(mass/proton_mass_c2);
     156        //      tlimit = 51.2*GeV*A13[iz]*A13[iz];
     157      }
     158      formfact = 2.0*electron_mass_c2/(x*x);
     159      tlimit   = 2.0/formfact;
     160    }
     161  }
     162}
     163
     164//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     165
     166G4double G4BetheBlochModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
     167                                                 const G4Material* mat,
     168                                                 G4double kineticEnergy)
     169{
     170  // this method is called only for ions
     171  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy);
     172  corrFactor = q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy);
     173  return corrFactor;
     174}
     175
     176//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     177
     178G4double G4BetheBlochModel::GetParticleCharge(const G4ParticleDefinition* p,
     179                                              const G4Material* mat,
     180                                              G4double kineticEnergy)
     181{
     182  // this method is called only for ions
     183  return corr->GetParticleCharge(p,mat,kineticEnergy);
     184}
     185
     186//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     187
     188G4double
     189G4BetheBlochModel::ComputeCrossSectionPerElectron(const G4ParticleDefinition* p,
     190                                                  G4double kineticEnergy,
     191                                                  G4double cutEnergy,
     192                                                  G4double maxKinEnergy)       
    122193{
    123194  G4double cross = 0.0;
     
    130201    G4double beta2     = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
    131202
    132     cross = 1.0/cutEnergy - 1.0/maxEnergy - beta2*log(maxEnergy/cutEnergy)/tmax;
     203    cross = 1.0/cutEnergy - 1.0/maxEnergy
     204      - beta2*log(maxEnergy/cutEnergy)/tmax;
    133205
    134206    // +term for spin=1/2 particle
    135207    if( 0.5 == spin ) cross += 0.5*(maxEnergy - cutEnergy)/energy2;
     208
     209    // High order correction different for hadrons and ions
     210    // nevetheless they are applied to reduce high energy transfers
     211    //    if(!isIon)
     212    //cross += corr->FiniteSizeCorrectionXS(p,currentMaterial,
     213    //                                    kineticEnergy,cutEnergy);
    136214
    137215    cross *= twopi_mc2_rcl2*chargeSquare/beta2;
     
    167245                                                 G4double maxEnergy)
    168246{
     247  currentMaterial   = material;
    169248  G4double eDensity = material->GetElectronDensity();
    170249  G4double cross = eDensity*ComputeCrossSectionPerElectron
     
    222301  dedx *= twopi_mc2_rcl2*chargeSquare*eDensity/beta2;
    223302
    224   //High order correction only for hadrons
    225   if(!isIon) dedx += corr->HighOrderCorrections(p,material,kineticEnergy);
    226 
     303  //High order correction different for hadrons and ions
     304  if(isIon) {
     305    dedx += corr->IonBarkasCorrection(p,material,kineticEnergy);
     306  } else {     
     307    dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
     308  }
    227309  return dedx;
     310}
     311
     312//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     313
     314void G4BetheBlochModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
     315                                             const G4DynamicParticle* dp,
     316                                             G4double& eloss,
     317                                             G4double&,
     318                                             G4double length)
     319{
     320  const G4ParticleDefinition* p = dp->GetDefinition();
     321  const G4Material* mat = couple->GetMaterial();
     322  G4double preKinEnergy = dp->GetKineticEnergy();
     323  G4double e = preKinEnergy - eloss*0.5;
     324  if(e < 0.0) e = preKinEnergy*0.5;
     325
     326  if(isIon) {
     327    G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,e);
     328    GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
     329    eloss *= q2*corr->EffectiveChargeCorrection(p,mat,e)/corrFactor;
     330    eloss += length*corr->IonHighOrderCorrections(p,couple,e);
     331  }
     332
     333  if(nuclearStopping && preKinEnergy*proton_mass_c2/mass < chargeSquare*100.*MeV) {
     334
     335    G4double nloss = length*corr->NuclearDEDX(p,mat,e,false);
     336
     337    // too big energy loss
     338    if(eloss + nloss > preKinEnergy) {
     339      nloss *= (preKinEnergy/(eloss + nloss));
     340      eloss = preKinEnergy;
     341    } else {
     342      eloss += nloss;
     343    }
     344    /*
     345    G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
     346           << " de= " << eloss << " NIEL= " << nloss
     347           << " dynQ= " << dp->GetCharge()/eplus << G4endl;
     348    */
     349    fParticleChange->ProposeNonIonizingEnergyDeposit(nloss);
     350  }
     351
    228352}
    229353
     
    239363  G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
    240364
    241   G4double maxKinEnergy = min(maxEnergy,tmax);
     365  G4double maxKinEnergy = std::min(maxEnergy,tmax);
    242366  if(minKinEnergy >= maxKinEnergy) return;
    243367
     
    246370  G4double beta2         = kineticEnergy*(kineticEnergy + 2.0*mass)/etot2;
    247371
    248   G4double deltaKinEnergy, f;
    249 
    250   // sampling follows ...
     372  G4double deltaKinEnergy, f;
     373  G4double f1 = 0.0;
     374  G4double fmax = 1.0;
     375  if( 0.5 == spin ) fmax += 0.5*maxKinEnergy*maxKinEnergy/etot2;
     376
     377  // sampling without nuclear size effect
    251378  do {
    252379    G4double q = G4UniformRand();
     
    255382
    256383    f = 1.0 - beta2*deltaKinEnergy/tmax;
    257     if( 0.5 == spin ) f += 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
    258 
    259     if(f > 1.0) {
    260         G4cout << "G4BetheBlochModel::SampleSecondary Warning! "
    261                << "Majorant 1.0 < "
    262                << f << " for Edelta= " << deltaKinEnergy
    263                << G4endl;
    264     }
    265 
    266   } while( G4UniformRand() > f );
    267 
     384    if( 0.5 == spin ) {
     385      f1 = 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
     386      f += f1;
     387    }
     388
     389  } while( fmax*G4UniformRand() > f);
     390
     391  // projectile formfactor - suppresion of high energy
     392  // delta-electron production at high energy
     393 
     394  G4double x = formfact*deltaKinEnergy;
     395  if(x > 1.e-6) {
     396
     397    G4double x1 = 1.0 + x;
     398    G4double g  = 1.0/(x1*x1);
     399    if( 0.5 == spin ) {
     400      G4double x2 = 0.5*electron_mass_c2*deltaKinEnergy/(mass*mass);
     401      g *= (1.0 + magMoment2*(x2 - f1/f)/(1.0 + x2));
     402    }
     403    if(g > 1.0) {
     404      G4cout << "### G4BetheBlochModel WARNING: g= " << g
     405             << dp->GetDefinition()->GetParticleName()
     406             << " Ekin(MeV)= " <<  kineticEnergy
     407             << " delEkin(MeV)= " << deltaKinEnergy
     408             << G4endl;
     409    }
     410    if(G4UniformRand() > g) return;
     411  }
     412
     413  // delta-electron is produced
    268414  G4double totMomentum = totEnergy*sqrt(beta2);
    269415  G4double deltaMomentum =
     
    309455}
    310456
    311 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     457//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     458
     459G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
     460                                               G4double kinEnergy)
     461{
     462  if(isIon) SetParticle(pd);
     463  G4double tau  = kinEnergy/mass;
     464  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
     465                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
     466  return std::min(tmax,tlimit);
     467}
     468
     469//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4BetheHeitlerModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BetheHeitlerModel.cc,v 1.11 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BetheHeitlerModel.cc,v 1.12 2008/10/15 15:54:57 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6161#include "G4PhysicsLogVector.hh"
    6262#include "G4ParticleChangeForGamma.hh"
     63#include "G4LossTableManager.hh"
    6364
    6465//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    7071  : G4VEmModel(nam),
    7172    theCrossSectionTable(0),
    72     nbins(200)
    73 {
     73    nbins(10)
     74{
     75  fParticleChange = 0;
    7476  theGamma    = G4Gamma::Gamma();
    7577  thePositron = G4Positron::Positron();
     
    9294                                     const G4DataVector&)
    9395{
    94   if(pParticleChange)
    95     fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    96   else
    97     fParticleChange = new G4ParticleChangeForGamma();
     96  if(!fParticleChange) {
     97    if(pParticleChange) {
     98      fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
     99    } else {
     100      fParticleChange = new G4ParticleChangeForGamma();
     101    }
     102  }
    98103
    99104  if(theCrossSectionTable) {
     
    108113  G4double emin = LowEnergyLimit();
    109114  G4double emax = HighEnergyLimit();
     115  G4int n = nbins*G4int(log10(emax/emin));
     116  G4bool spline = G4LossTableManager::Instance()->SplineFlag();
    110117  G4double e, value;
    111118
    112119  for(size_t j=0; j<nvect ; j++) {
    113120
    114     ptrVector  = new G4PhysicsLogVector(emin, emax, nbins);
     121    ptrVector  = new G4PhysicsLogVector(emin, emax, n);
     122    ptrVector->SetSpline(spline);
    115123    G4double Z = (*theElementTable)[j]->GetZ();
    116124    G4int   iz = G4int(Z);
  • trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BohrFluctuations.cc,v 1.6 2007/09/27 14:02:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BohrFluctuations.cc,v 1.7 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    137137//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    138138
     139G4double G4BohrFluctuations::Dispersion(const G4Material* material,
     140                                        const G4DynamicParticle* dp,
     141                                        G4double& tmax,
     142                                        G4double& length)
     143{
     144  if(!particle) InitialiseMe(dp->GetDefinition());
    139145
     146  G4double electronDensity = material->GetElectronDensity();
     147  kineticEnergy = dp->GetKineticEnergy();
     148  G4double etot = kineticEnergy + particleMass;
     149  beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
     150  G4double siga  = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
     151                 * electronDensity * chargeSquare;
     152
     153  return siga;
     154}
     155
     156//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     157
     158
  • trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggIonModel.cc,v 1.17 2007/07/28 13:30:53 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4BraggIonModel.cc,v 1.23 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4444// 25-04-06 Add stopping data from ASTAR (V.Ivanchenko)
    4545// 23-10-06 Reduce lowestKinEnergy to 0.25 keV (V.Ivanchenko)
     46// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     47//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    4648//
    4749
     
    6264#include "G4Electron.hh"
    6365#include "G4ParticleChangeForLoss.hh"
     66#include "G4LossTableManager.hh"
     67#include "G4EmCorrections.hh"
    6468
    6569//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7074                                 const G4String& nam)
    7175  : G4VEmModel(nam),
    72   particle(0),
    73   iMolecula(0),
    74   isIon(false)
     76    corr(0),
     77    particle(0),
     78    fParticleChange(0),
     79    iMolecula(0),
     80    isIon(false),
     81    isInitialised(false)
    7582{
    7683  if(p) SetParticle(p);
    77   highKinEnergy    = 2.0*MeV;
    78   lowKinEnergy     = 0.0*MeV;
     84  SetHighEnergyLimit(2.0*MeV);
     85
    7986  HeMass           = 3.727417*GeV;
    8087  rateMassHe2p     = HeMass/proton_mass_c2;
     
    104111{
    105112  if(p != particle) SetParticle(p);
    106   G4String pname = particle->GetParticleName();
    107   if(particle->GetParticleType() == "nucleus" &&
    108      pname != "deuteron" && pname != "triton") isIon = true;
    109 
    110   if(pParticleChange)
    111     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    112                                                               (pParticleChange);
    113   else
    114     fParticleChange = new G4ParticleChangeForLoss();
    115 
     113
     114  corrFactor = chargeSquare;
     115
     116  // always false before the run
     117  SetDeexcitationFlag(false);
     118
     119  if(!isInitialised) {
     120    isInitialised = true;
     121
     122    G4String pname = particle->GetParticleName();
     123    if(particle->GetParticleType() == "nucleus" &&
     124       pname != "deuteron" && pname != "triton") isIon = true;
     125
     126    corr = G4LossTableManager::Instance()->EmCorrections();
     127
     128    if(!fParticleChange) {
     129      if(pParticleChange) {
     130        fParticleChange =
     131          reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
     132      } else {
     133        fParticleChange = new G4ParticleChangeForLoss();
     134      }
     135    }
     136  }
     137}
     138
     139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     140
     141G4double G4BraggIonModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
     142                                               const G4Material* mat,
     143                                               G4double kineticEnergy)
     144{
     145  // this method is called only for ions
     146  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy);
     147  corrFactor  = q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy);
     148  return corrFactor;
     149}
     150
     151//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     152
     153G4double G4BraggIonModel::GetParticleCharge(const G4ParticleDefinition* p,
     154                                            const G4Material* mat,
     155                                            G4double kineticEnergy)
     156{
     157  // this method is called only for ions
     158  return corr->GetParticleCharge(p,mat,kineticEnergy);
    116159}
    117160
     
    124167                                                 G4double maxKinEnergy)
    125168{
    126 
    127169  G4double cross     = 0.0;
    128170  G4double tmax      = MaxSecondaryEnergy(p, kineticEnergy);
    129   G4double maxEnergy = min(tmax,maxKinEnergy);
     171  G4double maxEnergy = std::min(tmax,maxKinEnergy);
    130172  if(cutEnergy < tmax) {
    131173
     
    213255//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    214256
     257void G4BraggIonModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
     258                                           const G4DynamicParticle* dp,
     259                                           G4double& eloss,
     260                                           G4double&,
     261                                           G4double length)
     262{
     263  // this method is called only for ions
     264  const G4ParticleDefinition* p = dp->GetDefinition();
     265  const G4Material* mat = couple->GetMaterial();
     266  G4double preKinEnergy = dp->GetKineticEnergy();
     267  G4double e = preKinEnergy - eloss*0.5;
     268  if(e < 0.0) e = preKinEnergy*0.5;
     269
     270  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,e);
     271  GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
     272  eloss *= q2*corr->EffectiveChargeCorrection(p,mat,e)/corrFactor;
     273
     274  if(nuclearStopping) {
     275
     276    G4double nloss = length*corr->NuclearDEDX(p,mat,e,false);
     277
     278    // too big energy loss
     279    if(eloss + nloss > preKinEnergy) {
     280      nloss *= (preKinEnergy/(eloss + nloss));
     281      eloss = preKinEnergy;
     282    } else {
     283      eloss += nloss;
     284    }
     285    /*
     286    G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
     287           << " de= " << eloss << " NIEL= " << nloss
     288           << " dynQ= " << dp->GetCharge()/eplus << G4endl;
     289    */
     290    fParticleChange->ProposeNonIonizingEnergyDeposit(nloss);
     291  }
     292}
     293
     294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     295
    215296void G4BraggIonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
    216297                                        const G4MaterialCutsCouple*,
     
    220301{
    221302  G4double tmax = MaxSecondaryKinEnergy(dp);
    222   G4double xmax = min(tmax, maxEnergy);
     303  G4double xmax = std::min(tmax, maxEnergy);
    223304  if(xmin >= xmax) return;
    224305
     
    274355  fParticleChange->SetProposedKineticEnergy(kineticEnergy);
    275356  fParticleChange->SetProposedMomentumDirection(finalP);
     357}
     358
     359//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     360
     361G4double G4BraggIonModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
     362                                             G4double kinEnergy)
     363{
     364  if(pd != particle) SetParticle(pd);
     365  G4double tau  = kinEnergy/mass;
     366  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
     367                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
     368  return tmax;
    276369}
    277370
  • trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4BraggModel.cc,v 1.16 2007/07/28 13:30:53 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4BraggModel.cc,v 1.21 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5050// 15-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma)
    5151// 25-04-06 Add stopping data from PSTAR (V.Ivanchenko)
     52// 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     53//          CorrectionsAlongStep needed for ions(V.Ivanchenko)
    5254
    5355// Class Description:
     
    6769#include "G4Electron.hh"
    6870#include "G4ParticleChangeForLoss.hh"
     71#include "G4LossTableManager.hh"
     72#include "G4EmCorrections.hh"
    6973
    7074//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7478G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
    7579  : G4VEmModel(nam),
    76   particle(0),
    77   protonMassAMU(1.007276),
    78   iMolecula(0),
    79   isIon(false)
     80    particle(0),
     81    protonMassAMU(1.007276),
     82    iMolecula(0),
     83    isIon(false),
     84    isInitialised(false)
    8085{
    8186  if(p) SetParticle(p);
     87  SetHighEnergyLimit(2.0*MeV);
     88
    8289  lowestKinEnergy  = 1.0*keV;
    8390  theZieglerFactor = eV*cm2*1.0e-15;
     
    104111{
    105112  if(p != particle) SetParticle(p);
    106   G4String pname = particle->GetParticleName();
    107   if(particle->GetParticleType() == "nucleus" &&
    108      pname != "deuteron" && pname != "triton") isIon = true;
    109 
    110   if(pParticleChange)
    111     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    112                                                               (pParticleChange);
    113   else
    114     fParticleChange = new G4ParticleChangeForLoss();
     113
     114  // always false before the run
     115  SetDeexcitationFlag(false);
     116
     117  if(!isInitialised) {
     118    isInitialised = true;
     119
     120    G4String pname = particle->GetParticleName();
     121    if(particle->GetParticleType() == "nucleus" &&
     122       pname != "deuteron" && pname != "triton") isIon = true;
     123
     124    corr = G4LossTableManager::Instance()->EmCorrections();
     125
     126    if(pParticleChange) {
     127      fParticleChange =
     128        reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
     129    } else {
     130      fParticleChange = new G4ParticleChangeForLoss();
     131    }
     132  }
     133}
     134
     135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     136
     137G4double G4BraggModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
     138                                            const G4Material* mat,
     139                                            G4double kineticEnergy)
     140{
     141  // this method is called only for ions
     142  G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy);
     143  GetModelOfFluctuations()->SetParticleAndCharge(p, q2);
     144  return q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy);
     145}
     146
     147//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     148
     149G4double G4BraggModel::GetParticleCharge(const G4ParticleDefinition* p,
     150                                         const G4Material* mat,
     151                                         G4double kineticEnergy)
     152{
     153  // this method is called only for ions
     154  return corr->GetParticleCharge(p,mat,kineticEnergy);
    115155}
    116156
     
    123163                                                 G4double maxKinEnergy)
    124164{
    125 
    126165  G4double cross     = 0.0;
    127166  G4double tmax      = MaxSecondaryEnergy(p, kineticEnergy);
    128   G4double maxEnergy = min(tmax,maxKinEnergy);
     167  G4double maxEnergy = std::min(tmax,maxKinEnergy);
    129168  if(cutEnergy < tmax) {
    130169
     
    203242
    204243  return dedx;
     244}
     245
     246//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     247
     248void G4BraggModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
     249                                        const G4DynamicParticle* dp,
     250                                        G4double& eloss,
     251                                        G4double&,
     252                                        G4double length)
     253{
     254  if(nuclearStopping) {
     255
     256    G4double preKinEnergy = dp->GetKineticEnergy();
     257    G4double e = preKinEnergy - eloss*0.5;
     258    if(e < 0.0) e = preKinEnergy*0.5;
     259    G4double nloss = length*corr->NuclearDEDX(dp->GetDefinition(),
     260                                              couple->GetMaterial(),
     261                                              e,false);
     262
     263    // too big energy loss
     264    if(eloss + nloss > preKinEnergy) {
     265      nloss *= (preKinEnergy/(eloss + nloss));
     266      eloss = preKinEnergy;
     267    } else {
     268      eloss += nloss;
     269    }
     270    /*
     271    G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
     272           << " de= " << eloss << " NIEL= " << nloss
     273           << " dynQ= " << dp->GetCharge()/eplus << G4endl;
     274    */
     275    fParticleChange->ProposeNonIonizingEnergyDeposit(nloss);
     276  }
    205277}
    206278
     
    268340
    269341  vdp->push_back(delta);
     342}
     343
     344//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     345
     346G4double G4BraggModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
     347                                          G4double kinEnergy)
     348{
     349  if(pd != particle) SetParticle(pd);
     350  G4double tau  = kinEnergy/mass;
     351  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
     352                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
     353  return tmax;
    270354}
    271355
  • trunk/source/processes/electromagnetic/standard/src/G4ComptonScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ComptonScattering.cc,v 1.27 2006/09/14 10:27:19 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ComptonScattering.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    7474    isInitialised(false)
    7575{
    76   SetLambdaBinning(90);
    77   SetMinKinEnergy(0.1*keV);
    78   SetMaxKinEnergy(100.0*GeV);
     76  SetProcessSubType(fComptonScattering);
    7977}
    8078
     
    8684//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8785
     86G4bool G4ComptonScattering::IsApplicable(const G4ParticleDefinition& p)
     87{
     88  return (&p == G4Gamma::Gamma());
     89}
     90
     91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     92
    8893void G4ComptonScattering::InitialiseProcess(const G4ParticleDefinition*)
    8994{
     
    9297    SetBuildTableFlag(true);
    9398    SetSecondaryParticle(G4Electron::Electron());
    94     G4double emin = MinKinEnergy();
    95     G4double emax = MaxKinEnergy();
    9699    if(!Model()) SetModel(new G4KleinNishinaCompton);
    97     Model()->SetLowEnergyLimit(emin);
    98     Model()->SetHighEnergyLimit(emax);
     100    Model()->SetLowEnergyLimit(MinKinEnergy());
     101    Model()->SetHighEnergyLimit(MaxKinEnergy());
    99102    AddEmModel(1, Model());
    100103  }
     
    104107
    105108void G4ComptonScattering::PrintInfo()
    106 {
    107   G4cout
    108     << " Total cross sections has a good parametrisation"
    109     << " from 10 KeV to (100/Z) GeV"
    110     << "\n      Sampling according " << Model()->GetName() << " model"
    111     << G4endl;
    112 }         
     109{}         
    113110
    114111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4ComptonScattering52.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ComptonScattering52.cc,v 1.5 2007/05/16 14:00:56 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ComptonScattering52.cc,v 1.7 2008/10/15 17:53:44 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    7373    NumbBinTable(80),
    7474    fminimalEnergy(1*eV)
    75 {}
     75{
     76  SetProcessSubType(13);
     77  G4cout << "!!! G4ComptonScattering52 is the obsolete process class and will be removed soon !!!"
     78         << G4endl;
     79}
    7680
    7781//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CoulombScattering.cc,v 1.11 2007/11/20 18:43:25 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4CoulombScattering.cc,v 1.20 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5959
    6060G4CoulombScattering::G4CoulombScattering(const G4String& name)
    61   : G4VEmProcess(name),thetaMin(0.0),thetaMax(pi),q2Max(DBL_MAX),
     61  : G4VEmProcess(name),thetaMin(0.0),thetaMax(pi),q2Max(TeV*TeV),
    6262    isInitialised(false)
    6363{
    64   G4VEmProcess::SetBuildTableFlag(true);
     64  SetBuildTableFlag(true);
    6565  SetStartFromNullFlag(false);
    6666  SetIntegral(true);
    67   SetMinKinEnergy(keV);
    68   SetMaxKinEnergy(PeV);
    6967  thEnergy = PeV;
    7068  thEnergyElec = PeV;
     
    7371    thEnergyElec = 10.*GeV;
    7472  }
    75   SetLambdaBinning(120);
    7673  SetSecondaryParticle(G4Electron::Electron());
    77   buildElmTableFlag = true;
     74  SetProcessSubType(fCoulombScattering);
    7875}
    7976
     
    8582//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8683
     84G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
     85{
     86  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
     87}
     88
     89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     90
    8791void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
    8892{
    89   if(!isInitialised) {
     93  // second initialisation
     94  if(isInitialised) {
     95    G4VEmModel* mod = GetModelByIndex(0);
     96    mod->SetPolarAngleLimit(PolarAngleLimit());
     97    mod = GetModelByIndex(1);
     98    if(mod) mod->SetPolarAngleLimit(PolarAngleLimit());
     99
     100    // first initialisation
     101  } else {
    90102    isInitialised = true;
    91103    aParticle = p;
    92104    G4double mass = p->GetPDGMass();
    93105    if (mass > GeV || p->GetParticleType() == "nucleus") {
    94       buildElmTableFlag = false;
     106      SetBuildTableFlag(false);
    95107      verboseLevel = 0;
    96108    } else {
     
    106118    if(mass < MeV) eth  = thEnergyElec;
    107119    if(eth > emin) {
    108       G4eCoulombScatteringModel* model =
    109         new G4eCoulombScatteringModel(thetaMin,thetaMax,buildElmTableFlag,q2Max);
     120      G4eCoulombScatteringModel* model = new G4eCoulombScatteringModel();
     121      model->SetPolarAngleLimit(PolarAngleLimit());
    110122      model->SetLowEnergyLimit(emin);
    111123      model->SetHighEnergyLimit(std::min(eth,emax));
     
    113125    }
    114126    if(eth < emax) {
    115       G4CoulombScatteringModel* model =
    116         new G4CoulombScatteringModel(thetaMin,thetaMax,buildElmTableFlag,q2Max);
     127      G4CoulombScatteringModel* model = new G4CoulombScatteringModel();
     128      model->SetPolarAngleLimit(PolarAngleLimit());
    117129      model->SetLowEnergyLimit(eth);
    118130      model->SetHighEnergyLimit(emax);
     
    126138void G4CoulombScattering::PrintInfo()
    127139{
    128   G4cout << " Scattering of " << aParticle->GetParticleName()
    129          << " with   " << thetaMin/degree
    130          << " < Theta(degree) < " << thetaMax/degree
    131          << "; Eth(MeV)= ";
     140  G4cout << "      " << PolarAngleLimit()/degree
     141         << " < Theta(degree) < 180"
     142         << ", Eth(MeV)= ";
    132143  if(aParticle->GetPDGMass() < MeV) G4cout << thEnergyElec;
    133144  else                              G4cout << thEnergy;
  • trunk/source/processes/electromagnetic/standard/src/G4CoulombScatteringModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4CoulombScatteringModel.cc,v 1.29 2007/11/09 11:45:45 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4CoulombScatteringModel.cc,v 1.37 2008/07/31 13:11:34 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4444// 19.10.06 V.Ivanchenko use inheritance from G4eCoulombScatteringModel
    4545// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
     46// 09.06.08 V.Ivanchenko SelectIsotope is moved to the base class
    4647//
    4748// Class Description:
     
    5556#include "Randomize.hh"
    5657#include "G4ParticleChangeForGamma.hh"
    57 #include "G4NistManager.hh"
    5858#include "G4ParticleTable.hh"
    5959#include "G4IonTable.hh"
     
    6464using namespace std;
    6565
    66 G4CoulombScatteringModel::G4CoulombScatteringModel(
    67   G4double thetaMin, G4double thetaMax, G4bool build,
    68   G4double tlim, const G4String& nam)
    69   : G4eCoulombScatteringModel(thetaMin,thetaMax,build,tlim,nam)
    70 {
    71   theMatManager    = G4NistManager::Instance();
    72   theParticleTable = G4ParticleTable::GetParticleTable();
    73 }
     66G4CoulombScatteringModel::G4CoulombScatteringModel(const G4String& nam)
     67  : G4eCoulombScatteringModel(nam)
     68{}
    7469
    7570//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8479                                G4double kinEnergy,
    8580                                G4double Z,
    86                                 G4double A,
     81                                G4double,
    8782                                G4double cutEnergy,
    8883                                G4double)
    8984{
    90   if(p == particle && kinEnergy == tkin && Z == targetZ &&
    91      A == targetA && cutEnergy == ecut) return nucXSection;
    92 
    93   // Lab system
    94   G4double ekin = std::max(keV, kinEnergy);
    95   nucXSection = ComputeElectronXSectionPerAtom(p,ekin,Z,A,cutEnergy);
     85  SetupParticle(p);
     86  G4double ekin = std::max(lowEnergyLimit, kinEnergy);
     87  SetupKinematic(ekin, cutEnergy);
     88
     89  // save lab system kinematics
     90  G4double xtkin = tkin;
     91  G4double xmom2 = mom2;
     92  G4double xinvb = invbeta2;
    9693
    9794  // CM system
    9895  G4int iz      = G4int(Z);
    99   G4double m1   = theMatManager->GetAtomicMassAmu(iz)*amu_c2;
     96  G4double m2   = fNistManager->GetAtomicMassAmu(iz)*amu_c2;
    10097  G4double etot = tkin + mass;
    10198  G4double ptot = sqrt(mom2);
    102   G4double bet  = ptot/(etot + m1);
    103   G4double gam  = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
    104   G4double momCM= gam*(ptot - bet*etot);
    105 
    106   //  G4cout << "ptot= " << ptot << " etot= " << etot << " beta= "
    107   //     << bet << " gam= " << gam << " Z= " << Z << " A= " << A << G4endl;
    108   // G4cout << " CM. mom= " << momCM  << " m= " << m
    109   // << " m1= " << m1 << " iz= " << iz <<G4endl;
    110 
    111   G4double momCM2 = momCM*momCM;
    112   cosTetMaxNuc = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/momCM2);
    113   if(1.5 > targetA && p == theProton && cosTetMaxNuc < 0.0) cosTetMaxNuc = 0.0;
    114   //G4cout << " ctmax= " << cosTetMaxNuc
    115   //<< " ctmin= " << cosThetaMin << G4endl; 
    116 
    117   // Cross section in CM system
    118   if(cosTetMaxNuc < cosThetaMin) {
    119     G4double effmass = mass*m1/(mass + m1);
    120     G4double x1 = 1.0 - cosThetaMin;
    121     G4double x2 = 1.0 - cosTetMaxNuc;
    122     G4double z1 = x1 + screenZ;
    123     G4double z2 = x2 + screenZ;
    124     G4double d  = 1.0/formfactA;
    125     G4double zn1= x1 + d;
    126     G4double zn2= x2 + d;
    127     nucXSection += coeff*Z*Z*chargeSquare*(1.0 +  effmass*effmass/momCM2)
    128       *(1./z1 - 1./z2 + 1./zn1 - 1./zn2 +
    129         2.0*formfactA*std::log(z1*zn2/(z2*zn1)))/momCM2;
    130     //G4cout << "XS: x1= " << x1 << " x2= " << x2
    131     //<< " cross= " << cross << G4endl;
    132     //G4cout << "momCM2= " << momCM2 << " invbeta2= " << invbeta2
    133     //       << " coeff= " << coeff << G4endl;
    134   }
    135   if(nucXSection < 0.0) nucXSection = 0.0;
    136   return nucXSection;
    137 }
    138 
    139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    140 
    141 G4double G4CoulombScatteringModel::SelectIsotope(const G4Element* elm)
    142 {
    143   G4double N = elm->GetN();
    144   G4int ni   = elm->GetNumberOfIsotopes();
    145   if(ni > 0) {
    146     G4double* ab = elm->GetRelativeAbundanceVector();
    147     G4double x = G4UniformRand();
    148     G4int idx;
    149     for(idx=0; idx<ni; idx++) {
    150       x -= ab[idx];
    151       if (x <= 0.0) break;
    152     }
    153     if(idx >= ni) {
    154       G4cout << "G4CoulombScatteringModel::SelectIsotope WARNING: "
    155              << "abandance vector for"
    156              << elm->GetName() << " is not normalised to unit" << G4endl;
    157     } else {
    158       N = G4double(elm->GetIsotope(idx)->GetN());
    159     }
    160   }
    161   return N;
     99
     100  G4double m12  = mass*mass;
     101  G4double momCM= ptot*m2/sqrt(m12 + m2*m2 + 2.0*etot*m2);
     102
     103  mom2 = momCM*momCM;
     104  tkin = sqrt(mom2 + m12) - mass;
     105  invbeta2 = 1.0 +  m12/mom2;
     106
     107  SetupTarget(Z, tkin);
     108
     109  G4double xsec = CrossSectionPerAtom();
     110
     111  // restore Lab system kinematics
     112  tkin = xtkin;
     113  mom2 = xmom2;
     114  invbeta2 = xinvb;
     115
     116  return xsec;
    162117}
    163118
     
    169124                               const G4DynamicParticle* dp,
    170125                               G4double cutEnergy,
    171                                G4double maxEnergy)
     126                               G4double)
    172127{
    173   const G4Material* aMaterial = couple->GetMaterial();
    174   const G4ParticleDefinition* p = dp->GetDefinition();
    175128  G4double kinEnergy = dp->GetKineticEnergy();
    176 
    177   // Select isotope and setup
    178   SetupParticle(p);
    179   const G4Element* elm =
    180     SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy);
    181   G4double Z  = elm->GetZ();
    182   G4double A  = SelectIsotope(elm);
     129  if(kinEnergy <= DBL_MIN) return;
     130  DefineMaterial(couple);
     131  SetupParticle(dp->GetDefinition());
     132  G4double ekin = std::max(lowEnergyLimit, kinEnergy);
     133  SetupKinematic(ekin, cutEnergy);
     134
     135  // Choose nucleus
     136  currentElement = SelectRandomAtom(couple,particle,ekin,ecut,tkin);
     137
     138  G4double Z  = currentElement->GetZ();
    183139  G4int iz    = G4int(Z);
    184   G4int ia    = G4int(A + 0.5);
    185 
    186   G4double cross =
    187     ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy);
    188 
    189   G4double costm = cosTetMaxNuc;
    190   G4double formf = formfactA;
    191   if(G4UniformRand()*cross < elecXSection) {
    192     costm = cosTetMaxElec;
    193     formf = 0.0;
    194   }
    195 
    196   //  G4cout << "SampleSec: Ekin= " << kinEnergy << " m1= " << m1
    197   // << " Z= "<< Z << " A= " <<A<< G4endl;
    198 
    199   if(costm >= cosThetaMin) return;
    200 
    201   // kinematics in CM system
    202   G4double m1   = theParticleTable->GetIonTable()->GetNucleusMass(iz, ia);
    203   G4double etot = kinEnergy + mass;
     140  G4int ia    = SelectIsotopeNumber(currentElement);
     141  G4double m2 = theParticleTable->GetIonTable()->GetNucleusMass(iz, ia);
     142
     143  // CM system
     144  G4double etot = tkin + mass;
    204145  G4double ptot = sqrt(mom2);
    205   G4double bet  = ptot/(etot + m1);
     146
     147  G4double momCM= ptot*m2/sqrt(mass*mass + m2*m2 + 2.0*etot*m2);
     148  mom2 = momCM*momCM;
     149  G4double m12 = mass*mass;
     150  G4double eCM = sqrt(mom2 + m12);
     151
     152  // a correction for heavy projectile
     153  G4double fm = m2/(mass + m2);
     154  invbeta2 = 1.0 +  m12*fm*fm/mom2;
     155
     156  // sample scattering angle in CM system
     157  SetupTarget(Z, eCM - mass);
     158
     159  G4double cost = SampleCosineTheta();
     160  G4double z1   = 1.0 - cost;
     161  if(z1 < 0.0) return;
     162
     163  G4double sint = sqrt(z1*(1.0 + cost));
     164  G4double phi  = twopi * G4UniformRand();
     165
     166  // kinematics in the Lab system
     167  G4double bet  = ptot/(etot + m2);
    206168  G4double gam  = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
    207   G4double pCM  = gam*(ptot - bet*etot);
    208   G4double eCM  = gam*(etot - bet*ptot);
    209 
    210   G4double x1 = 1. - cosThetaMin + screenZ;
    211   G4double x2 = 1. - costm;
    212   G4double x3 = cosThetaMin - costm;
    213 
    214   G4double grej,  z, z1;
    215   do {
    216     z  = G4UniformRand()*x3;
    217     z1 = (x1*x2 - screenZ*z)/(x1 + z);
    218     if(z1 < 0.0) z1 = 0.0;
    219     else if(z1 > 2.0) z1 = 2.0;
    220     grej = 1.0/(1.0 + formf*z1);
    221   } while ( G4UniformRand() > grej*grej ); 
    222  
    223   G4double cost = 1.0 - z1;
    224   G4double sint= sqrt(z1*(2.0 - z1));
    225 
    226   G4double phi = twopi * G4UniformRand();
    227 
    228   // projectile after scattering
    229   G4double pzCM = pCM*cost;
    230   G4ThreeVector v1(pCM*cos(phi)*sint,pCM*sin(phi)*sint,gam*(pzCM + bet*eCM));
     169  G4double pzCM = momCM*cost;
     170
     171  G4ThreeVector v1(momCM*cos(phi)*sint,momCM*sin(phi)*sint,gam*(pzCM + bet*eCM));
    231172  G4ThreeVector dir = dp->GetMomentumDirection();
    232173  G4ThreeVector newDirection = v1.unit();
    233174  newDirection.rotateUz(dir);   
    234175  fParticleChange->ProposeMomentumDirection(newDirection);   
     176
    235177  G4double elab = gam*(eCM + bet*pzCM);
    236   G4double ekin = elab - mass;
     178  ekin = elab - mass;
    237179  if(ekin < 0.0) ekin = 0.0;
    238   G4double plab = sqrt(ekin*(ekin + 2.0*mass));
    239180  fParticleChange->SetProposedKineticEnergy(ekin);
    240181
    241182  // recoil
    242183  G4double erec = kinEnergy - ekin;
    243   if(erec > Z*aMaterial->GetIonisation()->GetMeanExcitationEnergy()) {
     184  G4double th =
     185    std::min(recoilThreshold,
     186             Z*currentElement->GetIonisation()->GetMeanExcitationEnergy());
     187
     188  if(erec > th) {
    244189    G4ParticleDefinition* ion = theParticleTable->FindIon(iz, ia, 0, iz);
     190    G4double plab = sqrt(ekin*(ekin + 2.0*mass));
    245191    G4ThreeVector p2 = (ptot*dir - plab*newDirection).unit();
    246192    G4DynamicParticle* newdp  = new G4DynamicParticle(ion, p2, erec);
  • trunk/source/processes/electromagnetic/standard/src/G4GammaConversion.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4GammaConversion.cc,v 1.27 2006/09/14 10:27:19 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4GammaConversion.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    7979    isInitialised(false)
    8080{
    81   SetLambdaBinning(100);
    8281  SetMinKinEnergy(2.0*electron_mass_c2);
    83   SetMaxKinEnergy(100.0*GeV);
     82  SetProcessSubType(fGammaConversion);
    8483}
    8584
     
    9190//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    9291
     92G4bool G4GammaConversion::IsApplicable(const G4ParticleDefinition& p)
     93{
     94  return (&p == G4Gamma::Gamma());
     95}
     96
     97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     98
    9399void G4GammaConversion::InitialiseProcess(const G4ParticleDefinition*)
    94100{
     
    97103    SetBuildTableFlag(true);
    98104    SetSecondaryParticle(G4Electron::Electron());
    99     G4double emin = max(MinKinEnergy(), 2.0*electron_mass_c2);
     105    G4double emin = std::max(MinKinEnergy(), 2.0*electron_mass_c2);
    100106    SetMinKinEnergy(emin);
    101     G4double emax = MaxKinEnergy();
    102     if(!Model()) SetModel(new G4BetheHeitlerModel);
     107    if(!Model()) SetModel(new G4BetheHeitlerModel());
    103108    Model()->SetLowEnergyLimit(emin);
    104     Model()->SetHighEnergyLimit(emax);
     109    Model()->SetHighEnergyLimit(MaxKinEnergy());
    105110    AddEmModel(1, Model());
    106111  }
     
    110115
    111116void G4GammaConversion::PrintInfo()
    112 {
    113   G4cout
    114     << " Total cross sections has a good parametrisation"
    115     << " from 1.5 MeV to 100 GeV for all Z;"
    116     << "\n      sampling secondary e+e- according "
    117     << Model()->GetName() << " model"
    118     << G4endl;
    119 }         
     117{}         
    120118
    121119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4InitXscPAI.cc

    r819 r961  
    2626//
    2727// $Id: G4InitXscPAI.cc,v 1.9 2006/06/29 19:53:00 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4IonFluctuations.cc,v 1.5.2.1 2008/04/25 00:22:53 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4IonFluctuations.cc,v 1.25 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4646// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
    4747// 27-09-07 Use FermiEnergy from material, add cut dependence (V.Ivanchenko)
     48// 01-02-08 Add protection for small energies and optimise the code (V.Ivanchenko)
     49// 01-06-08 Added initialisation of effective charge prestep (V.Ivanchenko)
    4850//
    4951// Class Description:
     
    6062#include "G4Material.hh"
    6163#include "G4DynamicParticle.hh"
    62 #include "G4ParticleDefinition.hh"
    6364
    6465//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    6768
    6869G4IonFluctuations::G4IonFluctuations(const G4String& nam)
    69  :G4VEmFluctuationModel(nam),
    70   particle(0),
    71   minNumberInteractionsBohr(10.0),
    72   theBohrBeta2(50.0*keV/proton_mass_c2),
    73   minFraction(0.2),
    74   xmin(0.2),
    75   minLoss(0.001*eV)
     70  : G4VEmFluctuationModel(nam),
     71    particle(0),
     72    particleMass(proton_mass_c2),
     73    charge(1.0),
     74    chargeSquare(1.0),
     75    effChargeSquare(1.0),
     76    parameter(10.0*CLHEP::MeV/CLHEP::proton_mass_c2),
     77    minNumberInteractionsBohr(0.0),
     78    theBohrBeta2(50.0*keV/CLHEP::proton_mass_c2),
     79    minFraction(0.2),
     80    xmin(0.2),
     81    minLoss(0.001*eV)
    7682{}
    7783
     
    8995  charge         = part->GetPDGCharge()/eplus;
    9096  chargeSquare   = charge*charge;
    91   chargeSqRatio  = 1.0;
     97  effChargeSquare= chargeSquare;
     98  uniFluct.InitialiseMe(part);
    9299}
    93100
     
    96103G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
    97104                                               const G4DynamicParticle* dp,
    98                                                      G4double& tmax,
    99                                                      G4double& length,
    100                                                      G4double& meanLoss)
    101 {
     105                                               G4double& tmax,
     106                                               G4double& length,
     107                                               G4double& meanLoss)
     108{
     109  //  G4cout << "### meanLoss= " << meanLoss << G4endl;
    102110  if(meanLoss <= minLoss) return meanLoss;
    103   //  G4cout << "### meanLoss= " << meanLoss << G4endl;
     111
     112  //G4cout << "G4IonFluctuations::SampleFluctuations E(MeV)= " << dp->GetKineticEnergy()
     113  //     << "  Elim(MeV)= " << parameter*charge*particleMass << G4endl;
     114
     115  // Vavilov fluctuations
     116  if(dp->GetKineticEnergy() > parameter*charge*particleMass) {
     117    return uniFluct.SampleFluctuations(material,dp,tmax,length,meanLoss);
     118  }
    104119
    105120  G4double siga = Dispersion(material,dp,tmax,length);
     
    107122 
    108123  G4double navr = minNumberInteractionsBohr;
    109 
    110124  navr = meanLoss*meanLoss/siga;
    111   //  G4cout << "### siga= " << sqrt(siga) << "  navr= " << navr << G4endl;
     125  //G4cout << "### siga= " << sqrt(siga) << "  navr= " << navr << G4endl;
    112126
    113127  // Gaussian fluctuation
     
    126140    //       G4cout << "siga= " << siga << G4endl;
    127141    siga = sqrt(siga);
    128 
    129142    G4double lossmax = meanLoss+meanLoss;
    130     do {
    131       loss = G4RandGauss::shoot(meanLoss,siga);
    132     } while (0.0 > loss || loss > lossmax);
    133 
     143
     144    if(siga > 5.0*meanLoss) {
     145      loss = lossmax*G4UniformRand();
     146    } else {
     147      do {
     148        loss = G4RandGauss::shoot(meanLoss,siga);
     149      } while (0.0 > loss || loss > lossmax);
     150    }
    134151  // Poisson fluctuations
    135152  } else {
     
    139156  }
    140157
    141   //  G4cout << "meanLoss= " << meanLoss << " loss= " << loss << G4endl;
     158  //G4cout << "meanLoss= " << meanLoss << " loss= " << loss << G4endl;
    142159  return loss;
    143160}
     
    145162//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    146163
    147 G4double G4IonFluctuations::Dispersion(
    148                           const G4Material* material,
    149                           const G4DynamicParticle* dp,
    150                                 G4double& tmax,
    151                                 G4double& length)
    152 {
    153   particle       = dp->GetDefinition();
    154   charge         = particle->GetPDGCharge()/eplus;
    155   G4double Q2    = charge*charge;
    156   particleMass   = particle->GetPDGMass();
    157   G4double q     = dp->GetCharge()/eplus;
    158   chargeSquare   = q*q;
    159   chargeSqRatio  = chargeSquare/Q2;
    160 
    161   //chargeSquare   = charge*charge;
    162   //chargeSqRatio  = 1.0;
     164G4double G4IonFluctuations::Dispersion(const G4Material* material,
     165                                       const G4DynamicParticle* dp,
     166                                       G4double& tmax,
     167                                       G4double& length)
     168{
     169  kineticEnergy = dp->GetKineticEnergy();
     170  G4double etot = kineticEnergy + particleMass;
     171  beta2 = kineticEnergy*(kineticEnergy + 2.*particleMass)/(etot*etot);
    163172
    164173  G4double electronDensity = material->GetElectronDensity();
    165   kineticEnergy  = dp->GetKineticEnergy();
    166   G4double etot = kineticEnergy + particleMass;
    167   //G4cout << "e= " <<  kineticEnergy << " m= " << particleMass
    168   //     << " tmax= " << tmax << " l= " << length << " q^2= " << chargeSquare << G4endl;
    169   beta2 = kineticEnergy*(kineticEnergy + 2.*particleMass)/(etot*etot);
    170 
     174
     175  /*
     176  G4cout << "e= " <<  kineticEnergy << " m= " << particleMass
     177         << " tmax= " << tmax << " l= " << length
     178         << " q^2= " << effChargeSquare << " beta2=" << beta2<< G4endl;
     179  */
    171180  G4double siga = (1. - beta2*0.5)*tmax*length*electronDensity*
    172     twopi_mc2_rcl2*Q2/beta2;
     181    twopi_mc2_rcl2*chargeSquare/beta2;
    173182
    174183  // Low velocity - additional ion charge fluctuations according to
    175184  // Q.Yang et al., NIM B61(1991)149-155.
    176   G4double zeff  = electronDensity/(material->GetTotNbOfAtomsPerVolume());
    177   //G4cout << "siga= " << siga << " zeff= " << zeff << " c= " << c << G4endl;
    178 
    179   G4double f = 0.0;
    180 
    181   // correction factors with cut dependence 
    182   if ( beta2 < 3.0*theBohrBeta2*zeff ) {
    183 
    184     G4double a = CoeffitientA (zeff);
    185     G4double b = CoeffitientB (material, zeff);
    186     //     G4cout << "a= " << a <<  " b= " << b << G4endl;
    187     f = a*chargeSqRatio + b;
    188   } else {
    189  
    190     // H.Geissel et al. NIM B, 195 (2002) 3.
    191     f = RelativisticFactor(material, zeff);
    192   }
     185  //G4cout << "sigE= " << sqrt(siga) << " charge= " << charge <<G4endl;
     186
     187  G4double Z = electronDensity/material->GetTotNbOfAtomsPerVolume();
     188 
     189  G4double fac = Factor(material, Z);
    193190
    194191  // heavy ion correction
     
    196193  if(beta2 > theBohrBeta2)  f1/= beta2;
    197194  else                      f1/= theBohrBeta2;
    198   if(f1 > 2.0) f1 = 2.0;
    199   f *= (1.0 + f1);
    200 
    201   if(f > 1.0) {
    202     siga *= (1. + (f - 1.0)*2.0*electron_mass_c2*beta2/(tmax*(1.0 - beta2)));
    203   }
    204   //  G4cout << "siga= " << siga << G4endl;
     195  if(f1 > 2.5) f1 = 2.5;
     196  fac *= (1.0 + f1);
     197
     198  // taking into account the cut
     199  if(fac > 1.0) {
     200    siga *= (1.0 + (fac - 1.0)*2.0*electron_mass_c2*beta2/(tmax*(1.0 - beta2)));
     201  }
     202  //G4cout << "siga(keV)= " << sqrt(siga)/keV << " fac= " << fac
     203  //     << "  f1= " << f1 << G4endl;
    205204
    206205  return siga;
     
    209208//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    210209
    211 G4double G4IonFluctuations::CoeffitientA(G4double& zeff)
     210G4double G4IonFluctuations::Factor(const G4Material* material, G4double Z)
    212211{
    213212  // The aproximation of energy loss fluctuations
     
    215214
    216215  // Reduced energy in MeV/AMU
    217   G4double energy = kineticEnergy * amu_c2/(particleMass*MeV) ;
    218   static G4double a[96][4] = {
     216  G4double energy = kineticEnergy *amu_c2/(particleMass*MeV) ;
     217
     218  // simple approximation for higher beta2
     219  G4double s1 = RelativisticFactor(material, Z);
     220
     221  // tabulation for lower beta2
     222  if( beta2 < 3.0*theBohrBeta2*Z ) {
     223
     224    static G4double a[96][4] = {
    219225 {-0.3291, -0.8312,  0.2460, -1.0220},
    220226 {-0.5615, -0.5898,  0.5205, -0.7258},
     
    260266 {-0.3972, -0.3600,  1.0260, -0.5842},
    261267
    262 {-0.3985, -0.3803,  1.0200, -0.6013},
     268 {-0.3985, -0.3803,  1.0200, -0.6013},
    263269 {-0.3985, -0.3979,  1.0150, -0.6168},
    264270 {-0.3968, -0.3990,  1.0160, -0.6195},
     
    322328 {-0.4284, -0.3204,  1.6290, -0.6380},
    323329 {-0.4227, -0.3217,  1.6360, -0.6438}
    324   } ;
    325 
    326   G4int iz = (G4int)zeff - 2 ;
    327   if( 0 > iz ) iz = 0 ;
    328   if(95 < iz ) iz = 95 ;
    329 
    330   G4double q = 1.0 / (1.0 + a[iz][0]*pow(energy,a[iz][1])+
    331                           + a[iz][2]*pow(energy,a[iz][3])) ;
    332 
    333   return q ;
    334 }
    335 
    336 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    337 
    338 G4double G4IonFluctuations::CoeffitientB(const G4Material* material, G4double& zeff)
    339 {
    340   // The aproximation of energy loss fluctuations
    341   // Q.Yang et al., NIM B61(1991)149-155.
    342 
    343   // Reduced energy in MeV/AMU
    344   G4double energy = kineticEnergy *amu_c2/(particleMass*MeV) ;
     330    } ;
     331
     332    G4int iz = G4int(Z) - 2;
     333    if( 0 > iz )      iz = 0;
     334    else if(95 < iz ) iz = 95;
     335
     336    G4double ss = 1.0 + a[iz][0]*pow(energy,a[iz][1])+
     337      + a[iz][2]*pow(energy,a[iz][3]);
     338 
     339    // protection for the validity range for low beta
     340    G4double slim = 0.001;
     341    if(ss < slim) s1 = 1.0/slim;
     342    // for high value of beta
     343    else if(s1*ss < 1.0) s1 = 1.0/ss;
     344  }
    345345
    346346  G4int i = 0 ;
     
    366366  // ions
    367367  } else {
    368     factor = charge * pow(charge/zeff, 0.3333) ;
     368
     369    factor = charge * pow(charge/Z, 0.33333333);
    369370
    370371    if( kStateGas == material->GetState() ) {
     
    378379
    379380    } else {
    380       energy /= (charge * sqrt(charge*zeff)) ;
     381      energy /= (charge * sqrt(charge*Z)) ;
    381382      i = 4 ;
    382383    }
    383384  }
    384385
    385   G4double x = b[i][2] * (1.0 - exp( - energy * b[i][3] )) ;
    386 
    387   G4double q = factor * x * b[i][0] /
    388              ((energy - b[i][1])*(energy - b[i][1]) + x*x) ;
    389 
    390   return q ;
    391 }
    392 
    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    394 
    395 G4double G4IonFluctuations::RelativisticFactor(const G4Material* material,
    396                                                G4double& zeff)
    397 {
     386  G4double x = b[i][2];
     387  G4double y = energy * b[i][3];
     388  if(y <= 0.2) x *= (y*(1.0 - 0.5*y));
     389  else         x *= (1.0 - exp(-y));
     390
     391  y = energy - b[i][1];
     392
     393  G4double s2 = factor * x * b[i][0] / (y*y + x*x);
     394  /* 
     395  G4cout << "s1= " << s1 << " s2= " << s2 << " q^2= " << effChargeSquare
     396         << " e= " << energy << G4endl;
     397  */
     398  return s1*effChargeSquare/chargeSquare + s2;
     399}
     400
     401//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     402
     403G4double G4IonFluctuations::RelativisticFactor(const G4Material* mat,
     404                                               G4double Z)
     405{
     406  G4double eF = mat->GetIonisation()->GetFermiEnergy();
     407  G4double I  = mat->GetIonisation()->GetMeanExcitationEnergy();
     408
    398409  // H.Geissel et al. NIM B, 195 (2002) 3.
    399   G4double eF = material->GetIonisation()->GetFermiEnergy();
    400410  G4double bF2= 2.0*eF/electron_mass_c2;
    401   G4double I  = material->GetIonisation()->GetMeanExcitationEnergy();
    402   G4double f  = 0.4*(1.0 - beta2)/((1.0 - 0.5*beta2)*zeff);
     411  G4double f  = 0.4*(1.0 - beta2)/((1.0 - 0.5*beta2)*Z);
    403412  if(beta2 > bF2) f *= log(2.0*electron_mass_c2*beta2/I)*bF2/beta2;
    404413  else            f *= log(4.0*eF/I);
    405  
     414
     415  //  G4cout << "f= " << f << " beta2= " << beta2
     416  //     << " bf2= " << bF2 << " q^2= " << chargeSquare << G4endl;
     417
    406418  return 1.0 + f;
    407419}
    408420
    409421//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     422
     423void G4IonFluctuations::SetParticleAndCharge(const G4ParticleDefinition* part,
     424                                             G4double q2)
     425{
     426  if(part != particle) {
     427    particle       = part;
     428    particleMass   = part->GetPDGMass();
     429    charge         = part->GetPDGCharge()/eplus;
     430    chargeSquare   = charge*charge;
     431  }
     432  effChargeSquare  = q2;
     433  uniFluct.SetParticleAndCharge(part, q2);
     434}
     435
     436//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/standard/src/G4KleinNishinaCompton.cc

    r819 r961  
    2525//
    2626// $Id: G4KleinNishinaCompton.cc,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/src/G4MollerBhabhaModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MollerBhabhaModel.cc,v 1.30 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MollerBhabhaModel.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7474                                         const G4String& nam)
    7575  : G4VEmModel(nam),
    76   particle(0),
    77   isElectron(true),
    78   twoln10(2.0*log(10.0)),
    79   lowLimit(0.2*keV)
     76    particle(0),
     77    isElectron(true),
     78    twoln10(2.0*log(10.0)),
     79    lowLimit(0.2*keV),
     80    isInitialised(false)
    8081{
    8182  theElectron = G4Electron::Electron();
     
    8788G4MollerBhabhaModel::~G4MollerBhabhaModel()
    8889{}
    89 
    90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    91 
    92 void G4MollerBhabhaModel::SetParticle(const G4ParticleDefinition* p)
    93 {
    94   particle = p;
    95   if(p != theElectron) isElectron = false;
    96 }
    9790
    9891//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    108101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    109102
     103G4double G4MollerBhabhaModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
     104                                                 G4double kinEnergy)
     105{
     106  G4double tmax = kinEnergy;
     107  if(isElectron) tmax *= 0.5;
     108  return tmax;
     109}
     110
     111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     112
    110113void G4MollerBhabhaModel::Initialise(const G4ParticleDefinition* p,
    111114                                     const G4DataVector&)
    112115{
    113116  if(!particle) SetParticle(p);
    114   if(pParticleChange)
     117  SetDeexcitationFlag(false);
     118
     119  if(isInitialised) return;
     120
     121  isInitialised = true;
     122  if(pParticleChange) {
    115123    fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
    116124                                                     (pParticleChange);
    117   else
     125  } else {
    118126    fParticleChange = new G4ParticleChangeForLoss();
     127  }
    119128}
    120129
  • trunk/source/processes/electromagnetic/standard/src/G4MscModel71.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MscModel71.cc,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MscModel71.cc,v 1.6 2008/03/13 17:20:07 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    561561  G4double tau = trueStepLength/lambda0 ;
    562562
    563   if(trueStepLength >= currentRange*dtrl)
     563  if(trueStepLength >= currentRange*dtrl) {
    564564    if(par1*trueStepLength < 1.)
    565565      tau = -par2*log(1.-par1*trueStepLength) ;
    566566    else
    567567      tau = taubig ;
    568 
     568  }
    569569  currentTau = tau ;
    570570
  • trunk/source/processes/electromagnetic/standard/src/G4MultipleScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MultipleScattering.cc,v 1.70 2007/10/29 08:57:19 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4MultipleScattering.cc,v 1.75 2008/10/15 17:53:44 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    121121// 12-02-07 skin can be changed via UI command, default skin=1 (VI)
    122122// 24-04-07 default skin=0 (temporal protection) (VI)
     123// 11-03-08 use G4VMscModel interface (VI)
    123124//
    124125// -----------------------------------------------------------------------------
     
    130131#include "G4UrbanMscModel.hh"
    131132#include "G4MscStepLimitType.hh"
     133#include "G4UrbanMscModel.hh"
    132134
    133135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    138140  : G4VMultipleScattering(processName)
    139141{
    140   dtrl              = 0.05;
    141   lambdalimit       = 1.*mm;
    142  
    143   samplez           = false ;
    144   isInitialized     = false; 
     142  isInitialized = false; 
    145143}
    146144
     
    178176    SetLateralDisplasmentFlag(false);
    179177    SetBuildLambdaTable(false);
    180     SetSkin(0.0);
    181     SetRangeFactor(0.2);
    182178  }
    183179
    184180  // initialisation of parameters - defaults for particles other
    185181  // than ions can be overwritten by users
    186   mscUrban = new G4UrbanMscModel(RangeFactor(),dtrl,lambdalimit,
    187                                  GeomFactor(),Skin(),
    188                                  samplez,StepLimitType());
     182  mscUrban = new G4UrbanMscModel();
     183  mscUrban->SetStepLimitType(StepLimitType());
    189184  mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
     185  mscUrban->SetSkin(Skin());
     186  mscUrban->SetRangeFactor(RangeFactor());
     187  mscUrban->SetGeomFactor(GeomFactor());
    190188
    191189  AddEmModel(1,mscUrban);
     
    204202void G4MultipleScattering::PrintInfo()
    205203{
    206   G4cout << "      Boundary/stepping algorithm is active with RangeFactor= "
    207          << RangeFactor()
    208          << "  Step limit type " << StepLimitType()
     204  G4cout << "      RangeFactor= " << RangeFactor()
     205         << ", step limit type: " << StepLimitType()
     206         << ", lateralDisplacement: " << LateralDisplasmentFlag()
     207         << ", skin= " << Skin() 
     208         << ", geomFactor= " << GeomFactor() 
    209209         << G4endl;
    210210}
  • trunk/source/processes/electromagnetic/standard/src/G4MultipleScattering71.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4MultipleScattering71.cc,v 1.4 2006/10/16 15:26:49 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4MultipleScattering71.cc,v 1.5 2008/07/16 11:27:41 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    7676
    7777#include "G4MultipleScattering71.hh"
     78#include "G4LossTableManager.hh"
    7879#include "G4MscModel71.hh"
    7980
     
    176177}
    177178
     179//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     180
     181G4double G4MultipleScattering71::GetContinuousStepLimit(
     182                                          const G4Track& track,
     183                                                G4double,
     184                                                G4double currentMinimalStep,
     185                                                G4double&)
     186{
     187  DefineMaterial(track.GetMaterialCutsCouple());
     188  const G4MaterialCutsCouple* couple = CurrentMaterialCutsCouple();
     189  G4double e = track.GetKineticEnergy();
     190  model = dynamic_cast<G4MscModel71*>(SelectModel(e));
     191  const G4ParticleDefinition* p = track.GetDefinition();
     192  G4double lambda0 = GetLambda(p, e);
     193  range =  G4LossTableManager::Instance()->GetRangeFromRestricteDEDX(p,e,couple);
     194  if(range < currentMinimalStep) currentMinimalStep = range;
     195  truePathLength = TruePathLengthLimit(track,lambda0,currentMinimalStep);
     196  //  G4cout << "StepLimit: tpl= " << truePathLength << " lambda0= "
     197  //       << lambda0 << " range= " << currentRange
     198  //       << " currentMinStep= " << currentMinimalStep << G4endl;
     199  if (truePathLength < currentMinimalStep) valueGPILSelectionMSC = CandidateForSelection;
     200  geomPathLength = model->GeomPathLength(LambdaTable(),couple,
     201           p,e,lambda0,range,truePathLength);
     202  if(geomPathLength > lambda0) geomPathLength = lambda0;
     203  return geomPathLength;
     204}
     205
    178206//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    179207
  • trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
     26// $Id: G4PAIModel.cc,v 1.46 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
     28//
     29// -------------------------------------------------------------------
     30//
     31// GEANT4 Class
    2632// File name:     G4PAIModel.cc
    2733//
     
    177183      fCutCouple = theCoupleTable->GetMaterialCutsCouple( fMaterial,
    178184                                          curReg->GetProductionCuts() );
     185      //G4cout << "Reg <" <<curReg->GetName() << ">  mat <"
     186      //             << fMaterial->GetName() << ">  fCouple= "
     187      //             << fCutCouple<<G4endl;
    179188      if( fCutCouple ) {
    180189        fMaterialCutsCoupleVector.push_back(fCutCouple);
     
    197206  }
    198207}
     208
     209//////////////////////////////////////////////////////////////////
     210
     211void G4PAIModel::InitialiseMe(const G4ParticleDefinition*)
     212{}
    199213
    200214//////////////////////////////////////////////////////////////////
     
    393407  {
    394408    //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    395     if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     409    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     410    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
    396411    else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    397412  }
     
    435450  {
    436451    //  if ( x1 == x2  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    437     if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     452    //    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     453    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*0.5 ;
    438454    else             dEdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    439455  }
     
    444460//////////////////////////////////////////////////////////////////////////////
    445461
    446 G4double G4PAIModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
    447                                  const G4ParticleDefinition* p,
    448                                        G4double kineticEnergy,
    449                                        G4double cutEnergy)
     462G4double G4PAIModel::ComputeDEDXPerVolume(const G4Material*,
     463                                          const G4ParticleDefinition* p,
     464                                          G4double kineticEnergy,
     465                                          G4double cutEnergy)
    450466{
    451467  G4int iTkin,iPlace;
    452468  size_t jMat;
     469 
     470  //G4double cut = std::min(MaxSecondaryEnergy(p, kineticEnergy), cutEnergy);
     471  G4double cut = cutEnergy;
     472
    453473  G4double massRatio  = fMass/p->GetPDGMass();
    454474  G4double scaledTkin = kineticEnergy*massRatio;
    455475  G4double charge     = p->GetPDGCharge();
    456   G4double charge2    = charge*charge, dEdx;
     476  G4double charge2    = charge*charge;
     477  const G4MaterialCutsCouple* matCC = CurrentCouple();
    457478
    458479  for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
     
    470491  iPlace = iTkin - 1;
    471492  if(iPlace < 0) iPlace = 0;
    472   dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cutEnergy) ) ; 
    473 
     493  G4double dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cut) );
    474494  if( dEdx < 0.) dEdx = 0.;
    475495  return dEdx;
     
    478498/////////////////////////////////////////////////////////////////////////
    479499
    480 G4double G4PAIModel::CrossSection( const G4MaterialCutsCouple* matCC,
    481                                    const G4ParticleDefinition* p,
    482                                          G4double kineticEnergy,
    483                                          G4double cutEnergy,
    484                                          G4double maxEnergy  )
     500G4double G4PAIModel::CrossSectionPerVolume( const G4Material*,
     501                                            const G4ParticleDefinition* p,
     502                                            G4double kineticEnergy,
     503                                            G4double cutEnergy,
     504                                            G4double maxEnergy  )
    485505{
    486506  G4int iTkin,iPlace;
    487507  size_t jMat;
    488   G4double tmax = min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
     508  G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
     509  if(tmax <= cutEnergy) return 0.0;
    489510  G4double massRatio  = fMass/p->GetPDGMass();
    490511  G4double scaledTkin = kineticEnergy*massRatio;
    491512  G4double charge     = p->GetPDGCharge();
    492513  G4double charge2    = charge*charge, cross, cross1, cross2;
     514  const G4MaterialCutsCouple* matCC = CurrentCouple();
    493515
    494516  for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
     
    935957}
    936958
     959/////////////////////////////////////////////////////////////////////
     960
     961G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
     962                                         G4double kinEnergy)
     963{
     964  G4double tmax = kinEnergy;
     965  if(p == fElectron) tmax *= 0.5;
     966  else if(p != fPositron) {
     967    G4double mass = p->GetPDGMass();
     968    G4double ratio= electron_mass_c2/mass;
     969    G4double gamma= kinEnergy/mass + 1.0;
     970    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
     971                  (1. + 2.0*gamma*ratio + ratio*ratio);
     972  }
     973  return tmax;
     974}
     975
     976///////////////////////////////////////////////////////////////
     977
     978void G4PAIModel::DefineForRegion(const G4Region* r)
     979{
     980  fPAIRegionVector.push_back(r);
     981}
    937982
    938983//
  • trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
     26// $Id: G4PAIPhotonModel.cc,v 1.21 2009/02/19 19:17:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
     28//
     29// -------------------------------------------------------------------
     30//
     31// GEANT4 Class
    2632// File name:     G4PAIPhotonModel.cc
    2733//
     
    217223//////////////////////////////////////////////////////////////////
    218224
     225void G4PAIPhotonModel::InitialiseMe(const G4ParticleDefinition*)
     226{}
     227
     228//////////////////////////////////////////////////////////////////
     229
    219230void G4PAIPhotonModel::ComputeSandiaPhotoAbsCof()
    220231{
     
    487498  {
    488499    //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    489     if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     500    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     501    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
    490502    else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    491503  }
     
    530542  {
    531543    //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    532     if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     544    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     545    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
    533546    else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    534547  }
     
    574587  {
    575588    //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    576     if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     589    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     590    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
    577591    else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    578592  }
     
    617631  {
    618632    //  if ( x1 == x2  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
    619     if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     633    //    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
     634    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*0.5 ;
    620635    else             dEdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;     
    621636  }
     
    626641//////////////////////////////////////////////////////////////////////////////
    627642
    628 G4double G4PAIPhotonModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
    629                                  const G4ParticleDefinition* p,
    630                                        G4double kineticEnergy,
    631                                        G4double cutEnergy)
     643G4double G4PAIPhotonModel::ComputeDEDXPerVolume(const G4Material*,
     644                                                const G4ParticleDefinition* p,
     645                                                G4double kineticEnergy,
     646                                                G4double cutEnergy)
    632647{
    633648  G4int iTkin,iPlace;
    634649  size_t jMat;
     650
     651  //G4double cut = std::min(MaxSecondaryEnergy(p, kineticEnergy), cutEnergy);
     652  G4double cut = cutEnergy;
     653
    635654  G4double particleMass = p->GetPDGMass();
    636655  G4double scaledTkin   = kineticEnergy*proton_mass_c2/particleMass;
     
    638657  G4double charge2      = charge*charge;
    639658  G4double dEdx         = 0.;
     659  const G4MaterialCutsCouple* matCC = CurrentCouple();
    640660
    641661  for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
     
    653673  iPlace = iTkin - 1;
    654674  if(iPlace < 0) iPlace = 0;
    655   dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cutEnergy) ) ; 
     675  dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cut) ) ; 
    656676
    657677  if( dEdx < 0.) dEdx = 0.;
     
    661681/////////////////////////////////////////////////////////////////////////
    662682
    663 G4double G4PAIPhotonModel::CrossSection( const G4MaterialCutsCouple* matCC,
    664                                    const G4ParticleDefinition* p,
    665                                          G4double kineticEnergy,
    666                                          G4double cutEnergy,
    667                                          G4double maxEnergy  )
     683G4double G4PAIPhotonModel::CrossSectionPerVolume( const G4Material*,
     684                                                  const G4ParticleDefinition* p,
     685                                                  G4double kineticEnergy,
     686                                                  G4double cutEnergy,
     687                                                  G4double maxEnergy  )
    668688{
    669689  G4int iTkin,iPlace;
    670690  size_t jMat, jMatCC;
    671   G4double tmax = min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
     691  G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
     692  if(cutEnergy >= tmax) return 0.0;
    672693  G4double particleMass = p->GetPDGMass();
    673694  G4double scaledTkin   = kineticEnergy*proton_mass_c2/particleMass;
     
    675696  G4double charge2      = charge*charge, cross, cross1, cross2;
    676697  G4double photon1, photon2, plasmon1, plasmon2;
     698
     699  const G4MaterialCutsCouple* matCC = CurrentCouple();
    677700
    678701  const G4ProductionCutsTable* theCoupleTable=
     
    12251248}
    12261249
     1250/////////////////////////////////////////////////////////////////////
     1251
     1252G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
     1253                                                      G4double kinEnergy)
     1254{
     1255  G4double tmax = kinEnergy;
     1256  if(p == fElectron) tmax *= 0.5;
     1257  else if(p != fPositron) {
     1258    G4double mass = p->GetPDGMass();
     1259    G4double ratio= electron_mass_c2/mass;
     1260    G4double gamma= kinEnergy/mass + 1.0;
     1261    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
     1262                  (1. + 2.0*gamma*ratio + ratio*ratio);
     1263  }
     1264  return tmax;
     1265}
     1266
     1267///////////////////////////////////////////////////////////////
     1268
     1269void G4PAIPhotonModel::DefineForRegion(const G4Region* r)
     1270{
     1271  fPAIRegionVector.push_back(r);
     1272}
     1273
    12271274
    12281275//
  • trunk/source/processes/electromagnetic/standard/src/G4PAIxSection.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PAIxSection.cc,v 1.21 2006/06/29 19:53:20 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4PAIxSection.cc,v 1.24 2008/05/30 16:04:40 grichine Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    7070         70.0 ,   100.0 , 300.0 , 600.0 , 1000.0 , 3000.0 ,
    7171      10000.0 , 50000.0
    72 } ;
     72};
    7373
    7474const G4int G4PAIxSection::
    75 fRefGammaNumber = 29 ;         // The number of gamma for creation of
     75fRefGammaNumber = 29;         // The number of gamma for creation of
    7676                               // spline (9)
    7777
     
    8080// Local class constants
    8181
    82 const G4double G4PAIxSection::fDelta = 0.005 ; // energy shift from interval border
    83 const G4double G4PAIxSection::fError = 0.005 ; // error in lin-log approximation
    84 
    85 const G4int G4PAIxSection::fMaxSplineSize = 500 ;  // Max size of output spline
     82const G4double G4PAIxSection::fDelta = 0.005; // energy shift from interval border
     83const G4double G4PAIxSection::fError = 0.005; // error in lin-log approximation
     84
     85const G4int G4PAIxSection::fMaxSplineSize = 500;  // Max size of output spline
    8686                                                    // arrays
    8787
     
    9595  fDensity       = matCC->GetMaterial()->GetDensity();
    9696  G4int matIndex = matCC->GetMaterial()->GetIndex();
     97  fMaterialIndex = matIndex;   
    9798  fSandia        = new G4SandiaTable(matIndex);
    9899
     
    108109    (*(*fMatSandiaMatrix)[i])[0] = fSandia->GetSandiaMatTable(i,0);
    109110
    110     for(j = 1; j < 5 ; j++)
     111    for(j = 1; j < 5; j++)
    111112    {
    112113      (*(*fMatSandiaMatrix)[i])[j] = fSandia->GetSandiaMatTable(i,j)*fDensity;
    113114    }     
    114115  }                     
    115 
    116 
    117 
    118116}
     117
     118////////////////////////////////////////////////////////////////
    119119
    120120G4PAIxSection::G4PAIxSection(G4int materialIndex,
    121121                             G4double maxEnergyTransfer)
    122122{
    123    const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
    124    G4int i, j ;   
    125 
    126       fDensity                = (*theMaterialTable)[materialIndex]->GetDensity() ;
     123   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
     124   G4int i, j;   
     125
     126      fMaterialIndex   = materialIndex;   
     127      fDensity                = (*theMaterialTable)[materialIndex]->GetDensity();
    127128      fElectronDensity        = (*theMaterialTable)[materialIndex]->
    128                              GetElectronDensity() ;
     129                             GetElectronDensity();
    129130      fIntervalNumber         = (*theMaterialTable)[materialIndex]->
    130                              GetSandiaTable()->GetMatNbOfIntervals() ;
     131                             GetSandiaTable()->GetMatNbOfIntervals();
    131132      fIntervalNumber--;     
    132       // G4cout<<fDensity<<"\t"<<fElectronDensity<<"\t"<<fIntervalNumber<<G4endl ;
    133 
    134       fEnergyInterval = new G4double[fIntervalNumber+2] ;
    135       fA1             = new G4double[fIntervalNumber+2] ;
    136       fA2             = new G4double[fIntervalNumber+2] ;
    137       fA3             = new G4double[fIntervalNumber+2] ;
    138       fA4             = new G4double[fIntervalNumber+2] ;
    139 
    140       for(i = 1 ; i <= fIntervalNumber ; i++ )
     133      // G4cout<<fDensity<<"\t"<<fElectronDensity<<"\t"<<fIntervalNumber<<G4endl;
     134
     135      fEnergyInterval = new G4double[fIntervalNumber+2];
     136      fA1             = new G4double[fIntervalNumber+2];
     137      fA2             = new G4double[fIntervalNumber+2];
     138      fA3             = new G4double[fIntervalNumber+2];
     139      fA4             = new G4double[fIntervalNumber+2];
     140
     141      for(i = 1; i <= fIntervalNumber; i++ )
    141142      {
    142143         if(((*theMaterialTable)[materialIndex]->
     
    144145              i > fIntervalNumber               )
    145146         {
    146             fEnergyInterval[i] = maxEnergyTransfer ;
    147             fIntervalNumber = i ;
     147            fEnergyInterval[i] = maxEnergyTransfer;
     148            fIntervalNumber = i;
    148149            break;
    149150         }
     
    159160                              GetSandiaTable()->GetSandiaCofForMaterial(i-1,4);
    160161         // G4cout<<i<<"\t"<<fEnergyInterval[i]<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
    161          //                               <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl ;
     162         //                               <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
    162163      }   
    163164      if(fEnergyInterval[fIntervalNumber] != maxEnergyTransfer)
    164165      {
    165166         fIntervalNumber++;
    166          fEnergyInterval[fIntervalNumber] = maxEnergyTransfer ;
     167         fEnergyInterval[fIntervalNumber] = maxEnergyTransfer;
    167168      }
    168169
     
    174175           1.5*fDelta*(fEnergyInterval[i+1]+fEnergyInterval[i]))
    175176        {
    176           continue ;
     177          continue;
    177178        }
    178179        else
     
    180181          for(j=i;j<fIntervalNumber;j++)
    181182          {
    182             fEnergyInterval[j] = fEnergyInterval[j+1] ;
    183                         fA1[j] = fA1[j+1] ;
    184                         fA2[j] = fA2[j+1] ;
    185                         fA3[j] = fA3[j+1] ;
    186                         fA4[j] = fA4[j+1] ;
     183            fEnergyInterval[j] = fEnergyInterval[j+1];
     184                        fA1[j] = fA1[j+1];
     185                        fA2[j] = fA2[j+1];
     186                        fA3[j] = fA3[j+1];
     187                        fA4[j] = fA4[j+1];
    187188          }
    188           fIntervalNumber-- ;
    189           i-- ;
     189          fIntervalNumber--;
     190          i--;
    190191        }
    191192      }
     
    194195      /* *********************************
    195196
    196       fSplineEnergy          = new G4double[fMaxSplineSize] ;   
    197       fRePartDielectricConst = new G4double[fMaxSplineSize] ;   
    198       fImPartDielectricConst = new G4double[fMaxSplineSize] ;   
    199       fIntegralTerm          = new G4double[fMaxSplineSize] ;   
    200       fDifPAIxSection        = new G4double[fMaxSplineSize] ;   
    201       fIntegralPAIxSection   = new G4double[fMaxSplineSize] ;   
     197      fSplineEnergy          = new G4double[fMaxSplineSize];   
     198      fRePartDielectricConst = new G4double[fMaxSplineSize];   
     199      fImPartDielectricConst = new G4double[fMaxSplineSize];   
     200      fIntegralTerm          = new G4double[fMaxSplineSize];   
     201      fDifPAIxSection        = new G4double[fMaxSplineSize];   
     202      fIntegralPAIxSection   = new G4double[fMaxSplineSize];   
    202203     
    203204      for(i=0;i<fMaxSplineSize;i++)
    204205      {
    205          fSplineEnergy[i]          = 0.0 ;   
    206          fRePartDielectricConst[i] = 0.0 ;   
    207          fImPartDielectricConst[i] = 0.0 ;   
    208          fIntegralTerm[i]          = 0.0 ;   
    209          fDifPAIxSection[i]        = 0.0 ;   
    210          fIntegralPAIxSection[i]   = 0.0 ;   
     206         fSplineEnergy[i]          = 0.0;   
     207         fRePartDielectricConst[i] = 0.0;   
     208         fImPartDielectricConst[i] = 0.0;   
     209         fIntegralTerm[i]          = 0.0;   
     210         fDifPAIxSection[i]        = 0.0;   
     211         fIntegralPAIxSection[i]   = 0.0;   
    211212      }
    212213      **************************************************  */   
    213214
    214       InitPAI() ;  // create arrays allocated above
     215      InitPAI();  // create arrays allocated above
    215216     
    216       delete[] fEnergyInterval ;
    217       delete[] fA1 ;
    218       delete[] fA2 ;
    219       delete[] fA3 ;
    220       delete[] fA4 ;   
     217      delete[] fEnergyInterval;
     218      delete[] fA1;
     219      delete[] fA2;
     220      delete[] fA3;
     221      delete[] fA4;   
    221222}
    222223
     
    232233{
    233234   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
    234    G4int i, j ;   
    235    
     235   G4int i, j;
     236 
     237      fMaterialIndex   = materialIndex;     
    236238      fDensity                = (*theMaterialTable)[materialIndex]->GetDensity();
    237239      fElectronDensity        = (*theMaterialTable)[materialIndex]->
    238                              GetElectronDensity() ;
    239 
    240       fIntervalNumber         = intNumber ;
     240                             GetElectronDensity();
     241
     242      fIntervalNumber         = intNumber;
    241243      fIntervalNumber--;
    242       //   G4cout<<fDensity<<"\t"<<fElectronDensity<<"\t"<<fIntervalNumber<<G4endl ;
     244      //   G4cout<<fDensity<<"\t"<<fElectronDensity<<"\t"<<fIntervalNumber<<G4endl;
    243245 
    244       fEnergyInterval = new G4double[fIntervalNumber+2] ;
    245       fA1             = new G4double[fIntervalNumber+2] ;
    246       fA2             = new G4double[fIntervalNumber+2] ;
    247       fA3             = new G4double[fIntervalNumber+2] ;
    248       fA4             = new G4double[fIntervalNumber+2] ;
    249 
    250       for( i = 1 ; i <= fIntervalNumber ; i++ )
     246      fEnergyInterval = new G4double[fIntervalNumber+2];
     247      fA1             = new G4double[fIntervalNumber+2];
     248      fA2             = new G4double[fIntervalNumber+2];
     249      fA3             = new G4double[fIntervalNumber+2];
     250      fA4             = new G4double[fIntervalNumber+2];
     251
     252      for( i = 1; i <= fIntervalNumber; i++ )
    251253      {
    252254         if( ( photoAbsCof[i-1][0] >= maxEnergyTransfer ) ||
    253255             i > fIntervalNumber )
    254256         {
    255             fEnergyInterval[i] = maxEnergyTransfer ;
    256             fIntervalNumber = i ;
     257            fEnergyInterval[i] = maxEnergyTransfer;
     258            fIntervalNumber = i;
    257259            break;
    258260         }
    259          fEnergyInterval[i] = photoAbsCof[i-1][0] ;
    260          fA1[i]             = photoAbsCof[i-1][1] ;
    261          fA2[i]             = photoAbsCof[i-1][2] ;
    262          fA3[i]             = photoAbsCof[i-1][3] ;
    263          fA4[i]             = photoAbsCof[i-1][4] ;
     261         fEnergyInterval[i] = photoAbsCof[i-1][0];
     262         fA1[i]             = photoAbsCof[i-1][1];
     263         fA2[i]             = photoAbsCof[i-1][2];
     264         fA3[i]             = photoAbsCof[i-1][3];
     265         fA4[i]             = photoAbsCof[i-1][4];
    264266         // G4cout<<i<<"\t"<<fEnergyInterval[i]<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
    265          //        <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl ;
     267         //        <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
    266268      }
    267269  // G4cout<<"i last = "<<i<<"; "<<"fIntervalNumber = "<<fIntervalNumber<<G4endl;   
     
    269271      {
    270272         fIntervalNumber++;
    271          fEnergyInterval[fIntervalNumber] = maxEnergyTransfer ;
     273         fEnergyInterval[fIntervalNumber] = maxEnergyTransfer;
    272274      }
    273275      for(i=1;i<=fIntervalNumber;i++)
    274276      {
    275277        //  G4cout<<i<<"\t"<<fEnergyInterval[i]<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
    276         //    <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl ;
     278        //    <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
    277279      }
    278280      // Now checking, if two borders are too close together
    279281
    280       for( i = 1 ; i < fIntervalNumber ; i++ )
     282      for( i = 1; i < fIntervalNumber; i++ )
    281283      {
    282284        if(fEnergyInterval[i+1]-fEnergyInterval[i] >
    283285           1.5*fDelta*(fEnergyInterval[i+1]+fEnergyInterval[i]))
    284286        {
    285           continue ;
     287          continue;
    286288        }
    287289        else
     
    289291          for(j=i;j<fIntervalNumber;j++)
    290292          {
    291             fEnergyInterval[j] = fEnergyInterval[j+1] ;
    292                         fA1[j] = fA1[j+1] ;
    293                         fA2[j] = fA2[j+1] ;
    294                         fA3[j] = fA3[j+1] ;
    295                         fA4[j] = fA4[j+1] ;
     293            fEnergyInterval[j] = fEnergyInterval[j+1];
     294                        fA1[j] = fA1[j+1];
     295                        fA2[j] = fA2[j+1];
     296                        fA3[j] = fA3[j+1];
     297                        fA4[j] = fA4[j+1];
    296298          }
    297           fIntervalNumber-- ;
    298           i-- ;
     299          fIntervalNumber--;
     300          i--;
    299301        }
    300302      }
     
    305307      fLorentzFactor[fRefGammaNumber]*fLorentzFactor[fRefGammaNumber] - 1;
    306308
    307       NormShift(betaGammaSqRef) ;             
    308       SplainPAI(betaGammaSqRef) ;
     309      NormShift(betaGammaSqRef);             
     310      SplainPAI(betaGammaSqRef);
    309311     
    310312      // Preparation of integral PAI cross section for input betaGammaSq
    311313   
    312       for(i = 1 ; i <= fSplineNumber ; i++)
     314      for(i = 1; i <= fSplineNumber; i++)
    313315      {
    314316         fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
     317         fdNdxMM[i]   = PAIdNdxMM(i,betaGammaSq);
    315318         fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
     319         fdNdxResonance[i]  = PAIdNdxResonance(i,betaGammaSq);
    316320         fDifPAIxSection[i] = DifPAIxSection(i,betaGammaSq);
     321
    317322         // G4cout<<i<<"; dNdxC = "<<fdNdxCerenkov[i]<<"; dNdxP = "<<fdNdxPlasmon[i]
    318323         //    <<"; dNdxPAI = "<<fDifPAIxSection[i]<<G4endl;
    319324      }
    320       IntegralCerenkov() ;
    321       IntegralPlasmon() ;
    322       IntegralPAIxSection() ;
     325      IntegralCerenkov();
     326      IntegralMM();
     327      IntegralPlasmon();
     328      IntegralResonance();
     329      IntegralPAIxSection();
    323330     
    324       delete[] fEnergyInterval ;
    325       delete[] fA1 ;
    326       delete[] fA2 ;
    327       delete[] fA3 ;
    328       delete[] fA4 ;   
     331      delete[] fEnergyInterval;
     332      delete[] fA1;
     333      delete[] fA2;
     334      delete[] fA3;
     335      delete[] fA4;   
    329336}
    330337
     
    339346   const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
    340347
    341    G4int i, j, numberOfElements ;   
    342    
     348   G4int i, j, numberOfElements;   
     349
     350   fMaterialIndex   = materialIndex;   
    343351   fDensity         = (*theMaterialTable)[materialIndex]->GetDensity();
    344    fElectronDensity = (*theMaterialTable)[materialIndex]->GetElectronDensity() ;
    345    numberOfElements = (*theMaterialTable)[materialIndex]->GetNumberOfElements() ;
    346 
    347    G4int* thisMaterialZ = new G4int[numberOfElements] ;
    348    
    349    for( i = 0 ; i < numberOfElements ; i++ )
     352   fElectronDensity = (*theMaterialTable)[materialIndex]->GetElectronDensity();
     353   numberOfElements = (*theMaterialTable)[materialIndex]->GetNumberOfElements();
     354
     355   G4int* thisMaterialZ = new G4int[numberOfElements];
     356   
     357   for( i = 0; i < numberOfElements; i++ )
    350358   {
    351359         thisMaterialZ[i] = (G4int)(*theMaterialTable)[materialIndex]->
    352                                       GetElement(i)->GetZ() ;
    353    }
    354    G4SandiaTable     thisMaterialSandiaTable(materialIndex) ;
     360                                      GetElement(i)->GetZ();
     361   }
     362   // fSandia = new G4SandiaTable(materialIndex);
     363   fSandia = (*theMaterialTable)[materialIndex]->
     364     GetSandiaTable();
     365   G4SandiaTable     thisMaterialSandiaTable(materialIndex);
    355366   fIntervalNumber = thisMaterialSandiaTable.SandiaIntervals
    356                            (thisMaterialZ,numberOfElements) ;   
     367                           (thisMaterialZ,numberOfElements);   
    357368   fIntervalNumber = thisMaterialSandiaTable.SandiaMixing
    358369                           ( thisMaterialZ ,
    359370                      (*theMaterialTable)[materialIndex]->GetFractionVector() ,
    360                              numberOfElements,fIntervalNumber) ;
     371                             numberOfElements,fIntervalNumber);
    361372
    362373   fIntervalNumber--;
    363374
    364       fEnergyInterval = new G4double[fIntervalNumber+2] ;
    365       fA1             = new G4double[fIntervalNumber+2] ;
    366       fA2             = new G4double[fIntervalNumber+2] ;
    367       fA3             = new G4double[fIntervalNumber+2] ;
    368       fA4             = new G4double[fIntervalNumber+2] ;
    369 
    370       for(i=1;i<=fIntervalNumber;i++)
     375      fEnergyInterval = new G4double[fIntervalNumber+2];
     376      fA1             = new G4double[fIntervalNumber+2];
     377      fA2             = new G4double[fIntervalNumber+2];
     378      fA3             = new G4double[fIntervalNumber+2];
     379      fA4             = new G4double[fIntervalNumber+2];
     380
     381      for( i = 1; i <= fIntervalNumber; i++ )
    371382      {
    372383  if((thisMaterialSandiaTable.GetPhotoAbsorpCof(i,0) >= maxEnergyTransfer) ||
    373384          i > fIntervalNumber)
    374385         {
    375             fEnergyInterval[i] = maxEnergyTransfer ;
    376             fIntervalNumber = i ;
     386            fEnergyInterval[i] = maxEnergyTransfer;
     387            fIntervalNumber = i;
    377388            break;
    378389         }
    379    fEnergyInterval[i] = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,0) ;
    380    fA1[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,1)*fDensity ;
    381    fA2[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,2)*fDensity ;
    382    fA3[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,3)*fDensity ;
    383    fA4[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,4)*fDensity ;
     390   fEnergyInterval[i] = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,0);
     391   fA1[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,1)*fDensity;
     392   fA2[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,2)*fDensity;
     393   fA3[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,3)*fDensity;
     394   fA4[i]             = thisMaterialSandiaTable.GetPhotoAbsorpCof(i,4)*fDensity;
    384395
    385396      }   
     
    387398      {
    388399         fIntervalNumber++;
    389          fEnergyInterval[fIntervalNumber] = maxEnergyTransfer ;
    390          fA1[fIntervalNumber] = fA1[fIntervalNumber-1] ;
    391          fA2[fIntervalNumber] = fA2[fIntervalNumber-1] ;
    392          fA3[fIntervalNumber] = fA3[fIntervalNumber-1] ;
    393          fA4[fIntervalNumber] = fA4[fIntervalNumber-1] ;
     400         fEnergyInterval[fIntervalNumber] = maxEnergyTransfer;
     401         fA1[fIntervalNumber] = fA1[fIntervalNumber-1];
     402         fA2[fIntervalNumber] = fA2[fIntervalNumber-1];
     403         fA3[fIntervalNumber] = fA3[fIntervalNumber-1];
     404         fA4[fIntervalNumber] = fA4[fIntervalNumber-1];
    394405      }
    395406      for(i=1;i<=fIntervalNumber;i++)
    396407      {
    397408        // G4cout<<fEnergyInterval[i]<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
    398         //   <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl ;
     409        //   <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;
    399410      }
    400411      // Now checking, if two borders are too close together
    401412
    402       for(i=1;i<fIntervalNumber;i++)
     413      for( i = 1; i < fIntervalNumber; i++ )
    403414      {
    404415        if(fEnergyInterval[i+1]-fEnergyInterval[i] >
    405416           1.5*fDelta*(fEnergyInterval[i+1]+fEnergyInterval[i]))
    406417        {
    407           continue ;
     418          continue;
    408419        }
    409420        else
    410421        {
    411           for(j=i;j<fIntervalNumber;j++)
     422          for( j = i; j < fIntervalNumber; j++ )
    412423          {
    413             fEnergyInterval[j] = fEnergyInterval[j+1] ;
    414                         fA1[j] = fA1[j+1] ;
    415                         fA2[j] = fA2[j+1] ;
    416                         fA3[j] = fA3[j+1] ;
    417                         fA4[j] = fA4[j+1] ;
     424            fEnergyInterval[j] = fEnergyInterval[j+1];
     425                        fA1[j] = fA1[j+1];
     426                        fA2[j] = fA2[j+1];
     427                        fA3[j] = fA3[j+1];
     428                        fA4[j] = fA4[j+1];
    418429          }
    419           fIntervalNumber-- ;
    420           i-- ;
     430          fIntervalNumber--;
     431          i--;
    421432        }
    422433      }
    423434
    424435      /* *********************************
    425       fSplineEnergy          = new G4double[fMaxSplineSize] ;   
    426       fRePartDielectricConst = new G4double[fMaxSplineSize] ;   
    427       fImPartDielectricConst = new G4double[fMaxSplineSize] ;   
    428       fIntegralTerm          = new G4double[fMaxSplineSize] ;   
    429       fDifPAIxSection        = new G4double[fMaxSplineSize] ;   
    430       fIntegralPAIxSection   = new G4double[fMaxSplineSize] ;   
     436      fSplineEnergy          = new G4double[fMaxSplineSize];   
     437      fRePartDielectricConst = new G4double[fMaxSplineSize];   
     438      fImPartDielectricConst = new G4double[fMaxSplineSize];   
     439      fIntegralTerm          = new G4double[fMaxSplineSize];   
     440      fDifPAIxSection        = new G4double[fMaxSplineSize];   
     441      fIntegralPAIxSection   = new G4double[fMaxSplineSize];   
    431442     
    432443      for(i=0;i<fMaxSplineSize;i++)
    433444      {
    434          fSplineEnergy[i]          = 0.0 ;   
    435          fRePartDielectricConst[i] = 0.0 ;   
    436          fImPartDielectricConst[i] = 0.0 ;   
    437          fIntegralTerm[i]          = 0.0 ;   
    438          fDifPAIxSection[i]        = 0.0 ;   
    439          fIntegralPAIxSection[i]   = 0.0 ;   
     445         fSplineEnergy[i]          = 0.0;   
     446         fRePartDielectricConst[i] = 0.0;   
     447         fImPartDielectricConst[i] = 0.0;   
     448         fIntegralTerm[i]          = 0.0;   
     449         fDifPAIxSection[i]        = 0.0;   
     450         fIntegralPAIxSection[i]   = 0.0;   
    440451      }
    441452      */ ////////////////////////
     
    446457      fLorentzFactor[fRefGammaNumber]*fLorentzFactor[fRefGammaNumber] - 1;
    447458
    448       NormShift(betaGammaSqRef) ;             
    449       SplainPAI(betaGammaSqRef) ;
     459      NormShift(betaGammaSqRef);             
     460      SplainPAI(betaGammaSqRef);
    450461     
    451462      // Preparation of integral PAI cross section for input betaGammaSq
    452463   
    453       for(i = 1 ; i <= fSplineNumber ; i++)
     464      for(i = 1; i <= fSplineNumber; i++)
    454465      {
    455466         fDifPAIxSection[i] = DifPAIxSection(i,betaGammaSq);
    456467         fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
     468         fdNdxMM[i]   = PAIdNdxMM(i,betaGammaSq);
    457469         fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
    458       }
    459       IntegralPAIxSection() ;
    460       IntegralCerenkov() ;
    461       IntegralPlasmon() ;
     470         fdNdxResonance[i]  = PAIdNdxResonance(i,betaGammaSq);
     471      }
     472      IntegralPAIxSection();
     473      IntegralCerenkov();
     474      IntegralMM();
     475      IntegralPlasmon();
     476      IntegralResonance();
    462477     
    463       //   delete[] fEnergyInterval ;
    464       delete[] fA1 ;
    465       delete[] fA2 ;
    466       delete[] fA3 ;
    467       delete[] fA4 ;   
     478      //   delete[] fEnergyInterval;
     479      delete[] fA1;
     480      delete[] fA2;
     481      delete[] fA3;
     482      delete[] fA4;   
    468483}
    469484
     
    476491{
    477492   /* ************************
    478    delete[] fSplineEnergy          ;   
    479    delete[] fRePartDielectricConst ;   
    480    delete[] fImPartDielectricConst ;   
    481    delete[] fIntegralTerm          ;   
    482    delete[] fDifPAIxSection        ;   
    483    delete[] fIntegralPAIxSection   ;
     493   delete[] fSplineEnergy         ;   
     494   delete[] fRePartDielectricConst;   
     495   delete[] fImPartDielectricConst;   
     496   delete[] fIntegralTerm         ;   
     497   delete[] fDifPAIxSection       ;   
     498   delete[] fIntegralPAIxSection  ;
    484499   */ ////////////////////////
    485500}
     
    492507void G4PAIxSection::InitPAI()
    493508{   
    494    G4int i ;
     509   G4int i;
    495510   G4double betaGammaSq = fLorentzFactor[fRefGammaNumber]*
    496511                          fLorentzFactor[fRefGammaNumber] - 1;
     
    498513   // Preparation of integral PAI cross section for reference gamma
    499514   
    500    NormShift(betaGammaSq) ;             
    501    SplainPAI(betaGammaSq) ;
    502 
    503    IntegralPAIxSection() ;
    504    IntegralCerenkov() ;
    505    IntegralPlasmon() ;
    506 
    507    for(i = 0 ; i<=fSplineNumber ; i++)
    508    {
    509       fPAItable[i][fRefGammaNumber] = fIntegralPAIxSection[i] ;
     515   NormShift(betaGammaSq);             
     516   SplainPAI(betaGammaSq);
     517
     518   IntegralPAIxSection();
     519   IntegralCerenkov();
     520   IntegralMM();
     521   IntegralPlasmon();
     522   IntegralResonance();
     523
     524   for(i = 0; i<= fSplineNumber; i++)
     525   {
     526      fPAItable[i][fRefGammaNumber] = fIntegralPAIxSection[i];
    510527      if(i != 0)
    511528      {
    512          fPAItable[i][0] = fSplineEnergy[i] ;
    513       }
    514    }
    515    fPAItable[0][0] = fSplineNumber ;
    516    
    517    for(G4int j = 1 ; j < 112 ; j++)       // for other gammas
    518    {
    519       if( j == fRefGammaNumber ) continue ;
     529         fPAItable[i][0] = fSplineEnergy[i];
     530      }
     531   }
     532   fPAItable[0][0] = fSplineNumber;
     533   
     534   for(G4int j = 1; j < 112; j++)       // for other gammas
     535   {
     536      if( j == fRefGammaNumber ) continue;
    520537     
    521       betaGammaSq = fLorentzFactor[j]*fLorentzFactor[j] - 1 ;
     538      betaGammaSq = fLorentzFactor[j]*fLorentzFactor[j] - 1;
    522539     
    523       for(i = 1 ; i <= fSplineNumber ; i++)
     540      for(i = 1; i <= fSplineNumber; i++)
    524541      {
    525542         fDifPAIxSection[i] = DifPAIxSection(i,betaGammaSq);
    526543         fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
     544         fdNdxMM[i]   = PAIdNdxMM(i,betaGammaSq);
    527545         fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
    528       }
    529       IntegralPAIxSection() ;
    530       IntegralCerenkov() ;
    531       IntegralPlasmon() ;
     546         fdNdxResonance[i]  = PAIdNdxResonance(i,betaGammaSq);
     547      }
     548      IntegralPAIxSection();
     549      IntegralCerenkov();
     550      IntegralMM();
     551      IntegralPlasmon();
     552      IntegralResonance();
    532553     
    533       for(i = 0 ; i <= fSplineNumber ; i++)
    534       {
    535          fPAItable[i][j] = fIntegralPAIxSection[i] ;
     554      for(i = 0; i <= fSplineNumber; i++)
     555      {
     556         fPAItable[i][j] = fIntegralPAIxSection[i];
    536557      }
    537558   }
     
    546567void G4PAIxSection::NormShift(G4double betaGammaSq)
    547568{
    548   G4int i, j ;
    549 
    550   for( i = 1 ; i <= fIntervalNumber-1 ; i++ )
    551   {
    552     for( j = 1 ; j <= 2 ; j++ )
     569  G4int i, j;
     570
     571  for( i = 1; i <= fIntervalNumber-1; i++ )
     572  {
     573    for( j = 1; j <= 2; j++ )
    553574    {
    554       fSplineNumber = (i-1)*2 + j ;
     575      fSplineNumber = (i-1)*2 + j;
    555576
    556577      if( j == 1 ) fSplineEnergy[fSplineNumber] = fEnergyInterval[i  ]*(1+fDelta);
     
    562583  fIntegralTerm[1]=RutherfordIntegral(1,fEnergyInterval[1],fSplineEnergy[1]);
    563584
    564   j = 1 ;
    565 
    566   for(i=2;i<=fSplineNumber;i++)
     585  j = 1;
     586
     587  for( i = 2; i <= fSplineNumber; i++ )
    567588  {
    568589    if(fSplineEnergy[i]<fEnergyInterval[j+1])
     
    570591         fIntegralTerm[i] = fIntegralTerm[i-1] +
    571592                            RutherfordIntegral(j,fSplineEnergy[i-1],
    572                                                  fSplineEnergy[i]   ) ;
     593                                                 fSplineEnergy[i]   );
    573594    }
    574595    else
    575596    {
    576597       G4double x = RutherfordIntegral(j,fSplineEnergy[i-1],
    577                                            fEnergyInterval[j+1]   ) ;
     598                                           fEnergyInterval[j+1]   );
    578599         j++;
    579600         fIntegralTerm[i] = fIntegralTerm[i-1] + x +
    580601                            RutherfordIntegral(j,fEnergyInterval[j],
    581                                                  fSplineEnergy[i]    ) ;
     602                                                 fSplineEnergy[i]    );
    582603    }
    583604    // G4cout<<i<<"\t"<<fSplineEnergy[i]<<"\t"<<fIntegralTerm[i]<<"\n"<<G4endl;
    584605  }
    585   fNormalizationCof = 2*pi*pi*hbarc*hbarc*fine_structure_const/electron_mass_c2 ;
    586   fNormalizationCof *= fElectronDensity/fIntegralTerm[fSplineNumber] ;
    587 
    588   // G4cout<<"fNormalizationCof = "<<fNormalizationCof<<G4endl ;
     606  fNormalizationCof = 2*pi*pi*hbarc*hbarc*fine_structure_const/electron_mass_c2;
     607  fNormalizationCof *= fElectronDensity/fIntegralTerm[fSplineNumber];
     608
     609  // G4cout<<"fNormalizationCof = "<<fNormalizationCof<<G4endl;
    589610
    590611          // Calculation of PAI differrential cross-section (1/(keV*cm))
    591612          // in the energy points near borders of energy intervals
    592613
    593    for(G4int k=1;k<=fIntervalNumber-1;k++)
    594    {
    595       for(j=1;j<=2;j++)
    596       {
    597          i = (k-1)*2 + j ;
     614   for(G4int k = 1; k <= fIntervalNumber-1; k++ )
     615   {
     616      for( j = 1; j <= 2; j++ )
     617      {
     618         i = (k-1)*2 + j;
    598619         fImPartDielectricConst[i] = fNormalizationCof*
    599620                                     ImPartDielectricConst(k,fSplineEnergy[i]);
     
    604625         fDifPAIxSection[i] = DifPAIxSection(i,betaGammaSq);
    605626         fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
     627         fdNdxMM[i]   = PAIdNdxMM(i,betaGammaSq);
    606628         fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
     629         fdNdxResonance[i]    = PAIdNdxResonance(i,betaGammaSq);
    607630      }
    608631   }
     
    616639// linear approximation would be smaller than 'fError'
    617640
    618 void
    619    G4PAIxSection::SplainPAI(G4double betaGammaSq)
     641void G4PAIxSection::SplainPAI(G4double betaGammaSq)
    620642{
    621    G4int k = 1 ;
    622    G4int i = 1 ;
     643   G4int k = 1;
     644   G4int i = 1;
    623645
    624646   while ( (i < fSplineNumber) && (fSplineNumber < fMaxSplineSize-1) )
     
    626648      if(fSplineEnergy[i+1] > fEnergyInterval[k+1])
    627649      {
    628           k++ ;   // Here next energy point is in next energy interval
     650          k++;   // Here next energy point is in next energy interval
    629651          i++;
    630652          continue;
     
    634656      fSplineNumber++;
    635657
    636       for(G4int j = fSplineNumber; j >= i+2 ; j-- )
     658      for(G4int j = fSplineNumber; j >= i+2; j-- )
    637659      {
    638660         fSplineEnergy[j]          = fSplineEnergy[j-1];
     
    643665         fDifPAIxSection[j] = fDifPAIxSection[j-1];
    644666         fdNdxCerenkov[j]   = fdNdxCerenkov[j-1];
     667         fdNdxMM[j]   = fdNdxMM[j-1];
    645668         fdNdxPlasmon[j]    = fdNdxPlasmon[j-1];
     669         fdNdxResonance[j]  = fdNdxResonance[j-1];
    646670      }
    647671      G4double x1  = fSplineEnergy[i];
     
    658682      G4double a = log10(y2/yy1)/log10(x2/x1);
    659683      G4double b = log10(yy1) - a*log10(x1);
    660       G4double y = a*log10(en1) + b ;
     684      G4double y = a*log10(en1) + b;
    661685      y = pow(10.,y);
    662686
     
    673697      fDifPAIxSection[i+1] = DifPAIxSection(i+1,betaGammaSq);
    674698      fdNdxCerenkov[i+1]   = PAIdNdxCerenkov(i+1,betaGammaSq);
     699      fdNdxMM[i+1]   = PAIdNdxMM(i+1,betaGammaSq);
    675700      fdNdxPlasmon[i+1]    = PAIdNdxPlasmon(i+1,betaGammaSq);
     701      fdNdxResonance[i+1]  = PAIdNdxResonance(i+1,betaGammaSq);
    676702
    677703                  // Condition for next division of this segment or to pass
     
    682708      if( x < 0 )
    683709      {
    684          x = -x ;
     710         x = -x;
    685711      }
    686712      if( x > fError && fSplineNumber < fMaxSplineSize-1 )
     
    704730                                            G4double x2   )
    705731{
    706    G4double  c1, c2, c3 ;
     732   G4double  c1, c2, c3;
    707733   // G4cout<<"RI: x1 = "<<x1<<"; "<<"x2 = "<<x2<<G4endl;   
    708    c1 = (x2 - x1)/x1/x2 ;
    709    c2 = (x2 - x1)*(x2 + x1)/x1/x1/x2/x2 ;
    710    c3 = (x2 - x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2 ;
     734   c1 = (x2 - x1)/x1/x2;
     735   c2 = (x2 - x1)*(x2 + x1)/x1/x1/x2/x2;
     736   c3 = (x2 - x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2;
    711737   // G4cout<<" RI: c1 = "<<c1<<"; "<<"c2 = "<<c2<<"; "<<"c3 = "<<c3<<G4endl;   
    712738   
    713    return  fA1[k]*log(x2/x1) + fA2[k]*c1 + fA3[k]*c2/2 + fA4[k]*c3/3 ;
     739   return  fA1[k]*log(x2/x1) + fA2[k]*c1 + fA3[k]*c2/2 + fA4[k]*c3/3;
    714740
    715741}   // end of RutherfordIntegral
     
    730756   energy4 = energy3*energy1;
    731757   
    732    result = fA1[k]/energy1+fA2[k]/energy2+fA3[k]/energy3+fA4[k]/energy4 
    733    result *=hbarc/energy1 ;
    734    
    735    return result ;
     758   result = fA1[k]/energy1+fA2[k]/energy2+fA3[k]/energy3+fA4[k]/energy4
     759   result *=hbarc/energy1;
     760   
     761   return result;
    736762
    737763}  // end of ImPartDielectricConst
    738764
     765/////////////////////////////////////////////////////////////////
     766//
     767// Returns lambda of photon with energy1 in current material
     768
     769G4double G4PAIxSection::GetPhotonRange( G4double energy1 )
     770{
     771  G4int i;
     772  G4double energy2, energy3, energy4, result, lambda;
     773
     774  energy2 = energy1*energy1;
     775  energy3 = energy2*energy1;
     776  energy4 = energy3*energy1;
     777
     778  // G4double* SandiaCof = fSandia->GetSandiaCofForMaterialPAI(energy1);
     779  // result = SandiaCof[0]/energy1+SandiaCof[1]/energy2+SandiaCof[2]/energy3+SandiaCof[3]/energy4;
     780  // result *= fDensity;
     781
     782  for( i = 1; i <= fIntervalNumber; i++ )
     783  {
     784     if( energy1 < fEnergyInterval[i]) break;
     785  }
     786  i--;
     787  if(i == 0) i = 1;
     788
     789  result = fA1[i]/energy1+fA2[i]/energy2+fA3[i]/energy3+fA4[i]/energy4; 
     790
     791  if( result > DBL_MIN ) lambda = 1./result;
     792  else                   lambda = DBL_MAX;
     793   
     794  return lambda;
     795
     796
     797/////////////////////////////////////////////////////////////////
     798//
     799// Return lambda of electron with energy1 in current material
     800// parametrisation from NIM A554(2005)474-493
     801
     802G4double G4PAIxSection::GetElectronRange( G4double energy )
     803{
     804  G4double range;
     805  /*
     806  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
     807
     808  G4double Z = (*theMaterialTable)[fMaterialIndex]->GetIonisation()->GetZeffective();
     809  G4double A = (*theMaterialTable)[fMaterialIndex]->GetA();
     810
     811  energy /= keV; // energy in keV in parametrised formula
     812
     813  if (energy < 10.)
     814  {
     815    range = 3.872e-3*A/Z;
     816    range *= pow(energy,1.492);
     817  }
     818  else
     819  {
     820    range = 6.97e-3*pow(energy,1.6);
     821  }
     822  */
     823  // Blum&Rolandi Particle Detection with Drift Chambers, p. 7
     824
     825  G4double cofA = 5.37e-4*g/cm2/keV;
     826  G4double cofB = 0.9815;
     827  G4double cofC = 3.123e-3/keV;
     828  // energy /= keV;
     829
     830  range = cofA*energy*( 1 - cofB/(1 + cofC*energy) );
     831
     832  // range *= g/cm2;
     833  range /= fDensity;
     834
     835  return range;
     836}
    739837
    740838//////////////////////////////////////////////////////////////////////////////
     
    747845{       
    748846   G4double x0, x02, x03, x04, x05, x1, x2, xx1 ,xx2 , xx12,
    749             c1, c2, c3, cof1, cof2, xln1, xln2, xln3, result ;
    750 
    751    x0 = enb ;
    752    result = 0 ;
     847            c1, c2, c3, cof1, cof2, xln1, xln2, xln3, result;
     848
     849   x0 = enb;
     850   result = 0;
    753851   
    754852   for(G4int i=1;i<=fIntervalNumber-1;i++)
    755853   {
    756       x1 = fEnergyInterval[i] ;
    757       x2 = fEnergyInterval[i+1] ;
    758       xx1 = x1 - x0 ;
    759       xx2 = x2 - x0 ;
    760       xx12 = xx2/xx1 ;
     854      x1 = fEnergyInterval[i];
     855      x2 = fEnergyInterval[i+1];
     856      xx1 = x1 - x0;
     857      xx2 = x2 - x0;
     858      xx12 = xx2/xx1;
    761859     
    762860      if(xx12<0)
     
    764862         xx12 = -xx12;
    765863      }
    766       xln1 = log(x2/x1) ;
    767       xln2 = log(xx12) ;
    768       xln3 = log((x2 + x0)/(x1 + x0)) ;
    769       x02 = x0*x0 ;
    770       x03 = x02*x0 ;
    771       x04 = x03*x0 ;
     864      xln1 = log(x2/x1);
     865      xln2 = log(xx12);
     866      xln3 = log((x2 + x0)/(x1 + x0));
     867      x02 = x0*x0;
     868      x03 = x02*x0;
     869      x04 = x03*x0;
    772870      x05 = x04*x0;
    773       c1  = (x2 - x1)/x1/x2 ;
    774       c2  = (x2 - x1)*(x2 +x1)/x1/x1/x2/x2 ;
    775       c3  = (x2 -x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2 ;
    776 
    777       result -= (fA1[i]/x02 + fA3[i]/x04)*xln1 ;
    778       result -= (fA2[i]/x02 + fA4[i]/x04)*c1 ;
    779       result -= fA3[i]*c2/2/x02 ;
    780       result -= fA4[i]*c3/3/x02 ;
    781 
    782       cof1 = fA1[i]/x02 + fA3[i]/x04 ;
    783       cof2 = fA2[i]/x03 + fA4[i]/x05 ;
    784 
    785       result += 0.5*(cof1 +cof2)*xln2 ;
    786       result += 0.5*(cof1 - cof2)*xln3 ;
     871      c1  = (x2 - x1)/x1/x2;
     872      c2  = (x2 - x1)*(x2 +x1)/x1/x1/x2/x2;
     873      c3  = (x2 -x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2;
     874
     875      result -= (fA1[i]/x02 + fA3[i]/x04)*xln1;
     876      result -= (fA2[i]/x02 + fA4[i]/x04)*c1;
     877      result -= fA3[i]*c2/2/x02;
     878      result -= fA4[i]*c3/3/x02;
     879
     880      cof1 = fA1[i]/x02 + fA3[i]/x04;
     881      cof2 = fA2[i]/x03 + fA4[i]/x05;
     882
     883      result += 0.5*(cof1 +cof2)*xln2;
     884      result += 0.5*(cof1 - cof2)*xln3;
    787885   }
    788    result *= 2*hbarc/pi ;
    789    
    790    return result ;
     886   result *= 2*hbarc/pi;
     887   
     888   return result;
    791889
    792890}   // end of RePartDielectricConst
     
    801899                                        G4double betaGammaSq  )
    802900{       
    803    G4double be2,cof,x1,x2,x3,x4,x5,x6,x7,x8,result ;
    804    //G4double beta, be4 ;
    805    G4double be4 ;
    806    G4double betaBohr2 = fine_structure_const*fine_structure_const ;
    807    G4double betaBohr4 = betaBohr2*betaBohr2*4.0 ;
    808    be2 = betaGammaSq/(1 + betaGammaSq) ;
    809    be4 = be2*be2 ;
    810    //  beta = sqrt(be2) ;
    811    cof = 1 ;
    812    x1 = log(2*electron_mass_c2/fSplineEnergy[i]) ;
    813 
    814    if( betaGammaSq < 0.01 ) x2 = log(be2) ;
     901   G4double be2,cof,x1,x2,x3,x4,x5,x6,x7,x8,result;
     902   //G4double beta, be4;
     903   G4double be4;
     904   G4double betaBohr2 = fine_structure_const*fine_structure_const;
     905   G4double betaBohr4 = betaBohr2*betaBohr2*4.0;
     906   be2 = betaGammaSq/(1 + betaGammaSq);
     907   be4 = be2*be2;
     908   //  beta = sqrt(be2);
     909   cof = 1;
     910   x1 = log(2*electron_mass_c2/fSplineEnergy[i]);
     911
     912   if( betaGammaSq < 0.01 ) x2 = log(be2);
    815913   else
    816914   {
    817915     x2 = -log( (1/betaGammaSq - fRePartDielectricConst[i])*
    818916                (1/betaGammaSq - fRePartDielectricConst[i]) +
    819                 fImPartDielectricConst[i]*fImPartDielectricConst[i] )/2 ;
     917                fImPartDielectricConst[i]*fImPartDielectricConst[i] )/2;
    820918   }
    821919   if( fImPartDielectricConst[i] == 0.0 ||betaGammaSq < 0.01 )
    822920   {
    823      x6=0 ;
     921     x6=0;
    824922   }
    825923   else
    826924   {
    827      x3 = -fRePartDielectricConst[i] + 1/betaGammaSq ;
     925     x3 = -fRePartDielectricConst[i] + 1/betaGammaSq;
    828926     x5 = -1 - fRePartDielectricConst[i] +
    829927          be2*((1 +fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) +
    830           fImPartDielectricConst[i]*fImPartDielectricConst[i]) ;
    831 
    832      x7 = atan2(fImPartDielectricConst[i],x3) ;
    833      x6 = x5 * x7 ;
    834    }
    835     // if(fImPartDielectricConst[i] == 0) x6 = 0 ;
    836    
    837    x4 = ((x1 + x2)*fImPartDielectricConst[i] + x6)/hbarc ;
    838    //   if( x4 < 0.0 ) x4 = 0.0 ;
     928          fImPartDielectricConst[i]*fImPartDielectricConst[i]);
     929
     930     x7 = atan2(fImPartDielectricConst[i],x3);
     931     x6 = x5 * x7;
     932   }
     933    // if(fImPartDielectricConst[i] == 0) x6 = 0;
     934   
     935   x4 = ((x1 + x2)*fImPartDielectricConst[i] + x6)/hbarc;
     936   //   if( x4 < 0.0 ) x4 = 0.0;
    839937   x8 = (1 + fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) +
    840         fImPartDielectricConst[i]*fImPartDielectricConst[i] ;
    841 
    842    result = (x4 + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i]) ;
    843    if(result < 1.0e-8) result = 1.0e-8 ;
    844    result *= fine_structure_const/be2/pi ;
    845    //   result *= (1-exp(-beta/betaBohr))*(1-exp(-beta/betaBohr)) ;
    846    //  result *= (1-exp(-be2/betaBohr2)) ;
    847    result *= (1-exp(-be4/betaBohr4)) ;
     938        fImPartDielectricConst[i]*fImPartDielectricConst[i];
     939
     940   result = (x4 + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i]);
     941   if(result < 1.0e-8) result = 1.0e-8;
     942   result *= fine_structure_const/be2/pi;
     943   //   result *= (1-exp(-beta/betaBohr))*(1-exp(-beta/betaBohr));
     944   //  result *= (1-exp(-be2/betaBohr2));
     945   result *= (1-exp(-be4/betaBohr4));
    848946   if(fDensity >= 0.1)
    849947   {
    850       result /= x8 ;
    851    }
    852    return result ;
     948      result /= x8;
     949   }
     950   return result;
    853951
    854952} // end of DifPAIxSection
     
    861959                                         G4double betaGammaSq  )
    862960{       
    863    G4double cof, logarithm, x3, x5, argument, modul2, dNdxC ;
    864    G4double be2, be4, betaBohr2,betaBohr4,cofBetaBohr ;
    865 
    866    cof         = 1.0 ;
    867    cofBetaBohr = 4.0 ;
    868    betaBohr2   = fine_structure_const*fine_structure_const ;
    869    betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr ;
    870 
    871    be2 = betaGammaSq/(1 + betaGammaSq) ;
    872    be4 = be2*be2 ;
    873 
    874    if( betaGammaSq < 0.01 ) logarithm = log(1.0+betaGammaSq) ; // 0.0 ;
     961   G4double logarithm, x3, x5, argument, modul2, dNdxC;
     962   G4double be2, be4, betaBohr2,betaBohr4,cofBetaBohr;
     963
     964   cofBetaBohr = 4.0;
     965   betaBohr2   = fine_structure_const*fine_structure_const;
     966   betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
     967
     968   be2 = betaGammaSq/(1 + betaGammaSq);
     969   be4 = be2*be2;
     970
     971   if( betaGammaSq < 0.01 ) logarithm = log(1.0+betaGammaSq); // 0.0;
    875972   else
    876973   {
    877974     logarithm  = -log( (1/betaGammaSq - fRePartDielectricConst[i])*
    878975                        (1/betaGammaSq - fRePartDielectricConst[i]) +
    879                         fImPartDielectricConst[i]*fImPartDielectricConst[i] )*0.5 ;
    880      logarithm += log(1+1.0/betaGammaSq) ;
     976                        fImPartDielectricConst[i]*fImPartDielectricConst[i] )*0.5;
     977     logarithm += log(1+1.0/betaGammaSq);
    881978   }
    882979
    883980   if( fImPartDielectricConst[i] == 0.0 || betaGammaSq < 0.01 )
    884981   {
    885      argument = 0.0 ;
     982     argument = 0.0;
    886983   }
    887984   else
    888985   {
    889      x3 = -fRePartDielectricConst[i] + 1.0/betaGammaSq ;
     986     x3 = -fRePartDielectricConst[i] + 1.0/betaGammaSq;
    890987     x5 = -1.0 - fRePartDielectricConst[i] +
    891988          be2*((1.0 +fRePartDielectricConst[i])*(1.0 + fRePartDielectricConst[i]) +
    892           fImPartDielectricConst[i]*fImPartDielectricConst[i]) ;
     989          fImPartDielectricConst[i]*fImPartDielectricConst[i]);
    893990     if( x3 == 0.0 ) argument = 0.5*pi;
    894      else            argument = atan2(fImPartDielectricConst[i],x3) ;
    895      argument *= x5  ;
     991     else            argument = atan2(fImPartDielectricConst[i],x3);
     992     argument *= x5 ;
    896993   }   
    897    dNdxC = ( logarithm*fImPartDielectricConst[i] + argument )/hbarc ;
     994   dNdxC = ( logarithm*fImPartDielectricConst[i] + argument )/hbarc;
    898995 
    899    if(dNdxC < 1.0e-8) dNdxC = 1.0e-8 ;
    900 
    901    dNdxC *= fine_structure_const/be2/pi ;
    902 
    903    dNdxC *= (1-exp(-be4/betaBohr4)) ;
     996   if(dNdxC < 1.0e-8) dNdxC = 1.0e-8;
     997
     998   dNdxC *= fine_structure_const/be2/pi;
     999
     1000   dNdxC *= (1-exp(-be4/betaBohr4));
    9041001
    9051002   if(fDensity >= 0.1)
    9061003   {
    9071004      modul2 = (1.0 + fRePartDielectricConst[i])*(1.0 + fRePartDielectricConst[i]) +
    908                     fImPartDielectricConst[i]*fImPartDielectricConst[i] ;
    909       dNdxC /= modul2 ;
    910    }
    911    return dNdxC ;
     1005                    fImPartDielectricConst[i]*fImPartDielectricConst[i];
     1006      dNdxC /= modul2;
     1007   }
     1008   return dNdxC;
    9121009
    9131010} // end of PAIdNdxCerenkov
     1011
     1012//////////////////////////////////////////////////////////////////////////
     1013//
     1014// Calculation od dN/dx of collisions of MM with creation of Cerenkov pseudo-photons
     1015
     1016G4double G4PAIxSection::PAIdNdxMM( G4int    i ,
     1017                                         G4double betaGammaSq  )
     1018{       
     1019   G4double logarithm, x3, x5, argument, dNdxC;
     1020   G4double be2, be4, betaBohr2,betaBohr4,cofBetaBohr;
     1021
     1022   cofBetaBohr = 4.0;
     1023   betaBohr2   = fine_structure_const*fine_structure_const;
     1024   betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
     1025
     1026   be2 = betaGammaSq/(1 + betaGammaSq);
     1027   be4 = be2*be2;
     1028
     1029   if( betaGammaSq < 0.01 ) logarithm = log(1.0+betaGammaSq); // 0.0;
     1030   else
     1031   {
     1032     logarithm  = -log( (1/betaGammaSq - fRePartDielectricConst[i])*
     1033                        (1/betaGammaSq - fRePartDielectricConst[i]) +
     1034                        fImPartDielectricConst[i]*fImPartDielectricConst[i] )*0.5;
     1035     logarithm += log(1+1.0/betaGammaSq);
     1036   }
     1037
     1038   if( fImPartDielectricConst[i] == 0.0 || betaGammaSq < 0.01 )
     1039   {
     1040     argument = 0.0;
     1041   }
     1042   else
     1043   {
     1044     x3 = -fRePartDielectricConst[i] + 1.0/betaGammaSq;
     1045     x5 = be2*( 1.0 + fRePartDielectricConst[i] ) - 1.0;
     1046     if( x3 == 0.0 ) argument = 0.5*pi;
     1047     else            argument = atan2(fImPartDielectricConst[i],x3);
     1048     argument *= x5 ;
     1049   }   
     1050   dNdxC = ( logarithm*fImPartDielectricConst[i]*be2 + argument )/hbarc;
     1051 
     1052   if(dNdxC < 1.0e-8) dNdxC = 1.0e-8;
     1053
     1054   dNdxC *= fine_structure_const/be2/pi;
     1055
     1056   dNdxC *= (1-exp(-be4/betaBohr4));
     1057   return dNdxC;
     1058
     1059} // end of PAIdNdxMM
    9141060
    9151061//////////////////////////////////////////////////////////////////////////
     
    9211067                                        G4double betaGammaSq  )
    9221068{       
    923    G4double cof, resonance, modul2, dNdxP ;
    924    G4double be2, be4, betaBohr2, betaBohr4, cofBetaBohr ;
    925 
    926    cof = 1 ;
    927    cofBetaBohr = 4.0 ;
    928    betaBohr2   = fine_structure_const*fine_structure_const ;
    929    betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr ;
    930 
    931    be2 = betaGammaSq/(1 + betaGammaSq) ;
    932    be4 = be2*be2 ;
     1069   G4double resonance, modul2, dNdxP, cof = 1.;
     1070   G4double be2, be4, betaBohr2, betaBohr4, cofBetaBohr;
     1071
     1072 
     1073   cofBetaBohr = 4.0;
     1074   betaBohr2   = fine_structure_const*fine_structure_const;
     1075   betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
     1076
     1077   be2 = betaGammaSq/(1 + betaGammaSq);
     1078   be4 = be2*be2;
    9331079 
    934    resonance = log(2*electron_mass_c2*be2/fSplineEnergy[i]) 
    935    resonance *= fImPartDielectricConst[i]/hbarc ;
    936 
    937 
    938    dNdxP = ( resonance + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i] ) ;
    939 
    940    if( dNdxP < 1.0e-8 ) dNdxP = 1.0e-8 ;
    941 
    942    dNdxP *= fine_structure_const/be2/pi ;
    943    dNdxP *= (1-exp(-be4/betaBohr4)) ;
     1080   resonance = log(2*electron_mass_c2*be2/fSplineEnergy[i])
     1081   resonance *= fImPartDielectricConst[i]/hbarc;
     1082
     1083
     1084   dNdxP = ( resonance + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i] );
     1085
     1086   if( dNdxP < 1.0e-8 ) dNdxP = 1.0e-8;
     1087
     1088   dNdxP *= fine_structure_const/be2/pi;
     1089   dNdxP *= (1-exp(-be4/betaBohr4));
    9441090
    9451091   if( fDensity >= 0.1 )
    9461092   {
    9471093     modul2 = (1 + fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) +
    948         fImPartDielectricConst[i]*fImPartDielectricConst[i] ;
    949      dNdxP /= modul2 ;
    950    }
    951    return dNdxP ;
     1094        fImPartDielectricConst[i]*fImPartDielectricConst[i];
     1095     dNdxP /= modul2;
     1096   }
     1097   return dNdxP;
    9521098
    9531099} // end of PAIdNdxPlasmon
     1100
     1101//////////////////////////////////////////////////////////////////////////
     1102//
     1103// Calculation od dN/dx of collisions with creation of longitudinal EM
     1104// resonance excitations (plasmons, delta-electrons)
     1105
     1106G4double G4PAIxSection::PAIdNdxResonance( G4int    i ,
     1107                                        G4double betaGammaSq  )
     1108{       
     1109   G4double resonance, modul2, dNdxP;
     1110   G4double be2, be4, betaBohr2, betaBohr4, cofBetaBohr;
     1111
     1112   cofBetaBohr = 4.0;
     1113   betaBohr2   = fine_structure_const*fine_structure_const;
     1114   betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
     1115
     1116   be2 = betaGammaSq/(1 + betaGammaSq);
     1117   be4 = be2*be2;
     1118 
     1119   resonance = log(2*electron_mass_c2*be2/fSplineEnergy[i]); 
     1120   resonance *= fImPartDielectricConst[i]/hbarc;
     1121
     1122
     1123   dNdxP = resonance;
     1124
     1125   if( dNdxP < 1.0e-8 ) dNdxP = 1.0e-8;
     1126
     1127   dNdxP *= fine_structure_const/be2/pi;
     1128   dNdxP *= (1-exp(-be4/betaBohr4));
     1129
     1130   if( fDensity >= 0.1 )
     1131   {
     1132     modul2 = (1 + fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) +
     1133        fImPartDielectricConst[i]*fImPartDielectricConst[i];
     1134     dNdxP /= modul2;
     1135   }
     1136   return dNdxP;
     1137
     1138} // end of PAIdNdxResonance
    9541139
    9551140////////////////////////////////////////////////////////////////////////
     
    9611146void G4PAIxSection::IntegralPAIxSection()
    9621147{
    963   fIntegralPAIxSection[fSplineNumber] = 0 ;
    964   fIntegralPAIdEdx[fSplineNumber]     = 0 ;
    965   fIntegralPAIxSection[0]             = 0 ;
    966   G4int k = fIntervalNumber -1 ;
    967 
    968   for(G4int i = fSplineNumber-1 ; i >= 1 ; i--)
     1148  fIntegralPAIxSection[fSplineNumber] = 0;
     1149  fIntegralPAIdEdx[fSplineNumber]     = 0;
     1150  fIntegralPAIxSection[0]             = 0;
     1151  G4int k = fIntervalNumber -1;
     1152
     1153  for(G4int i = fSplineNumber-1; i >= 1; i--)
    9691154  {
    9701155    if(fSplineEnergy[i] >= fEnergyInterval[k])
    9711156    {
    972       fIntegralPAIxSection[i] = fIntegralPAIxSection[i+1] + SumOverInterval(i) ;
    973       fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i+1] + SumOverIntervaldEdx(i) ;
     1157      fIntegralPAIxSection[i] = fIntegralPAIxSection[i+1] + SumOverInterval(i);
     1158      fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i+1] + SumOverIntervaldEdx(i);
    9741159    }
    9751160    else
    9761161    {
    9771162      fIntegralPAIxSection[i] = fIntegralPAIxSection[i+1] +
    978                                    SumOverBorder(i+1,fEnergyInterval[k]) ;
     1163                                   SumOverBorder(i+1,fEnergyInterval[k]);
    9791164      fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i+1] +
    980                                    SumOverBorderdEdx(i+1,fEnergyInterval[k]) ;
    981       k-- ;
     1165                                   SumOverBorderdEdx(i+1,fEnergyInterval[k]);
     1166      k--;
    9821167    }
    9831168  }
     
    9921177void G4PAIxSection::IntegralCerenkov()
    9931178{
    994   G4int i, k ;
    995    fIntegralCerenkov[fSplineNumber] = 0 ;
    996    fIntegralCerenkov[0] = 0 ;
    997    k = fIntervalNumber -1 ;
    998 
    999    for( i = fSplineNumber-1 ; i >= 1 ; i-- )
     1179  G4int i, k;
     1180   fIntegralCerenkov[fSplineNumber] = 0;
     1181   fIntegralCerenkov[0] = 0;
     1182   k = fIntervalNumber -1;
     1183
     1184   for( i = fSplineNumber-1; i >= 1; i-- )
    10001185   {
    10011186      if(fSplineEnergy[i] >= fEnergyInterval[k])
    10021187      {
    1003         fIntegralCerenkov[i] = fIntegralCerenkov[i+1] + SumOverInterCerenkov(i) ;
     1188        fIntegralCerenkov[i] = fIntegralCerenkov[i+1] + SumOverInterCerenkov(i);
    10041189        // G4cout<<"int: i = "<<i<<"; sumC = "<<fIntegralCerenkov[i]<<G4endl;
    10051190      }
     
    10071192      {
    10081193        fIntegralCerenkov[i] = fIntegralCerenkov[i+1] +
    1009                                    SumOverBordCerenkov(i+1,fEnergyInterval[k]) ;
    1010         k-- ;
     1194                                   SumOverBordCerenkov(i+1,fEnergyInterval[k]);
     1195        k--;
    10111196        // G4cout<<"bord: i = "<<i<<"; sumC = "<<fIntegralCerenkov[i]<<G4endl;
    10121197      }
     
    10141199
    10151200}   // end of IntegralCerenkov
     1201
     1202////////////////////////////////////////////////////////////////////////
     1203//
     1204// Calculation of the PAI MM-Cerenkov integral cross-section
     1205// fIntegralMM[1] = specific MM-Cerenkov ionisation, 1/cm
     1206// and fIntegralMM[0] = mean MM-Cerenkov loss per cm  in keV/cm
     1207
     1208void G4PAIxSection::IntegralMM()
     1209{
     1210  G4int i, k;
     1211   fIntegralMM[fSplineNumber] = 0;
     1212   fIntegralMM[0] = 0;
     1213   k = fIntervalNumber -1;
     1214
     1215   for( i = fSplineNumber-1; i >= 1; i-- )
     1216   {
     1217      if(fSplineEnergy[i] >= fEnergyInterval[k])
     1218      {
     1219        fIntegralMM[i] = fIntegralMM[i+1] + SumOverInterMM(i);
     1220        // G4cout<<"int: i = "<<i<<"; sumC = "<<fIntegralMM[i]<<G4endl;
     1221      }
     1222      else
     1223      {
     1224        fIntegralMM[i] = fIntegralMM[i+1] +
     1225                                   SumOverBordMM(i+1,fEnergyInterval[k]);
     1226        k--;
     1227        // G4cout<<"bord: i = "<<i<<"; sumC = "<<fIntegralMM[i]<<G4endl;
     1228      }
     1229   }
     1230
     1231}   // end of IntegralMM
    10161232
    10171233////////////////////////////////////////////////////////////////////////
     
    10231239void G4PAIxSection::IntegralPlasmon()
    10241240{
    1025    fIntegralPlasmon[fSplineNumber] = 0 ;
    1026    fIntegralPlasmon[0] = 0 ;
    1027    G4int k = fIntervalNumber -1 ;
     1241   fIntegralPlasmon[fSplineNumber] = 0;
     1242   fIntegralPlasmon[0] = 0;
     1243   G4int k = fIntervalNumber -1;
    10281244   for(G4int i=fSplineNumber-1;i>=1;i--)
    10291245   {
    10301246      if(fSplineEnergy[i] >= fEnergyInterval[k])
    10311247      {
    1032         fIntegralPlasmon[i] = fIntegralPlasmon[i+1] + SumOverInterPlasmon(i) ;
     1248        fIntegralPlasmon[i] = fIntegralPlasmon[i+1] + SumOverInterPlasmon(i);
    10331249      }
    10341250      else
    10351251      {
    10361252        fIntegralPlasmon[i] = fIntegralPlasmon[i+1] +
    1037                                    SumOverBordPlasmon(i+1,fEnergyInterval[k]) ;
    1038         k-- ;
     1253                                   SumOverBordPlasmon(i+1,fEnergyInterval[k]);
     1254        k--;
    10391255      }
    10401256   }
    10411257
    10421258}   // end of IntegralPlasmon
     1259
     1260////////////////////////////////////////////////////////////////////////
     1261//
     1262// Calculation of the PAI resonance integral cross-section
     1263// fIntegralResonance[1] = resonance primary ionisation, 1/cm
     1264// and fIntegralResonance[0] = mean resonance loss per cm  in keV/cm
     1265
     1266void G4PAIxSection::IntegralResonance()
     1267{
     1268   fIntegralResonance[fSplineNumber] = 0;
     1269   fIntegralResonance[0] = 0;
     1270   G4int k = fIntervalNumber -1;
     1271   for(G4int i=fSplineNumber-1;i>=1;i--)
     1272   {
     1273      if(fSplineEnergy[i] >= fEnergyInterval[k])
     1274      {
     1275        fIntegralResonance[i] = fIntegralResonance[i+1] + SumOverInterResonance(i);
     1276      }
     1277      else
     1278      {
     1279        fIntegralResonance[i] = fIntegralResonance[i+1] +
     1280                                   SumOverBordResonance(i+1,fEnergyInterval[k]);
     1281        k--;
     1282      }
     1283   }
     1284
     1285}   // end of IntegralResonance
    10431286
    10441287//////////////////////////////////////////////////////////////////////
     
    10501293G4double G4PAIxSection::SumOverInterval( G4int i )
    10511294{         
    1052    G4double x0,x1,y0,yy1,a,b,c,result ;
    1053 
    1054    x0 = fSplineEnergy[i] ;
    1055    x1 = fSplineEnergy[i+1] ;
    1056    y0 = fDifPAIxSection[i] ;
     1295   G4double x0,x1,y0,yy1,a,b,c,result;
     1296
     1297   x0 = fSplineEnergy[i];
     1298   x1 = fSplineEnergy[i+1];
     1299   y0 = fDifPAIxSection[i];
    10571300   yy1 = fDifPAIxSection[i+1];
    10581301   c = x1/x0;
    1059    a = log10(yy1/y0)/log10(c) ;
    1060    // b = log10(y0) - a*log10(x0) ;
    1061    b = y0/pow(x0,a) ;
    1062    a += 1 ;
     1302   a = log10(yy1/y0)/log10(c);
     1303   // b = log10(y0) - a*log10(x0);
     1304   b = y0/pow(x0,a);
     1305   a += 1;
    10631306   if(a == 0)
    10641307   {
    1065       result = b*log(x1/x0) ;
     1308      result = b*log(x1/x0);
    10661309   }
    10671310   else
    10681311   {
    1069       result = y0*(x1*pow(c,a-1) - x0)/a ;
     1312      result = y0*(x1*pow(c,a-1) - x0)/a;
    10701313   }
    10711314   a++;
    10721315   if(a == 0)
    10731316   {
    1074       fIntegralPAIxSection[0] += b*log(x1/x0) ;
     1317      fIntegralPAIxSection[0] += b*log(x1/x0);
    10751318   }
    10761319   else
    10771320   {
    1078       fIntegralPAIxSection[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a ;
    1079    }
    1080    return result ;
     1321      fIntegralPAIxSection[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
     1322   }
     1323   return result;
    10811324
    10821325} //  end of SumOverInterval
     
    10861329G4double G4PAIxSection::SumOverIntervaldEdx( G4int i )
    10871330{         
    1088    G4double x0,x1,y0,yy1,a,b,c,result ;
    1089 
    1090    x0 = fSplineEnergy[i] ;
    1091    x1 = fSplineEnergy[i+1] ;
    1092    y0 = fDifPAIxSection[i] ;
     1331   G4double x0,x1,y0,yy1,a,b,c,result;
     1332
     1333   x0 = fSplineEnergy[i];
     1334   x1 = fSplineEnergy[i+1];
     1335   y0 = fDifPAIxSection[i];
    10931336   yy1 = fDifPAIxSection[i+1];
    10941337   c = x1/x0;
    1095    a = log10(yy1/y0)/log10(c) ;
    1096    // b = log10(y0) - a*log10(x0) ;
    1097    b = y0/pow(x0,a) ;
    1098    a += 2 ;
     1338   a = log10(yy1/y0)/log10(c);
     1339   // b = log10(y0) - a*log10(x0);
     1340   b = y0/pow(x0,a);
     1341   a += 2;
    10991342   if(a == 0)
    11001343   {
    1101      result = b*log(x1/x0) ;
     1344     result = b*log(x1/x0);
    11021345   }
    11031346   else
    11041347   {
    1105      result = y0*(x1*x1*pow(c,a-2) - x0*x0)/a ;
    1106    }
    1107    return result ;
     1348     result = y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
     1349   }
     1350   return result;
    11081351
    11091352} //  end of SumOverInterval
     
    11171360G4double G4PAIxSection::SumOverInterCerenkov( G4int i )
    11181361{         
    1119    G4double x0,x1,y0,yy1,a,b,c,result ;
    1120 
    1121    x0  = fSplineEnergy[i] ;
    1122    x1  = fSplineEnergy[i+1] ;
    1123    y0  = fdNdxCerenkov[i] ;
     1362   G4double x0,x1,y0,yy1,a,b,c,result;
     1363
     1364   x0  = fSplineEnergy[i];
     1365   x1  = fSplineEnergy[i+1];
     1366   y0  = fdNdxCerenkov[i];
    11241367   yy1 = fdNdxCerenkov[i+1];
    11251368   // G4cout<<"SumC, i = "<<i<<"; x0 ="<<x0<<"; x1 = "<<x1
     
    11271370
    11281371   c = x1/x0;
    1129    a = log10(yy1/y0)/log10(c) ;
    1130    b = y0/pow(x0,a) ;
    1131 
    1132    a += 1.0 ;
    1133    if(a == 0) result = b*log(c) ;
    1134    else       result = y0*(x1*pow(c,a-1) - x0)/a ;   
    1135    a += 1.0 ;
    1136 
    1137    if( a == 0 ) fIntegralCerenkov[0] += b*log(x1/x0) ;
    1138    else         fIntegralCerenkov[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a ;
     1372   a = log10(yy1/y0)/log10(c);
     1373   b = y0/pow(x0,a);
     1374
     1375   a += 1.0;
     1376   if(a == 0) result = b*log(c);
     1377   else       result = y0*(x1*pow(c,a-1) - x0)/a;   
     1378   a += 1.0;
     1379
     1380   if( a == 0 ) fIntegralCerenkov[0] += b*log(x1/x0);
     1381   else         fIntegralCerenkov[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
    11391382   //  G4cout<<"a = "<<a<<"; b = "<<b<<"; result = "<<result<<G4endl;   
    1140    return result ;
     1383   return result;
    11411384
    11421385} //  end of SumOverInterCerenkov
     1386
     1387//////////////////////////////////////////////////////////////////////
     1388//
     1389// Calculation the PAI MM-Cerenkov integral cross-section inside
     1390// of interval of continuous values of photo-ionisation Cerenkov
     1391// cross-section. Parameter  'i' is the number of interval.
     1392
     1393G4double G4PAIxSection::SumOverInterMM( G4int i )
     1394{         
     1395   G4double x0,x1,y0,yy1,a,b,c,result;
     1396
     1397   x0  = fSplineEnergy[i];
     1398   x1  = fSplineEnergy[i+1];
     1399   y0  = fdNdxMM[i];
     1400   yy1 = fdNdxMM[i+1];
     1401   // G4cout<<"SumC, i = "<<i<<"; x0 ="<<x0<<"; x1 = "<<x1
     1402   //   <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
     1403
     1404   c = x1/x0;
     1405   a = log10(yy1/y0)/log10(c);
     1406   b = y0/pow(x0,a);
     1407
     1408   a += 1.0;
     1409   if(a == 0) result = b*log(c);
     1410   else       result = y0*(x1*pow(c,a-1) - x0)/a;   
     1411   a += 1.0;
     1412
     1413   if( a == 0 ) fIntegralMM[0] += b*log(x1/x0);
     1414   else         fIntegralMM[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
     1415   //  G4cout<<"a = "<<a<<"; b = "<<b<<"; result = "<<result<<G4endl;   
     1416   return result;
     1417
     1418} //  end of SumOverInterMM
    11431419
    11441420//////////////////////////////////////////////////////////////////////
     
    11501426G4double G4PAIxSection::SumOverInterPlasmon( G4int i )
    11511427{         
    1152    G4double x0,x1,y0,yy1,a,b,c,result ;
    1153 
    1154    x0  = fSplineEnergy[i] ;
    1155    x1  = fSplineEnergy[i+1] ;
    1156    y0  = fdNdxPlasmon[i] ;
     1428   G4double x0,x1,y0,yy1,a,b,c,result;
     1429
     1430   x0  = fSplineEnergy[i];
     1431   x1  = fSplineEnergy[i+1];
     1432   y0  = fdNdxPlasmon[i];
    11571433   yy1 = fdNdxPlasmon[i+1];
    11581434   c =x1/x0;
    1159    a = log10(yy1/y0)/log10(c) ;
    1160    // b = log10(y0) - a*log10(x0) ;
    1161    b = y0/pow(x0,a) ;
    1162 
    1163    a += 1.0 ;
    1164    if(a == 0) result = b*log(x1/x0) ;
    1165    else       result = y0*(x1*pow(c,a-1) - x0)/a ;   
    1166    a += 1.0 ;
    1167 
    1168    if( a == 0 ) fIntegralPlasmon[0] += b*log(x1/x0) ;
    1169    else         fIntegralPlasmon[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a ;
    1170    
    1171    return result ;
     1435   a = log10(yy1/y0)/log10(c);
     1436   // b = log10(y0) - a*log10(x0);
     1437   b = y0/pow(x0,a);
     1438
     1439   a += 1.0;
     1440   if(a == 0) result = b*log(x1/x0);
     1441   else       result = y0*(x1*pow(c,a-1) - x0)/a;   
     1442   a += 1.0;
     1443
     1444   if( a == 0 ) fIntegralPlasmon[0] += b*log(x1/x0);
     1445   else         fIntegralPlasmon[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
     1446   
     1447   return result;
    11721448
    11731449} //  end of SumOverInterPlasmon
     1450
     1451//////////////////////////////////////////////////////////////////////
     1452//
     1453// Calculation the PAI resonance integral cross-section inside
     1454// of interval of continuous values of photo-ionisation resonance
     1455// cross-section. Parameter  'i' is the number of interval.
     1456
     1457G4double G4PAIxSection::SumOverInterResonance( G4int i )
     1458{         
     1459   G4double x0,x1,y0,yy1,a,b,c,result;
     1460
     1461   x0  = fSplineEnergy[i];
     1462   x1  = fSplineEnergy[i+1];
     1463   y0  = fdNdxResonance[i];
     1464   yy1 = fdNdxResonance[i+1];
     1465   c =x1/x0;
     1466   a = log10(yy1/y0)/log10(c);
     1467   // b = log10(y0) - a*log10(x0);
     1468   b = y0/pow(x0,a);
     1469
     1470   a += 1.0;
     1471   if(a == 0) result = b*log(x1/x0);
     1472   else       result = y0*(x1*pow(c,a-1) - x0)/a;   
     1473   a += 1.0;
     1474
     1475   if( a == 0 ) fIntegralResonance[0] += b*log(x1/x0);
     1476   else         fIntegralResonance[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
     1477   
     1478   return result;
     1479
     1480} //  end of SumOverInterResonance
    11741481
    11751482///////////////////////////////////////////////////////////////////////////////
     
    11811488                                       G4double en0    )
    11821489{               
    1183    G4double x0,x1,y0,yy1,a,b,c,d,e0,result ;
    1184 
    1185    e0 = en0 ;
    1186    x0 = fSplineEnergy[i] ;
    1187    x1 = fSplineEnergy[i+1] ;
    1188    y0 = fDifPAIxSection[i] ;
    1189    yy1 = fDifPAIxSection[i+1] ;
     1490   G4double x0,x1,y0,yy1,a,b,c,d,e0,result;
     1491
     1492   e0 = en0;
     1493   x0 = fSplineEnergy[i];
     1494   x1 = fSplineEnergy[i+1];
     1495   y0 = fDifPAIxSection[i];
     1496   yy1 = fDifPAIxSection[i+1];
    11901497
    11911498   c = x1/x0;
    11921499   d = e0/x0;   
    1193    a = log10(yy1/y0)/log10(x1/x0) ;
    1194    // b0 = log10(y0) - a*log10(x0) ;
    1195    b = y0/pow(x0,a);  // pow(10.,b) ;
    1196    
    1197    a += 1 ;
     1500   a = log10(yy1/y0)/log10(x1/x0);
     1501   // b0 = log10(y0) - a*log10(x0);
     1502   b = y0/pow(x0,a);  // pow(10.,b);
     1503   
     1504   a += 1;
    11981505   if(a == 0)
    11991506   {
    1200       result = b*log(x0/e0) ;
     1507      result = b*log(x0/e0);
    12011508   }
    12021509   else
    12031510   {
    1204       result = y0*(x0 - e0*pow(d,a-1))/a ;
    1205    }
    1206    a++ ;
     1511      result = y0*(x0 - e0*pow(d,a-1))/a;
     1512   }
     1513   a++;
    12071514   if(a == 0)
    12081515   {
    1209       fIntegralPAIxSection[0] += b*log(x0/e0) ;
     1516      fIntegralPAIxSection[0] += b*log(x0/e0);
    12101517   }
    12111518   else
    12121519   {
    1213       fIntegralPAIxSection[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a ;
    1214    }
    1215    x0 = fSplineEnergy[i - 1] ;
    1216    x1 = fSplineEnergy[i - 2] ;
    1217    y0 = fDifPAIxSection[i - 1] ;
    1218    yy1 = fDifPAIxSection[i - 2] ;
     1520      fIntegralPAIxSection[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
     1521   }
     1522   x0 = fSplineEnergy[i - 1];
     1523   x1 = fSplineEnergy[i - 2];
     1524   y0 = fDifPAIxSection[i - 1];
     1525   yy1 = fDifPAIxSection[i - 2];
    12191526
    12201527   c = x1/x0;
    12211528   d = e0/x0;   
    1222    a = log10(yy1/y0)/log10(x1/x0) ;
    1223    //  b0 = log10(y0) - a*log10(x0) ;
    1224    b = y0/pow(x0,a) ;
    1225    a += 1 ;
     1529   a = log10(yy1/y0)/log10(x1/x0);
     1530   //  b0 = log10(y0) - a*log10(x0);
     1531   b = y0/pow(x0,a);
     1532   a += 1;
    12261533   if(a == 0)
    12271534   {
    1228       result += b*log(e0/x0) ;
     1535      result += b*log(e0/x0);
    12291536   }
    12301537   else
    12311538   {
    1232       result += y0*(e0*pow(d,a-1) - x0)/a ;
    1233    }
    1234    a++ ;
     1539      result += y0*(e0*pow(d,a-1) - x0)/a;
     1540   }
     1541   a++;
    12351542   if(a == 0)
    12361543   {
    1237       fIntegralPAIxSection[0] += b*log(e0/x0) ;
     1544      fIntegralPAIxSection[0] += b*log(e0/x0);
    12381545   }
    12391546   else
    12401547   {
    1241       fIntegralPAIxSection[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a ;
    1242    }
    1243    return result ;
     1548      fIntegralPAIxSection[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
     1549   }
     1550   return result;
    12441551
    12451552}
     
    12501557                                       G4double en0    )
    12511558{               
    1252    G4double x0,x1,y0,yy1,a,b,c,d,e0,result ;
    1253 
    1254    e0 = en0 ;
    1255    x0 = fSplineEnergy[i] ;
    1256    x1 = fSplineEnergy[i+1] ;
    1257    y0 = fDifPAIxSection[i] ;
    1258    yy1 = fDifPAIxSection[i+1] ;
     1559   G4double x0,x1,y0,yy1,a,b,c,d,e0,result;
     1560
     1561   e0 = en0;
     1562   x0 = fSplineEnergy[i];
     1563   x1 = fSplineEnergy[i+1];
     1564   y0 = fDifPAIxSection[i];
     1565   yy1 = fDifPAIxSection[i+1];
    12591566
    12601567   c = x1/x0;
    12611568   d = e0/x0;   
    1262    a = log10(yy1/y0)/log10(x1/x0) ;
    1263    // b0 = log10(y0) - a*log10(x0) ;
    1264    b = y0/pow(x0,a);  // pow(10.,b) ;
    1265    
    1266    a += 2 ;
     1569   a = log10(yy1/y0)/log10(x1/x0);
     1570   // b0 = log10(y0) - a*log10(x0);
     1571   b = y0/pow(x0,a);  // pow(10.,b);
     1572   
     1573   a += 2;
    12671574   if(a == 0)
    12681575   {
    1269       result = b*log(x0/e0) ;
     1576      result = b*log(x0/e0);
    12701577   }
    12711578   else
    12721579   {
    1273       result = y0*(x0*x0 - e0*e0*pow(d,a-2))/a ;
    1274    }
    1275    x0 = fSplineEnergy[i - 1] ;
    1276    x1 = fSplineEnergy[i - 2] ;
    1277    y0 = fDifPAIxSection[i - 1] ;
    1278    yy1 = fDifPAIxSection[i - 2] ;
     1580      result = y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
     1581   }
     1582   x0 = fSplineEnergy[i - 1];
     1583   x1 = fSplineEnergy[i - 2];
     1584   y0 = fDifPAIxSection[i - 1];
     1585   yy1 = fDifPAIxSection[i - 2];
    12791586
    12801587   c = x1/x0;
    12811588   d = e0/x0;   
    1282    a = log10(yy1/y0)/log10(x1/x0) ;
    1283    //  b0 = log10(y0) - a*log10(x0) ;
    1284    b = y0/pow(x0,a) ;
    1285    a += 2 ;
     1589   a = log10(yy1/y0)/log10(x1/x0);
     1590   //  b0 = log10(y0) - a*log10(x0);
     1591   b = y0/pow(x0,a);
     1592   a += 2;
    12861593   if(a == 0)
    12871594   {
    1288       result += b*log(e0/x0) ;
     1595      result += b*log(e0/x0);
    12891596   }
    12901597   else
    12911598   {
    1292       result += y0*(e0*e0*pow(d,a-2) - x0*x0)/a ;
    1293    }
    1294    return result ;
     1599      result += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
     1600   }
     1601   return result;
    12951602
    12961603}
     
    13041611                                             G4double en0    )
    13051612{               
    1306    G4double x0,x1,y0,yy1,a,b,e0,c,d,result ;
    1307 
    1308    e0 = en0 ;
    1309    x0 = fSplineEnergy[i] ;
    1310    x1 = fSplineEnergy[i+1] ;
    1311    y0 = fdNdxCerenkov[i] ;
    1312    yy1 = fdNdxCerenkov[i+1] ;
     1613   G4double x0,x1,y0,yy1,a,b,e0,c,d,result;
     1614
     1615   e0 = en0;
     1616   x0 = fSplineEnergy[i];
     1617   x1 = fSplineEnergy[i+1];
     1618   y0 = fdNdxCerenkov[i];
     1619   yy1 = fdNdxCerenkov[i+1];
    13131620
    13141621   //  G4cout<<G4endl;
    13151622   //  G4cout<<"SumBordC, i = "<<i<<"; en0 = "<<en0<<"; x0 ="<<x0<<"; x1 = "<<x1
    13161623   //     <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
    1317    c = x1/x0 ;
    1318    d = e0/x0 ;
    1319    a = log10(yy1/y0)/log10(c) ;
    1320    // b0 = log10(y0) - a*log10(x0) ;
    1321    b = y0/pow(x0,a); // pow(10.,b0) ;   
    1322    
    1323    a += 1.0 ;
    1324    if( a == 0 ) result = b*log(x0/e0) ;
    1325    else         result = y0*(x0 - e0*pow(d,a-1))/a ;   
    1326    a += 1.0 ;
    1327 
    1328    if( a == 0 ) fIntegralCerenkov[0] += b*log(x0/e0) ;
    1329    else         fIntegralCerenkov[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a ;
     1624   c = x1/x0;
     1625   d = e0/x0;
     1626   a = log10(yy1/y0)/log10(c);
     1627   // b0 = log10(y0) - a*log10(x0);
     1628   b = y0/pow(x0,a); // pow(10.,b0);   
     1629   
     1630   a += 1.0;
     1631   if( a == 0 ) result = b*log(x0/e0);
     1632   else         result = y0*(x0 - e0*pow(d,a-1))/a;   
     1633   a += 1.0;
     1634
     1635   if( a == 0 ) fIntegralCerenkov[0] += b*log(x0/e0);
     1636   else         fIntegralCerenkov[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
    13301637
    13311638// G4cout<<"a = "<<a<<"; b0 = "<<b0<<"; b = "<<b<<"; result = "<<result<<G4endl;
    13321639   
    1333    x0  = fSplineEnergy[i - 1] ;
    1334    x1  = fSplineEnergy[i - 2] ;
    1335    y0  = fdNdxCerenkov[i - 1] ;
    1336    yy1 = fdNdxCerenkov[i - 2] ;
     1640   x0  = fSplineEnergy[i - 1];
     1641   x1  = fSplineEnergy[i - 2];
     1642   y0  = fdNdxCerenkov[i - 1];
     1643   yy1 = fdNdxCerenkov[i - 2];
    13371644
    13381645   // G4cout<<"x0 ="<<x0<<"; x1 = "<<x1
    13391646   //    <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
    13401647
    1341    c = x1/x0 ;
    1342    d = e0/x0 ;
    1343    a  = log10(yy1/y0)/log10(x1/x0) ;
    1344    // b0 = log10(y0) - a*log10(x0) ;
    1345    b  =  y0/pow(x0,a);  // pow(10.,b0) ;
    1346 
    1347    a += 1.0 ;
    1348    if( a == 0 ) result += b*log(e0/x0) ;
    1349    else         result += y0*(e0*pow(d,a-1) - x0 )/a ;
    1350    a += 1.0 ;
    1351 
    1352    if( a == 0 )   fIntegralCerenkov[0] += b*log(e0/x0) ;
    1353    else           fIntegralCerenkov[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a ;
     1648   c = x1/x0;
     1649   d = e0/x0;
     1650   a  = log10(yy1/y0)/log10(x1/x0);
     1651   // b0 = log10(y0) - a*log10(x0);
     1652   b  =  y0/pow(x0,a);  // pow(10.,b0);
     1653
     1654   a += 1.0;
     1655   if( a == 0 ) result += b*log(e0/x0);
     1656   else         result += y0*(e0*pow(d,a-1) - x0 )/a;
     1657   a += 1.0;
     1658
     1659   if( a == 0 )   fIntegralCerenkov[0] += b*log(e0/x0);
     1660   else           fIntegralCerenkov[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
    13541661
    13551662   // G4cout<<"a = "<<a<<"; b0 = "<<b0<<"; b = "
    13561663   // <<b<<"; result = "<<result<<G4endl;   
    13571664
    1358    return result ;
     1665   return result;
     1666
     1667}
     1668
     1669///////////////////////////////////////////////////////////////////////////////
     1670//
     1671// Integration of MM-Cerenkov cross-section for the case of
     1672// passing across border between intervals
     1673
     1674G4double G4PAIxSection::SumOverBordMM( G4int      i ,
     1675                                             G4double en0    )
     1676{               
     1677   G4double x0,x1,y0,yy1,a,b,e0,c,d,result;
     1678
     1679   e0 = en0;
     1680   x0 = fSplineEnergy[i];
     1681   x1 = fSplineEnergy[i+1];
     1682   y0 = fdNdxMM[i];
     1683   yy1 = fdNdxMM[i+1];
     1684
     1685   //  G4cout<<G4endl;
     1686   //  G4cout<<"SumBordC, i = "<<i<<"; en0 = "<<en0<<"; x0 ="<<x0<<"; x1 = "<<x1
     1687   //     <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
     1688   c = x1/x0;
     1689   d = e0/x0;
     1690   a = log10(yy1/y0)/log10(c);
     1691   // b0 = log10(y0) - a*log10(x0);
     1692   b = y0/pow(x0,a); // pow(10.,b0);   
     1693   
     1694   a += 1.0;
     1695   if( a == 0 ) result = b*log(x0/e0);
     1696   else         result = y0*(x0 - e0*pow(d,a-1))/a;   
     1697   a += 1.0;
     1698
     1699   if( a == 0 ) fIntegralMM[0] += b*log(x0/e0);
     1700   else         fIntegralMM[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
     1701
     1702// G4cout<<"a = "<<a<<"; b0 = "<<b0<<"; b = "<<b<<"; result = "<<result<<G4endl;
     1703   
     1704   x0  = fSplineEnergy[i - 1];
     1705   x1  = fSplineEnergy[i - 2];
     1706   y0  = fdNdxMM[i - 1];
     1707   yy1 = fdNdxMM[i - 2];
     1708
     1709   // G4cout<<"x0 ="<<x0<<"; x1 = "<<x1
     1710   //    <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
     1711
     1712   c = x1/x0;
     1713   d = e0/x0;
     1714   a  = log10(yy1/y0)/log10(x1/x0);
     1715   // b0 = log10(y0) - a*log10(x0);
     1716   b  =  y0/pow(x0,a);  // pow(10.,b0);
     1717
     1718   a += 1.0;
     1719   if( a == 0 ) result += b*log(e0/x0);
     1720   else         result += y0*(e0*pow(d,a-1) - x0 )/a;
     1721   a += 1.0;
     1722
     1723   if( a == 0 )   fIntegralMM[0] += b*log(e0/x0);
     1724   else           fIntegralMM[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
     1725
     1726   // G4cout<<"a = "<<a<<"; b0 = "<<b0<<"; b = "
     1727   // <<b<<"; result = "<<result<<G4endl;   
     1728
     1729   return result;
    13591730
    13601731}
     
    13681739                                             G4double en0    )
    13691740{               
    1370    G4double x0,x1,y0,yy1,a,b,c,d,e0,result ;
    1371 
    1372    e0 = en0 ;
    1373    x0 = fSplineEnergy[i] ;
    1374    x1 = fSplineEnergy[i+1] ;
    1375    y0 = fdNdxPlasmon[i] ;
    1376    yy1 = fdNdxPlasmon[i+1] ;
    1377 
    1378    c = x1/x0 ;
    1379    d = e0/x0 ;   
    1380    a = log10(yy1/y0)/log10(c) ;
    1381    //  b0 = log10(y0) - a*log10(x0) ;
    1382    b = y0/pow(x0,a); //pow(10.,b) ;
    1383    
    1384    a += 1.0 ;
    1385    if( a == 0 ) result = b*log(x0/e0) ;
    1386    else         result = y0*(x0 - e0*pow(d,a-1))/a ;   
    1387    a += 1.0 ;
    1388 
    1389    if( a == 0 ) fIntegralPlasmon[0] += b*log(x0/e0) ;
    1390    else         fIntegralPlasmon[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a ;
    1391    
    1392    x0 = fSplineEnergy[i - 1] ;
    1393    x1 = fSplineEnergy[i - 2] ;
    1394    y0 = fdNdxPlasmon[i - 1] ;
    1395    yy1 = fdNdxPlasmon[i - 2] ;
    1396 
    1397    c = x1/x0 ;
    1398    d = e0/x0 ;
    1399    a = log10(yy1/y0)/log10(c) ;
    1400    // b0 = log10(y0) - a*log10(x0) ;
    1401    b = y0/pow(x0,a);// pow(10.,b0) ;
    1402 
    1403    a += 1.0 ;
    1404    if( a == 0 ) result += b*log(e0/x0) ;
    1405    else         result += y0*(e0*pow(d,a-1) - x0)/a ;
    1406    a += 1.0 ;
    1407 
    1408    if( a == 0 )   fIntegralPlasmon[0] += b*log(e0/x0) ;
    1409    else           fIntegralPlasmon[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a ;
    1410    
    1411    return result ;
     1741   G4double x0,x1,y0,yy1,a,b,c,d,e0,result;
     1742
     1743   e0 = en0;
     1744   x0 = fSplineEnergy[i];
     1745   x1 = fSplineEnergy[i+1];
     1746   y0 = fdNdxPlasmon[i];
     1747   yy1 = fdNdxPlasmon[i+1];
     1748
     1749   c = x1/x0;
     1750   d = e0/x0;   
     1751   a = log10(yy1/y0)/log10(c);
     1752   //  b0 = log10(y0) - a*log10(x0);
     1753   b = y0/pow(x0,a); //pow(10.,b);
     1754   
     1755   a += 1.0;
     1756   if( a == 0 ) result = b*log(x0/e0);
     1757   else         result = y0*(x0 - e0*pow(d,a-1))/a;   
     1758   a += 1.0;
     1759
     1760   if( a == 0 ) fIntegralPlasmon[0] += b*log(x0/e0);
     1761   else         fIntegralPlasmon[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
     1762   
     1763   x0 = fSplineEnergy[i - 1];
     1764   x1 = fSplineEnergy[i - 2];
     1765   y0 = fdNdxPlasmon[i - 1];
     1766   yy1 = fdNdxPlasmon[i - 2];
     1767
     1768   c = x1/x0;
     1769   d = e0/x0;
     1770   a = log10(yy1/y0)/log10(c);
     1771   // b0 = log10(y0) - a*log10(x0);
     1772   b = y0/pow(x0,a);// pow(10.,b0);
     1773
     1774   a += 1.0;
     1775   if( a == 0 ) result += b*log(e0/x0);
     1776   else         result += y0*(e0*pow(d,a-1) - x0)/a;
     1777   a += 1.0;
     1778
     1779   if( a == 0 )   fIntegralPlasmon[0] += b*log(e0/x0);
     1780   else           fIntegralPlasmon[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
     1781   
     1782   return result;
    14121783
    14131784}
    14141785
     1786///////////////////////////////////////////////////////////////////////////////
     1787//
     1788// Integration of resonance cross-section for the case of
     1789// passing across border between intervals
     1790
     1791G4double G4PAIxSection::SumOverBordResonance( G4int      i ,
     1792                                             G4double en0    )
     1793{               
     1794   G4double x0,x1,y0,yy1,a,b,c,d,e0,result;
     1795
     1796   e0 = en0;
     1797   x0 = fSplineEnergy[i];
     1798   x1 = fSplineEnergy[i+1];
     1799   y0 = fdNdxResonance[i];
     1800   yy1 = fdNdxResonance[i+1];
     1801
     1802   c = x1/x0;
     1803   d = e0/x0;   
     1804   a = log10(yy1/y0)/log10(c);
     1805   //  b0 = log10(y0) - a*log10(x0);
     1806   b = y0/pow(x0,a); //pow(10.,b);
     1807   
     1808   a += 1.0;
     1809   if( a == 0 ) result = b*log(x0/e0);
     1810   else         result = y0*(x0 - e0*pow(d,a-1))/a;   
     1811   a += 1.0;
     1812
     1813   if( a == 0 ) fIntegralResonance[0] += b*log(x0/e0);
     1814   else         fIntegralResonance[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
     1815   
     1816   x0 = fSplineEnergy[i - 1];
     1817   x1 = fSplineEnergy[i - 2];
     1818   y0 = fdNdxResonance[i - 1];
     1819   yy1 = fdNdxResonance[i - 2];
     1820
     1821   c = x1/x0;
     1822   d = e0/x0;
     1823   a = log10(yy1/y0)/log10(c);
     1824   // b0 = log10(y0) - a*log10(x0);
     1825   b = y0/pow(x0,a);// pow(10.,b0);
     1826
     1827   a += 1.0;
     1828   if( a == 0 ) result += b*log(e0/x0);
     1829   else         result += y0*(e0*pow(d,a-1) - x0)/a;
     1830   a += 1.0;
     1831
     1832   if( a == 0 )   fIntegralResonance[0] += b*log(e0/x0);
     1833   else           fIntegralResonance[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
     1834   
     1835   return result;
     1836
     1837}
     1838
    14151839/////////////////////////////////////////////////////////////////////////
    14161840//
    1417 //
     1841// Returns random PAI-total energy loss over step
    14181842
    14191843G4double G4PAIxSection::GetStepEnergyLoss( G4double step )
    14201844
    1421   G4int iTransfer  ;
    1422   G4long numOfCollisions ;
    1423   G4double loss = 0.0 ;
    1424   G4double meanNumber, position ;
    1425 
    1426   // G4cout<<" G4PAIxSection::GetStepEnergyLoss "<<G4endl ;
    1427 
    1428 
    1429 
    1430   meanNumber = fIntegralPAIxSection[1]*step ;
    1431   numOfCollisions = G4Poisson(meanNumber) ;
    1432 
    1433   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl ;
     1845  G4long numOfCollisions;
     1846  G4double meanNumber, loss = 0.0;
     1847
     1848  // G4cout<<" G4PAIxSection::GetStepEnergyLoss "<<G4endl;
     1849
     1850  meanNumber = fIntegralPAIxSection[1]*step;
     1851  numOfCollisions = G4Poisson(meanNumber);
     1852
     1853  //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
    14341854
    14351855  while(numOfCollisions)
    14361856  {
    1437     position = fIntegralPAIxSection[1]*G4UniformRand() ;
    1438 
    1439     for( iTransfer=1 ; iTransfer<=fSplineNumber ; iTransfer++ )
    1440     {
    1441         if( position >= fIntegralPAIxSection[iTransfer] ) break ;
    1442     }
    1443     loss += fSplineEnergy[iTransfer]  ;
    1444     numOfCollisions-- ;
     1857   loss += GetEnergyTransfer();
     1858   numOfCollisions--;
    14451859  }
    1446   // G4cout<<"PAI energy loss = "<<loss/keV<<" keV"<<G4endl ;
    1447 
    1448   return loss ;
     1860  // G4cout<<"PAI energy loss = "<<loss/keV<<" keV"<<G4endl;
     1861
     1862  return loss;
    14491863}
    14501864
    14511865/////////////////////////////////////////////////////////////////////////
    14521866//
    1453 //
     1867// Returns random PAI-total energy transfer in one collision
     1868
     1869G4double G4PAIxSection::GetEnergyTransfer()
     1870
     1871  G4int iTransfer ;
     1872
     1873  G4double energyTransfer, position;
     1874
     1875  position = fIntegralPAIxSection[1]*G4UniformRand();
     1876
     1877  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     1878  {
     1879        if( position >= fIntegralPAIxSection[iTransfer] ) break;
     1880  }
     1881  if(iTransfer > fSplineNumber) iTransfer--;
     1882 
     1883  energyTransfer = fSplineEnergy[iTransfer];
     1884
     1885  if(iTransfer > 1)
     1886  {
     1887    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     1888  }
     1889  return energyTransfer;
     1890}
     1891
     1892/////////////////////////////////////////////////////////////////////////
     1893//
     1894// Returns random Cerenkov energy loss over step
    14541895
    14551896G4double G4PAIxSection::GetStepCerenkovLoss( G4double step )
    14561897
    1457   G4int iTransfer  ;
    1458   G4long numOfCollisions ;
    1459   G4double loss = 0.0 ;
    1460   G4double meanNumber, position ;
    1461 
    1462   // G4cout<<" G4PAIxSection::GetStepCreLosnkovs "<<G4endl ;
    1463 
    1464 
    1465 
    1466   meanNumber = fIntegralCerenkov[1]*step ;
    1467   numOfCollisions = G4Poisson(meanNumber) ;
    1468 
    1469   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl ;
     1898  G4long numOfCollisions;
     1899  G4double meanNumber, loss = 0.0;
     1900
     1901  // G4cout<<" G4PAIxSection::GetStepCerenkovLoss "<<G4endl;
     1902
     1903  meanNumber = fIntegralCerenkov[1]*step;
     1904  numOfCollisions = G4Poisson(meanNumber);
     1905
     1906  //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
    14701907
    14711908  while(numOfCollisions)
    14721909  {
    1473     position = fIntegralCerenkov[1]*G4UniformRand() ;
    1474 
    1475     for( iTransfer=1 ; iTransfer<=fSplineNumber ; iTransfer++ )
    1476     {
    1477         if( position >= fIntegralCerenkov[iTransfer] ) break ;
    1478     }
    1479     loss += fSplineEnergy[iTransfer]  ;
    1480     numOfCollisions-- ;
     1910    loss += GetCerenkovEnergyTransfer();
     1911    numOfCollisions--;
    14811912  }
    1482   // G4cout<<"PAI Cerenkov loss = "<<loss/keV<<" keV"<<G4endl ;
    1483 
    1484   return loss ;
     1913  // G4cout<<"PAI Cerenkov loss = "<<loss/keV<<" keV"<<G4endl;
     1914
     1915  return loss;
    14851916}
    14861917
    14871918/////////////////////////////////////////////////////////////////////////
    14881919//
    1489 //
     1920// Returns random MM-Cerenkov energy loss over step
     1921
     1922G4double G4PAIxSection::GetStepMMLoss( G4double step )
     1923
     1924  G4long numOfCollisions;
     1925  G4double meanNumber, loss = 0.0;
     1926
     1927  // G4cout<<" G4PAIxSection::GetStepMMLoss "<<G4endl;
     1928
     1929  meanNumber = fIntegralMM[1]*step;
     1930  numOfCollisions = G4Poisson(meanNumber);
     1931
     1932  //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
     1933
     1934  while(numOfCollisions)
     1935  {
     1936    loss += GetMMEnergyTransfer();
     1937    numOfCollisions--;
     1938  }
     1939  // G4cout<<"PAI MM-Cerenkov loss = "<<loss/keV<<" keV"<<G4endl;
     1940
     1941  return loss;
     1942}
     1943
     1944/////////////////////////////////////////////////////////////////////////
     1945//
     1946// Returns Cerenkov energy transfer in one collision
     1947
     1948G4double G4PAIxSection::GetCerenkovEnergyTransfer()
     1949
     1950  G4int iTransfer ;
     1951
     1952  G4double energyTransfer, position;
     1953
     1954  position = fIntegralCerenkov[1]*G4UniformRand();
     1955
     1956  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     1957  {
     1958        if( position >= fIntegralCerenkov[iTransfer] ) break;
     1959  }
     1960  if(iTransfer > fSplineNumber) iTransfer--;
     1961 
     1962  energyTransfer = fSplineEnergy[iTransfer];
     1963
     1964  if(iTransfer > 1)
     1965  {
     1966    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     1967  }
     1968  return energyTransfer;
     1969}
     1970
     1971/////////////////////////////////////////////////////////////////////////
     1972//
     1973// Returns MM-Cerenkov energy transfer in one collision
     1974
     1975G4double G4PAIxSection::GetMMEnergyTransfer()
     1976
     1977  G4int iTransfer ;
     1978
     1979  G4double energyTransfer, position;
     1980
     1981  position = fIntegralMM[1]*G4UniformRand();
     1982
     1983  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     1984  {
     1985        if( position >= fIntegralMM[iTransfer] ) break;
     1986  }
     1987  if(iTransfer > fSplineNumber) iTransfer--;
     1988 
     1989  energyTransfer = fSplineEnergy[iTransfer];
     1990
     1991  if(iTransfer > 1)
     1992  {
     1993    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     1994  }
     1995  return energyTransfer;
     1996}
     1997
     1998/////////////////////////////////////////////////////////////////////////
     1999//
     2000// Returns random plasmon energy loss over step
    14902001
    14912002G4double G4PAIxSection::GetStepPlasmonLoss( G4double step )
    14922003
    1493   G4int iTransfer  ;
    1494   G4long numOfCollisions ;
    1495   G4double loss = 0.0 ;
    1496   G4double meanNumber, position ;
    1497 
    1498   // G4cout<<" G4PAIxSection::GetStepCreLosnkovs "<<G4endl ;
    1499 
    1500 
    1501 
    1502   meanNumber = fIntegralPlasmon[1]*step ;
    1503   numOfCollisions = G4Poisson(meanNumber) ;
    1504 
    1505   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl ;
     2004  G4long numOfCollisions;
     2005  G4double  meanNumber, loss = 0.0;
     2006
     2007  // G4cout<<" G4PAIxSection::GetStepPlasmonLoss "<<G4endl;
     2008
     2009  meanNumber = fIntegralPlasmon[1]*step;
     2010  numOfCollisions = G4Poisson(meanNumber);
     2011
     2012  //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
    15062013
    15072014  while(numOfCollisions)
    15082015  {
    1509     position = fIntegralPlasmon[1]*G4UniformRand() ;
    1510 
    1511     for( iTransfer=1 ; iTransfer<=fSplineNumber ; iTransfer++ )
    1512     {
    1513         if( position >= fIntegralPlasmon[iTransfer] ) break ;
    1514     }
    1515     loss += fSplineEnergy[iTransfer]  ;
    1516     numOfCollisions-- ;
     2016    loss += GetPlasmonEnergyTransfer();
     2017    numOfCollisions--;
    15172018  }
    1518   // G4cout<<"PAI Plasmon loss = "<<loss/keV<<" keV"<<G4endl ;
    1519 
    1520   return loss ;
     2019  // G4cout<<"PAI Plasmon loss = "<<loss/keV<<" keV"<<G4endl;
     2020
     2021  return loss;
    15212022}
    15222023
     2024/////////////////////////////////////////////////////////////////////////
     2025//
     2026// Returns plasmon energy transfer in one collision
     2027
     2028G4double G4PAIxSection::GetPlasmonEnergyTransfer()
     2029
     2030  G4int iTransfer ;
     2031
     2032  G4double energyTransfer, position;
     2033
     2034  position = fIntegralPlasmon[1]*G4UniformRand();
     2035
     2036  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     2037  {
     2038        if( position >= fIntegralPlasmon[iTransfer] ) break;
     2039  }
     2040  if(iTransfer > fSplineNumber) iTransfer--;
     2041 
     2042  energyTransfer = fSplineEnergy[iTransfer];
     2043
     2044  if(iTransfer > 1)
     2045  {
     2046    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     2047  }
     2048  return energyTransfer;
     2049}
     2050
     2051/////////////////////////////////////////////////////////////////////////
     2052//
     2053// Returns random resonance energy loss over step
     2054
     2055G4double G4PAIxSection::GetStepResonanceLoss( G4double step )
     2056
     2057  G4long numOfCollisions;
     2058  G4double meanNumber, loss = 0.0;
     2059
     2060  // G4cout<<" G4PAIxSection::GetStepCreLosnkovs "<<G4endl;
     2061
     2062  meanNumber = fIntegralResonance[1]*step;
     2063  numOfCollisions = G4Poisson(meanNumber);
     2064
     2065  //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
     2066
     2067  while(numOfCollisions)
     2068  {
     2069    loss += GetResonanceEnergyTransfer();
     2070    numOfCollisions--;
     2071  }
     2072  // G4cout<<"PAI resonance loss = "<<loss/keV<<" keV"<<G4endl;
     2073
     2074  return loss;
     2075}
     2076
     2077
     2078/////////////////////////////////////////////////////////////////////////
     2079//
     2080// Returns resonance energy transfer in one collision
     2081
     2082G4double G4PAIxSection::GetResonanceEnergyTransfer()
     2083
     2084  G4int iTransfer ;
     2085
     2086  G4double energyTransfer, position;
     2087
     2088  position = fIntegralResonance[1]*G4UniformRand();
     2089
     2090  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     2091  {
     2092        if( position >= fIntegralResonance[iTransfer] ) break;
     2093  }
     2094  if(iTransfer > fSplineNumber) iTransfer--;
     2095 
     2096  energyTransfer = fSplineEnergy[iTransfer];
     2097
     2098  if(iTransfer > 1)
     2099  {
     2100    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     2101  }
     2102  return energyTransfer;
     2103}
     2104
     2105
     2106/////////////////////////////////////////////////////////////////////////
     2107//
     2108// Returns Rutherford energy transfer in one collision
     2109
     2110G4double G4PAIxSection::GetRutherfordEnergyTransfer()
     2111
     2112  G4int iTransfer ;
     2113
     2114  G4double energyTransfer, position;
     2115
     2116  position = (fIntegralPlasmon[1]-fIntegralResonance[1])*G4UniformRand();
     2117
     2118  for( iTransfer = 1; iTransfer <= fSplineNumber; iTransfer++ )
     2119  {
     2120        if( position >= (fIntegralPlasmon[iTransfer]-fIntegralResonance[iTransfer]) ) break;
     2121  }
     2122  if(iTransfer > fSplineNumber) iTransfer--;
     2123 
     2124  energyTransfer = fSplineEnergy[iTransfer];
     2125
     2126  if(iTransfer > 1)
     2127  {
     2128    energyTransfer -= (fSplineEnergy[iTransfer]-fSplineEnergy[iTransfer-1])*G4UniformRand();
     2129  }
     2130  return energyTransfer;
     2131}
    15232132
    15242133
     
    15282137//
    15292138
    1530 G4int G4PAIxSection::fNumberOfGammas = 111 ;
     2139G4int G4PAIxSection::fNumberOfGammas = 111;
    15312140
    15322141const G4double G4PAIxSection::fLorentzFactor[112] =     // fNumberOfGammas+1
     
    155621655.658206e+04, 6.422112e+04, 7.289153e+04, 8.273254e+04, 9.390219e+04, // 110
    155721661.065799e+05
    1558 } ;
     2167};
    15592168
    15602169///////////////////////////////////////////////////////////////////////
     
    15642173
    15652174const
    1566 G4int G4PAIxSection::fRefGammaNumber = 29 ;
     2175G4int G4PAIxSection::fRefGammaNumber = 29;
    15672176
    15682177   
  • trunk/source/processes/electromagnetic/standard/src/G4PAIySection.cc

    r819 r961  
    2626//
    2727// $Id: G4PAIySection.cc,v 1.3 2007/10/01 18:38:10 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/standard/src/G4PEEffectModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PEEffectModel.cc,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4PEEffectModel.cc,v 1.7 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4141//
    4242// 04.12.05 : SetProposedKineticEnergy(0.) for the killed photon (mma)
     43// 20.02.09 : Added initialisation of deexcitation flag and method
     44//            CrossSectionPerVolume instead of mfp (V.Ivanchenko)
    4345//
    4446// Class Description:
     
    6668  theGamma    = G4Gamma::Gamma();
    6769  theElectron = G4Electron::Electron();
     70  fminimalEnergy = 1.0*eV;
    6871}
    6972
     
    7174
    7275G4PEEffectModel::~G4PEEffectModel()
    73 {
    74 }
     76{}
    7577
    7678//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    7981                                 const G4DataVector&)
    8082{
    81  if (isInitialized) return;
    82  if (pParticleChange)
    83    fParticleChange =
    84                   reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    85   else
    86    fParticleChange = new G4ParticleChangeForGamma();
    87 
    88  fminimalEnergy = 1.0*eV;
     83  // always false before the run
     84  SetDeexcitationFlag(false);
     85
     86  if (isInitialized) return;
     87  if (pParticleChange) {
     88    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
     89  } else {
     90    fParticleChange = new G4ParticleChangeForGamma();
     91  }
     92  isInitialized = true;
     93}
     94
     95//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     96
     97G4double G4PEEffectModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
     98                                                     G4double energy,
     99                                                     G4double Z, G4double,
     100                                                     G4double, G4double)
     101{
     102  G4double* SandiaCof = G4SandiaTable::GetSandiaCofPerAtom((G4int)Z, energy);
     103
     104  G4double energy2 = energy*energy;
     105  G4double energy3 = energy*energy2;
     106  G4double energy4 = energy2*energy2;
     107
     108  return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
     109    SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
     110}
     111
     112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     113
     114G4double G4PEEffectModel::CrossSectionPerVolume(const G4Material* material,
     115                                                const G4ParticleDefinition*,
     116                                                G4double energy,
     117                                                G4double, G4double)
     118{
     119  G4double* SandiaCof =
     120    material->GetSandiaTable()->GetSandiaCofForMaterial(energy);
     121                               
     122  G4double energy2 = energy*energy;
     123  G4double energy3 = energy*energy2;
     124  G4double energy4 = energy2*energy2;
     125         
     126  return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
     127    SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
    89128}
    90129
  • trunk/source/processes/electromagnetic/standard/src/G4PSTARStopping.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PSTARStopping.cc,v 1.5 2006/06/29 19:53:24 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4PSTARStopping.cc,v 1.8 2008/11/24 18:28:09 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929//---------------------------------------------------------------------------
     
    5353G4PSTARStopping::G4PSTARStopping()
    5454{
     55  currentE = 0.0;
    5556  currentMaterial = 0;
    5657  index = 0;
     
    7273  for (G4int i=0; i<74; i++){
    7374    if (matName == name[i]){
    74       matIndex= -1;
     75      matIndex = i;
    7576      currentMaterial = mat;
    7677      return i;
     
    115116  res = e1*std::exp(std::log(energy/t1)*std::log(e2/e1)/std::log(t2/t1));
    116117  return res;
    117  }
     118}
    118119 
    119120void G4PSTARStopping::Initialise()
     
    122123 
    123124  name [0] = "G4_A-150_TISSUE";
    124   Znum [0] = 0;
    125  
    126125  G4double T0[60] = {
    127126    0.001, 0.0015, 0.002, 0.0025, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008,
     
    131130    0.275, 0.3,    0.35,  0.4,    0.45,  0.5,    0.55,   0.6, 0.65,  0.7,
    132131    0.75,  0.8,    0.85,  0.9,    0.95,  1.,     1.25,   1.5, 1.75,  2. };
    133  
    134132  G4double e0[60] = { 176.8, 216.6, 250.1, 279.6, 306.3, 351.1, 390.9, 426.8, 459.8, 489.9, 517.8, 544, 596.4, 641.3, 680.6, 715.7, 747, 775, 800, 822.6, 861.7, 894.2, 920.7, 941.5, 957.3, 968.6, 976.2, 980.5, 982, 981, 978, 973.2, 967, 959.5, 910.4, 853.6, 797.9, 746.9, 701.5, 661.5, 626.4, 595.6, 544.8, 504.4, 471.1, 442.8, 416.4, 392, 369.9, 350, 332.2, 316.4, 302.2, 289.5, 278.1, 267.9, 228.9, 200.8, 179.5, 162.6 };
    135133 
     
    138136 
    139137  name [1] = "G4_ACETYLENE";
    140   Znum [1] = 0;
    141  
    142138  G4double e1[60] = { 185.5, 227.2, 262.3, 293.2, 321.2, 364.8, 404, 439.3, 471.6, 500.3, 526.4, 550.6, 600.2, 641.6, 677.4, 709.2, 737.3, 762, 783.7, 803.1, 837.2, 866.8, 891.7, 911.6, 926.6, 937.4, 944.7, 949, 950.8, 950.3, 947.9, 943.9, 938.4, 931.8, 887.1, 833.7, 779.9, 729.5, 686.8, 650.4, 618.5, 590.2, 541.4, 500.4, 465.3, 434.8, 408, 384.6, 364.4, 346.5, 330.5, 316.1, 303.2, 291.3, 280.4, 270.4, 230.7, 202.2, 180.5, 163.5 };
    143139 
     
    145141 
    146142  name [2] = "G4_ADIPOSE_TISSUE_ICRP";
    147   Znum [2] = 0;
    148  
    149143  G4double e2[60] = { 195.9, 239.9, 277, 309.7, 339.3, 387.5, 430.6, 469.4, 505, 537.2, 566.9, 594.6, 649.9, 696.7, 737.4, 773.3, 805.2, 833.4, 858.3, 880.5, 918.9, 951, 977.2, 997.6, 1013, 1023, 1030, 1034, 1034, 1033, 1029, 1023, 1016, 1008, 955.6, 895, 835.1, 779.6, 729.7, 685.6, 646.6, 612.3, 555, 509.1, 471.6, 440.3, 413.7, 390.4, 370.1, 352.1, 336, 321.4, 308.3, 296.3, 285.3, 275.2, 234.9, 206, 184, 166.7 };
    150144 
     
    152146 
    153147  name [3] = "G4_Ag";
    154   Znum [3] = 47;
    155  
    156148  G4double e3[60] = { 29.73, 36.41, 42.05, 47.01, 51.5, 59.46, 66.48, 72.83, 78.66, 84.09, 89.2, 94.02, 103.7, 112.1, 119.7, 126.6, 132.8, 138.5, 143.7, 148.5, 157.1, 164.3, 170.5, 175.7, 180.1, 183.7, 186.7, 189.1, 191.1, 192.5, 193.6, 194.4, 194.8, 195, 193.4, 189.3, 184.4, 179.2, 174.1, 169.3, 164.8, 160.5, 152.7, 145.7, 139.5, 133.8, 128.6, 123.9, 119.5, 115.4, 111.7, 108.1, 104.8, 101.7, 98.74, 95.98, 84.49, 75.92, 69.3, 64.05 };
    157149 
     
    159151 
    160152  name [4] = "G4_AIR";
    161   Znum [4] = 0;
    162  
    163153  G4double e4[60] = { 119.7, 146.7, 169.3, 189.3, 207.4, 239.5, 267.8, 293.3, 316.8, 338.7, 359.2, 378.7, 417, 450.4, 480.1, 506.7, 530.7, 552.6, 572.4, 590.5, 622.1, 648.3, 670, 687.7, 702, 713.2, 721.7, 727.8, 731.9, 734.1, 734.8, 734, 732, 729, 702.9, 667.2, 629.1, 592.2, 558.3, 527.8, 500.6, 476.3, 434.9, 401.2, 373.3, 349.8, 329.7, 312.1, 296.4, 282.4, 269.9, 258.7, 248.5, 239.1, 230.6, 222.7, 191.1, 168.2, 150.8, 137 };
    164154 
     
    166156 
    167157  name [5] = "G4_Al";
    168   Znum [5] = 13;
    169  
    170158  G4double e5[60] = { 92.38, 113.1, 130.6, 146.1, 160, 184.8, 206.6, 226.3, 244.4, 261.3, 277.1, 292.1, 320.6, 344.8, 365.7, 383.8, 399.6, 413.2, 425, 435.1, 451, 462, 469.2, 473.4, 475.2, 475.1, 473.7, 471.2, 468, 464.2, 460.1, 455.8, 451.3, 446.8, 424.5, 404.5, 386.7, 371, 356.8, 344, 332.3, 321.5, 301.7, 284.2, 268.6, 254.8, 242.5, 231.4, 221.5, 212.4, 204.2, 196.6, 189.7, 183.3, 177.4, 171.9, 149.4, 132.7, 119.8, 109.4 };
    171159 
     
    173161 
    174162  name [6] = "G4_ALUMINUM_OXIDE";
    175   Znum [6] = 0;
    176  
    177163  G4double e6[60] = { 73.51, 90.03, 104, 116.2, 127.3, 147, 164.4, 180.1, 194.5, 207.9, 220.5, 232.5, 256.1, 276.8, 295.3, 311.9, 327, 340.8, 353.4, 364.9, 385.3, 402.5, 417, 429.2, 439.3, 447.6, 454.3, 459.6, 463.7, 466.6, 468.6, 469.8, 470.2, 470, 461.9, 447.2, 430.1, 412.7, 396.5, 381.4, 367.5, 354.5, 331.1, 310.6, 292.6, 276.5, 262.2, 249.4, 238.1, 227.9, 218.7, 210.2, 202.6, 195.7, 189.2, 183.2, 158.9, 140.9, 127, 116 };
    178164 
     
    180166 
    181167  name [7] = "G4_Ar";
    182   Znum [7] = 40;
    183  
    184168  G4double e7[60] = { 86.08, 105.4, 121.7, 136.1, 149.1, 172.2, 192.5, 210.9, 227.7, 243.5, 258.2, 272.2, 299.7, 323.5, 344.5, 363.3, 380.2, 395.3, 409, 421.4, 442.5, 459.4, 472.8, 483.1, 490.7, 496, 499.2, 500.7, 500.8, 499.5, 497.2, 494, 490, 485.5, 457.4, 426.7, 397.7, 371.9, 349.5, 330.1, 313.2, 298.5, 274.2, 254.9, 239, 225.6, 214.4, 204.7, 196.1, 188.4, 181.3, 174.9, 168.9, 163.4, 158.2, 153.3, 133, 118.2, 106.8, 97.72 };
    185169 
     
    187171 
    188172  name [8] = "G4_Au";
    189   Znum [8] = 79;
    190  
    191173  G4double e8[60] = { 14.76, 18.07, 20.87, 23.33, 25.56, 29.51, 33, 36.15, 39.04, 41.74, 44.27, 46.66, 51.51, 55.8, 59.66, 63.18, 66.43, 69.43, 72.23, 74.84, 79.58, 83.77, 87.5, 90.81, 93.77, 96.4, 98.74, 100.8, 102.6, 104.3, 105.7, 106.9, 108, 108.9, 111.5, 112, 111.2, 109.6, 107.6, 105.4, 103.2, 101, 96.33, 91.8, 87.7, 84.05, 80.83, 78, 75.47, 73.18, 71.11, 69.21, 67.46, 65.83, 64.32, 62.91, 56.98, 52.39, 48.68, 45.58 };
    192174 
     
    194176 
    195177  name [9] = "G4_B-100_BONE";
    196   Znum [9] = 0;
    197  
    198178  G4double e9[60] = { 142.5, 174.5, 201.5, 225.2, 246.7, 283.1, 315.3, 344.4, 371.1, 395.5, 418.2, 439.6, 482.3, 519, 551.3, 580.1, 606, 629.2, 650.1, 669, 701.9, 729.5, 752.2, 770.4, 784.5, 795.1, 802.6, 807.4, 810, 810.5, 809.3, 806.6, 802.7, 797.7, 762.5, 719.5, 676.2, 635.8, 599.3, 566.7, 537.9, 512.3, 468.1, 431.4, 400.8, 375, 353, 333.7, 316.9, 301.9, 288.5, 276.3, 265.3, 255.1, 245.9, 237.4, 203.4, 178.9, 160.2, 145.4 };
    199179 
     
    201181 
    202182  name [10] = "G4_Be";
    203   Znum [10] = 4;
    204  
    205183  G4double e10[60] = { 149.7, 183.3, 211.7, 236.7, 259.2, 299.3, 334.7, 366.6, 396, 423.3, 449, 473.3, 517.2, 553.4, 583.6, 608.7, 629.6, 646.8, 660.7, 671.9, 687.3, 695.5, 698.4, 697.6, 694.2, 689.1, 682.8, 675.7, 668.2, 660.5, 652.7, 644.9, 637.2, 629.6, 594.2, 563, 535.4, 510.7, 488.4, 468.2, 449.8, 432.8, 404.4, 380.1, 358.1, 337.6, 318.8, 302.2, 287.4, 274.2, 262.3, 251.5, 241.7, 232.7, 224.4, 216.8, 186, 163.6, 146.3, 132.6 };
    206184 
     
    208186 
    209187  name [11] = "G4_BONE_COMPACT_ICRU";
    210   Znum [11] = 0;
    211  
    212188  G4double e11[60] = { 141.6, 173.4, 200.2, 223.8, 245.2, 281.3, 313.3, 342.2, 368.8, 393.1, 415.6, 436.8, 479, 515.2, 547, 575.3, 600.7, 623.4, 643.8, 662.1, 694.2, 721, 743.2, 760.9, 774.8, 785.2, 792.6, 797.6, 800.3, 801.1, 800.3, 797.9, 794.4, 789.9, 756.4, 714.5, 671.4, 630.5, 593.2, 559.7, 530, 503.5, 459, 423, 393.3, 368.3, 346.9, 328.1, 311.6, 296.9, 283.7, 271.8, 261, 251.1, 242, 233.7, 200.3, 176.3, 158, 143.5 };
    213189 
     
    215191 
    216192  name [12] = "G4_C";
    217   Znum [12] = 6;
    218  
    219193  G4double e12[60] = { 138.4, 169.5, 195.7, 218.8, 239.7, 270.2, 297.8, 322.7, 345.4, 365.1, 382.6, 398.7, 433.5, 462.4, 487.4, 509.9, 530, 547.7, 563.4, 577.6, 603.9, 628.3, 650.1, 668.6, 683.5, 695.3, 704.5, 711.4, 716.3, 719.4, 720.8, 720.9, 719.7, 717.4, 694.5, 661.1, 624.7, 589.1, 556, 526, 499.1, 475, 435.8, 404.4, 377.9, 354.6, 334, 315.9, 300.2, 286.2, 273.7, 262.4, 252.2, 242.7, 234.1, 226.1, 194.2, 171.1, 153.4, 139.4 };
    220194 
    221195  for(i=0; i<60; i++) {e[12][i]=e12[i]*MeV*cm2/g;}
    222196 
    223   name [13] = "G4_C_Graphite";
    224   Znum [13] = 0;
    225  
     197  name [13] = "G4_GRAPHITE";
    226198  G4double e13[60] = { 142.6, 175.3, 203.1, 228, 250.5, 283.4, 313.3, 340.4, 365.1, 386.7, 405.9, 423.5, 462, 494, 521.9, 546.9, 569.3, 589.2, 606.9, 622.9, 652.4, 679.9, 704.5, 725.3, 742.2, 755.6, 766.1, 774, 779.6, 783.1, 784.7, 784.8, 783.4, 780.7, 753.8, 714.5, 671.4, 629.1, 590.2, 555.6, 524.9, 497.7, 453.9, 419.3, 390.3, 365.1, 343, 323.7, 307.1, 292.3, 279.1, 267.3, 256.6, 246.8, 237.8, 229.5, 196.7, 173, 155, 140.8 };
    227199 
     
    229201 
    230202  name [14] = "G4_ETHYLENE";
    231   Znum [14] = 0;
    232  
    233203  G4double e14[60] = { 225.8, 276.5, 319.3, 357, 391.1, 445.9, 494.9, 539.1, 579.6, 616, 649.5, 680.6, 742.9, 795.1, 840.1, 879.9, 914.8, 945.5, 972.4, 996.1, 1037, 1071, 1099, 1120, 1135, 1145, 1150, 1152, 1152, 1148, 1142, 1135, 1126, 1115, 1052, 981.5, 912.8, 849.7, 795.6, 749, 708.3, 672.4, 611.7, 562.1, 520.6, 485.3, 454.9, 428.4, 405.5, 385.2, 367.1, 350.8, 336.2, 322.8, 310.5, 299.3, 254.6, 222.7, 198.6, 179.6 };
    234204 
     
    236206 
    237207  name [15] = "G4_C-552";
    238   Znum [15] = 0;
    239  
    240208  G4double e15[60] = { 119.2, 146, 168.6, 188.5, 206.5, 235.1, 260.7, 283.8, 305, 323.9, 341.3, 357.4, 390.7, 418.9, 443.7, 465.8, 485.7, 503.6, 519.5, 534.1, 560.1, 583.2, 603.2, 620, 633.7, 644.7, 653.4, 660.1, 665, 668.4, 670.3, 671.1, 670.7, 669.5, 652.9, 626.4, 596.2, 565.7, 537, 510.7, 486.8, 465.1, 427.5, 396.1, 369.6, 347, 327.4, 310.1, 294.9, 281.3, 269, 258, 247.9, 238.6, 230.2, 222.4, 191, 168.2, 150.8, 137 };
    241209 
     
    243211 
    244212  name [16] = "G4_CARBON_DIOXIDE";
    245   Znum [16] = 0;
    246  
    247213  G4double e16[60] = { 106.4, 130.3, 150.4, 168.2, 184.2, 212.7, 237.9, 260.6, 281.4, 300.9, 319.1, 336.4, 370.9, 401.2, 428.3, 452.8, 475.1, 495.6, 514.4, 531.8, 562.6, 588.8, 611.2, 630.2, 646.1, 659.3, 670.1, 678.6, 685.2, 690, 693.2, 694.9, 695.4, 694.8, 679, 650.5, 617.3, 583.6, 552.1, 523.6, 497.8, 474.6, 434.7, 401.8, 374.3, 351, 330.9, 313.2, 297.6, 283.7, 271.2, 259.9, 249.6, 240.3, 231.7, 223.7, 191.9, 168.9, 151.4, 137.5 };
    248214 
     
    250216 
    251217  name [17] = "G4_CALCIUM_FLUORIDE";
    252   Znum [17] = 0;
    253 
    254218  G4double e17[60] = { 74.48, 91.21, 105.3, 117.8, 129, 149, 166.5, 182.4, 197, 210.6, 223.4, 235.5, 259.6, 280.7, 299.6, 316.6, 332, 346.2, 359.1, 371.1, 392.2, 410.1, 425.2, 438, 448.7, 457.5, 464.6, 470.3, 474.7, 477.9, 480.1, 481.4, 481.9, 481.7, 473, 456.7, 437.6, 417.8, 398.6, 380.6, 364, 348.7, 322.9, 301.7, 283.5, 267.5, 253.4, 240.9, 229.8, 219.9, 210.8, 202.5, 194.8, 187.7, 181.3, 175.5, 151.6, 134.4, 121.1, 110.6 };
    255219 
     
    257221 
    258222  name [18] = "G4_CERIC_SULFATE";
    259   Znum [18] = 0;
    260  
    261223  G4double e18[60] = { 135.4, 165.8, 191.5, 214.1, 234.5, 270.8, 302.8, 331.7, 358.2, 383, 406.2, 428.2, 471.7, 509.8, 543.6, 574, 601.5, 626.5, 649.3, 670.1, 706.4, 736.5, 761.2, 781.4, 797.4, 809.8, 819, 825.3, 829.2, 830.8, 830.6, 828.7, 825.4, 820.9, 785.9, 741.4, 696, 653.6, 618.4, 588.8, 562.8, 539.6, 499.3, 464.8, 434.6, 407.9, 384.2, 363.4, 344.9, 328.4, 313.6, 300.3, 288.2, 277.2, 267, 257.7, 220.4, 193.5, 173, 156.9 };
    262224 
     
    264226 
    265227  name [19] = "G4_CELLULOSE_NITRATE";
    266   Znum [19] = 0;
    267  
    268228  G4double e19[60] = { 132.2, 161.9, 187, 209, 229, 262.6, 292.5, 319.4, 344.2, 366.8, 387.8, 407.5, 447, 481, 510.8, 537.6, 561.6, 583.2, 602.7, 620.4, 651.5, 677.9, 700, 718.2, 732.7, 744.1, 752.7, 759, 763.2, 765.5, 766.2, 765.5, 763.5, 760.6, 734.4, 698.2, 659.3, 621.4, 586, 553.8, 524.9, 498.9, 452.4, 413.9, 382.9, 358, 337.7, 319.7, 303.9, 289.7, 277.1, 265.6, 255.2, 245.6, 236.9, 228.8, 196.4, 173, 155, 140.8 };
    269229 
     
    271231 
    272232  name [20] = "G4_BONE_CORTICAL_ICRP";
    273   Znum [20] = 0;
    274  
    275233  G4double e20[60] = { 123.5, 151.3, 174.7, 195.3, 214, 246.1, 274.5, 300.2, 323.8, 345.6, 365.9, 385, 423, 455.7, 484.7, 510.5, 533.8, 554.8, 573.7, 590.9, 620.8, 645.9, 666.5, 683.3, 696.6, 706.8, 714.4, 719.7, 723, 724.5, 724.5, 723.1, 720.6, 717.1, 689.6, 653.5, 615.8, 579.8, 546.6, 516.7, 490, 466.2, 426.1, 393.6, 366.6, 343.7, 324, 306.7, 291.5, 278, 265.8, 254.7, 244.7, 235.5, 227.1, 219.4, 188.4, 166.1, 149, 135.4 };
    276234 
     
    278236 
    279237  name [21] = "G4_CESIUM_IODIDE";
    280   Znum [21] = 0;
    281  
    282238  G4double e21[60] = { 34.67, 42.46, 49.03, 54.82, 60.05, 69.34, 77.52, 84.92, 91.73, 98.06, 104, 109.6, 121, 130.9, 139.9, 148, 155.5, 162.3, 168.6, 174.5, 184.9, 194, 201.8, 208.5, 214.2, 219, 223, 226.3, 228.9, 231, 232.5, 233.4, 234, 234.1, 230.4, 221.9, 211.4, 200.6, 190.1, 180.6, 171.9, 164.1, 151.1, 140.6, 132.1, 125.1, 119.1, 114, 109.6, 105.6, 102.1, 98.92, 95.83, 92.83, 89.95, 87.22, 75.76, 67.41, 61.26, 56.63 };
    283239 
     
    285241 
    286242  name [22] = "G4_Cu";
    287   Znum [22] = 29;
    288  
    289243  G4double e22[60] = { 34.9, 42.74, 49.35, 55.18, 60.45, 69.8, 78.04, 85.48, 92.33, 98.71, 104.7, 110.4, 121.4, 130.9, 139.2, 146.6, 153.2, 159, 164.3, 168.9, 176.9, 183.2, 188.4, 192.5, 195.9, 198.7, 201, 202.8, 204.4, 205.6, 206.7, 207.5, 208.2, 208.7, 209.9, 209.2, 207.5, 205.1, 202.3, 199.1, 195.8, 192.3, 185.4, 178.6, 172, 165.8, 159.6, 153.6, 148, 142.7, 137.8, 133.3, 129.1, 125.2, 121.7, 118.3, 104.7, 94.43, 86.45, 79.87 };
    290244 
     
    292246 
    293247  name [23] = "G4_Fe";
    294   Znum [23] = 26;
    295  
    296248  G4double e23[60] = { 37.81, 46.31, 53.47, 59.78, 65.49, 75.62, 84.54, 92.61, 100, 106.9, 113.4, 119.6, 132, 143, 153, 162, 170.4, 178.2, 185.4, 192.2, 204.6, 215.6, 225.4, 234.2, 242.1, 249.2, 255.5, 261.2, 266.2, 270.7, 274.6, 278.1, 281, 283.6, 290.9, 291.5, 287.6, 281, 272.8, 263.9, 254.9, 246, 229.5, 214.8, 202.1, 191.1, 181.6, 173.4, 166.2, 159.7, 153.8, 148.5, 143.6, 139.1, 135, 131.1, 115.3, 103.5, 94.02, 86.52 };
    297249 
     
    299251 
    300252  name [24] = "G4_FERROUS_SULFATE";
    301   Znum [24] = 0;
    302  
    303253  G4double e24[60] = { 135.1, 165.5, 191.1, 213.6, 234, 270.2, 302.1, 330.9, 357.4, 382.1, 405.3, 427.2, 470.7, 508.7, 542.4, 572.8, 600.3, 625.3, 648, 668.8, 705, 735.1, 759.9, 780.1, 796.1, 808.5, 817.7, 824.1, 827.9, 829.6, 829.4, 827.5, 824.2, 819.7, 784.9, 740.5, 695.1, 652.8, 617.8, 588.4, 562.8, 539.9, 499.9, 465.6, 435.5, 408.8, 385, 364.1, 345.6, 329.1, 314.3, 300.9, 288.8, 277.7, 267.6, 258.3, 220.8, 193.9, 173.4, 157.2 };
    304254 
     
    306256 
    307257  name [25] = "G4_Gd";
    308   Znum [25] = 64;
    309  
    310258  G4double e25[60] = { 25.71, 31.49, 36.37, 40.66, 44.54, 51.43, 57.5, 62.99, 68.03, 72.73, 77.14, 81.32, 89.78, 97.24, 104, 110.1, 115.8, 121, 125.8, 130.4, 138.5, 145.7, 152.1, 157.7, 162.6, 166.9, 170.7, 173.9, 176.7, 179, 181, 182.5, 183.8, 184.7, 185.6, 182.1, 176.3, 169.4, 162.2, 155.2, 148.7, 142.6, 132, 123.3, 116.2, 110.2, 105, 100.6, 96.67, 93.2, 90.08, 87.27, 84.72, 82.38, 80.24, 78.26, 70.14, 63.87, 58.87, 54.76 };
    311259 
     
    313261 
    314262  name [26] = "G4_Ge";
    315   Znum [26] = 32;
    316  
    317263  G4double e26[60] = { 45.91, 56.23, 64.93, 72.59, 79.52, 91.82, 102.7, 112.5, 121.5, 129.9, 137.7, 145.2, 159.7, 172.3, 183.3, 193.1, 201.7, 209.4, 216.3, 222.3, 232.3, 240, 245.6, 249.6, 252.3, 253.9, 254.5, 254.5, 253.9, 252.9, 251.5, 250, 248.2, 246.4, 236.5, 227.2, 218.9, 211.6, 205.1, 199.3, 193.9, 189, 180.1, 172.3, 165.2, 158.8, 152.6, 146.6, 140.9, 135.7, 130.8, 126.3, 122.1, 118.3, 114.7, 111.3, 97.72, 87.77, 80.18, 74.18 };
    318264 
     
    320266 
    321267  name [27] = "G4_Pyrex_Glass";
    322   Znum [27] = 0;
    323  
    324268  G4double e27[60] = { 88.74, 108.7, 125.5, 140.3, 153.7, 177.5, 198.4, 217.4, 234.8, 251, 266.2, 280.6, 308.9, 333.6, 355.6, 375.3, 393.1, 409.2, 423.9, 437.3, 460.8, 480.4, 496.7, 510.2, 521.2, 530.1, 537.1, 542.5, 546.4, 549.1, 550.6, 551.2, 551, 550.1, 537.6, 518.1, 496.1, 473.9, 451.2, 429.2, 408.8, 390.1, 357.9, 331.5, 309.8, 291.7, 276.2, 262.4, 250.1, 239.1, 229.2, 220.2, 212, 204.6, 197.7, 191.4, 165.6, 146.7, 132.1, 120.4 };
    325269 
     
    327271 
    328272  name [28] = "G4_H";
    329   Znum [28] = 1;
    330  
    331273  G4double e28[60] = { 746.5, 914.3, 1056, 1180, 1293, 1493, 1669, 1829, 1975, 2112, 2240, 2361, 2586, 2777, 2942, 3084, 3208, 3316, 3409, 3490, 3618, 3710, 3771, 3808, 3823, 3822, 3807, 3781, 3745, 3702, 3654, 3601, 3545, 3487, 3183, 2890, 2629, 2402, 2204, 2031, 1882, 1753, 1544, 1384, 1258, 1159, 1077, 1007, 947, 894.2, 847.5, 805.9, 768.6, 734.9, 704.3, 676.4, 566.7, 489.7, 432.5, 388.1 };
    332274 
     
    334276 
    335277  name [29] = "G4_He";
    336   Znum [29] = 2;
    337  
    338278  G4double e29[60] = { 184.2, 225.6, 260.6, 291.3, 319.1, 368.5, 412, 451.3, 487.4, 521.1, 552.7, 582.6, 641.3, 691.9, 736.7, 776.6, 812.5, 844.9, 874.2, 900.8, 946.6, 984.1, 1014, 1039, 1058, 1072, 1083, 1089, 1093, 1094, 1093, 1090, 1085, 1079, 1032, 973, 911.2, 852.1, 797.5, 748.3, 704.5, 665.8, 600.4, 547.7, 504.5, 468.3, 437.7, 411.3, 388.2, 368, 349.9, 333.8, 319.3, 306.2, 294.2, 283.2, 239.6, 208.6, 185.2, 167 };
    339279 
     
    341281 
    342282  name [30] = "G4_KAPTON";
    343   Znum [30] = 0;
    344  
    345283  G4double e30[60] = { 145.4, 178.1, 205.6, 229.9, 251.8, 286.2, 317.1, 344.9, 370.4, 393.1, 413.7, 432.9, 472.6, 506.1, 535.2, 561.3, 584.6, 605.3, 623.8, 640.4, 670.2, 696.5, 719.1, 737.7, 752.5, 763.9, 772.5, 778.6, 782.6, 784.6, 784.9, 783.8, 781.4, 778, 749.2, 710.6, 669.6, 630, 593.5, 560.4, 530.8, 504.4, 459.6, 423.3, 393.3, 368.2, 346.8, 328, 311.6, 296.9, 283.8, 272, 261.3, 251.5, 242.4, 234.1, 200.8, 176.8, 158.4, 143.8 };
    346284 
     
    348286 
    349287  name [31] = "G4_Kr";
    350   Znum [31] = 36;
    351  
    352288  G4double e31[60] = { 45.92, 56.24, 64.94, 72.6, 79.53, 91.84, 102.7, 112.5, 121.5, 129.9, 137.8, 145.2, 160.1, 173.2, 184.9, 195.5, 205.1, 213.8, 221.8, 229.1, 242, 252.7, 261.6, 268.8, 274.6, 279, 282.3, 284.5, 285.8, 286.2, 286, 285.1, 283.8, 281.9, 268.6, 252.2, 236.2, 221.7, 209, 198.2, 188.9, 180.9, 168.1, 158.1, 150.2, 143.7, 138.1, 133.2, 128.8, 124.8, 121.2, 117.8, 114.6, 111.6, 108.8, 106.1, 94.63, 85.43, 77.91, 71.84 };
    353289 
     
    355291 
    356292  name [32] = "G4_LITHIUM_TETRABORATE";
    357   Znum [32] = 0;
    358  
    359293  G4double e32[60] = { 111, 135.9, 157, 175.5, 192.2, 222, 248.2, 271.9, 293.6, 313.9, 333, 351, 386.5, 417.4, 444.8, 469.4, 491.6, 511.7, 530.1, 546.7, 575.8, 599.9, 619.8, 636, 649.1, 659.3, 667.2, 672.9, 676.7, 678.9, 679.6, 679.1, 677.6, 675.1, 653, 622.4, 589.5, 557.3, 525.5, 495.6, 468.4, 444.1, 403.1, 370.6, 344.6, 323.5, 305.9, 290.3, 276.4, 263.9, 252.7, 242.4, 233.2, 224.7, 216.9, 209.6, 180.4, 159.2, 142.8, 129.9 };
    360294 
     
    362296 
    363297  name [33] = "G4_LITHIUM_FLUORIDE";
    364   Znum [33] = 0;
    365  
    366298  G4double e33[60] = { 80.87, 99.04, 114.4, 127.9, 140.1, 161.7, 180.8, 198.1, 214, 228.7, 242.6, 255.7, 281.9, 304.9, 325.4, 344, 360.9, 376.5, 390.8, 404, 427.6, 447.8, 465.3, 480.3, 493.1, 504.1, 513.3, 521.1, 527.4, 532.5, 536.5, 539.6, 541.7, 543, 540.3, 527.4, 509.2, 488.8, 467.4, 446.5, 426.9, 408.7, 376.9, 350.4, 328, 309.1, 292.7, 278.1, 265.1, 253.3, 242.5, 232.8, 223.9, 215.6, 208.2, 201.2, 173.1, 152.5, 136.8, 124.4 };
    367299 
     
    369301 
    370302  name [34] = "G4_M3_WAX";
    371   Znum [34] = 0;
    372  
    373303  G4double e34[60] = { 198.1, 242.6, 280.2, 313.3, 343.1, 391.9, 435.4, 474.6, 510.6, 543.1, 573, 601, 656.7, 703.7, 744.4, 780.4, 812.2, 840.3, 865, 887, 925, 956.5, 982.1, 1002, 1016, 1026, 1032, 1035, 1036, 1033, 1029, 1023, 1016, 1007, 953.3, 891.9, 831.3, 775.4, 725.1, 680.6, 641.3, 606.6, 546.6, 497.8, 458.8, 427.4, 401.7, 379.2, 359.6, 342.2, 326.7, 312.7, 300.1, 288.5, 277.8, 268.1, 229.1, 201, 179.7, 162.8 };
    374304 
     
    376306 
    377307  name [35] = "G4_MS20_TISSUE";
    378   Znum [35] = 0;
    379  
    380308  G4double e35[60] = { 174.4, 213.6, 246.7, 275.8, 302.1, 345, 383.2, 417.7, 449.4, 477.9, 504.3, 528.8, 578.1, 619.8, 656, 688.2, 716.7, 742, 764.4, 784.4, 819.3, 848.7, 872.8, 892, 906.4, 916.8, 923.7, 927.8, 929.4, 928.8, 926.4, 922.3, 916.9, 910.4, 866.6, 814.5, 762, 712.8, 668.3, 628.6, 593.3, 562.1, 507.7, 463.3, 427.6, 398.9, 375.3, 354.7, 336.7, 320.6, 306.2, 293.3, 281.6, 270.9, 261, 252, 215.7, 189.5, 169.6, 153.9 };
    381309 
     
    383311 
    384312  name [36] = "G4_METHANE";
    385   Znum [36] = 0;
    386  
    387313  G4double e36[60] = { 272.8, 334.1, 385.8, 431.4, 472.5, 545.6, 610, 668.2, 721.8, 771.6, 818.4, 862.7, 949.2, 1024, 1090, 1148, 1200, 1246, 1288, 1325, 1387, 1436, 1473, 1500, 1518, 1528, 1532, 1530, 1524, 1514, 1501, 1485, 1467, 1447, 1338, 1227, 1127, 1041, 967.3, 904.6, 850.4, 803.2, 724.6, 661.8, 610.5, 567.7, 531.4, 499.8, 472.5, 448.3, 426.7, 407.4, 390, 374.1, 359.6, 346.4, 293.7, 256.2, 227.9, 205.7 };
    388314 
     
    390316 
    391317  name [37] = "G4_Mo";
    392   Znum [37] = 42;
    393  
    394318  G4double e37[60] = { 40.18, 49.21, 56.82, 63.53, 69.59, 80.35, 89.84, 98.41, 106.3, 113.6, 120.5, 127, 140.2, 151.7, 162.1, 171.5, 180.1, 188, 195.4, 202.1, 214.3, 224.8, 233.8, 241.6, 248.3, 253.9, 258.7, 262.6, 265.7, 268.2, 270, 271.3, 272.1, 272.4, 268.7, 259.5, 248, 235.8, 224, 213.1, 203.1, 194.1, 178.9, 166.6, 156.5, 148.1, 141, 134.9, 129.5, 124.7, 120.4, 116.4, 112.6, 109.1, 105.8, 102.6, 89.8, 80.34, 73.15, 67.51 };
    395319 
     
    397321 
    398322  name [38] = "G4_MUSCLE_WITH_SUCROSE";
    399   Znum [38] = 0;
    400  
    401323  G4double e38[60] = { 149.4, 183, 211.3, 236.2, 258.7, 298.3, 333.3, 364.8, 393.8, 420.8, 446, 469.8, 516.6, 557.2, 593.1, 625.2, 654, 680, 703.5, 724.8, 761.7, 792, 816.7, 836.5, 851.9, 863.6, 871.9, 877.4, 880.4, 881.2, 880.1, 877.3, 873.2, 867.9, 829.5, 781.9, 733.4, 688, 647.9, 612.8, 581.8, 554.2, 507.1, 468.4, 435.9, 408.3, 384.4, 363.5, 344.9, 328.4, 313.7, 300.3, 288.2, 277.2, 267, 257.7, 220.4, 193.5, 173, 156.9 };
    402324 
     
    404326 
    405327  name [39] = "G4_MUSCLE_WITHOUT_SUCROSE";
    406   Znum [39] = 0;
    407  
    408328  G4double e39[60] = { 146.6, 179.5, 207.3, 231.8, 253.9, 292.9, 327.3, 358.4, 386.9, 413.5, 438.4, 461.9, 508.2, 548.4, 584, 615.8, 644.5, 670.4, 693.8, 715.1, 752, 782.3, 807.1, 827, 842.5, 854.3, 862.9, 868.5, 871.6, 872.6, 871.6, 869, 865, 859.8, 822, 774.9, 726.9, 682, 643, 609.2, 579.4, 552.9, 507.4, 469.6, 437.7, 410.1, 386.1, 365.1, 346.5, 329.9, 315, 301.6, 289.4, 278.3, 268.2, 258.8, 221.3, 194.3, 173.7, 157.5 };
    409329 
     
    411331 
    412332  name [40] = "G4_MUSCLE_SKELETAL_ICRP";
    413   Znum [40] = 0;
    414  
    415333  G4double e40[60] = { 141.3, 173.1, 199.9, 223.5, 244.8, 282.5, 315.8, 345.8, 373.5, 399.2, 423.3, 446.1, 491.1, 530.2, 565, 596.1, 624.2, 649.7, 672.8, 693.8, 730.4, 760.6, 785.3, 805.3, 821.1, 833.1, 841.9, 847.9, 851.4, 852.6, 852, 849.7, 846.1, 841.2, 804.8, 758.9, 712.2, 668.5, 631.2, 599, 570.8, 545.6, 502.2, 465.8, 434.6, 407.5, 383.7, 362.8, 344.4, 327.9, 313.1, 299.8, 287.7, 276.7, 266.6, 257.3, 220, 193.2, 172.8, 156.7 };
    416334 
     
    418336 
    419337  name [41] = "G4_MUSCLE_STRIATED_ICRU";
    420   Znum [41] = 0;
    421  
    422338  G4double e41[60] = { 141.7, 173.5, 200.4, 224, 245.4, 283.2, 316.5, 346.6, 374.3, 400, 424.2, 447, 492.1, 531.3, 566.1, 597.3, 625.4, 650.9, 674, 695.1, 731.6, 761.9, 786.7, 806.6, 822.4, 834.4, 843.3, 849.2, 852.6, 853.9, 853.2, 851, 847.3, 842.4, 805.8, 759.8, 713, 669.2, 632, 600.1, 572.1, 547.1, 504, 467.7, 436.5, 409.3, 385.3, 364.3, 345.7, 329.2, 314.4, 300.9, 288.8, 277.8, 267.6, 258.3, 220.8, 193.9, 173.4, 157.2 };
    423339 
     
    425341 
    426342  name [42] = "G4_N";
    427   Znum [42] = 7;
    428  
    429343  G4double e42[60] = { 126.5, 155, 179, 200.1, 219.2, 253.1, 283, 310, 334.8, 357.9, 379.6, 400.2, 440.6, 475.8, 507, 535, 560.2, 583.1, 603.8, 622.7, 655.5, 682.7, 704.9, 722.9, 737.3, 748.4, 756.6, 762.3, 765.9, 767.5, 767.5, 766, 763.3, 759.4, 729.3, 689.8, 648.6, 609.1, 572.9, 540.4, 511.6, 486.2, 443.4, 408.8, 380.1, 356, 335.4, 317.2, 301.2, 286.8, 274.1, 262.6, 252.2, 242.7, 234, 225.9, 193.8, 170.5, 152.8, 138.8 };
    430344 
     
    432346 
    433347  name [43] = "G4_SODIUM_IODIDE";
    434   Znum [43] = 0;
    435  
    436348  G4double e43[60] = { 41.1, 50.34, 58.12, 64.98, 71.19, 82.2, 91.9, 100.7, 108.7, 116.2, 123.3, 130, 143.4, 155.2, 165.8, 175.4, 184.2, 192.3, 199.7, 206.6, 219, 229.6, 238.9, 246.8, 253.5, 259.2, 264, 268, 271.1, 273.6, 275.4, 276.7, 277.4, 277.7, 273.7, 264.2, 252.3, 239.7, 227.6, 216.2, 205.9, 196.6, 180.7, 167.8, 157.3, 148.5, 141.1, 134.7, 129.1, 124.1, 119.7, 115.7, 111.9, 108.4, 105.1, 101.9, 88.79, 78.99, 71.48, 65.54 };
    437349 
     
    439351 
    440352  name [44] = "G4_Ne";
    441   Znum [44] = 10;
    442  
    443353  G4double e44[60] = { 58.01, 71.05, 82.04, 91.73, 100.5, 116, 129.7, 142.1, 153.5, 164.1, 174, 183.5, 202.5, 219.3, 234.5, 248.3, 261, 272.8, 283.8, 294, 312.7, 329.2, 343.8, 356.9, 368.6, 379, 388.3, 396.5, 403.8, 410.2, 415.8, 420.7, 424.8, 428.4, 438.1, 437.9, 431.3, 420.8, 408.2, 394.6, 380.7, 367.1, 339, 313.8, 293.3, 277.2, 264.3, 252.6, 241.9, 232.2, 223.2, 215, 207.4, 200.4, 193.8, 187.7, 163, 144.6, 130.3, 118.9 };
    444354 
     
    446356 
    447357  name [45] = "G4_NYLON_6/6";
    448   Znum [45] = 0;
    449  
    450358  G4double e45[60] = { 191, 233.9, 270.1, 302, 330.8, 377.8, 419.7, 457.5, 492.1, 523.4, 552.3, 579.2, 633, 678.5, 717.9, 752.9, 783.8, 811.1, 835.3, 856.8, 894.2, 925.4, 951, 971, 985.8, 996.3, 1003, 1007, 1008, 1006, 1003, 997.7, 991.2, 983.5, 933.5, 875.4, 817.5, 763.6, 715, 671.7, 633.5, 599.6, 542.9, 497.4, 460.4, 429.7, 403.7, 381, 361.2, 343.6, 327.9, 313.8, 301, 289.3, 278.6, 268.8, 229.5, 201.3, 179.8, 162.9 };
    451359 
     
    453361 
    454362  name [46] = "G4_O";
    455   Znum [46] = 8;
    456 
    457363  G4double e46[60] = { 99.46, 121.8, 140.7, 157.3, 172.3, 198.9, 222.4, 243.6, 263.1, 281.3, 298.4, 314.5, 346.6, 374.7, 399.8, 422.4, 443, 461.9, 479.1, 495, 523.1, 547, 567.2, 584.4, 598.7, 610.6, 620.2, 628, 633.9, 638.3, 641.3, 643, 643.6, 643.3, 630.5, 606.7, 578.3, 549.1, 520.9, 494.6, 470.9, 449.7, 413.2, 383.1, 357.8, 336.3, 317.6, 301.1, 286.3, 273.2, 261.3, 250.5, 240.8, 231.9, 223.7, 216.1, 185.7, 163.7, 146.7, 133.4 };
    458364 
     
    460366 
    461367  name [47] = "G4_PARAFFIN";
    462   Znum [47] = 0;
    463  
    464368  G4double e47[60] = { 228.8, 280.2, 323.5, 361.7, 396.2, 451.9, 501.6, 546.5, 587.6, 624.6, 658.6, 690.2, 753.4, 806.4, 852.1, 892.4, 927.9, 959.1, 986.3, 1010, 1052, 1086, 1114, 1135, 1150, 1160, 1166, 1168, 1166, 1163, 1157, 1149, 1140, 1129, 1064, 992.4, 922.6, 858.6, 801.5, 751.1, 706.8, 667.8, 601.8, 548.9, 506.2, 471.3, 442.2, 416.9, 394.9, 375.4, 358, 342.3, 328.2, 315.3, 303.4, 292.6, 249.3, 218.3, 194.8, 176.3 };
    465369 
     
    467371 
    468372  name [48] = "G4_Pb";
    469   Znum [48] = 82;
    470  
    471373  G4double e48[60] = { 15.4, 18.86, 21.78, 24.35, 26.68, 30.81, 34.44, 37.73, 40.75, 43.57, 46.21, 48.71, 53.82, 58.34, 62.45, 66.21, 69.7, 72.94, 75.98, 78.85, 84.11, 88.84, 93.13, 97.02, 100.6, 103.8, 106.8, 109.5, 111.9, 114.1, 116.2, 118, 119.6, 121.1, 126.1, 128.1, 127.9, 126.3, 123.6, 120.4, 116.9, 113.3, 106.4, 99.98, 94.37, 89.5, 85.18, 81.37, 78.01, 75.05, 72.42, 70.08, 67.99, 66.12, 64.44, 62.92, 56.88, 52.22, 48.46, 45.34 };
    472374 
     
    474376 
    475377  name [49] = "G4_PHOTO_EMULSION";
    476   Znum [49] = 0;
    477  
    478378  G4double e49[60] = { 61.33, 75.12, 86.74, 96.97, 106.2, 122.2, 136.3, 149.1, 160.8, 171.6, 181.6, 191.1, 210, 226.3, 240.6, 253.5, 265, 275.4, 284.8, 293.3, 308, 320.3, 330.3, 338.4, 344.7, 349.4, 352.8, 355.1, 356.4, 356.9, 356.6, 355.7, 354.3, 352.4, 338.9, 322.3, 305.5, 289.9, 275.7, 263, 251.7, 241.5, 224.4, 210.3, 198.3, 188, 179, 171, 163.9, 157.5, 151.6, 146.3, 141.3, 136.6, 132.1, 128, 110.6, 97.75, 87.92, 80.2 };
    479379 
     
    481381 
    482382  name [50] = "G4_PLASTIC_SC_VINYLTOLUENE";
    483   Znum [50] = 0;
    484  
    485383  G4double e50[60] = { 190.1, 232.8, 268.8, 300.5, 329.2, 374.1, 414.4, 450.7, 483.9, 513.5, 540.4, 565.4, 616.5, 659.2, 696, 728.7, 757.6, 783, 805.3, 825.2, 860.1, 890.2, 915.4, 935.4, 950.4, 961.1, 968.2, 972.3, 973.8, 973, 970.2, 965.7, 959.9, 952.8, 906, 850.6, 795.1, 743.3, 696.4, 654.7, 617.9, 585.3, 530.7, 487.1, 451.3, 421.4, 395.9, 373.7, 354.4, 337.2, 321.9, 308.1, 295.7, 284.2, 273.8, 264.1, 225.7, 198.1, 177.1, 160.5 };
    486384 
     
    488386 
    489387  name [51] = "G4_POLYCARBONATE";
    490   Znum [51] = 0;
    491  
    492388  G4double e51[60] = { 164.8, 201.8, 233, 260.5, 285.4, 324.6, 359.7, 391.4, 420.3, 446.2, 469.7, 491.7, 536.5, 574.3, 607.1, 636.2, 662.2, 685.1, 705.4, 723.6, 755.9, 783.9, 807.7, 826.9, 841.7, 852.8, 860.8, 866, 868.8, 869.6, 868.6, 866, 862.1, 857.1, 820.5, 774.5, 727.2, 682.2, 641.1, 604.1, 571.2, 542, 492.3, 452.1, 419.1, 391.8, 368.6, 348.4, 330.7, 314.9, 300.8, 288.1, 276.7, 266.1, 256.5, 247.6, 212, 186.3, 166.8, 151.3 };
    493389 
     
    495391 
    496392  name [52] = "G4_POLYETHYLENE";
    497   Znum [52] = 0;
    498  
    499393  G4double e52[60] = { 184.9, 226.5, 261.5, 292.4, 320.3, 369.9, 413.5, 453, 489.3, 523, 554.8, 584.8, 643.9, 695.3, 740.8, 781.4, 817.9, 850.9, 880.6, 907.5, 953.7, 990.9, 1021, 1044, 1061, 1073, 1081, 1084, 1085, 1083, 1078, 1072, 1064, 1054, 994.1, 927.8, 865, 808.9, 760.1, 717.9, 681.4, 649.7, 591.2, 541, 499.2, 464.9, 436.3, 411.4, 389.8, 370.6, 353.4, 338.1, 324.2, 311.4, 299.8, 289.1, 246.4, 215.9, 192.7, 174.4 };
    500394 
     
    502396 
    503397  name [53] = "G4_POLYETHYLENE_TEREPHTHALATE_MYLAR";
    504   Znum [53] = 0;
    505  
    506398  G4double e53[60] = { 150.9, 184.9, 213.5, 238.7, 261.4, 297.8, 330.2, 359.6, 386.4, 410.5, 432.5, 453, 494.9, 530.3, 561.2, 588.8, 613.4, 635.3, 654.7, 672.3, 703.4, 730.5, 753.5, 772.3, 787, 798.3, 806.6, 812.4, 816, 817.6, 817.4, 815.8, 812.9, 808.9, 777.6, 736.5, 693.4, 651.9, 613.6, 579.1, 548.2, 520.6, 472.9, 434, 402.2, 376.1, 354.3, 335, 318.2, 303.2, 289.8, 277.7, 266.7, 256.6, 247.4, 238.9, 204.8, 180.2, 161.4, 146.5 };
    507399 
     
    509401 
    510402  name [54] = "G4_PLEXIGLASS";
    511   Znum [54] = 0;
    512  
    513403  G4double e54[60] = { 174.9, 214.2, 247.4, 276.6, 303, 345.9, 384.1, 418.7, 450.4, 479, 505.2, 529.8, 579.1, 620.8, 657.1, 689.3, 717.9, 743.2, 765.7, 785.8, 820.8, 850.5, 875, 894.5, 909.3, 920.1, 927.4, 931.9, 933.9, 933.7, 931.6, 928, 922.9, 916.8, 874.4, 823.2, 771.3, 722.4, 676.2, 634, 596.2, 562.8, 507.2, 463.4, 428.5, 400.2, 376.7, 356.1, 338, 321.9, 307.5, 294.5, 282.8, 272, 262.1, 253, 216.6, 190.4, 170.3, 154.5 };
    514404 
     
    516406 
    517407  name [55] = "G4_POLYPROPYLENE";
    518   Znum [55] = 0;
    519  
    520408  G4double e55[60] = { 197.6, 242, 279.4, 312.4, 342.2, 395.1, 441.8, 483.9, 522.7, 558.8, 592.7, 624.8, 687.3, 741.3, 789, 831.4, 869.4, 903.6, 934.3, 962, 1009, 1048, 1078, 1101, 1119, 1132, 1140, 1145, 1146, 1145, 1141, 1135, 1128, 1119, 1060, 991.7, 924.3, 862, 806.1, 756.5, 712.8, 674.2, 605.4, 548.6, 503.3, 467.5, 438.7, 413.6, 391.8, 372.4, 355.2, 339.7, 325.7, 312.9, 301.1, 290.4, 247.5, 216.8, 193.5, 175.1 };
    521409 
     
    523411 
    524412  name [56] = "G4_POLYSTYRENE";
    525   Znum [56] = 0;
    526  
    527413  G4double e56[60] = { 186, 227.8, 263.1, 294.1, 322.2, 372.1, 416, 455.7, 492.2, 526.2, 558.1, 588.3, 645.3, 693.8, 735.8, 772.4, 804.5, 832.6, 857.2, 878.7, 913.5, 939.2, 957.2, 969, 975.6, 978, 976.8, 972.8, 966.5, 958.4, 948.9, 938.3, 926.9, 914.9, 851.3, 789.6, 734.2, 685.4, 642.9, 605.7, 573, 543.9, 499.5, 465.2, 435.8, 409.1, 384.6, 363.2, 344.6, 328.1, 313.3, 300, 288, 277, 266.8, 257.5, 220.4, 193.6, 173.2, 157 };
    528414 
    529415  for(i=0; i<60; i++) {e[56][i]=e56[i]*MeV*cm2/g;}
    530416 
    531   name [57] = "G4_POLYTETRAFLUOROETHYLENE";
    532   Znum [57] = 0;
    533  
     417  name [57] = "G4_TEFLON";
    534418  G4double e57[60] = { 83.27, 102, 117.8, 131.7, 144.2, 165, 183.4, 200.1, 215.3, 229.2, 242, 254, 278.7, 300, 319, 336.2, 351.9, 366.1, 379.2, 391.2, 413.1, 432.7, 450, 465.1, 478, 489.1, 498.5, 506.4, 513, 518.4, 522.7, 526, 528.4, 530.1, 528.6, 516.7, 499.4, 479.6, 460.4, 442.3, 425.4, 409.6, 381.2, 356.4, 334.6, 315.4, 298.3, 283.1, 269.6, 257.4, 246.5, 236.5, 227.4, 219.1, 211.5, 204.4, 175.9, 155.2, 139.3, 126.7 };
    535419 
     
    537421 
    538422  name [58] = "G4_POLYVINYL_CHLORIDE";
    539   Znum [58] = 0;
    540  
    541423  G4double e58[60] = { 140.2, 171.7, 198.3, 221.7, 242.8, 277.9, 309, 337.2, 363, 386.4, 408.1, 428.4, 468.9, 503.4, 533.6, 560.3, 584.1, 605.3, 624.1, 640.9, 670.1, 694.5, 714.3, 729.8, 741.4, 749.6, 755, 757.9, 758.6, 757.6, 755, 751, 746, 740, 701.3, 656.7, 612.9, 572.6, 538.7, 509.8, 484.7, 462.4, 424.2, 392.4, 365.3, 341.8, 321.1, 302.9, 287.3, 273.6, 261.3, 250.1, 240.1, 231.1, 222.7, 215, 184.5, 162.6, 145.9, 132.6 };
    542424 
     
    544426
    545427  name [59] = "G4_PROPANE";
    546   Znum [59] = 0;
    547 
    548428  G4double e59[60] = { 194.5, 234.7, 268.4, 298, 324.7, 372, 413.6, 451.2, 485.8, 518, 548.2, 576.8, 642.6, 702.2, 756.9, 808, 855.9, 901.2, 944.4, 985.6, 1063, 1135, 1203, 1267, 1327, 1385, 1440, 1492, 1543, 1592, 1639, 1684, 1728, 1770, 1964, 2131, 2277, 2404, 2516, 2613, 2698, 2771, 2887, 2969, 3022, 3053, 3065, 3061, 3046, 3021, 2990, 2953, 2912, 2868, 2822, 2775, 2564, 2372, 2191, 2022 };
    549429
     
    551431
    552432  name [60] = "G4_Pt";
    553   Znum [60] = 78;
    554 
    555433  G4double e60[60] = { 30.79, 33.73, 36.43, 38.95, 41.31, 43.55, 48.11, 52.16, 55.83, 59.2, 62.32, 65.23, 67.95, 70.51, 75.22, 79.46, 83.3, 86.79, 89.97, 92.87, 95.51, 97.92, 100.1, 102.1, 103.9, 105.5, 107, 108.3, 112.7, 114.5, 114.4, 113, 110.8, 108.1, 105.3, 102.4, 96.92, 92.12, 87.91, 84.22, 80.97, 78.11, 75.56, 73.26, 71.17, 69.26, 67.5, 65.87, 64.36, 62.94, 57, 52.39, 48.67, 45.57, 42.94, 40.66, 38.67, 36.9, 33.91, 31.45 };
    556434
     
    558436 
    559437  name [61] = "G4_Si";
    560   Znum [61] = 14;
    561  
    562438  G4double e61[60] = { 105, 128.6, 148.5, 166, 181.8, 210, 234.8, 257.2, 277.8, 296.9, 315, 332, 364.6, 392.5, 416.7, 437.8, 456.3, 472.5, 486.6, 498.9, 518.4, 532.3, 541.6, 547, 549.2, 549, 546.8, 543, 538, 532.2, 525.7, 518.8, 511.7, 504.4, 468.7, 437.3, 410.7, 388.4, 369.4, 353, 338.7, 325.9, 304.1, 285.9, 270.3, 256.7, 245.2, 235.1, 225.9, 217.2, 209, 201.1, 193.6, 187, 180.9, 175.3, 152.3, 135.4, 122.2, 111.7 };
    563439 
    564440  for(i=0; i<60; i++) {e[61][i]=e61[i]*MeV*cm2/g;}
    565441 
    566   name [62] = "G4_SiO2";
    567   Znum [62] = 0;
    568  
     442  name [62] = "G4_SILICON_DIOXIDE";
    569443  G4double e62[60] = { 85.64, 104.9, 121.1, 135.4, 148.3, 171.3, 191.5, 209.8, 226.6, 242.2, 256.9, 270.8, 298.1, 322, 343.1, 362.1, 379.3, 394.9, 409.1, 422.1, 444.8, 463.8, 479.7, 492.8, 503.6, 512.3, 519.2, 524.5, 528.5, 531.2, 532.9, 533.7, 533.6, 532.9, 521.9, 503.9, 483.5, 462.8, 442.9, 424.2, 406.7, 390.6, 358.9, 330.8, 307.6, 288.9, 273.6, 259.9, 247.8, 236.9, 227.1, 218.2, 210.1, 202.7, 195.9, 189.7, 164.2, 145.5, 131.1, 119.6 };
    570444 
     
    572446 
    573447  name [63] = "G4_STILBENE";
    574   Znum [63] = 0;
    575  
    576448  G4double e63[60] = { 179.2, 219.5, 253.4, 283.3, 310.4, 352.2, 389.8, 423.8, 454.7, 482.3, 507.2, 530.3, 577.9, 617.7, 652.1, 682.6, 709.7, 733.5, 754.4, 773, 806.1, 835.1, 859.5, 879.2, 894.2, 905.1, 912.7, 917.4, 919.6, 919.6, 917.7, 914.2, 909.3, 903.3, 861.4, 810.7, 759.2, 710.8, 667.1, 628.3, 593.9, 563.4, 511.8, 470.2, 435.9, 407.2, 382.8, 361.4, 342.9, 326.4, 311.6, 298.4, 286.4, 275.4, 265.3, 256.1, 219, 192.4, 172.1, 156.1 };
    577449 
     
    579451 
    580452  name [64] = "G4_Ti";
    581   Znum [64] = 22;
    582  
    583453  G4double e64[60] = { 60.88, 74.56, 86.1, 96.26, 105.4, 121.8, 136.1, 149.1, 161.1, 172.2, 182.6, 192.5, 212.3, 229.6, 245.1, 259.1, 271.8, 283.5, 294.2, 304.1, 321.6, 336.5, 349.1, 359.8, 368.7, 376, 382, 386.7, 390.2, 392.7, 394.4, 395.2, 395.3, 394.8, 385.4, 369.3, 351, 332.6, 315.4, 299.6, 285.5, 272.8, 251.3, 233.9, 219.6, 207.6, 197.4, 188.7, 181, 174.1, 167.9, 162.2, 157, 152.2, 147.7, 143.5, 126, 112.5, 101.7, 93.07 };
    584454 
     
    586456 
    587457  name [65] = "G4_Sn";
    588   Znum [65] = 50;
    589  
    590458  G4double e65[60] = { 32.4, 39.68, 45.82, 51.23, 56.12, 64.8, 72.45, 79.36, 85.72, 91.64, 97.2, 102.5, 113.1, 122.4, 130.8, 138.5, 145.5, 151.9, 157.9, 163.4, 173.4, 182, 189.5, 196, 201.6, 206.4, 210.4, 213.8, 216.5, 218.7, 220.4, 221.6, 222.4, 222.9, 220.7, 213.8, 204.9, 195.4, 186, 177.3, 169.4, 162.3, 150.1, 140.3, 132.2, 125.5, 119.7, 114.7, 110.1, 106.1, 102.5, 99.14, 96.12, 93.34, 90.77, 88.4, 78.69, 71.47, 65.7, 60.79 };
    591459 
     
    593461 
    594462  name [66] = "G4_TISSUE-METHANE";
    595   Znum [66] = 0;
    596  
    597463  G4double e66[60] = { 174.5, 213.8, 246.8, 276, 302.3, 349.1, 390.3, 427.6, 461.8, 493.7, 523.6, 552, 607.8, 656.2, 699.1, 737.4, 771.9, 803, 831.1, 856.5, 900.2, 935.6, 963.8, 985.9, 1003, 1015, 1022, 1027, 1028, 1027, 1023, 1018, 1011, 1002, 947.8, 885.5, 824.9, 769.7, 720.9, 678.2, 641, 608.6, 553.2, 507.9, 470.5, 439.1, 412.4, 389, 368.6, 350.5, 334.4, 319.8, 306.6, 294.6, 283.6, 273.5, 233.2, 204.4, 182.5, 165.2 };
    598464 
     
    600466 
    601467  name [67] = "G4_TISSUE-PROPANE";
    602   Znum [67] = 0;
    603  
    604468  G4double e67[60] = { 169.9, 208.1, 240.3, 268.6, 294.3, 339.8, 379.9, 416.2, 449.5, 480.6, 509.7, 537.3, 591.5, 638.4, 679.9, 716.9, 750.2, 780.2, 807.4, 832, 874.4, 909.1, 937.1, 959.3, 976.6, 989.5, 998.7, 1005, 1008, 1008, 1006, 1003, 998, 991.7, 946.9, 891.9, 836, 783.4, 735.7, 693.2, 655.4, 622, 563.5, 515.3, 475.8, 443.4, 416.2, 392.6, 371.9, 353.6, 337.3, 322.5, 309.3, 297.1, 286, 275.8, 235.1, 206, 183.9, 166.5 };
    605469 
     
    607471 
    608472  name [68] = "G4_TOLUENE";
    609   Znum [68] = 0;
    610  
    611473  G4double e68[60] = { 191.6, 234.7, 271, 302.9, 331.9, 377.2, 417.8, 454.5, 488, 517.9, 545.1, 570.4, 621.9, 665, 702.2, 735.2, 764.3, 790, 812.4, 832.5, 867.7, 897.9, 923.2, 943.3, 958.3, 969, 976, 980, 981.4, 980.4, 977.5, 972.9, 966.9, 959.8, 912.2, 856.2, 800.1, 747.8, 700.6, 658.5, 621.4, 588.5, 535.1, 492.8, 457.8, 427.9, 401.8, 379.1, 359.4, 341.9, 326.3, 312.3, 299.6, 287.9, 277.3, 267.5, 228.5, 200.4, 179.1, 162.3 };
    612474 
     
    614476 
    615477  name [69] = "G4_U";
    616   Znum [69] = 92;
    617  
    618478  G4double e69[60] = { 18.38, 22.51, 25.99, 29.06, 31.83, 36.75, 41.09, 45.01, 48.62, 51.98, 55.13, 58.11, 64.19, 69.57, 74.44, 78.9, 83.02, 86.84, 90.42, 93.78, 99.92, 105.4, 110.3, 114.8, 118.8, 122.4, 125.7, 128.6, 131.2, 133.5, 135.6, 137.4, 139, 140.4, 144.4, 144.8, 142.7, 139.1, 134.5, 129.6, 124.2, 118.8, 108.7, 100, 92.78, 86.72, 81.64, 77.35, 73.71, 70.6, 67.92, 65.59, 63.56, 61.77, 60.19, 58.78, 53.33, 49.08, 45.62, 42.73 };
    619479 
     
    621481 
    622482  name [70] = "G4_W";
    623   Znum [70] = 74;
    624  
    625483  G4double e70[60] = { 14.97, 18.34, 21.17, 23.67, 25.93, 29.94, 33.47, 36.67, 39.61, 42.34, 44.91, 47.34, 52.3, 56.7, 60.68, 64.33, 67.7, 70.84, 73.78, 76.55, 81.61, 86.15, 90.24, 93.95, 97.3, 100.3, 103.1, 105.6, 107.8, 109.9, 111.7, 113.3, 114.7, 116, 120, 121.2, 120.5, 118.5, 115.9, 112.9, 109.8, 106.7, 100.2, 94.14, 89.08, 85, 81.68, 78.78, 76.2, 73.88, 71.78, 69.86, 68.09, 66.45, 64.93, 63.5, 57.52, 52.9, 49.15, 46.04 };
    626484 
     
    628486 
    629487  name [71] = "G4_WATER";
    630   Znum [71] = 0;
    631  
    632488  G4double e71[60] = { 133.7, 163.8, 189.1, 211.4, 231.6, 267.5, 299, 327.6, 353.8, 378.2, 401.2, 422.9, 466, 503.6, 537.2, 567.3, 594.6, 619.5, 642.1, 662.8, 698.9, 729, 753.8, 774, 790.1, 802.6, 811.9, 818.3, 822.3, 824.1, 823.9, 822.2, 819, 814.5, 780.1, 736, 695.9, 660.4, 628.6, 599.9, 573.7, 549.7, 507.5, 471.4, 440.1, 412.8, 388.8, 367.6, 348.9, 332.2, 317.2, 303.7, 291.4, 280.3, 270, 260.6, 222.8, 195.5, 174.8, 158.5 };
    633489 
     
    635491 
    636492  name [72] = "G4_WATER_VAPOR";
    637   Znum [72] = 0;
    638  
    639493  G4double e72[60] = { 152.2, 186.5, 215.3, 240.7, 263.7, 304.5, 340.4, 372.9, 402.8, 430.6, 456.7, 481.4, 530.5, 573.2, 611.3, 645.4, 676.4, 704.4, 730, 753.3, 793.8, 827.4, 855, 877.2, 894.8, 908.2, 918.1, 924.7, 928.5, 929.9, 929.1, 926.5, 922.3, 916.9, 876.3, 825.9, 775.3, 728.5, 686.8, 650.1, 618, 589.9, 536.1, 489.2, 450.8, 420.2, 395.5, 373.8, 354.6, 337.5, 322.2, 308.3, 295.8, 284.4, 273.9, 264.3, 225.7, 198, 176.9, 160.4 };
    640494 
     
    642496 
    643497  name [73] = "G4_Xe";
    644   Znum [73] = 54;
    645  
    646498  G4double e73[60] = { 38.1, 46.67, 53.88, 60.24, 65.99, 76.2, 85.2, 93.33, 100.8, 107.8, 114.3, 120.5, 132.8, 143.6, 153.2, 161.8, 169.6, 176.7, 183.2, 189.1, 199.4, 208, 215, 220.7, 225.2, 228.7, 231.2, 232.9, 233.9, 234.3, 234.1, 233.5, 232.5, 231.1, 221.3, 209.3, 197.4, 186.5, 177, 168.6, 161.3, 155, 144.4, 135.9, 128.8, 122.8, 117.5, 112.7, 108.4, 104.5, 101, 97.75, 94.8, 92.09, 89.6, 87.29, 77.8, 70.52, 64.84, 60.13 };
    647499 
  • trunk/source/processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4PhotoElectricEffect.cc,v 1.37 2006/09/14 10:27:19 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4PhotoElectricEffect.cc,v 1.42 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    8080  G4ProcessType type):G4VEmProcess (processName, type),
    8181    isInitialised(false)
    82 {}
     82{
     83  SetProcessSubType(fPhotoElectricEffect);
     84}
    8385
    8486//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8688G4PhotoElectricEffect::~G4PhotoElectricEffect()
    8789{}
     90
     91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     92
     93G4bool G4PhotoElectricEffect::IsApplicable(const G4ParticleDefinition& p)
     94{
     95  return (&p == G4Gamma::Gamma());
     96}
    8897
    8998//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    95104    SetBuildTableFlag(false);
    96105    SetSecondaryParticle(G4Electron::Electron());
    97     if(!Model()) SetModel(new G4PEEffectModel);
     106    if(!Model()) SetModel(new G4PEEffectModel());
    98107    Model()->SetLowEnergyLimit(MinKinEnergy());
    99108    Model()->SetHighEnergyLimit(MaxKinEnergy());
     
    105114
    106115void G4PhotoElectricEffect::PrintInfo()
    107 {
    108   G4cout
    109     << " Total cross sections from Sandia parametrisation. "
    110     << "\n      Sampling according " << Model()->GetName() << " model" 
    111     << G4endl;
    112 }
     116{}
    113117
    114118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4PolarizedComptonScattering.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4PolarizedComptonScattering.cc,v 1.16 2006/06/29 19:53:30 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4PolarizedComptonScattering.cc,v 1.18 2008/10/15 17:53:44 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    5050using namespace std;
    5151
    52 G4PolarizedComptonScattering::G4PolarizedComptonScattering(
    53                                                   const G4String& processName)
    54 : G4ComptonScattering52 (processName)
     52G4PolarizedComptonScattering::G4PolarizedComptonScattering(const G4String& pname)
     53  : G4ComptonScattering52 (pname)
    5554{ }
    5655
  • trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UniversalFluctuation.cc,v 1.15 2007/07/13 11:01:50 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4UniversalFluctuation.cc,v 1.17 2009/02/19 11:26:01 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    107107
    108108G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
    109                                                 const G4DynamicParticle* dp,
    110                                                       G4double& tmax,
    111                                                       G4double& length,
    112                                                       G4double& meanLoss)
     109                                                    const G4DynamicParticle* dp,
     110                                                    G4double& tmax,
     111                                                    G4double& length,
     112                                                    G4double& meanLoss)
    113113{
    114114// Calculate actual loss from the mean loss.
     
    305305}
    306306
    307 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     307//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     308
     309void
     310G4UniversalFluctuation::SetParticleAndCharge(const G4ParticleDefinition* part,
     311                                             G4double q2)
     312{
     313  if(part != particle) {
     314    particle       = part;
     315    particleMass   = part->GetPDGMass();
     316  }
     317  chargeSquare = q2;
     318}
     319
     320//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UrbanMscModel.cc,v 1.77.2.2 2008/04/25 00:34:55 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4UrbanMscModel.cc,v 1.86 2008/10/29 14:15:30 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    178178using namespace std;
    179179
    180 G4UrbanMscModel::G4UrbanMscModel(G4double m_facrange, G4double m_dtrl,
    181                                  G4double m_lambdalimit,
    182                                  G4double m_facgeom,G4double m_skin,
    183                                  G4bool m_samplez, G4MscStepLimitType m_stepAlg,
    184                                  const G4String& nam)
    185   : G4VEmModel(nam),
    186     dtrl(m_dtrl),
    187     lambdalimit(m_lambdalimit),
    188     facrange(m_facrange),
    189     facgeom(m_facgeom),
    190     skin(m_skin),
    191     steppingAlgorithm(m_stepAlg),
    192     samplez(m_samplez),
     180G4UrbanMscModel::G4UrbanMscModel(const G4String& nam)
     181  : G4VMscModel(nam),
    193182    isInitialized(false)
    194183{
     
    202191  tlimitminfix  = 1.e-6*mm;           
    203192  stepmin       = tlimitminfix;
    204   skindepth     = skin*stepmin;
    205193  smallstep     = 1.e10;
    206194  currentRange  = 0. ;
     
    213201  geommin       = 1.e-3*mm;
    214202  geomlimit     = geombig;
    215   facsafety     = 0.25;
    216203  presafety     = 0.*mm;
    217204  Zeff          = 1.;
     
    396383  G4double eKineticEnergy = KineticEnergy;
    397384
    398   if((particle->GetParticleName() != "e-") &&
    399      (particle->GetParticleName() != "e+") )
     385  if(mass > electron_mass_c2)
    400386  {
    401      G4double TAU = KineticEnergy/mass ;
    402      G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
    403      G4double w = c-2. ;
    404      G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
    405      eKineticEnergy = electron_mass_c2*tau ;
     387    G4double TAU = KineticEnergy/mass ;
     388    G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
     389    G4double w = c-2. ;
     390    G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
     391    eKineticEnergy = electron_mass_c2*tau ;
    406392  }
    407393
     
    504490{
    505491  tPathLength = currentMinimalStep;
    506   G4int stepNumber = track.GetCurrentStepNumber();
    507492  const G4DynamicParticle* dp = track.GetDynamicParticle();
    508 
    509   if(stepNumber == 1) {
     493  G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
     494  G4StepStatus stepStatus = sp->GetStepStatus();
     495
     496  if(stepStatus == fUndefined) {
    510497    inside = false;
    511498    insideskin = false;
     
    527514  if(tPathLength > currentRange) tPathLength = currentRange;
    528515
    529   G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
    530516  presafety = sp->GetSafety();
    531517
     
    541527    }
    542528
    543   G4StepStatus stepStatus = sp->GetStepStatus();
    544 
    545529  // standard  version
    546530  //
     
    560544      insideskin = false;
    561545
    562       if((stepStatus == fGeomBoundary) || (stepNumber == 1))
     546      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
    563547        {
    564           if(stepNumber == 1) smallstep = 1.e10;
     548          if(stepStatus == fUndefined) smallstep = 1.e10;
    565549          else  smallstep = 1.;
    566550
     
    660644        }
    661645
    662       if((stepStatus == fGeomBoundary) || (stepNumber == 1))
     646      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
    663647        {
    664648          // facrange scaling in lambda
     
    870854{
    871855  G4double kineticEnergy = dynParticle->GetKineticEnergy();
    872   if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix)) return;
     856  if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix) ||
     857     (tPathLength/tausmall < lambda0) ) return;
    873858
    874859  G4double cth  = SampleCosineTheta(tPathLength,kineticEnergy);
    875860  // protection against 'bad' cth values
    876   if(cth > 1.)  cth =  1.;
    877   if(cth < -1.) cth = -1.;
     861  if(abs(cth) > 1.) return;
     862
    878863  G4double sth  = sqrt((1.0 - cth)*(1.0 + cth));
    879864  G4double phi  = twopi*G4UniformRand();
  • trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel90.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UrbanMscModel90.cc,v 1.1.2.2 2008/04/25 00:34:55 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4UrbanMscModel90.cc,v 1.10 2008/10/29 14:15:30 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6969using namespace std;
    7070
    71 G4UrbanMscModel90::G4UrbanMscModel90(G4double m_facrange, G4double m_dtrl,
    72                                      G4double m_lambdalimit,
    73                                      G4double m_facgeom,G4double m_skin,
    74                                      G4bool m_samplez, G4MscStepLimitType m_stepAlg,
    75                                      const G4String& nam)
    76   : G4VEmModel(nam),
    77     dtrl(m_dtrl),
    78     lambdalimit(m_lambdalimit),
    79     facrange(m_facrange),
    80     facgeom(m_facgeom),
    81     skin(m_skin),
    82     steppingAlgorithm(m_stepAlg),
    83     samplez(m_samplez),
     71G4UrbanMscModel90::G4UrbanMscModel90(const G4String& nam)
     72  : G4VMscModel(nam),
    8473    isInitialized(false)
    8574{
     
    9079  tlimitminfix  = 1.e-6*mm;           
    9180  stepmin       = tlimitminfix;
    92   skindepth     = skin*stepmin;
    9381  smallstep     = 1.e10;
    9482  currentRange  = 0. ;
     
    10189  geommin       = 1.e-3*mm;
    10290  geomlimit     = geombig;
    103   facsafety     = 0.25;
    10491  presafety     = 0.*mm;
    10592  Zeff          = 1.;
     
    126113  SetParticle(p);
    127114
    128   if (pParticleChange)
     115  if (pParticleChange) {
    129116   fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);
    130   else
     117  } else {
    131118   fParticleChange = new G4ParticleChangeForMSC();
    132 
     119  }
    133120  safetyHelper = G4TransportationManager::GetTransportationManager()
    134121    ->GetSafetyHelper();
     
    283270  G4double eKineticEnergy = KineticEnergy;
    284271
    285   if((particle->GetParticleName() != "e-") &&
    286      (particle->GetParticleName() != "e+") )
     272  if(mass > electron_mass_c2)
    287273  {
    288      G4double TAU = KineticEnergy/mass ;
    289      G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
    290      G4double w = c-2. ;
    291      G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
    292      eKineticEnergy = electron_mass_c2*tau ;
     274    G4double TAU = KineticEnergy/mass ;
     275    G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
     276    G4double w = c-2. ;
     277    G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
     278    eKineticEnergy = electron_mass_c2*tau ;
    293279  }
    294280
     
    391377{
    392378  tPathLength = currentMinimalStep;
    393   G4int stepNumber = track.GetCurrentStepNumber();
    394379  const G4DynamicParticle* dp = track.GetDynamicParticle();
    395 
    396   if(stepNumber == 1) {
     380  G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
     381  G4StepStatus stepStatus = sp->GetStepStatus();
     382
     383  if(stepStatus == fUndefined) {
    397384    inside = false;
    398385    insideskin = false;
     
    414401  if(tPathLength > currentRange) tPathLength = currentRange;
    415402
    416   G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
    417403  presafety = sp->GetSafety();
    418 
    419   //  G4cout << "G4UrbanMscModel90::ComputeTruePathLengthLimit tPathLength= "
    420   //     <<tPathLength<<" safety= " << presafety
    421   //     << " range= " <<currentRange<<G4endl;
    422 
     404  /*
     405  G4cout << "G4UrbanMscModel90::ComputeTruePathLengthLimit tPathLength= "
     406         <<tPathLength<<" safety= " << presafety
     407       << " range= " <<currentRange<<G4endl;
     408  */
    423409  // far from geometry boundary
    424410  if(currentRange < presafety)
     
    427413      return tPathLength; 
    428414    }
    429 
    430   G4StepStatus stepStatus = sp->GetStepStatus();
    431415
    432416  // standard  version
     
    447431      insideskin = false;
    448432
    449       if((stepStatus == fGeomBoundary) || (stepNumber == 1))
     433      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
    450434        {
    451435
    452           if(stepNumber == 1) smallstep = 1.e10;
     436          if(stepStatus == fUndefined) smallstep = 1.e10;
    453437          else  smallstep = 1.;
    454438
     
    547531        }
    548532
    549       if((stepStatus == fGeomBoundary) || (stepNumber == 1))
     533      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
    550534        {
    551535          // facrange scaling in lambda
     
    584568  //  G4cout << "tPathLength= " << tPathLength << "  geomlimit= " << geomlimit
    585569  //     << " currentMinimalStep= " << currentMinimalStep << G4endl;
    586 
    587570  return tPathLength ;
    588571}
     
    755738void G4UrbanMscModel90::SampleScattering(const G4DynamicParticle* dynParticle,
    756739                                         G4double safety)
    757 
    758 
    759 
    760740{
    761741  G4double kineticEnergy = dynParticle->GetKineticEnergy();
    762   if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix)) return;
     742  if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix) ||
     743     (tPathLength/tausmall < lambda0) ) return;
    763744
    764745  G4double cth  = SampleCosineTheta(tPathLength,kineticEnergy);
    765746  // protection against 'bad' cth values
    766   if(cth > 1.)  cth =  1.;
    767   if(cth < -1.) cth = -1.;
     747  if(std::abs(cth) > 1.) return;
    768748
    769749  G4double sth  = sqrt((1.0 - cth)*(1.0 + cth));
  • trunk/source/processes/electromagnetic/standard/src/G4WaterStopping.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4WaterStopping.cc,v 1.2 2006/06/29 19:53:40 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4WaterStopping.cc,v 1.11 2008/12/18 13:01:38 gunter Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828
    2929//---------------------------------------------------------------------------
     
    4848//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    4949
    50 G4WaterStopping::G4WaterStopping(G4EmCorrections* corr)
     50G4WaterStopping::G4WaterStopping(G4EmCorrections* corr, G4bool splineFlag)
    5151{
     52  spline = splineFlag;
    5253  Initialise(corr);
    5354}
     
    5657
    5758G4WaterStopping::~G4WaterStopping()
    58 {
    59   int n = dedx.size();
    60   for(int i=0; i<n; i++) {delete dedx[i];}
    61 }
     59{}
    6260
    6361//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6664{
    6765  G4double res = 0.0;
     66  if(iz < 3 || iz > 18) return res;
    6867  G4bool b;
    69   G4int idx = 0;
    70   for(; idx<8; idx++) {
    71     if(iz == Z[idx]) {
    72       res = (dedx[idx])->GetValue(energy, b);
    73       break;
    74     }
     68  G4int idx = iz - 3;
     69  G4double scaledEnergy = energy/A[idx];
     70  G4double emin = 0.025*MeV;
     71  if(scaledEnergy < emin) {
     72    res = (dedx[idx])->GetValue(emin, b)*std::sqrt(scaledEnergy/emin);
     73  } else {
     74    res = (dedx[idx])->GetValue(scaledEnergy, b);
    7575  }
    7676  return res;
    77  }
     77}
     78
     79//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     80
     81void G4WaterStopping::AddData(G4double* energy, G4double* stoppower,
     82                              G4double factor)
     83{
     84  G4LPhysicsFreeVector* pv = new G4LPhysicsFreeVector(53,energy[0],energy[52]);
     85  pv->SetSpline(spline);
     86  dedx.push_back(pv);
     87  for(G4int i=0;i<53;i++) {
     88    pv->PutValues(i,energy[i],stoppower[i]*factor);
     89  }
     90}
     91
     92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7893
    7994void G4WaterStopping::Initialise(G4EmCorrections* corr)
     
    8196  G4int i;
    8297  //..List of ions
    83   G4int zz[8] = {3, 4, 5, 6, 7, 8, 9, 10 };
    84   G4int aa[8] = {7, 9, 11, 12, 14, 16, 19, 20 };
    85 
    86   for(i=0; i<8; i++) {
     98  G4int zz[16] = {3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18};
     99  G4int aa[16] = {7, 9, 11, 12, 14, 16, 19, 20, 23, 24, 27, 28,31,32, 35,40};
     100  // G4double A_Ion[16] = {6.941,9.0122,10.811,12.011,14.007,15.999,18.998,20.180,22.990,24.305,26.982,28.086,30.974,32.065,35.453,39.948};
     101  for(i=0; i<16; i++) {
    87102    Z[i] = zz[i];
    88     A[i] = aa[i];
     103    A[i] = G4double(aa[i]);
    89104  }
    90105  //..Reduced energies
    91   G4double E[53] = {0.025,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,2.5,3,4,5,6,7,8,9,10,15,20,25,30,40,50,60,70,80,90,100,150,200,250
    92 ,300,400,500,600,700,800,900,1000};
     106  G4double E[53] = {0.025,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,2.5,3,4,5,6,7,8,9,10,15,20,25,30,40,50,60,70,80,90,100,150,200,250,300,400,500,600,700,800,900,1000};
    93107  for(i=0; i<53; i++) {E[i] *= MeV;}
    94108
    95   //..Li
    96   G4double Li[53] = {2.626,2.84,3.191,3.461,3.665,3.817,3.927,4.004,4.056,4.102,3.998,3.853,3.702,3.413,3.158,2.934,2.739,2.567,2.415,2.28,1.782,1.465,1.247,1.087,0.8706,0.7299,0.631,0.5575,0.5005,0.455,0.4178,0.3004,0.2376,0.1981,0.1708,0.1354,0.1132,0.09803,0.08692,0.07842,0.07171,0.06627,0.0495,0.04085,0.03557,0.03203,0.0276,0.02498,0.02327,0.0221,0.02126,0.02064,0.02016};
    97   G4LPhysicsFreeVector* pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    98   dedx.push_back(pv);
    99   for(i=0; i<53; i++) { pv->PutValues(i,E[i],Li[i]*1000.*MeV/cm); }
     109  G4double factor = 1000.*MeV/cm;
    100110
    101   //..Be
    102   G4double Be[53] = {3.272,3.565,4.061,4.463,4.79,5.052,5.258,5.419,5.542,5.803,5.787,5.675,5.529,5.215,4.912,4.634,4.381,4.152,3.944,3.756,3.026,2.533,2.179,1.913,1.542,1.296,1.122,0.9911,0.8898,0.8087,0.7423,0.5335,0.4219,0.3518,0.3034,0.2406,0.2013,0.1743,0.1545,0.1394,0.1275,0.1178,0.08805,0.07266,0.06328,0.05698,0.0491,0.04444,0.04141,0.03933,0.03783,0.03672,0.03588};
    103   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    104   dedx.push_back(pv);
    105   for(i=0; i<53; i++) { pv->PutValues(i,E[i],Be[i]*1000.*MeV/cm); }
     111G4double G4_WATER_Li [53]={2.626, 2.84, 3.191, 3.461, 3.665, 3.817, 3.927, 4.004, 4.056, 4.102, 3.998, 3.853, 3.702, 3.413, 3.158, 2.934, 2.739, 2.567, 2.415, 2.28, 1.782, 1.465, 1.247, 1.087, 0.8706, 0.7299, 0.631, 0.5575, 0.5005, 0.455, 0.4178, 0.3004, 0.2376, 0.1981, 0.1708, 0.1354, 0.1132, 0.09803, 0.08692, 0.07842, 0.07171, 0.06627, 0.0495, 0.04085, 0.03557, 0.03203, 0.0276, 0.02498, 0.02327, 0.0221, 0.02126, 0.02064, 0.02016, };
     112AddData(E,G4_WATER_Li,factor);
    106113
    107   //..B
    108   G4double B[53] = {3.773,4.142,4.776,5.304,5.749,6.122,6.431,6.684,6.89,7.432,7.551,7.505,7.391,7.091,6.772,6.463,6.172,5.901,5.65,5.418,4.484,3.817,3.322,2.94,2.392,2.02,1.752,1.549,1.391,1.265,1.161,0.8332,0.6587,0.5492,0.4737,0.3757,0.3144,0.2723,0.2415,0.2179,0.1993,0.1842,0.1376,0.1136,0.09894,0.08909,0.07678,0.0695,0.06477,0.06151,0.05916,0.05743,0.05611};
    109   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    110   dedx.push_back(pv);
    111   for(i=0; i<53; i++) { pv->PutValues(i,E[i],B[i]*1000.*MeV/cm); }
     114G4double G4_WATER_Be [53]={3.272, 3.565, 4.061, 4.463, 4.79, 5.052, 5.258, 5.419, 5.542, 5.803, 5.787, 5.675, 5.529, 5.215, 4.912, 4.634, 4.381, 4.152, 3.944, 3.756, 3.026, 2.533, 2.179, 1.913, 1.542, 1.296, 1.122, 0.9911, 0.8898, 0.8087, 0.7423, 0.5335, 0.4219, 0.3518, 0.3034, 0.2406, 0.2013, 0.1743, 0.1545, 0.1394, 0.1275, 0.1178, 0.08805, 0.07266, 0.06328, 0.05698, 0.0491, 0.04444, 0.04141, 0.03933, 0.03783, 0.03672, 0.03588, };
     115AddData(E,G4_WATER_Be,factor);
    112116
    113   //..C
    114   G4double C[53] = {4.154,4.593,5.358,6.009,6.568,7.049,7.46,7.809,8.103,8.968,9.262,9.311,9.25,8.994,8.68,8.358,8.045,7.747,7.465,7.199,6.093,5.269,4.636,4.137,3.403,2.891,2.516,2.23,2.004,1.823,1.673,1.2,0.9483,0.7904,0.6817,0.5406,0.4525,0.392,0.3477,0.3138,0.287,0.2653,0.1983,0.1637,0.1426,0.1284,0.1107,0.1002,0.09335,0.08865,0.08528,0.08278,0.08088};
    115   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    116   dedx.push_back(pv);
    117   for(i=0; i<53; i++) { pv->PutValues(i,E[i],C[i]*1000.*MeV/cm); }
     117G4double G4_WATER_B [53]={3.773, 4.142, 4.776, 5.304, 5.749, 6.122, 6.431, 6.684, 6.89, 7.432, 7.551, 7.505, 7.391, 7.091, 6.772, 6.463, 6.172, 5.901, 5.65, 5.418, 4.484, 3.817, 3.322, 2.94, 2.392, 2.02, 1.752, 1.549, 1.391, 1.265, 1.161, 0.8332, 0.6587, 0.5492, 0.4737, 0.3757, 0.3144, 0.2723, 0.2415, 0.2179, 0.1993, 0.1842, 0.1376, 0.1136, 0.09894, 0.08909, 0.07678, 0.0695, 0.06477, 0.06151, 0.05916, 0.05743, 0.05611, };
     118AddData(E,G4_WATER_B,factor);
    118119
    119   //..N
    120   G4double N[53] = {4.49,4.984,5.86,6.616,7.276,7.854,8.36,8.799,9.179,10.39,10.89,11.07,11.08,10.9,10.61,10.3,9.974,9.66,9.357,9.068,7.823,6.859,6.097,5.484,4.56,3.9,3.408,3.029,2.727,2.482,2.28,1.636,1.291,1.076,0.9274,0.7354,0.6156,0.5333,0.4731,0.427,0.3906,0.3611,0.27,0.2229,0.1942,0.1749,0.1507,0.1365,0.1272,0.1208,0.1162,0.1128,0.1102};
    121   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    122   dedx.push_back(pv);
    123   for(i=0; i<53; i++) { pv->PutValues(i,E[i],N[i]*1000.*MeV/cm); }
     120G4double G4_WATER_C [53]={4.154, 4.593, 5.358, 6.009, 6.568, 7.049, 7.46, 7.809, 8.103, 8.968, 9.262, 9.311, 9.25, 8.994, 8.68, 8.358, 8.045, 7.747, 7.465, 7.199, 6.093, 5.269, 4.636, 4.137, 3.403, 2.891, 2.516, 2.23, 2.004, 1.823, 1.673, 1.2, 0.9483, 0.7904, 0.6817, 0.5406, 0.4525, 0.392, 0.3477, 0.3138, 0.287, 0.2653, 0.1983, 0.1637, 0.1426, 0.1284, 0.1107, 0.1002, 0.09335, 0.08865, 0.08528, 0.08278, 0.08088, };
     121AddData(E,G4_WATER_C,factor);
    124122
    125   //..O
    126   G4double O[53] = {4.778,5.321,6.298,7.152,7.907,8.578,9.173,9.7,10.16,11.73,12.46,12.78,12.89,12.81,12.57,12.27,11.95,11.63,11.32,11.01,9.659,8.571,7.691,6.967,5.854,5.042,4.427,3.945,3.56,3.245,2.983,2.142,1.689,1.406,1.212,0.9602,0.8037,0.6963,0.6178,0.5577,0.5102,0.4716,0.3527,0.2913,0.2538,0.2285,0.197,0.1784,0.1663,0.1579,0.1519,0.1475,0.1441};
    127   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    128   dedx.push_back(pv);
    129   for(i=0; i<53; i++) { pv->PutValues(i,E[i],O[i]*1000.*MeV/cm); }
     123G4double G4_WATER_N [53]={4.49, 4.984, 5.86, 6.616, 7.276, 7.854, 8.36, 8.799, 9.179, 10.39, 10.89, 11.07, 11.08, 10.9, 10.61, 10.3, 9.974, 9.66, 9.357, 9.068, 7.823, 6.859, 6.097, 5.484, 4.56, 3.9, 3.408, 3.029, 2.727, 2.482, 2.28, 1.636, 1.291, 1.076, 0.9274, 0.7354, 0.6156, 0.5333, 0.4731, 0.427, 0.3906, 0.3611, 0.27, 0.2229, 0.1942, 0.1749, 0.1507, 0.1365, 0.1272, 0.1208, 0.1162, 0.1128, 0.1102, };
     124AddData(E,G4_WATER_N,factor);
    130125
    131   //..F
    132   G4double F[53] = {4.992, 5.575, 6.637, 7.578, 8.418, 9.171, 9.847, 10.45, 11, 12.9, 13.88, 14.35, 14.56, 14.59, 14.4, 14.13, 13.83, 13.51, 13.19, 12.87, 11.44, 10.26, 9.279, 8.463, 7.187, 6.237, 5.506, 4.928, 4.461, 4.076, 3.753, 2.707, 2.137, 1.779, 1.533, 1.215, 1.017, 0.8809, 0.7816, 0.7056, 0.6456, 0.5969, 0.4466, 0.3688, 0.3213, 0.2894, 0.2496, 0.2259,
    133 0.2106, 0.2, 0.1924, 0.1868, 0.1825};
    134   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    135   dedx.push_back(pv);
    136   for(i=0; i<53; i++) { pv->PutValues(i,E[i],F[i]*1000.*MeV/cm); }
     126G4double G4_WATER_O [53]={4.778, 5.321, 6.298, 7.152, 7.907, 8.578, 9.173, 9.7, 10.16, 11.73, 12.46, 12.78, 12.89, 12.81, 12.57, 12.27, 11.95, 11.63, 11.32, 11.01, 9.659, 8.571, 7.691, 6.967, 5.854, 5.042, 4.427, 3.945, 3.56, 3.245, 2.983, 2.142, 1.689, 1.406, 1.212, 0.9602, 0.8037, 0.6963, 0.6178, 0.5577, 0.5102, 0.4716, 0.3527, 0.2913, 0.2538, 0.2285, 0.197, 0.1784, 0.1663, 0.1579, 0.1519, 0.1475, 0.1441, };
     127AddData(E,G4_WATER_O,factor);
    137128
    138   //..Ne
    139   G4double Ne[53] = {5.182, 5.797, 6.931, 7.948, 8.865, 9.693, 10.044, 11.12, 11.74, 13.98, 15.21, 15.85, 16.17, 16.33, 16.21, 15.98, 15.69, 15.38, 15.06, 14.74, 13.24, 11.98, 10.91, 10.01, 8.584, 7.503, 6.66, 5.986, 5.436, 4.979, 4.595, 3.332, 2.635, 2.195, 1.892, 1.499, 1.255, 1.087, 0.9646, 0.8709, 0.7969, 0.7368, 0.5514, 0.4555, 0.3969, 0.3576, 0.3083, 0.2792, 0.2602, 0.2472, 0.2378, 0.2308, 0.2255};
    140   pv = new G4LPhysicsFreeVector(53,E[0],E[52]);
    141   dedx.push_back(pv);
    142   for(i=0; i<53; i++) { pv->PutValues(i,E[i],Ne[i]*1000.*MeV/cm); }
     129G4double G4_WATER_F [53]={4.992, 5.575, 6.637, 7.578, 8.418, 9.171, 9.847, 10.45, 11, 12.9, 13.88, 14.35, 14.56, 14.59, 14.4, 14.13, 13.83, 13.51, 13.19, 12.87, 11.44, 10.26, 9.279, 8.463, 7.187, 6.237, 5.506, 4.928, 4.461, 4.076, 3.753, 2.707, 2.137, 1.779, 1.533, 1.215, 1.017, 0.8809, 0.7816, 0.7056, 0.6456, 0.5969, 0.4466, 0.3688, 0.3213, 0.2894, 0.2496, 0.2259, 0.2106, 0.2, 0.1924, 0.1868, 0.1825, };
     130AddData(E,G4_WATER_F,factor);
     131
     132G4double G4_WATER_Ne [53]={5.182, 5.797, 6.931, 7.948, 8.865, 9.693, 10.44, 11.12, 11.74, 13.98, 15.21, 15.85, 16.17, 16.33, 16.21, 15.98, 15.69, 15.38, 15.06, 14.74, 13.24, 11.98, 10.91, 10.01, 8.584, 7.503, 6.66, 5.986, 5.436, 4.979, 4.595, 3.332, 2.635, 2.195, 1.892, 1.499, 1.255, 1.087, 0.9646, 0.8709, 0.7969, 0.7368, 0.5514, 0.4555, 0.3969, 0.3576, 0.3083, 0.2792, 0.2602, 0.2472, 0.2378, 0.2308, 0.2255, };
     133AddData(E,G4_WATER_Ne,factor);
     134
     135G4double G4_WATER_Na [53]={5.352, 5.998, 7.203, 8.3, 9.298, 10.21, 11.04, 11.81, 12.5, 15.13, 16.68, 17.56, 18.04, 18.43, 18.44, 18.29, 18.05, 17.78, 17.48, 17.18, 15.67, 14.32, 13.15, 12.14, 10.5, 9.226, 8.218, 7.401, 6.728, 6.166, 5.69, 4.112, 3.237, 2.686, 2.307, 1.821, 1.521, 1.317, 1.168, 1.054, 0.9644, 0.8917, 0.6674, 0.5514, 0.4806, 0.4329, 0.3734, 0.3381, 0.3152, 0.2993, 0.288, 0.2796, 0.2732, };
     136AddData(E,G4_WATER_Na,factor);
     137
     138G4double G4_WATER_Mg [53]={5.542, 6.193, 7.42, 8.551, 9.59, 10.54, 11.42, 12.23, 12.98, 15.85, 17.62, 18.66, 19.26, 19.76, 19.83, 19.7, 19.47, 19.2, 18.89, 18.58, 17.02, 15.62, 14.41, 13.36, 11.64, 10.3, 9.233, 8.362, 7.64, 7.033, 6.516, 4.777, 3.792, 3.162, 2.725, 2.159, 1.806, 1.565, 1.388, 1.254, 1.147, 1.061, 0.7944, 0.6565, 0.5722, 0.5156, 0.4447, 0.4027, 0.3754, 0.3566, 0.343, 0.333, 0.3254, };
     139AddData(E,G4_WATER_Mg,factor);
     140
     141G4double G4_WATER_Al [53]={5.724, 6.39, 7.649, 8.82, 9.905, 10.91, 11.84, 12.71, 13.51, 16.66, 18.69, 19.93, 20.68, 21.38, 21.56, 21.5, 21.32, 21.07, 20.79, 20.48, 18.91, 17.47, 16.19, 15.08, 13.24, 11.78, 10.61, 9.641, 8.835, 8.153, 7.569, 5.583, 4.444, 3.71, 3.199, 2.534, 2.12, 1.836, 1.629, 1.471, 1.346, 1.245, 0.9325, 0.7707, 0.6719, 0.6054, 0.5223, 0.473, 0.441, 0.4189, 0.403, 0.3912, 0.3823, };
     142AddData(E,G4_WATER_Al,factor);
     143
     144G4double G4_WATER_Si [53]={5.905, 6.583, 7.868, 9.073, 10.2, 11.25, 12.23, 13.14, 13.99, 17.4, 19.66, 21.1, 22.01, 22.91, 23.21, 23.22, 23.09, 22.87, 22.61, 22.32, 20.76, 19.28, 17.95, 16.78, 14.83, 13.26, 11.99, 10.94, 10.06, 9.304, 8.656, 6.43, 5.135, 4.294, 3.705, 2.938, 2.458, 2.129, 1.889, 1.706, 1.561, 1.444, 1.082, 0.8942, 0.7796, 0.7026, 0.6061, 0.549, 0.5119, 0.4862, 0.4678, 0.4542, 0.4438, };
     145AddData(E,G4_WATER_Si,factor);
     146
     147G4double G4_WATER_P [53]={6.12, 6.81, 8.118, 9.352, 10.51, 11.61, 12.63, 13.58, 14.48, 18.13, 20.63, 22.28, 23.34, 24.47, 24.91, 25.02, 24.95, 24.78, 24.55, 24.28, 22.76, 21.26, 19.89, 18.67, 16.59, 14.92, 13.54, 12.39, 11.42, 10.59, 9.867, 7.367, 5.896, 4.935, 4.259, 3.376, 2.824, 2.445, 2.169, 1.959, 1.792, 1.657, 1.242, 1.027, 0.8954, 0.807, 0.6963, 0.6308, 0.5881, 0.5587, 0.5375, 0.5219, 0.51, };
     148AddData(E,G4_WATER_P,factor);
     149
     150G4double G4_WATER_S [53]={6.294, 7, 8.338, 9.604, 10.8, 11.94, 13, 14, 14.94, 18.82, 21.55, 23.41, 24.65, 26.01, 26.6, 26.81, 26.81, 26.69, 26.5, 26.26, 24.79, 23.28, 21.88, 20.61, 18.43, 16.64, 15.16, 13.92, 12.86, 11.95, 11.15, 8.371, 6.715, 5.624, 4.856, 3.847, 3.217, 2.785, 2.47, 2.229, 2.04, 1.886, 1.413, 1.169, 1.019, 0.9187, 0.7929, 0.7183, 0.6697, 0.6362, 0.6122, 0.5944, 0.5808, };
     151AddData(E,G4_WATER_S,factor);
     152
     153G4double G4_WATER_Cl [53]={6.522, 7.237, 8.59, 9.875, 11.1, 12.26, 13.36, 14.39, 15.37, 19.45, 22.4, 24.45, 25.86, 27.46, 28.19, 28.5, 28.57, 28.5, 28.34, 28.13, 26.72, 25.21, 23.78, 22.47, 20.2, 18.32, 16.75, 15.42, 14.28, 13.3, 12.44, 9.392, 7.557, 6.34, 5.479, 4.344, 3.633, 3.145, 2.789, 2.517, 2.303, 2.13, 1.596, 1.32, 1.151, 1.038, 0.8957, 0.8115, 0.7567, 0.7189, 0.6917, 0.6717, 0.6563, };
     154AddData(E,G4_WATER_Cl,factor);
     155
     156G4double G4_WATER_Ar [53]={6.642, 7.369, 8.739, 10.04, 11.28, 12.47, 13.59, 14.66, 15.66, 19.93, 23.08, 25.32, 26.89, 28.72, 29.6, 30.01, 30.15, 30.13, 30, 29.82, 28.46, 26.94, 25.49, 24.15, 21.81, 19.86, 18.22, 16.82, 15.61, 14.57, 13.65, 10.39, 8.394, 7.063, 6.114, 4.859, 4.067, 3.522, 3.125, 2.821, 2.581, 2.387, 1.789, 1.48, 1.291, 1.164, 1.005, 0.9105, 0.8491, 0.8067, 0.7763, 0.7537, 0.7365, };
     157AddData(E,G4_WATER_Ar,factor);
    143158
    144159  if(corr) {
    145     for(i=0; i<8; i++) {corr->AddStoppingData(Z[i], A[i], "G4_WATER", *(dedx[i]));}
     160    for(i=0; i<16; i++) {corr->AddStoppingData(Z[i], aa[i], "G4_WATER", dedx[i]);}
    146161  }
    147162}
  • trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlung.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eBremsstrahlung.cc,v 1.48 2007/05/23 08:47:34 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eBremsstrahlung.cc,v 1.56 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6969// 22-05-06 Use gammaThreshold from manager (V.Ivantchenko)
    7070// 15-01-07 use SetEmModel() from G4VEnergyLossProcess (mma)
    71 //
     71//          use RelEmModel above 1GeV (AS &  VI) 
     72// 13-11-08 reenable LPM switch (A.Schaelicke)
    7273// -------------------------------------------------------------------
    7374//
     
    7879#include "G4Gamma.hh"
    7980#include "G4eBremsstrahlungModel.hh"
    80 #include "G4UniversalFluctuation.hh"
     81#include "G4eBremsstrahlungRelModel.hh"
    8182#include "G4UnitsTable.hh"
    8283#include "G4LossTableManager.hh"
     
    9293  G4VEnergyLossProcess(name),
    9394  isInitialised(false)
    94 {}
     95{
     96  SetProcessSubType(fBremsstrahlung);
     97}
    9598
    9699//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    98101G4eBremsstrahlung::~G4eBremsstrahlung()
    99102{}
     103
     104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     105
     106G4bool G4eBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
     107{
     108  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
     109}
    100110
    101111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    109119    SetSecondaryParticle(G4Gamma::Gamma());
    110120    SetIonisation(false);
    111     if (!EmModel()) SetEmModel(new G4eBremsstrahlungModel());
    112     EmModel()->SetLowEnergyLimit (100*eV);
    113     EmModel()->SetHighEnergyLimit(100*TeV);
    114     if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
     121
     122    if (!EmModel(1)) SetEmModel(new G4eBremsstrahlungModel(), 1);
     123    if (!EmModel(2)) SetEmModel(new G4eBremsstrahlungRelModel(), 2);
     124
     125    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
     126    EmModel(1)->SetHighEnergyLimit(EmModel(2)->LowEnergyLimit());
     127    EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
    115128               
    116     AddEmModel(1, EmModel(), FluctModel());
     129    G4VEmFluctuationModel* fm = 0;
     130    AddEmModel(1, EmModel(1), fm);
     131    AddEmModel(2, EmModel(2), fm);
    117132    isInitialised = true;
    118133  }
    119134  G4LossTableManager* man = G4LossTableManager::Instance();
    120   dynamic_cast<G4eBremsstrahlungModel*>(EmModel())
    121     ->SetEnergyThreshold(man->BremsstrahlungTh());
    122   dynamic_cast<G4eBremsstrahlungModel*>(EmModel())
    123     ->SetLPMflag(man->LPMFlag());
     135  G4double eth = man->BremsstrahlungTh();
     136  EmModel(1)->SetSecondaryThreshold(eth);
     137  EmModel(2)->SetSecondaryThreshold(eth);
     138
     139  // Only high energy model LMP flag is ON/OFF
     140  EmModel(1)->SetLPMFlag(false);
     141  EmModel(2)->SetLPMFlag(man->LPMFlag());
    124142}
    125143
     
    128146void G4eBremsstrahlung::PrintInfo()
    129147{
    130   if(EmModel()) {
    131     G4cout << "      Total cross sections and sampling from "
    132            << EmModel()->GetName() << " model" 
    133            << " (based on the EEDL data library) "
    134            << "\n      Good description from 1 KeV to 100 GeV, "
    135            << "log scale extrapolation above 100 GeV."
    136            << " LPM flag "
    137            << dynamic_cast<G4eBremsstrahlungModel*>(EmModel())->LPMflag()
    138            << G4endl;
    139     G4double eth = dynamic_cast<G4eBremsstrahlungModel*>(EmModel())->EnergyThreshold();
    140     if(eth < DBL_MIN)
    141       G4cout << "      HighEnergyThreshold(GeV)= " << eth/GeV
    142              << G4endl;
     148  if(EmModel(1)) {
     149    G4LossTableManager* man = G4LossTableManager::Instance();
     150    G4double eth = man->BremsstrahlungTh();
     151    G4cout << "      LPM flag: " << man->LPMFlag() << " for E > "
     152           << EmModel(1)->HighEnergyLimit()/GeV << " GeV";
     153    if(eth < DBL_MAX) G4cout << ",  HighEnergyThreshold(GeV)= " << eth/GeV;
     154    G4cout << G4endl;
    143155  }
    144156}
  • trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eBremsstrahlungModel.cc,v 1.39 2007/05/23 08:47:35 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4eBremsstrahlungModel.cc,v 1.43 2008/11/13 19:28:58 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5454// 27-03-06  Fix calculation of fl parameter at low energy (energy loss) (VI)
    5555// 15-02-07  correct LPMconstant by a factor 2, thanks to G. Depaola (mma)
     56// 09-09-08  MigdalConstant increased in (2pi)^2 times (A.Schaelicke)
    5657//
    5758// Class Description:
     
    8586    isElectron(true),
    8687    probsup(1.0),
    87     MigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length/pi),
     88    MigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length*4.0*pi),
    8889    LPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)),
    89     theLPMflag(true),
    9090    isInitialised(false)
    9191{
     
    9393  theGamma = G4Gamma::Gamma();
    9494  minThreshold = 1.0*keV;
    95   highKinEnergy= 100.*TeV;
    96   lowKinEnergy = 1.0*keV;
    97   highEnergyTh = DBL_MAX;
    9895}
    9996
     
    164161  if(isInitialised) return;
    165162
    166   if(pParticleChange)
     163  if(pParticleChange) {
    167164    fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
    168   else
     165  } else {
    169166    fParticleChange = new G4ParticleChangeForLoss();
    170 
     167  }
    171168  isInitialised = true;
    172169}
     
    834831    gammaEnergy = x*kineticEnergy;
    835832
    836     if (theLPMflag) {
     833    if (LPMFlag()) {
    837834     // take into account the supression due to the LPM effect
    838835      if (G4UniformRand() <= SupressionFunction(material,kineticEnergy,
     
    879876
    880877  // stop tracking and create new secondary instead of primary
    881   if(gammaEnergy > highEnergyTh) {
     878  if(gammaEnergy > SecondaryThreshold()) {
    882879    fParticleChange->ProposeTrackStatus(fStopAndKill);
    883880    fParticleChange->SetProposedKineticEnergy(0.0);
     
    951948  G4double supr = 1.0;
    952949
    953   if (theLPMflag) {
     950  if (LPMFlag()) {
    954951
    955952    G4double s2lpm = LPMEnergy*gammaEnergy/totEnergySquare;
  • trunk/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eCoulombScatteringModel.cc,v 1.40 2008/01/07 08:32:01 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eCoulombScatteringModel.cc,v 1.59 2008/10/22 18:39:29 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4444// 19.08.06 V.Ivanchenko add inline function ScreeningParameter
    4545// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
     46// 09.06.08 V.Ivanchenko add SelectIsotope and sampling of the recoil ion
    4647//
    4748// Class Description:
     
    6162#include "G4Positron.hh"
    6263#include "G4Proton.hh"
     64#include "G4ParticleTable.hh"
    6365
    6466//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    6668using namespace std;
    6769
    68 G4eCoulombScatteringModel::G4eCoulombScatteringModel(
    69   G4double thetaMin, G4double thetaMax, G4bool build,
    70   G4double tlim, const G4String& nam)
     70G4eCoulombScatteringModel::G4eCoulombScatteringModel(const G4String& nam)
    7171  : G4VEmModel(nam),
    72     cosThetaMin(cos(thetaMin)),
    73     cosThetaMax(cos(thetaMax)),
    74     q2Limit(tlim),
    75     theCrossSectionTable(0),
    76     lowKEnergy(keV),
    77     highKEnergy(TeV),
     72    cosThetaMin(1.0),
     73    cosThetaMax(-1.0),
     74    q2Limit(TeV*TeV),
    7875    alpha2(fine_structure_const*fine_structure_const),
    7976    faclim(100.0),
    80     nbins(12),
    81     nmax(100),
    82     buildTable(build),
    8377    isInitialised(false)
    8478{
    8579  fNistManager = G4NistManager::Instance();
     80  theParticleTable = G4ParticleTable::GetParticleTable();
    8681  theElectron = G4Electron::Electron();
    8782  thePositron = G4Positron::Positron();
    8883  theProton   = G4Proton::Proton();
     84  currentMaterial = 0;
     85  currentElement  = 0;
    8986  a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
    9087  G4double p0 = electron_mass_c2*classic_electr_radius;
    9188  coeff  = twopi*p0*p0;
    9289  constn = 6.937e-6/(MeV*MeV);
    93   tkin = targetZ = targetA = mom2 = DBL_MIN;
     90  tkin = targetZ = mom2 = DBL_MIN;
    9491  elecXSection = nucXSection = 0.0;
     92  recoilThreshold = DBL_MAX;
    9593  ecut = DBL_MAX;
    9694  particle = 0;
    97   for(size_t j=0; j<100; j++) {index[j] = -1;}
     95  currentCouple = 0;
     96  for(size_t j=0; j<100; j++) {
     97    FF[j] = 0.0;
     98  }
    9899}
    99100
     
    101102
    102103G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
    103 {
    104   if(theCrossSectionTable) {
    105     theCrossSectionTable->clearAndDestroy();
    106     delete theCrossSectionTable;
    107   }
    108 }
     104{}
    109105
    110106//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    111107
    112108void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
    113                                            const G4DataVector&)
    114 {
    115   //  G4cout << "!!! G4eCoulombScatteringModel::Initialise for "
    116   // << p->GetParticleName() << "  cos(TetMin)= " << cosThetaMin
    117   // << "  cos(TetMax)= " << cosThetaMax <<G4endl;
     109                                           const G4DataVector& cuts)
     110{
     111  SetupParticle(p);
     112  currentCouple = 0;
     113  elecXSection = nucXSection = 0.0;
     114  tkin = targetZ = mom2 = DBL_MIN;
     115  ecut = etag = DBL_MAX;
     116  cosThetaMin = cos(PolarAngleLimit());
     117  currentCuts = &cuts;
     118  //G4cout << "!!! G4eCoulombScatteringModel::Initialise for "
     119  //     << p->GetParticleName() << "  cos(TetMin)= " << cosThetaMin
     120  //     << "  cos(TetMax)= " << cosThetaMax <<G4endl;
    118121  if(!isInitialised) {
    119122    isInitialised = true;
     
    124127    else
    125128      fParticleChange = new G4ParticleChangeForGamma();
    126   } else {
    127     return;
    128   }
    129 
    130   if(p->GetParticleType() == "nucleus") buildTable = false;
    131   if(!buildTable) return;
    132 
    133   // Compute log cross section table per atom
    134   if(!theCrossSectionTable) theCrossSectionTable = new G4PhysicsTable();
    135  
    136   nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
    137 }
    138 
    139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    140 
    141 G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
    142                 const G4ParticleDefinition* p,
    143                 G4double kinEnergy,
    144                 G4double Z, G4double A,
    145                 G4double cutEnergy, G4double)
    146 {
    147   if(p == particle && kinEnergy == tkin && Z == targetZ &&
    148      A == targetA && cutEnergy == ecut) return nucXSection;
    149 
    150   //G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom  for "
    151   //     << p->GetParticleName() << " Z= " << Z << " A= " << A
    152   //     << " e= " << kinEnergy << G4endl;
    153 
    154   nucXSection = ComputeElectronXSectionPerAtom(p,kinEnergy,Z,A,cutEnergy);
    155 
    156   // nuclear cross section
    157   if(theCrossSectionTable) {
    158     G4bool b;
    159     G4int iz  = G4int(Z);
    160     G4int idx = index[iz];
    161 
    162     // compute table for given Z
    163     if(-1 == idx) {
    164       idx = theCrossSectionTable->size();
    165       index[iz] = idx;
    166       G4PhysicsLogVector* ptrVector
    167         = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
    168       //  G4cout << "New vector Z= " << iz << " A= " << A << " idx= " << idx << G4endl;
    169       G4double e, value;
    170       for(G4int i=0; i<=nbins; i++) {
    171         e     = ptrVector->GetLowEdgeEnergy( i ) ;
    172         value = CalculateCrossSectionPerAtom(p, e, Z, A); 
    173         ptrVector->PutValue( i, log(value) );
    174       }
    175       theCrossSectionTable->push_back(ptrVector);
    176     }
    177 
    178       // take value from the table
    179     nucXSection +=
    180       std::exp((((*theCrossSectionTable)[idx]))->GetValue(kinEnergy, b));
    181 
    182     // compute value from scratch
    183   } else nucXSection += CalculateCrossSectionPerAtom(p, kinEnergy, Z, A);
    184  
    185   //  G4cout << " cross(bn)= " << nucXSection/barn << G4endl;
    186  
    187   if(nucXSection < 0.0) nucXSection = 0.0;
    188   return nucXSection;
    189 }
    190 
    191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    192 
    193 G4double G4eCoulombScatteringModel::ComputeElectronXSectionPerAtom(
    194                 const G4ParticleDefinition* p,
    195                 G4double kinEnergy,
    196                 G4double Z,
    197                 G4double A,
    198                 G4double cutEnergy)
    199 {
    200   if(p == particle && kinEnergy == tkin && Z == targetZ &&
    201      cutEnergy == ecut) return elecXSection;
     129  }
     130  if(mass < GeV && particle->GetParticleType() != "nucleus") {
     131    InitialiseElementSelectors(p,cuts);
     132  }
     133}
     134
     135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     136
     137void G4eCoulombScatteringModel::ComputeMaxElectronScattering(G4double cutEnergy)
     138{
    202139  ecut = cutEnergy;
    203   elecXSection = 0.0;
    204   SetupParticle(p);
    205   G4double ekin = std::max(keV, kinEnergy);
    206   //G4double ekin = kinEnergy;
    207   SetupTarget(Z, A, ekin);
    208 
    209140  G4double tmax = tkin;
    210   if(p == theElectron) tmax *= 0.5;
    211   else if(p != thePositron) {
     141  cosTetMaxElec = 1.0;
     142  if(mass > MeV) {
    212143    G4double ratio = electron_mass_c2/mass;
    213144    G4double tau = tkin/mass;
    214145    tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
    215146      (1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
    216   }
    217 
    218   cosTetMaxElec = cosTetMaxNuc;
    219   G4double t = std::min(cutEnergy, tmax);
    220   G4double mom21 = t*(t + 2.0*electron_mass_c2);
    221   G4double t1 = tkin - t;
    222   if(t1 > 0.0) {
    223     G4double mom22 = t1*(t1 + 2.0*mass);
    224     G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
    225     if(ctm > cosTetMaxElec && ctm <= 1.0) cosTetMaxElec = ctm;
    226   }
    227 
    228   if(cosTetMaxElec < cosThetaMin) {
    229     G4double x1 = 1.0 - cosThetaMin  + screenZ;
    230     G4double x2 = 1.0 - cosTetMaxElec + screenZ;
    231     elecXSection = coeff*Z*chargeSquare*invbeta2*
    232       (cosThetaMin - cosTetMaxElec)/(x1*x2*mom2);
    233   }
    234   //  G4cout << "cut= " << ecut << " e= " << tkin
    235   // << " croosE(barn)= " << elecXSection/barn
    236   // << " cosEl= " << cosTetMaxElec << " costmin= " << cosThetaMin << G4endl;
    237   return elecXSection;
    238 }
    239 
    240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    241 
    242 G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom(
    243                              const G4ParticleDefinition* p,
    244                              G4double kinEnergy,
    245                              G4double Z, G4double A)
    246 {
    247   G4double cross = 0.0;
     147    cosTetMaxElec = 1.0 - std::min(cutEnergy, tmax)*electron_mass_c2/mom2;
     148  } else {
     149
     150    if(particle == theElectron) tmax *= 0.5;
     151    G4double t = std::min(cutEnergy, tmax);
     152    G4double mom21 = t*(t + 2.0*electron_mass_c2);
     153    G4double t1 = tkin - t;
     154    //G4cout << "tkin= " << tkin << " t= " << t << " t1= " << t1 << G4endl;
     155    if(t1 > 0.0) {
     156      G4double mom22 = t1*(t1 + 2.0*mass);
     157      G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
     158      //G4cout << "ctm= " << ctm << G4endl;
     159      if(ctm < 1.0) cosTetMaxElec = ctm;
     160    }
     161  }
     162}
     163
     164//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     165
     166G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
     167                const G4ParticleDefinition* p,
     168                G4double kinEnergy,
     169                G4double Z, G4double,
     170                G4double cutEnergy, G4double)
     171{
     172  //G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom  for "
     173  //  << p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV << G4endl;
     174  G4double xsec = 0.0;
    248175  SetupParticle(p);
    249   G4double ekin = std::max(keV, kinEnergy);
    250   //G4double ekin = kinEnergy;
    251   SetupTarget(Z, A, ekin);
    252 
    253   if(cosTetMaxNuc < cosThetaMin) {
    254     G4double x1 = 1.0 - cosThetaMin;
    255     G4double x2 = 1.0 - cosTetMaxNuc;
    256     G4double x3 = cosThetaMin - cosTetMaxNuc;
    257     G4double z1 = x1 + screenZ;
    258     G4double z2 = x2 + screenZ;
    259     G4double d  = 1.0/formfactA - screenZ;
    260     G4double d1 = 1.0 - formfactA*screenZ;
    261     G4double zn1= x1 + d;
    262     G4double zn2= x2 + d;
    263     cross = coeff*Z*Z*chargeSquare*invbeta2
    264       *(x3/(z1*z2) + x3/(zn1*zn2) +
    265         2.0*std::log(z1*zn2/(z2*zn1))/d) / (mom2*d1*d1);
    266   }
     176  G4double ekin = std::max(lowEnergyLimit, kinEnergy);
     177  SetupKinematic(ekin, cutEnergy);
     178  if(cosTetMaxNuc < cosTetMinNuc) {
     179    SetupTarget(Z, ekin);
     180    xsec = CrossSectionPerAtom(); 
     181  }
     182  /*
     183  G4cout << "e(MeV)= " << ekin/MeV << "cosTetMinNuc= " << cosTetMinNuc
     184         << " cosTetMaxNuc= " << cosTetMaxNuc
     185         << " cosTetMaxElec= " << cosTetMaxElec
     186         << " screenZ= " << screenZ
     187         << " formfactA= " << formfactA
     188         << " cosTetMaxHad= " << cosTetMaxHad << G4endl;
     189  */
     190  return xsec; 
     191}
     192
     193//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     194
     195G4double G4eCoulombScatteringModel::CrossSectionPerAtom()
     196{
     197  // This method needs initialisation before be called
     198
     199  G4double fac = coeff*targetZ*chargeSquare*invbeta2/mom2;
     200  elecXSection = 0.0;
     201  nucXSection  = 0.0;
     202
     203  G4double x  = 1.0 - cosTetMinNuc;
     204  G4double x1 = x + screenZ;
     205
     206  if(cosTetMaxElec2 < cosTetMinNuc) {
     207    elecXSection = fac*(cosTetMinNuc - cosTetMaxElec2)/
     208      (x1*(1.0 - cosTetMaxElec2 + screenZ));
     209    nucXSection  = elecXSection;
     210  }
     211
     212  //G4cout << "XS tkin(MeV)= " << tkin<<" xs= " <<nucXSection
     213  //     << " costmax= " << cosTetMaxNuc2
     214  //     << " costmin= " << cosTetMinNuc << "  Z= " << targetZ <<G4endl;
     215  if(cosTetMaxNuc2 < cosTetMinNuc) {
     216    G4double s  = screenZ*formfactA;
     217    G4double z1 = 1.0 - cosTetMaxNuc2 + screenZ;
     218    G4double d  = (1.0 - s)/formfactA;
     219    //G4cout <<"x1= "<<x1<<" z1= " <<z1<<" s= "<<s << " d= " <<d <<G4endl;
     220    if(d < 0.2*x1) {
     221      G4double x2 = x1*x1;
     222      G4double z2 = z1*z1;
     223      x = (1.0/(x1*x2) - 1.0/(z1*z2) - d*1.5*(1.0/(x2*x2) - 1.0/(z2*z2)))/
     224        (3.0*formfactA*formfactA);
     225    } else {
     226      G4double x2 = x1 + d;
     227      G4double z2 = z1 + d;
     228      x = (1.0 + 2.0*s)*((cosTetMinNuc - cosTetMaxNuc2)*(1.0/(x1*z1) + 1.0/(x2*z2)) -
     229                         2.0*log(z1*x2/(z2*x1))/d);
     230    }
     231    nucXSection += fac*targetZ*x;
     232  }
     233
     234  //G4cout<<" cross(bn)= "<<nucXSection/barn<<" xsElec(bn)= "<<elecXSection/barn
     235  //    << " Asc= " << screenZ << G4endl;
    267236 
    268   //  G4cout << "CalculateCrossSectionPerAtom: e(MeV)= " << tkin
    269   // << " cross(b)= " << cross/barn << " ctmin= " << cosThetaMin
    270   // << " ctmax= " << cosTetMaxNuc << G4endl;
    271  
    272   return cross;
     237  return nucXSection;
    273238}
    274239
     
    276241
    277242void G4eCoulombScatteringModel::SampleSecondaries(
    278                 std::vector<G4DynamicParticle*>*,
     243                std::vector<G4DynamicParticle*>* fvect,
    279244                const G4MaterialCutsCouple* couple,
    280245                const G4DynamicParticle* dp,
    281246                G4double cutEnergy,
    282                 G4double maxEnergy)
    283 {
    284   const G4Material* aMaterial = couple->GetMaterial();
    285   const G4ParticleDefinition* p = dp->GetDefinition();
     247                G4double)
     248{
    286249  G4double kinEnergy = dp->GetKineticEnergy();
    287 
    288   // Select atom and setup
    289   SetupParticle(p);
    290   const G4Element* elm =
    291     SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy);
    292   G4double Z  = elm->GetZ();
    293   G4double A  = elm->GetN();
    294 
    295   G4double cross =
    296     ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy);
    297 
    298   G4double costm = cosTetMaxNuc;
     250  if(kinEnergy <= DBL_MIN) return;
     251  DefineMaterial(couple);
     252  SetupParticle(dp->GetDefinition());
     253  G4double ekin = std::max(lowEnergyLimit, kinEnergy);
     254  SetupKinematic(ekin, cutEnergy);
     255  //G4cout << "G4eCoulombScatteringModel::SampleSecondaries e(MeV)= "
     256  //     << kinEnergy << "  " << particle->GetParticleName() << G4endl;
     257 
     258  // Choose nucleus
     259  currentElement = SelectRandomAtom(couple,particle,ekin,cutEnergy,ekin);
     260
     261  SetupTarget(currentElement->GetZ(),ekin);
     262 
     263  G4double cost = SampleCosineTheta();
     264  G4double z1   = 1.0 - cost;
     265  if(z1 < 0.0) return;
     266
     267  G4double sint = sqrt(z1*(1.0 + cost));
     268 
     269  //G4cout<<"## Sampled sint= " << sint << "  Z= " << targetZ
     270  //    << "  screenZ= " << screenZ << " cn= " << formfactA << G4endl;
     271 
     272  G4double phi  = twopi * G4UniformRand();
     273
     274  G4ThreeVector direction = dp->GetMomentumDirection();
     275  G4ThreeVector newDirection(cos(phi)*sint,sin(phi)*sint,cost);
     276  newDirection.rotateUz(direction);   
     277
     278  fParticleChange->ProposeMomentumDirection(newDirection);   
     279
     280  // recoil sampling assuming a small recoil
     281  // and first order correction to primary 4-momentum
     282  if(lowEnergyLimit < kinEnergy) {
     283    G4int ia = SelectIsotopeNumber(currentElement);
     284    G4double Trec = z1*mom2/(amu_c2*G4double(ia));
     285    G4double th =
     286      std::min(recoilThreshold,
     287               targetZ*currentElement->GetIonisation()->GetMeanExcitationEnergy());
     288
     289    if(Trec > th) {
     290      G4int iz = G4int(targetZ);
     291      G4ParticleDefinition* ion = theParticleTable->FindIon(iz, ia, 0, iz);
     292      Trec = z1*mom2/ion->GetPDGMass();
     293      if(Trec < kinEnergy) {
     294        G4ThreeVector dir = (direction - newDirection).unit();
     295        G4DynamicParticle* newdp = new G4DynamicParticle(ion, dir, Trec);
     296        fvect->push_back(newdp);
     297        fParticleChange->SetProposedKineticEnergy(kinEnergy - Trec);
     298      }
     299    }
     300  }
     301 
     302  return;
     303}
     304
     305//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     306
     307G4double G4eCoulombScatteringModel::SampleCosineTheta()
     308{
     309  G4double costm = cosTetMaxNuc2;
    299310  G4double formf = formfactA;
    300   if(G4UniformRand()*cross < elecXSection) {
    301     costm = cosTetMaxElec;
     311  G4double prob  = 0.0;
     312  G4double xs = CrossSectionPerAtom();
     313  if(xs > 0.0) prob = elecXSection/xs;
     314
     315  // scattering off e or A?
     316  if(G4UniformRand() < prob) {
     317    costm = cosTetMaxElec2;
    302318    formf = 0.0;
    303319  }
     320
    304321  /*
    305   G4cout << "G4eCoul...SampleSecondaries: e(MeV)= " << tkin
     322  G4cout << "SampleCost: e(MeV)= " << tkin
    306323         << " ctmin= " << cosThetaMin
    307324         << " ctmaxN= " << cosTetMaxNuc
    308325         << " ctmax= " << costm
    309          << " Z= " << Z << " A= " << A
    310          << " cross= " << cross/barn << " crossE= " << elecXSection/barn
     326         << " Z= " << targetZ << " A= " << targetA
    311327         << G4endl;
    312328  */
    313   if(costm >= cosThetaMin) return;
    314 
    315   G4double x1 = 1. - cosThetaMin + screenZ;
    316   G4double x2 = 1. - costm;
    317   G4double x3 = cosThetaMin - costm;
    318   G4double grej,  z, z1;
     329  if(costm >= cosTetMinNuc) return 2.0;
     330
     331  G4double x1 = 1. - cosTetMinNuc + screenZ;
     332  G4double x2 = 1. - costm + screenZ;
     333  G4double x3 = cosTetMinNuc - costm;
     334  G4double grej, z1;
    319335  do {
    320     z  = G4UniformRand()*x3;
    321     z1 = (x1*x2 - screenZ*z)/(x1 + z);
    322     if(z1 < 0.0) z1 = 0.0;
    323     else if(z1 > 2.0) z1 = 2.0;
     336    z1 = x1*x2/(x1 + G4UniformRand()*x3) - screenZ;
    324337    grej = 1.0/(1.0 + formf*z1);
    325338  } while ( G4UniformRand() > grej*grej ); 
    326  
    327   G4double cost = 1.0 - z1;
    328   G4double sint= sqrt(z1*(2.0 - z1));
    329   /*
    330   if(sint > 0.1)
    331     G4cout<<"## SampleSecondaries: e(MeV)= " << kinEnergy
    332           << " sint= " << sint << "  Z= " << Z << "  screenZ= " << screenZ
    333           << " cn= " << formf
    334           << G4endl;
    335   */
    336   G4double phi  = twopi * G4UniformRand();
    337 
    338   G4ThreeVector direction = dp->GetMomentumDirection();
    339   G4ThreeVector newDirection(cos(phi)*sint,sin(phi)*sint,cost);
    340   newDirection.rotateUz(direction);   
    341 
    342   fParticleChange->ProposeMomentumDirection(newDirection);   
    343  
    344   return;
    345 }
    346 
    347 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    348 
    349 
     339
     340  //G4cout << "z= " << z1 << " cross= " << nucXSection/barn
     341  // << " crossE= " << elecXSection/barn << G4endl;
     342
     343  return 1.0 - z1;
     344}
     345
     346//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     347
     348
  • trunk/source/processes/electromagnetic/standard/src/G4eIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eIonisation.cc,v 1.53 2007/05/22 17:34:36 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eIonisation.cc,v 1.57 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    9090    isInitialised(false)
    9191{
    92   SetStepFunction(0.2, 1*mm);
    93   SetIntegral(true);
    94   SetVerboseLevel(1);
     92  //  SetStepFunction(0.2, 1*mm);
     93  // SetIntegral(true);
     94  // SetVerboseLevel(1);
     95  SetProcessSubType(fIonisation);
    9596}
    9697
     
    99100G4eIonisation::~G4eIonisation()
    100101{}
     102
     103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     104
     105G4double G4eIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
     106                                         const G4Material*,
     107                                         G4double cut)
     108{
     109  G4double x = cut;
     110  if(isElectron) x += cut;
     111  return x;
     112}
     113
     114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     115
     116G4bool G4eIonisation::IsApplicable(const G4ParticleDefinition& p)
     117{
     118  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
     119}
    101120
    102121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    110129    SetSecondaryParticle(theElectron);
    111130    if (!EmModel()) SetEmModel(new G4MollerBhabhaModel());
    112     EmModel()->SetLowEnergyLimit (100*eV);
    113     EmModel()->SetHighEnergyLimit(100*TeV);
     131    EmModel()->SetLowEnergyLimit (MinKinEnergy());
     132    EmModel()->SetHighEnergyLimit(MaxKinEnergy());
    114133    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
    115134               
     
    122141
    123142void G4eIonisation::PrintInfo()
    124 {
    125   if(EmModel())
    126     G4cout << "      Delta cross sections and sampling from "
    127            << EmModel()->GetName() << " model"
    128            << "\n      Good description from 1 KeV to 100 GeV."
    129            << G4endl;
    130 }
     143{}
    131144
    132145//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/standard/src/G4eeToTwoGammaModel.cc

    r819 r961  
    2525//
    2626// $Id: G4eeToTwoGammaModel.cc,v 1.14 2007/05/23 08:47:35 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/standard/src/G4eplusAnnihilation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4eplusAnnihilation.cc,v 1.27 2007/10/02 10:17:12 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4eplusAnnihilation.cc,v 1.30 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6868  : G4VEmProcess(name), isInitialised(false)
    6969{
     70  SetProcessSubType(fAnnihilation);
    7071  enableAtRestDoIt = true;
    7172}
     
    7879//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7980
     81G4bool G4eplusAnnihilation::IsApplicable(const G4ParticleDefinition& p)
     82{
     83  return (&p == G4Positron::Positron());
     84}
     85
     86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     87
     88G4double G4eplusAnnihilation::AtRestGetPhysicalInteractionLength(
     89                              const G4Track&, G4ForceCondition* condition)
     90{
     91  *condition = NotForced;
     92  return 0.0;
     93}
     94
     95//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     96
    8097void G4eplusAnnihilation::InitialiseProcess(const G4ParticleDefinition*)
    8198{
     
    85102    SetStartFromNullFlag(false);
    86103    SetSecondaryParticle(G4Gamma::Gamma());
    87     G4double emin = 0.1*keV;
    88     G4double emax = 100.*TeV;
    89     SetLambdaBinning(120);
    90     SetMinKinEnergy(emin);
    91     SetMaxKinEnergy(emax);
    92     if(!Model()) SetModel(new G4eeToTwoGammaModel);
    93     Model()->SetLowEnergyLimit(emin);
    94     Model()->SetHighEnergyLimit(emax);
     104    if(!Model()) SetModel(new G4eeToTwoGammaModel());
     105    Model()->SetLowEnergyLimit(MinKinEnergy());
     106    Model()->SetHighEnergyLimit(MaxKinEnergy());
    95107    AddEmModel(1, Model());
    96108  }
     
    100112
    101113void G4eplusAnnihilation::PrintInfo()
    102 {
    103   G4cout
    104     << "      Sampling according " << Model()->GetName() << " model"   
    105     << G4endl;
    106 }
     114{}
    107115
    108116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hIonisation.cc,v 1.70 2008/01/14 11:59:45 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4hIonisation.cc,v 1.82 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7878//          positive from pi+ and p (VI)
    7979// 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma)
     80// 12-09-08 Removed CorrectionsAlongStep (VI)
    8081//
    8182// -------------------------------------------------------------------
     
    9091#include "G4BraggModel.hh"
    9192#include "G4BetheBlochModel.hh"
     93#include "G4IonFluctuations.hh"
    9294#include "G4UniversalFluctuation.hh"
    9395#include "G4BohrFluctuations.hh"
     
    9597#include "G4PionPlus.hh"
    9698#include "G4PionMinus.hh"
    97 #include "G4LossTableManager.hh"
     99#include "G4KaonPlus.hh"
     100#include "G4KaonMinus.hh"
    98101
    99102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    103106G4hIonisation::G4hIonisation(const G4String& name)
    104107  : G4VEnergyLossProcess(name),
    105     theParticle(0),
    106     theBaseParticle(0),
    107     isInitialised(false)
    108 {
    109   SetStepFunction(0.2, 1*mm);
    110   SetIntegral(true);
    111   SetVerboseLevel(1);
     108    isInitialised(false),
     109    nuclearStopping(true)
     110{
     111  //  SetStepFunction(0.2, 1.0*mm);
     112  //SetIntegral(true);
     113  //SetVerboseLevel(1);
     114  SetProcessSubType(fIonisation);
    112115  mass = 0.0;
    113116  ratio = 0.0;
    114   corr = G4LossTableManager::Instance()->EmCorrections(); 
    115   nuclearStopping = true;
    116117}
    117118
     
    120121G4hIonisation::~G4hIonisation()
    121122{}
     123
     124//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     125
     126G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p)
     127{
     128  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV &&
     129         !p.IsShortLived());
     130}
     131
     132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     133
     134G4double G4hIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
     135                                         const G4Material*,
     136                                         G4double cut)
     137{
     138  G4double x = 0.5*cut/electron_mass_c2;
     139  G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
     140  return mass*(g - 1.0);
     141}
    122142
    123143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 
     
    127147                    const G4ParticleDefinition* bpart)
    128148{
    129   if(isInitialised) return;
    130 
    131   theParticle = part;
    132 
    133   G4String pname = part->GetParticleName();
    134 
    135   // standard base particles
    136   if(part == bpart || pname == "proton" ||
    137      pname == "anti_proton" || pname == "pi+" || pname == "pi-" )
    138     theBaseParticle = 0;
    139 
    140   // select base particle
    141   else if(bpart == 0) {
    142 
    143     if(pname == "kaon+")      theBaseParticle = G4PionPlus::PionPlus();
    144     else if(pname == "kaon-") theBaseParticle = G4PionMinus::PionMinus();
    145     else if(part->GetPDGCharge() > 0.0) theBaseParticle = G4Proton::Proton();
    146     else theBaseParticle = G4AntiProton::AntiProton();
    147 
    148   } else theBaseParticle = bpart;
    149 
    150   SetBaseParticle(theBaseParticle);
    151   SetSecondaryParticle(G4Electron::Electron());
    152   mass  = theParticle->GetPDGMass();
    153   ratio = electron_mass_c2/mass;
    154   massratio = 1.0;
    155   if(theBaseParticle) massratio = theBaseParticle->GetPDGMass()/mass;
    156 
    157   if (!EmModel(1)) SetEmModel(new G4BraggModel(),1);
    158   EmModel(1)->SetLowEnergyLimit(100*eV);
    159   eth = 2.0*MeV*mass/proton_mass_c2;
    160   ethnuc = eth*50.0;
    161   EmModel(1)->SetHighEnergyLimit(eth);
    162   if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
    163   AddEmModel(1, EmModel(1), FluctModel());
    164 
    165   if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); 
    166   EmModel(2)->SetLowEnergyLimit(eth);
    167   EmModel(2)->SetHighEnergyLimit(100*TeV);
    168   AddEmModel(2, EmModel(2), FluctModel()); 
    169 
    170   isInitialised = true;
     149  if(!isInitialised) {
     150
     151    const G4ParticleDefinition* theBaseParticle = 0;
     152    G4String pname = part->GetParticleName();
     153
     154    // standard base particles
     155    if(part == bpart || pname == "proton" ||
     156       pname == "anti_proton" ||
     157       pname == "pi+" || pname == "pi-" ||
     158       pname == "kaon+" || pname == "kaon-")
     159      {
     160        theBaseParticle = 0;
     161      }
     162    // select base particle
     163    else if(bpart == 0) {
     164
     165      if(part->GetPDGSpin() == 0.0)
     166        if(part->GetPDGCharge() > 0.0 ) {
     167          theBaseParticle = G4KaonPlus::KaonPlus();
     168        } else {
     169          theBaseParticle = G4KaonMinus::KaonMinus();
     170        }
     171      else if(part->GetPDGCharge() > 0.0) {
     172        theBaseParticle = G4Proton::Proton();
     173      } else {
     174        theBaseParticle = G4AntiProton::AntiProton();
     175      }
     176      // base particle defined by interface
     177    } else {
     178      theBaseParticle = bpart;
     179    }
     180    SetBaseParticle(theBaseParticle);
     181    SetSecondaryParticle(G4Electron::Electron());
     182
     183    mass  = part->GetPDGMass();
     184    ratio = electron_mass_c2/mass;
     185
     186    if(mass < 900.*MeV) nuclearStopping = false;
     187
     188    if (!EmModel(1)) SetEmModel(new G4BraggModel(),1);
     189    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
     190
     191    // model limit defined for protons
     192    eth = (EmModel(1)->HighEnergyLimit())*mass/proton_mass_c2;
     193    EmModel(1)->SetHighEnergyLimit(eth);
     194    AddEmModel(1, EmModel(1), new G4IonFluctuations());
     195
     196    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
     197
     198    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); 
     199    EmModel(2)->SetLowEnergyLimit(eth);
     200    EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
     201    AddEmModel(2, EmModel(2), FluctModel()); 
     202
     203    isInitialised = true;
     204  }
     205  EmModel(1)->ActivateNuclearStopping(nuclearStopping);
     206  EmModel(2)->ActivateNuclearStopping(nuclearStopping);
    171207}
    172208
     
    175211void G4hIonisation::PrintInfo()
    176212{
    177   if(EmModel(1) && EmModel(2))
    178     G4cout << "      Scaling relation is used from proton dE/dx and range."
    179            << "\n      Delta cross sections and sampling from "
    180            << EmModel(2)->GetName() << " model for scaled energy > "
    181            << eth/MeV << " MeV"
    182            << "\n      Parametrisation from "
    183            << EmModel(1)->GetName() << " for protons below."
    184            << " NuclearStopping= " << nuclearStopping
     213  if(EmModel(1) && EmModel(2)) {
     214    G4cout << "      NuclearStopping= " << nuclearStopping
    185215           << G4endl;
    186 }
    187 
    188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    189 
    190 void G4hIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
    191                                          const G4DynamicParticle* dp,
    192                                          G4double& eloss,
    193                                          G4double& s)
    194 {
    195   G4double ekin = dp->GetKineticEnergy();
    196   if(nuclearStopping && ekin < ethnuc) {
    197     G4double nloss = s*corr->NuclearDEDX(theParticle,couple->GetMaterial(),
    198                                          ekin - eloss*0.5);
    199     eloss += nloss;
    200     //  G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
    201     //     << " de= " << eloss << " NIEL= " << nloss << G4endl;
    202     fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
    203216  }
    204217}
  • trunk/source/processes/electromagnetic/standard/src/G4hMultipleScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4hMultipleScattering.cc,v 1.7 2007/12/07 17:35:52 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4hMultipleScattering.cc,v 1.13 2008/10/15 17:53:44 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -----------------------------------------------------------------------------
     
    5858  : G4VMultipleScattering(processName)
    5959{
    60   dtrl              = 0.05;
    61   lambdalimit       = 1.*mm;
    62  
    63   samplez           = false ;
    64   isInitialized     = false; 
    65 
    66   SetLateralDisplasmentFlag(true);
    67   SetSkin(0.0);
    68   SetRangeFactor(0.2);
    69   SetGeomFactor(0.1);
     60  isInitialized = false; 
     61  isIon         = false;
    7062  SetStepLimitType(fMinimal);
    7163}
     
    8981  // Modification of parameters between runs
    9082  if(isInitialized) {
    91     if (p->GetParticleType() != "nucleus") {
     83    if (p->GetParticleType() != "nucleus" && p->GetPDGMass() < GeV) {
    9284      mscUrban->SetStepLimitType(StepLimitType());
    9385      mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
     
    9991  }
    10092
     93  // defaults for ions, which cannot be overwritten
     94  if (p->GetParticleType() == "nucleus" || p->GetPDGMass() > GeV) {
     95    SetStepLimitType(fMinimal);
     96    SetLateralDisplasmentFlag(false);
     97    SetBuildLambdaTable(false);
     98    if(p->GetParticleType() == "nucleus") isIon = true;
     99  }
     100
    101101  // initialisation of parameters
    102102  G4String part_name = p->GetParticleName();
    103   mscUrban = new G4UrbanMscModel90(RangeFactor(),dtrl,lambdalimit,
    104                                  GeomFactor(),Skin(),
    105                                  samplez,StepLimitType());
     103  mscUrban = new G4UrbanMscModel90();
     104
     105  mscUrban->SetStepLimitType(StepLimitType());
    106106  mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
     107  mscUrban->SetSkin(Skin());
     108  mscUrban->SetRangeFactor(RangeFactor());
     109  mscUrban->SetGeomFactor(GeomFactor());
    107110
    108   if (p->GetParticleType() == "nucleus") {
    109     mscUrban->SetStepLimitType(fMinimal);
    110     SetLateralDisplasmentFlag(false);
    111     SetBuildLambdaTable(false);
    112     SetSkin(0.0);
    113     SetRangeFactor(0.2);
    114   }
    115111  AddEmModel(1,mscUrban);
    116112  isInitialized = true;
     
    121117void G4hMultipleScattering::PrintInfo()
    122118{
    123   G4cout << "      Boundary/stepping algorithm is active with RangeFactor= "
    124          << RangeFactor()
    125          << "  Step limit type " << StepLimitType()
     119  G4cout << "      RangeFactor= " << RangeFactor()
     120         << ", step limit type: " << StepLimitType()
     121         << ", lateralDisplacement: " << LateralDisplasmentFlag()
     122         << ", skin= " << Skin() 
     123    //   << ", geomFactor= " << GeomFactor() 
    126124         << G4endl;
    127125}
     
    129127//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    130128
     129G4double G4hMultipleScattering::AlongStepGetPhysicalInteractionLength(
     130                             const G4Track& track,
     131                             G4double,
     132                             G4double currentMinimalStep,
     133                             G4double& currentSafety,
     134                             G4GPILSelection* selection)
     135{
     136  // get Step limit proposed by the process
     137  valueGPILSelectionMSC = NotCandidateForSelection;
     138
     139  G4double escaled = track.GetKineticEnergy();
     140  if(isIon) escaled *= track.GetDynamicParticle()->GetMass()/proton_mass_c2;
     141
     142  G4double steplength = GetMscContinuousStepLimit(track,
     143                                                  escaled,
     144                                                  currentMinimalStep,
     145                                                  currentSafety);
     146  // G4cout << "StepLimit= " << steplength << G4endl;
     147  // set return value for G4GPILSelection
     148  *selection = valueGPILSelectionMSC;
     149  return  steplength;
     150}
     151
     152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     153
  • trunk/source/processes/electromagnetic/standard/src/G4ionGasIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionGasIonisation.cc,v 1.4 2008/01/14 11:59:45 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionGasIonisation.cc,v 1.14 2008/09/12 16:26:34 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5656
    5757G4ionGasIonisation::G4ionGasIonisation(const G4String& name)
    58   : G4ionIonisation(name),
    59     currParticle(0),
    60     baseParticle(0),
    61     initialised(false)
     58  : G4ionIonisation(name)
    6259{
    63   atomXS = CLHEP::pi*CLHEP::Bohr_radius*CLHEP::Bohr_radius;
    64   verboseLevel = 1;
    6560}
    6661
     
    7065{}
    7166
    72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    73 
    74 void G4ionGasIonisation::InitialiseEnergyLossProcess(
    75                       const G4ParticleDefinition* part,
    76                       const G4ParticleDefinition* bpart)
    77 {
    78   G4ionIonisation::InitialiseEnergyLossProcess(part, bpart);
    79   if(initialised) return;
    80 
    81   currParticle = part;
    82 
    83   if(part == bpart || part == G4GenericIon::GenericIon()) baseParticle = 0;
    84   else if(bpart == 0) baseParticle = G4GenericIon::GenericIon();
    85   else                baseParticle = bpart;
    86 
    87   if(baseParticle) basePartMass = baseParticle->GetPDGMass();
    88   else             basePartMass = currParticle->GetPDGMass();
    89  
    90   initialised = true;
    91 }
    92 
    93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    94 
    95 void G4ionGasIonisation::PrintInfo()
    96 {
    97   G4ionIonisation::PrintInfo();
    98   G4cout << "      Version of ion process with simulation discrete ion/media change exchange."
    99          << G4endl;     
    100 }
    101 
    102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    103 
    104 void G4ionGasIonisation::InitialiseMassCharge(const G4Track& track)
    105 {
    106   // First step of an ion
    107   if(track.GetCurrentStepNumber() == 1) {
    108     currParticle = track.GetDefinition();
    109     ionZ = G4int(currParticle->GetPDGCharge()/eplus + 0.5);
    110     currentIonZ = G4int(track.GetDynamicParticle()->GetCharge()/eplus + 0.5);
    111     currMassRatio = basePartMass/currParticle->GetPDGMass();
    112   }
    113   // any step
    114   G4double q = eplus*currentIonZ;
    115   SetDynamicMassCharge(currMassRatio, q*q);
    116   preStepKinEnergy = track.GetKineticEnergy();
    117 }
    118 
    119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    120 
    121 void G4ionGasIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
    122                                               const G4DynamicParticle* dp,
    123                                               G4double& eloss,
    124                                               G4double& s)
    125 {
    126   const G4ParticleDefinition* part = dp->GetDefinition();
    127   const G4Material* mat = couple->GetMaterial();
    128   // add corrections
    129   if(eloss < preStepKinEnergy) {
    130 
    131     // use Bethe-Bloch with corrections
    132     if(preStepKinEnergy*currMassRatio > BetheBlochEnergyThreshold())
    133       eloss += s*corr->HighOrderCorrections(part,mat,preStepKinEnergy);
    134 
    135     // effective number of collisions
    136     G4double x = mat->GetElectronDensity()*s*atomXS;
    137     // equilibrium charge
    138     G4double q = fParticleChange.GetProposedCharge();
    139  
    140     // sample charge change during the step
    141     fParticleChange.SetProposedCharge(SampleChargeAfterStep(q, x));
    142   }
    143 
    144   // use nuclear stopping
    145   if(NuclearStoppingFlag()) {
    146     G4double nloss = s*corr->NuclearDEDX(part,mat,preStepKinEnergy - eloss*0.5);
    147     eloss += nloss;
    148     fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
    149   }
    150 }
    151 
     67/*
    15268//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    15369
     
    15773  // xeff - effective number of collisions
    15874  // q    - current charge
    159   G4double q = eplus*currentIonZ;
     75  G4double q = G4double(currentIonZ);
     76  if(qeff > q) {
     77    if(G4UniformRand() < qeff - q) currentIonZ++;
     78  } else {
     79    if(G4UniformRand() < q - qeff) currentIonZ--;
     80  }
     81
     82  q = eplus*currentIonZ;
    16083  if(verboseLevel > 1) G4cout << "G4ionGasIonisation: Q1= " << currentIonZ
    16184                              << " Qeff= " << qeff/eplus << "  Neff= " << xeff
     
    16386  return q;
    16487}
    165 
     88*/
    16689//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionIonisation.cc,v 1.45.2.2 2008/04/25 00:34:55 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionIonisation.cc,v 1.66 2009/02/20 12:06:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555// 16-05-07 Add data for light ion stopping only for GenericIon (V.Ivantchenko)
    5656// 07-11-07 Fill non-ionizing energy loss (V.Ivantchenko)
     57// 12-09-08 Removed InitialiseMassCharge and CorrectionsAlongStep (VI)
    5758//
    5859//
     
    6566#include "G4Electron.hh"
    6667#include "G4Proton.hh"
     68//#include "G4Alpha.hh"
    6769#include "G4GenericIon.hh"
    6870#include "G4BraggModel.hh"
    6971#include "G4BraggIonModel.hh"
    7072#include "G4BetheBlochModel.hh"
    71 #include "G4IonFluctuations.hh"
    7273#include "G4UnitsTable.hh"
    7374#include "G4LossTableManager.hh"
    7475#include "G4WaterStopping.hh"
     76#include "G4EmCorrections.hh"
     77#include "G4IonFluctuations.hh"
    7578
    7679//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    8083G4ionIonisation::G4ionIonisation(const G4String& name)
    8184  : G4VEnergyLossProcess(name),
     85    corr(0),
    8286    theParticle(0),
    83     theBaseParticle(0),
    8487    isInitialised(false),
    8588    stopDataActive(true),
     
    8992  SetStepFunction(0.1, 0.1*mm);
    9093  SetIntegral(true);
    91   SetVerboseLevel(1);
     94  SetProcessSubType(fIonisation);
     95  //  SetVerboseLevel(1);
    9296  corr = G4LossTableManager::Instance()->EmCorrections();
    9397}
     
    100104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    101105
     106G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p)
     107{
     108  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() &&
     109          p.GetParticleType() == "nucleus");
     110}
     111
     112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     113
     114G4double G4ionIonisation::MinPrimaryEnergy(const G4ParticleDefinition* p,
     115                                           const G4Material*,
     116                                           G4double cut)
     117{
     118  return
     119    p->GetPDGMass()*(std::sqrt(1. + 0.5*cut/CLHEP::electron_mass_c2) - 1.0);
     120}
     121
     122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     123
    102124void G4ionIonisation::InitialiseEnergyLossProcess(
    103125                      const G4ParticleDefinition* part,
    104126                      const G4ParticleDefinition* bpart)
    105127{
    106   if(isInitialised) return;
     128  const G4ParticleDefinition* ion = G4GenericIon::GenericIon();
    107129
    108   theParticle = part;
     130  if(!isInitialised) {
    109131
    110   if(part == bpart || part == G4GenericIon::GenericIon()) theBaseParticle = 0;
    111   else if(bpart == 0) theBaseParticle = G4GenericIon::GenericIon();
    112   else                theBaseParticle = bpart;
     132    theParticle = part;
     133    //G4String pname = part->GetParticleName();
    113134
    114   SetBaseParticle(theBaseParticle);
    115   SetSecondaryParticle(G4Electron::Electron());
     135    // define base particle
     136    const G4ParticleDefinition* theBaseParticle = 0;
    116137
    117   if(theBaseParticle) baseMass = theBaseParticle->GetPDGMass();
    118   else                baseMass = theParticle->GetPDGMass();
    119  
    120   if (!EmModel(1)) SetEmModel(new G4BraggIonModel(),1);
    121   EmModel(1)->SetLowEnergyLimit(100*eV);
    122   eth = 2.0*MeV; 
    123   EmModel(1)->SetHighEnergyLimit(eth);
    124   if (!FluctModel()) SetFluctModel(new G4IonFluctuations());
    125   AddEmModel(1, EmModel(1), FluctModel());
     138    if(part == ion)     theBaseParticle = 0;
     139    else if(bpart == 0) theBaseParticle = ion;
     140    else                theBaseParticle = bpart;
    126141
    127   if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); 
    128   EmModel(2)->SetLowEnergyLimit(eth);
    129   EmModel(2)->SetHighEnergyLimit(100*TeV);
    130   AddEmModel(2, EmModel(2), FluctModel());   
     142    SetBaseParticle(theBaseParticle);
     143    SetSecondaryParticle(G4Electron::Electron());
    131144
    132   // Add ion stoping tables for Generic Ion
    133   if(part == G4GenericIon::GenericIon()) {
    134     G4WaterStopping  ws(corr);
    135     effCharge = corr->GetIonEffectiveCharge(EmModel(1));
    136   } else {
    137     effCharge = corr->GetIonEffectiveCharge(0);
     145    if (!EmModel(1)) SetEmModel(new G4BraggIonModel(), 1);
     146    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
     147
     148    // model limit defined for protons
     149    eth = (EmModel(1)->HighEnergyLimit())*part->GetPDGMass()/proton_mass_c2;
     150    EmModel(1)->SetHighEnergyLimit(eth);
     151
     152    if (!FluctModel()) SetFluctModel(new G4IonFluctuations());
     153    AddEmModel(1, EmModel(1), FluctModel());
     154
     155    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); 
     156    EmModel(2)->SetLowEnergyLimit(eth);
     157    EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
     158    AddEmModel(2, EmModel(2), FluctModel());   
     159
     160    // Add ion stoping tables for Generic Ion
     161    if(part == ion) {
     162      G4WaterStopping  ws(corr);
     163      corr->SetIonisationModels(EmModel(1),EmModel(2));
     164    }
     165    isInitialised = true;
    138166  }
    139 
    140   isInitialised = true;
     167  // reinitialisation of corrections for the new run
     168  EmModel(1)->ActivateNuclearStopping(nuclearStopping);
     169  EmModel(2)->ActivateNuclearStopping(nuclearStopping);
     170  if(part == ion) corr->InitialiseForNewRun();
    141171}
    142172
     
    145175void G4ionIonisation::PrintInfo()
    146176{
    147   if(EmModel(1) && EmModel(2))
    148     G4cout << "      Scaling relation is used from proton dE/dx and range."
    149            << "\n      Delta cross sections and sampling from "
    150            << EmModel(2)->GetName() << " model for scaled energy > "
    151            << eth/MeV << " MeV"
    152            << "\n      Parametrisation from "
    153            << EmModel(1)->GetName() << " for protons below."
    154            << " NuclearStopping= " << nuclearStopping
    155            << G4endl;   
    156   if (stopDataActive)
    157     G4cout << "\n      Stopping Power data for "
     177  if (stopDataActive && G4GenericIon::GenericIon() == theParticle) {
     178    G4cout << "      Stopping Power data for "
    158179           << corr->GetNumberOfStoppingVectors()
    159            << " ion/material pairs are used."
     180           << " ion/material pairs, nuclearStopping: " << nuclearStopping
    160181           << G4endl;
     182  }
    161183}
    162184
     
    165187void G4ionIonisation::AddStoppingData(G4int Z, G4int A,
    166188                                      const G4String& mname,
    167                                       G4PhysicsVector& dVector)
     189                                      G4PhysicsVector* dVector)
    168190{
    169191  corr->AddStoppingData(Z, A, mname, dVector);
     
    171193
    172194//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    173 
    174 void G4ionIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
    175                                            const G4DynamicParticle* dp,
    176                                            G4double& eloss,
    177                                            G4double& s)
    178 {
    179   const G4ParticleDefinition* part = dp->GetDefinition();
    180   const G4Material* mat = couple->GetMaterial();
    181   if(eloss < preKinEnergy) {
    182     //    G4cout << "e= " << preKinEnergy << " ratio= " << massRatio << " eth= " << eth<<  G4endl;
    183     if(preKinEnergy*massRatio > eth)
    184       eloss += s*corr->HighOrderCorrections(part,mat,preKinEnergy);
    185     else {
    186 
    187       if(stopDataActive)
    188         eloss *= corr->EffectiveChargeCorrection(part,mat,preKinEnergy);
    189 
    190     }
    191     fParticleChange.SetProposedCharge(effCharge->EffectiveCharge(part,
    192                                       mat,preKinEnergy-eloss));
    193   }
    194   if(nuclearStopping && preKinEnergy*massRatio < 50.*eth*charge2) {
    195     G4double nloss = s*corr->NuclearDEDX(part,mat,preKinEnergy - eloss*0.5);
    196     eloss += nloss;
    197     //  G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy
    198     //     << " de= " << eloss << " NIEL= " << nloss << G4endl;
    199     fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
    200   }
    201 }
    202 
    203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/utils/History

    r819 r961  
    1 $Id: History,v 1.308.2.1 2008/04/22 15:28:12 vnivanch Exp $
     1$Id: History,v 1.372 2009/02/26 11:33:33 vnivanch Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
    20 22 April 08: V.Ivant (emutils-V09-00-14)
    21 - G4EmCorrections - set finite size correction to zero (provides         
    22                     flat distribution of vertex detector response
    23                     for high energy hadrons)
    24 - G4ionEffectiveCharge - minor change of numerical constants to provide
    25                          a continuous change of charge versus energy
    26 
     2026 February 09: V.Ivant (emutils-V09-02-03)
     21G4EmConfigurator - fixed for the case if only fluctuation model is set
     22                   and main model is default
     23
     2422 February 09: V.Ivant (emutils-V09-02-02)
     25- G4VEmModel - make methods to access geometry protected, added new
     26               method SetSampleZ, added geommax private member
     27- G4EmCalculator - added possibility to be used by DNA processes:
     28                   take into account special DNA particles
     29
     3018 February 09: V.Ivant (emutils-V09-02-01)
     31G4VEmModel, G4VEmFluctuationModel, G4VEnegryLossProcess, G4VEmProcess,
     32G4VMultipleScattering - move all virtual methods to source, update comments
     33G4VEmModel - added flagDeexcitation and Get/Set methods
     34G4VEnegryLossProcess, G4VEmProcess - added calls to deexcitation PostStep
     35G4EmProcessOptions - added ActivateDeexcitation method
     36G4EnergyLossMessenger - added /process/em/deexcitation UI command
     37G4LossTableBuilder - added protection in BuildRangeTable against zero dedx
     38
     3927 January 09: V.Ivant (emutils-V09-02-00)
     40G4VEmModel - added method SampleDeexcitationAlongStep
     41G4VEnegryLossProcess - added deexcitation AlongStep per region
     42G4VMscModel - added methdos: InitialiseSafetyHelper, ComputeSafety,
     43              ComputeGeomLimit, ComputeDisplacement
     44G4VEmProcess - added possibility to set more than 1 model
     45
     4620 November 08: V.Ivant (emutils-V09-01-37)
     47G4EmConfigurator - fixed energy interval selection for a model
     48G4VMultipleScattering - set process sub-type 10 to distinguish with
     49                        single Coulomb scattering
     50
     5113 Novemver 08: A.Schaelicke (emutils-V09-01-36)
     52G4LossTableManager - changed default LPM effect to ON again
     53G4VEmModel - (VI) add LPM flag and Get/Set methods
     54
     5512 November 08: V.Ivant (emutils-V09-01-35)
     56G4VEmModel - fixed memory leak by destruction G4EmElementSelectors
     57G4EmSaturation - activate saturation for energy deposition due to
     58                 photo-electric effect
     59
     6024 October 08: V.Ivant (emutils-V09-01-34)
     61G4EmProcessSubType - moved optical processes enumeration to optical directory
     62
     6320 October 08: V.Ivant (emutils-V09-01-33)
     64G4EnergyLossMessenger - added /process/em/applyCuts command
     65
     6617 October 08: V.Ivant (emutils-V09-01-32)
     67G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering set number
     68   of bins for tables 7 per decade
     69
     7015 October 08: V.Ivant (emutils-V09-01-31)
     71G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering improved cout
     72
     7314 October 08: V.Ivant (emutils-V09-01-30)
     74G4VEmModel - add secondaryThreshold variable and Get/Set methods
     75G4EmCorrections - define the range of correction vector 25 keV - 2.5 MeV,
     76                  as it is in ICRU'73 table, use 20 bins
     77G4LossTableManager - set spline option "true" and flagLPM "false" by default
     78G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering set default
     79                  table size 0.1 keV - 100 TeV in 60 bins
     80G4EmModelManager - included G4EmProcessSubType.hh header
     81G4EmTableType.hh - changed enumeration names fIonisation -> fIsIonisation,
     82                   fSubIonisation -> fIsSubIonisation to avoid clash with
     83                   sub-type enumeration name
     84
     8521 September 08: V.Ivant (emutils-V09-01-29)
     86G4EmCorrections - do not compute ion corrections if for ions
     87                  G4hIonisation process is used
     88
     8921 September 08: V.Ivant (emutils-V09-01-28)
     90G4ionEffectiveCharge - remove chargeFactor - return to 01-25
     91G4VEnergyLossProcess - fixed initialisation;
     92
     9312 September 08: V.Ivant (emutils-V09-01-27)
     94G4VEmProcess - improved verbose output
     95G4VEnergyLossProcess - added pointer to current G4VEmModel;
     96                       removed method CorrectionsAlongStep, instead
     97                       corresponding method of a model are used;
     98                       improved verbose output
     99G4VEmFluctuationModel - added method SetParticleAndCharge
     100G4VEmModel - minor optimisations of SelectRandomAtom and SelectIsotope;
     101             added methods GetParticleCharge, GetChargeSquareRatio,
     102             CorrectionsAlongStep, ActivateNuclearStopping needed for
     103             simulation of ion transport
     104G4EmCorrections - added interfaces to effective charge
     105G4ionEffectiveCharge - added variable chargeFactor to be used for He ions
     106
     10729 August 08: V.Ivant (emutils-V09-01-26)
     108G4VEmProcess, G4VMultipleScattering, G4VEnergyLossProcess - use
     109                   new DumpModelList method from G4EmModelManager
     110                   in the verbosity output
     111G4EmModelManager - fixed crash in destructor when verbosity > 1;
     112                   fixed selection of models per energy;
     113                   update printout with DumpModelList method
     114
     11521 August 08: V.Ivant (emutils-V09-01-25)
     116G4VEmModel - add parameter kinEnergy to SetupMaterial method;
     117             set pointer currentElement in ComputeCrossSectionPerAtom
     118G4EmElementSelector - update usage of methods SetupMaterial and
     119             ComputeCrossSectionPerAtom
     120
     1213 August 08: V.Ivant (emutils-V09-01-24)
     122G4EmCorrections - dEdx data for ions are initialised at the start of a run for
     123                  materials used in geometry; search for ion/material pairs updated
     124G4EmCalculator - improved cout
     125
     12631 July 08: V.Ivant (emutils-V09-01-23)
     127G4VEmProcess, G4VMultipleScattering, G4VEnergyLossProcess - use verbosity flag
     128    for GetEmModel method
     129G4VEmModel - use stl vector for cross sections instead of array
     130
     13121 July 08: V.Ivant (emutils-V09-01-22)
     132G4VEmModel - added vector of G4ElementSelectors, in which vectors
     133             of relative cross sections per elements of a compound
     134             material are stored; added new methods:
     135             InitialisaElementSelectors and SelectRandomAtom,
     136G4LossTableBuilder - remove dependence on G4LossTableManager
     137G4LossTableManager - propagated spline flag to G4LossTableBuilder           
     138
     13915 July 08: V.Ivant (emutils-V09-01-21)
     140G4EmConfigurator - a new helper class to add model per particle type,
     141                   process, energy range and G4Region
     142G4VEmProcess, G4VEnergyLossProcess - renamed and improved method
     143                   "MicroscopicCrossSection" by "CrossSectionPerVolume"
     144G4VEmModel, G4VEmProcess, G4VMultipleScattering, G4VEnergyLossProcess
     145                   reodering of members of classes and improved comments:
     146                   - separated members fixed at construction, defined at
     147                     ininitialisation, and modified in run time
     148                   - improved comments in header files
     149G4LossTableManager - added register/deregister mechanism and deletion
     150                   at the end of job for G4VEmModel
     151G4EmModelManager - does not delete models anymore
     152
     1539 July 08: V.Ivant (emutils-V09-01-20)
     154G4ElectronIonPair - a new helper class to sample number of primary ionisations
     155                    in detectors
     156
     1578 July 08: V.Ivant (emutils-V09-01-19)
     158G4VEmModel - added inline method ComputeCrossSectionPerAtom
     159G4LossTableManager and G4EnergyLossTable - remove call to exit()
     160
     1619 June 08: V.Ivant (emutils-V09-01-18)
     162G4ionEffectiveCharge - return back Ziegler formula for effective charge of ions;
     163                       min effective charge is 1.0 (instead of 0.1)
     164G4EmCorrections - a minor change of the scale for external ion data
     165
     1662 June 08: V.Ivant (emutils-V09-01-17)
     167G4ionEffectiveCharge - use simplified formula for effective charge of ions
     168
     16928 May 08: V.Ivant (emutils-V09-01-16)
     170G4VEmModel - added virtual method SetupForMaterial
     171G4EmElementSelector - helper class to sample random G4Element in a
     172                      compound material
     173
     17428 May 08: V.Ivant (emutils-V09-01-15)
     175G4VEnergyLossProcess - fixed problem of subcutoff option for ions (ion
     176                       ranges were wrong)
     177G4LossableBuilder - use more precise algorith to compute range for the
     178                    case, when spline is used 
     179
     18020 May 08: V.Ivant (emutils-V09-01-14)
     181- G4EmCorrections - computation of the finite size correction is moved to
     182                    the Bethe-Bloch model
     183
     18411 May 08: V.Ivant (emutils-V09-01-13)
     185- G4VMultipleScattering - make AlongStepGetPhysicalInteractionLength
     186  method virtual allowing to overwrite it by a derived class -
     187  needed for ion simulation
     188- G4EmCalculator - fixed bug in computation for ions
     189
     19021 April 08: V.Ivant (emutils-V09-01-12)
     191- G4VEmModel, G4VEmProcess, G4VMultipleScattering, G4EnergyLossMessenger
     192  G4EmProcessOptions - introduced polarAngleLimit parameter and Get/Set
     193  methods for single and multiple scattering models
     194- G4ionEffectiveCharge - fixed initialisation at first event
     195- G4EmCorrections - review and fix computation of high order corrections
     196                    for ions
     197- G4EmCalculator - updated computations for ions
     198
     19908 April 08: V.Ivant (emutils-V09-01-11)
     200- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering,
     201  G4LossTableBuilder - introduced spline
     202
     20325 March 08: V.Ivant (emutils-V09-01-10)
     204- G4EmCorrections - precompute EM formfactor for corrections
     205- G4VEnergyLossProcess - store bremsstrahlung cross sections
     206
     20725 March 08: V.Ivant (emutils-V09-01-09)
     208- G4EmCorrections - added cut dependence into finite size correction
     209- G4VEnergyLossProcess - added cout of linLossLimit
     210
     21117 March 08: V.Ivant (emutils-V09-01-08)
     212- G4EmSaturation - added interface with G4Step
     213     
     21414 March 08: mma (emutils-V09-01-07)
     215- modifs in G4EmSaturation
     216
     21714 March 08: V.Ivant (emutils-V09-01-06)
     218- G4EmSaturation - added computation of the average recoil mass,
     219                   use Birks coefficient from G4Material
     220- G4LossTableManager - fixed logic in compute dedx table for an
     221                       inactive process
     222
     22310 March 08: V.Ivant (emutils-V09-01-05)
     224- G4LossTableManager, G4EmProcessOptions - added Set/Get spline flag
     225- G4EnergyLossMessenger - added a command "/process/em/spline"
     226- G4VMultipleScattering - SetSkin method does not change
     227                          StepLimitType anymore
     228- G4VMscModel - new class to define general msc parameters
     229
     23021 February 08: V.Ivant (emutils-V09-01-04)
     231- G4EmSaturation - fixed initialisation problem
     232
     23321 February 08: V.Ivant (emutils-V09-01-03)
     234- G4EmCorrections - added correction on effective charge for NIST
     235  materials in the IonHighOrderCorrections method
     236- G4EmSaturation - new helper class
     237- G4LossTableManager - added GetEmSaturation method
     238
     23914 February 08: V.Ivant (emutils-V09-01-02)
     240- G4EmCorrections - added IonBarkasCorrection, IonHighOrderCorrections
     241  and ComputeIonCorrections methods in order to provide a smooth transition
     242  between low-energy parameterization and Bethe-Bloch model
     243- G4ionEffectiveCharge - use precomputed Z^1/3 values, use expantions
     244  of exp and pow functions, do not perform recomputation if arguments
     245  of methods unchanged
     246
     24704 February 08: V.Ivant (emutils-V09-01-01)
     248- G4VEnergyLossProcess - fixed computation of NIEL at the last step
     249  of a particle
     250 
    2725111 January 08: V.Ivant (emutils-V09-01-00)
    28252- G4EmCorrections - improve CPU by usage expansions and precalculated
     
    3325709 November 07: V.Ivant (emutils-V09-00-13)
    34258- G4VMultipleScattering - set at initialisation that scattering may be
    35                           off electrons (needed for single scattering)
     259                          off lectrons (needed for single scattering)
    36260- G4EmModelmanager - add pointers to G4Gamma and G4Positron at
    37261                     initialisation
     
    3926307 November 07: V.Ivant (emutils-V09-00-12)
    40264- G4VEnergyLossProcess - simplify logic to switch on/off fluctuations
    41 - G4EmProcessOptions - add forgotten initialisation of G4LossTableManager
     265- G4EmProcessOptions - add forgoten initialisation of G4LossTableManager
    42266                       parameters together with parameters of concrete
    43267                       processes (fixed initialisation when options
    44                        defined before processes are instantiated)
     268                       defined before proceeses are instantiated)
    45269
    4627029 October 07: V.Ivant (emutils-V09-00-11)
     
    75299- G4VEnergyLossProcess and G4VEmProcess - fixed handling zero cross
    76300  section in PostStepGetPhysicalInteractionLength method to avoid problem
    77   happens in FanoCavity example when cross section inside cavity is zero
     301  happans in FanoCavity example when cross section inside cavity is zero
    78302- G4VEmModel - compare cross section with DBL_MIN instead of zero
    79303
     
    124348  void, extra parameter std::vector<G4DynamicParticle*>*, this vector
    125349  is now a member of base class G4VEnergyLossProcess, G4VEmProcess,
    126   no new and delete of the vector in the run time. About 5% speedup
     350  no new and delete of the vector in the run time. About 5% speadup
    127351  of EM shower simulation
    128352- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering modified
  • trunk/source/processes/electromagnetic/utils/include/G4DummyModel.hh

    r819 r961  
    2525//
    2626// $Id: G4DummyModel.hh,v 1.3 2007/05/22 17:31:57 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/utils/include/G4EmCalculator.hh

    r819 r961  
    2525//
    2626// $Id: G4EmCalculator.hh,v 1.18 2007/03/15 12:34:46 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
  • trunk/source/processes/electromagnetic/utils/include/G4EmCorrections.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmCorrections.hh,v 1.10 2008/01/11 19:55:29 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4EmCorrections.hh,v 1.24 2008/09/12 14:44:48 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4141// 28.04.2006 General cleanup, add finite size corrections (V.Ivanchenko)
    4242// 13.05.2006 Add corrections for ion stopping (V.Ivanhcenko)
     43// 20.05.2008 Removed Finite Size correction (V.Ivanchenko)
     44// 12.09.2008 Added inlined interfaces to effective charge (V.Ivanchenko)
    4345//
    4446// Class Description:
     
    5860#include "G4Material.hh"
    5961#include "G4ParticleDefinition.hh"
     62#include "G4NistManager.hh"
    6063
    6164class G4VEmModel;
    6265class G4PhysicsVector;
    6366class G4IonTable;
    64 class G4NistManager;
     67class G4MaterialCutsCouple;
    6568
    6669class G4EmCorrections
     
    7376  virtual ~G4EmCorrections();
    7477
    75   G4double HighOrderCorrections(const G4ParticleDefinition* p,
    76                                 const G4Material* material,
    77                                       G4double kineticEnergy);
    78 
    79   G4double Bethe(const G4ParticleDefinition* p,
    80                  const G4Material* material,
     78  G4double HighOrderCorrections(const G4ParticleDefinition*,
     79                                const G4Material*,
     80                                G4double kineticEnergy,
     81                                G4double cutEnergy);
     82
     83  G4double IonHighOrderCorrections(const G4ParticleDefinition*,
     84                                   const G4MaterialCutsCouple*,
     85                                   G4double kineticEnergy);
     86
     87  G4double ComputeIonCorrections(const G4ParticleDefinition*,
     88                                 const G4Material*,
     89                                 G4double kineticEnergy);
     90
     91  G4double IonBarkasCorrection(const G4ParticleDefinition*,
     92                               const G4Material*,
     93                               G4double kineticEnergy);
     94
     95  G4double Bethe(const G4ParticleDefinition*,
     96                 const G4Material*,
    8197                 G4double kineticEnergy);
    8298
    83   G4double SpinCorrection(const G4ParticleDefinition* p,
    84                           const G4Material* material,
     99  G4double SpinCorrection(const G4ParticleDefinition*,
     100                          const G4Material*,
    85101                          G4double kineticEnergy);
    86102
    87   G4double KShellCorrection(const G4ParticleDefinition* p,
    88                             const G4Material* material,
     103  G4double KShellCorrection(const G4ParticleDefinition*,
     104                            const G4Material*,
    89105                            G4double kineticEnergy);
    90106
    91   G4double LShellCorrection(const G4ParticleDefinition* p,
    92                             const G4Material* material,
     107  G4double LShellCorrection(const G4ParticleDefinition*,
     108                            const G4Material*,
    93109                            G4double kineticEnergy);
    94110
    95   G4double ShellCorrection(const G4ParticleDefinition* p,
    96                            const G4Material* material,
     111  G4double ShellCorrection(const G4ParticleDefinition*,
     112                           const G4Material*,
    97113                           G4double kineticEnergy);
    98114
    99   G4double ShellCorrectionSTD(const G4ParticleDefinition* p,
    100                               const G4Material* material,
     115  G4double ShellCorrectionSTD(const G4ParticleDefinition*,
     116                              const G4Material*,
    101117                              G4double kineticEnergy);
    102118
    103   G4double DensityCorrection(const G4ParticleDefinition* p,
    104                              const G4Material* material,
     119  G4double DensityCorrection(const G4ParticleDefinition*,
     120                             const G4Material*,
    105121                             G4double kineticEnergy);
    106122
    107   G4double BarkasCorrection(const G4ParticleDefinition* p,
    108                             const G4Material* material,
     123  G4double BarkasCorrection(const G4ParticleDefinition*,
     124                            const G4Material*,
    109125                            G4double kineticEnergy);
    110126
    111   G4double BlochCorrection(const G4ParticleDefinition* p,
    112                            const G4Material* material,
     127  G4double BlochCorrection(const G4ParticleDefinition*,
     128                           const G4Material*,
    113129                           G4double kineticEnergy);
    114130
    115   G4double MottCorrection(const G4ParticleDefinition* p,
    116                           const G4Material* material,
     131  G4double MottCorrection(const G4ParticleDefinition*,
     132                          const G4Material*,
    117133                          G4double kineticEnergy);
    118134
    119   G4double FiniteSizeCorrection(const G4ParticleDefinition* p,
    120                                 const G4Material* material,
    121                                 G4double kineticEnergy);
    122 
    123   G4double NuclearDEDX(const G4ParticleDefinition* p,
    124                        const G4Material* material,
     135  G4double NuclearDEDX(const G4ParticleDefinition*,
     136                       const G4Material*,
    125137                       G4double kineticEnergy,
    126138                       G4bool fluct = true);
    127139
    128140  void AddStoppingData(G4int Z, G4int A, const G4String& materialName,
    129                        G4PhysicsVector& dVector);
    130 
     141                       G4PhysicsVector* dVector);
     142
     143  void InitialiseForNewRun();
     144
     145  // effective charge correction using stopping power data
    131146  G4double EffectiveChargeCorrection(const G4ParticleDefinition*,
    132147                                     const G4Material*,
    133                                      G4double);
    134 
    135   G4ionEffectiveCharge* GetIonEffectiveCharge(G4VEmModel* m = 0);
    136 
    137   G4int GetNumberOfStoppingVectors();
     148                                     G4double kineticEnergy);
     149
     150  // effective charge of an ion
     151  inline G4double GetParticleCharge(const G4ParticleDefinition*,
     152                                    const G4Material*,
     153                                    G4double kineticEnergy);
     154
     155  inline
     156  G4double EffectiveChargeSquareRatio(const G4ParticleDefinition*,
     157                                      const G4Material*,
     158                                      G4double kineticEnergy);
     159
     160  // ionisation models for ions
     161  inline void SetIonisationModels(G4VEmModel* m1 = 0, G4VEmModel* m2 = 0);
     162
     163  inline G4int GetNumberOfStoppingVectors();
    138164
    139165private:
     
    141167  void Initialise();
    142168
    143   G4PhysicsVector* InitialiseMaterial(const G4Material* mat);
    144 
    145   void SetupKinematics(const G4ParticleDefinition* p,
    146                        const G4Material* material,
     169  void BuildCorrectionVector();
     170
     171  void SetupKinematics(const G4ParticleDefinition*,
     172                       const G4Material*,
    147173                       G4double kineticEnergy);
    148174
     
    207233  G4double     Z23[100];
    208234
     235  std::vector<const G4Material*> currmat;
     236  std::vector<G4double>          thcorr[100];
     237  size_t        ncouples;
     238
    209239  const G4ParticleDefinition* particle;
    210240  const G4ParticleDefinition* curParticle;
     
    218248  G4double  mass;
    219249  G4double  massFactor;
     250  G4double  formfact;
     251  G4double  eth;
    220252  G4double  tau;
    221253  G4double  gamma;
     
    225257  G4double  ba2;
    226258  G4double  tmax;
    227   G4double  tmax0;
    228259  G4double  charge;
    229260  G4double  q2;
     261  G4double  eCorrMin;
     262  G4double  eCorrMax;
     263  G4int     nbinCorr;
    230264
    231265  G4AtomicShells        shells;
     
    234268  G4NistManager*        nist;
    235269  const G4IonTable*     ionTable;
    236   G4VEmModel*           ionModel;
     270  G4VEmModel*           ionLEModel;
     271  G4VEmModel*           ionHEModel;
    237272
    238273  // Ion stopping data
    239274  G4int                       nIons;
    240275  G4int                       idx;
     276  G4int                       currentZ;
    241277  std::vector<G4int>          Zion;
    242278  std::vector<G4int>          Aion;
    243279  std::vector<G4String>       materialName;
     280
     281  std::vector<const G4ParticleDefinition*> ionList;
    244282
    245283  std::vector<const G4Material*> materialList;
     
    271309               z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv))))
    272310         / ((x2-x1)*(y2-y1));
     311}
     312
     313inline
     314void G4EmCorrections::SetIonisationModels(G4VEmModel* m1, G4VEmModel* m2)
     315{
     316  if(m1) ionLEModel = m1;
     317  if(m2) ionHEModel = m2;
     318}
     319
     320inline G4int G4EmCorrections::GetNumberOfStoppingVectors()
     321{
     322  return nIons;
     323}
     324
     325inline G4double
     326G4EmCorrections::GetParticleCharge(const G4ParticleDefinition* p,
     327                                   const G4Material* mat,
     328                                   G4double kineticEnergy)
     329{
     330  return effCharge.EffectiveCharge(p,mat,kineticEnergy);
     331}
     332
     333inline G4double
     334G4EmCorrections::EffectiveChargeSquareRatio(const G4ParticleDefinition* p,
     335                                            const G4Material* mat,
     336                                            G4double kineticEnergy)
     337{
     338  return effCharge.EffectiveChargeSquareRatio(p,mat,kineticEnergy);
    273339}
    274340
     
    289355    G4double ratio = electron_mass_c2/mass;
    290356    tmax  = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
    291     tmax0 = tmax;
    292357    charge  = p->GetPDGCharge()/eplus;
    293     if(charge < 1.5)  q2 = charge*charge;
     358    if(charge < 1.5)  {q2 = charge*charge;}
    294359    else {
    295360      q2 = effCharge.EffectiveChargeSquareRatio(p,mat,kinEnergy);
    296361      charge = std::sqrt(q2);
    297362    }
    298     if(mass > 120.*MeV)
    299       tmax = std::min(tmax,51200.*electron_mass_c2*std::pow(proton_mass_c2/mass,0.666667));
    300363  }
    301364  if(mat != material) {
  • trunk/source/processes/electromagnetic/utils/include/G4EmModelManager.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmModelManager.hh,v 1.22 2007/11/09 11:35:54 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4EmModelManager.hh,v 1.25 2008/10/13 14:56:56 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7474#include "G4DataVector.hh"
    7575#include "G4EmTableType.hh"
     76#include "G4EmProcessSubType.hh"
     77#include "G4Region.hh"
    7678
    7779class G4RegionModels
     
    8486private:
    8587
    86   G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE);
     88  G4RegionModels(G4int nMod, std::vector<G4int>& indx,
     89                 G4DataVector& lowE, const G4Region* reg);
    8790
    8891  ~G4RegionModels();
     
    105108  };
    106109
     110  G4double LowEdgeEnergy(G4int n) const {
     111    return lowKineticEnergy[n];
     112  };
     113
     114  const G4Region* Region() const {
     115    return theRegion;
     116  };
     117
     118  const G4Region*    theRegion;
    107119  G4int              nModelsForRegion;
    108120  G4int*             theListOfModelIndexes;
     
    150162  G4VEmModel* SelectModel(G4double& energy, size_t& index);
    151163
    152   G4VEmModel* GetModel(G4int);
     164  G4VEmModel* GetModel(G4int, G4bool ver = false);
    153165
    154166  G4int NumberOfModels() const;
     
    157169 
    158170  void UpdateEmModel(const G4String&, G4double, G4double);
     171
     172  void DumpModelList(G4int verb);
    159173
    160174private:
     
    176190  std::vector<const G4Region*>            regions;
    177191  std::vector<G4int>                      orderOfModels;
    178   G4DataVector                            upperEkin;
    179192
    180193  G4int                       nEmModels;
  • trunk/source/processes/electromagnetic/utils/include/G4EmMultiModel.hh

    r819 r961  
    2525//
    2626// $Id: G4EmMultiModel.hh,v 1.6 2007/05/22 17:31:57 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/utils/include/G4EmProcessOptions.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmProcessOptions.hh,v 1.12 2007/05/18 18:39:54 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4EmProcessOptions.hh,v 1.15 2009/02/18 14:40:10 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    107107  void SetLinearLossLimit(G4double val);
    108108
    109   void ActivateDeexcitation(G4bool val, const G4Region* r = 0);
     109  void ActivateDeexcitation(const G4String& proc, G4bool val,
     110                            const G4String& reg = "");
    110111
    111112  void SetMscStepLimitation(G4MscStepLimitType val);
     
    121122  void SetLPMFlag(G4bool val);
    122123
     124  void SetSplineFlag(G4bool val);
     125
    123126  void SetBremsstrahlungTh(G4double val);
     127
     128  void SetPolarAngleLimit(G4double val);
    124129
    125130private:
  • trunk/source/processes/electromagnetic/utils/include/G4EmTableType.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EmTableType.hh,v 1.3 2007/01/15 17:27:40 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4EmTableType.hh,v 1.4 2008/10/13 14:56:56 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//---------------------------------------------------------------
     
    5151  fRestricted,
    5252  fSubRestricted,
    53   fIonisation,
    54   fSubIonisation
     53  fIsIonisation,
     54  fIsSubIonisation
    5555};
    5656#endif
  • trunk/source/processes/electromagnetic/utils/include/G4EnergyLossMessenger.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EnergyLossMessenger.hh,v 1.18 2007/05/18 18:39:54 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4EnergyLossMessenger.hh,v 1.23 2009/02/18 14:40:10 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
     
    4545// 16-03-07 modify /process/eLoss/minsubsec command (V.Ivanchenko)
    4646// 18-05-07 add /process/msc directory and commands (V.Ivanchenko)
     47// 11-03-08 add /process/em directory and commands (V.Ivanchenko)
    4748//
    4849// -------------------------------------------------------------------
     
    100101  G4UIdirectory*             eLossDirectory;
    101102  G4UIdirectory*             mscDirectory;
     103  G4UIdirectory*             emDirectory;
    102104  G4UIcmdWithABool*          RndmStepCmd;
    103105  G4UIcmdWithABool*          EnlossFlucCmd;
     
    105107  G4UIcmdWithADouble*        MinSubSecCmd;
    106108  G4UIcommand*               StepFuncCmd;
     109  G4UIcommand*               deexCmd;
    107110  G4UIcmdWithAString*        mscCmd;
    108111  G4UIcmdWithADoubleAndUnit* MinEnCmd;
     
    112115  G4UIcmdWithABool*          lpmCmd;
    113116  G4UIcmdWithABool*          latCmd;
     117  G4UIcmdWithABool*          splCmd;
     118  G4UIcmdWithABool*          aplCmd;
    114119  G4UIcmdWithAnInteger*      verCmd;
     120  G4UIcmdWithAnInteger*      ver1Cmd;
    115121  G4UIcmdWithAnInteger*      dedxCmd;
    116122  G4UIcmdWithAnInteger*      lamCmd;
     
    120126  G4UIcmdWithADouble*        frCmd;
    121127  G4UIcmdWithADouble*        fgCmd;
     128  G4UIcmdWithADoubleAndUnit* angCmd;
    122129};
    123130
  • trunk/source/processes/electromagnetic/utils/include/G4EnergyLossTables.hh

    r819 r961  
    2626//
    2727// $Id: G4EnergyLossTables.hh,v 1.19 2006/06/29 19:54:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// $Id:
  • trunk/source/processes/electromagnetic/utils/include/G4LossTableBuilder.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LossTableBuilder.hh,v 1.7 2006/06/29 19:54:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4LossTableBuilder.hh,v 1.8 2008/07/22 15:55:15 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    4040//
    4141// Modifications:
    42 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
    43 //
     42// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
     43// 17-07-08 Added splineFlag (V.Ivanchenko)
    4444//
    4545// Class Description:
     
    5656#include "globals.hh"
    5757#include "G4PhysicsTable.hh"
    58 
    5958
    6059class G4LossTableBuilder
     
    7574                              G4PhysicsTable* invRangeTable,
    7675                              G4bool isIonisation = false);
     76
     77  inline void SetSplineFlag(G4bool flag);
    7778 
    7879private:
     
    8182  G4LossTableBuilder(const  G4LossTableBuilder&);
    8283
     84  G4bool splineFlag;
     85
    8386};
     87
     88inline void G4LossTableBuilder::SetSplineFlag(G4bool flag)
     89{
     90  splineFlag = flag;
     91}
    8492
    8593//....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/utils/include/G4LossTableManager.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LossTableManager.hh,v 1.48 2007/11/07 18:38:49 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4LossTableManager.hh,v 1.53 2008/07/15 16:56:38 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929//
     
    7777#define G4LossTableManager_h 1
    7878
    79 
    8079#include <map>
    8180#include <vector>
     
    9190class G4VEmProcess;
    9291class G4EmCorrections;
     92class G4EmSaturation;
    9393class G4LossTableBuilder;
    9494
     
    152152
    153153  void DeRegister(G4VEmProcess* p);
     154
     155  void Register(G4VEmModel* p);
     156
     157  void DeRegister(G4VEmModel* p);
     158
     159  void Register(G4VEmFluctuationModel* p);
     160
     161  void DeRegister(G4VEmFluctuationModel* p);
    154162
    155163  void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle,
     
    195203  void SetLPMFlag(G4bool val);
    196204
     205  void SetSplineFlag(G4bool val);
     206
    197207  void SetLinearLossLimit(G4double val);
    198208
     
    207217  G4bool LPMFlag() const;
    208218
     219  G4bool SplineFlag() const;
     220
    209221  G4double BremsstrahlungTh() const;
    210222
     
    217229  inline G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
    218230
    219   inline G4EmCorrections* EmCorrections();
     231  G4EmCorrections* EmCorrections();
     232
     233  G4EmSaturation* EmSaturation();
    220234
    221235private:
     
    251265  std::vector<G4VMultipleScattering*> msc_vector;
    252266  std::vector<G4VEmProcess*> emp_vector;
     267  std::vector<G4VEmModel*> mod_vector;
     268  std::vector<G4VEmFluctuationModel*> fmod_vector;
    253269
    254270  // cash
     
    274290  G4bool stepFunctionActive;
    275291  G4bool flagLPM;
     292  G4bool splineFlag;
    276293
    277294  G4double minSubRange;
     
    286303  G4EnergyLossMessenger*      theMessenger;
    287304  G4EmCorrections*            emCorrections;
     305  G4EmSaturation*             emSaturation;
     306
    288307  const G4ParticleDefinition* firstParticle;
    289308  G4int verbose;
     
    418437//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    419438
    420 inline G4EmCorrections* G4LossTableManager::EmCorrections()
    421 {
    422   return emCorrections;
    423 }
    424 
    425 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    426 
    427439#endif
    428440
  • trunk/source/processes/electromagnetic/utils/include/G4MscStepLimitType.hh

    r819 r961  
    2626//
    2727// $Id: G4MscStepLimitType.hh,v 1.2 2007/06/11 14:56:51 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//---------------------------------------------------------------
  • trunk/source/processes/electromagnetic/utils/include/G4VEmFluctuationModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmFluctuationModel.hh,v 1.10 2006/06/29 19:54:41 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4VEmFluctuationModel.hh,v 1.12 2009/02/19 11:25:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    9595  virtual void InitialiseMe(const G4ParticleDefinition*);
    9696
     97  virtual void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
     98
    9799  //------------------------------------------------------------------------
    98100  // Generic methods common to all models
    99101  //------------------------------------------------------------------------
    100102
    101   G4String GetName() const;
     103  inline G4String GetName() const;
    102104
    103105private:
     
    113115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    114116
    115 inline void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
    116 {}
    117 
    118117inline G4String G4VEmFluctuationModel::GetName() const
    119118{
  • trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmModel.hh,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VEmModel.hh,v 1.66 2009/02/19 09:57:36 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6161// 29-06-06 Add member currentElement and Get/Set methods (V.Ivanchenko)
    6262// 29-10-07 Added SampleScattering (V.Ivanchenko)
     63// 15-07-08 Reorder class members and improve comments (VI)
     64// 21-07-08 Added vector of G4ElementSelector and methods to use it (VI)
     65// 12-09-08 Added methods GetParticleCharge, GetChargeSquareRatio,
     66//          CorrectionsAlongStep, ActivateNuclearStopping (VI)
     67// 16-02-09 Move implementations of virtual methods to source (VI)
    6368//
    6469// Class Description:
     
    8186#include "G4DataVector.hh"
    8287#include "G4VEmFluctuationModel.hh"
     88#include "G4EmElementSelector.hh"
    8389#include "Randomize.hh"
     90#include <vector>
    8491
    8592class G4PhysicsTable;
     
    98105
    99106  //------------------------------------------------------------------------
    100   // Virtual methods to be implemented for the concrete model
    101   //------------------------------------------------------------------------
    102 
    103   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0;
    104 
     107  // Virtual methods to be implemented for any concrete model
     108  //------------------------------------------------------------------------
     109
     110  virtual void Initialise(const G4ParticleDefinition*,
     111                          const G4DataVector&) = 0;
    105112
    106113  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
     
    114121  //------------------------------------------------------------------------
    115122
    116   virtual G4double MinEnergyCut(const G4ParticleDefinition*,
    117                         const G4MaterialCutsCouple*);
    118 
    119   virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
    120                                const G4ParticleDefinition*,
    121                                G4double kineticEnergy,
    122                                G4double cutEnergy = DBL_MAX);
    123 
    124   virtual G4double CrossSection(const G4MaterialCutsCouple*,
    125                                 const G4ParticleDefinition*,
    126                                 G4double kineticEnergy,
    127                                 G4double cutEnergy = 0.0,
    128                                 G4double maxEnergy = DBL_MAX);
    129 
     123  // main method to compute dEdx
    130124  virtual G4double ComputeDEDXPerVolume(const G4Material*,
    131125                                        const G4ParticleDefinition*,
     
    133127                                        G4double cutEnergy = DBL_MAX);
    134128
    135 
    136   virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
    137                                               G4double kinEnergy,
    138                                               G4double Z,
    139                                               G4double A = 0.,
    140                                               G4double cutEnergy = 0.0,
    141                                               G4double maxEnergy = DBL_MAX);
    142                                      
    143   virtual G4double ComputeMeanFreePath(const G4ParticleDefinition*,
    144                                        G4double kineticEnergy,
    145                                        const G4Material*,   
    146                                        G4double cutEnergy = 0.0,
    147                                        G4double maxEnergy = DBL_MAX);
    148                                      
     129  // main method to compute cross section per Volume
    149130  virtual G4double CrossSectionPerVolume(const G4Material*,
    150131                                         const G4ParticleDefinition*,
     
    153134                                         G4double maxEnergy = DBL_MAX);
    154135
     136  // main method to compute cross section depending on atom
     137  virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
     138                                              G4double kinEnergy,
     139                                              G4double Z,
     140                                              G4double A = 0., /* amu */
     141                                              G4double cutEnergy = 0.0,
     142                                              G4double maxEnergy = DBL_MAX);
     143                                                                     
     144  // min cut in kinetic energy allowed by the model
     145  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
     146                                const G4MaterialCutsCouple*);
     147
     148  // Compute effective ion charge square
     149  virtual G4double GetChargeSquareRatio(const G4ParticleDefinition*,
     150                                        const G4Material*,
     151                                        G4double kineticEnergy);
     152
     153  // Compute ion charge
     154  virtual G4double GetParticleCharge(const G4ParticleDefinition*,
     155                                     const G4Material*,
     156                                     G4double kineticEnergy);
     157
     158  // add correction to energy loss and ompute non-ionizing energy loss
     159  virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
     160                                    const G4DynamicParticle*,
     161                                    G4double& eloss,
     162                                    G4double& niel,
     163                                    G4double length);
     164
     165  // sample PIXE deexcitation
     166  virtual void SampleDeexcitationAlongStep(const G4Material*,
     167                                           const G4Track&,
     168                                           G4double& eloss);
     169
    155170protected:
    156171
     172  // kinematically allowed max kinetic energy of a secondary
    157173  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
    158174                                      G4double kineticEnergy); 
     
    177193  virtual void DefineForRegion(const G4Region*);
    178194
     195  virtual void SetupForMaterial(const G4ParticleDefinition*,
     196                                const G4Material*,
     197                                G4double kineticEnergy);
     198
    179199  //------------------------------------------------------------------------
    180200  // Generic methods common to all models
    181201  //------------------------------------------------------------------------
    182202
    183   void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
    184 
    185   G4VEmFluctuationModel* GetModelOfFluctuations();
    186 
    187   G4double HighEnergyLimit();
    188 
    189   G4double LowEnergyLimit();
    190 
    191   void SetHighEnergyLimit(G4double);
    192 
    193   void SetLowEnergyLimit(G4double);
    194 
    195   G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle);
    196 
    197   const G4Element* SelectRandomAtom(const G4Material*,
    198                                     const G4ParticleDefinition*,
    199                                     G4double kineticEnergy,
    200                                     G4double cutEnergy = 0.0,
    201                                     G4double maxEnergy = DBL_MAX);
    202 
    203   const G4String& GetName() const;
     203  // should be called at initialisation to build element selectors
     204  void InitialiseElementSelectors(const G4ParticleDefinition*,
     205                                  const G4DataVector&);
     206
     207  // dEdx per unit length
     208  inline G4double ComputeDEDX(const G4MaterialCutsCouple*,
     209                              const G4ParticleDefinition*,
     210                              G4double kineticEnergy,
     211                              G4double cutEnergy = DBL_MAX);
     212
     213  // cross section per volume
     214  inline G4double CrossSection(const G4MaterialCutsCouple*,
     215                                const G4ParticleDefinition*,
     216                                G4double kineticEnergy,
     217                                G4double cutEnergy = 0.0,
     218                                G4double maxEnergy = DBL_MAX);
     219
     220  // compute mean free path via cross section per volume
     221  inline G4double ComputeMeanFreePath(const G4ParticleDefinition*,
     222                                      G4double kineticEnergy,
     223                                      const G4Material*,   
     224                                      G4double cutEnergy = 0.0,
     225                                      G4double maxEnergy = DBL_MAX);
     226
     227  // generic cross section per element
     228  inline G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
     229                                             const G4Element*,
     230                                             G4double kinEnergy,
     231                                             G4double cutEnergy = 0.0,
     232                                             G4double maxEnergy = DBL_MAX);
     233
     234  // atom can be selected effitiantly if element selectors are initialised
     235  inline const G4Element* SelectRandomAtom(const G4MaterialCutsCouple*,
     236                                           const G4ParticleDefinition*,
     237                                           G4double kineticEnergy,
     238                                           G4double cutEnergy = 0.0,
     239                                           G4double maxEnergy = DBL_MAX);
     240
     241  // to select atom cross section per volume is recomputed for each element
     242  inline const G4Element* SelectRandomAtom(const G4Material*,
     243                                           const G4ParticleDefinition*,
     244                                           G4double kineticEnergy,
     245                                           G4double cutEnergy = 0.0,
     246                                           G4double maxEnergy = DBL_MAX);
     247
     248  // select isotope in order to have precise mass of the nucleus
     249  inline G4int SelectIsotopeNumber(const G4Element*);
     250
     251  //------------------------------------------------------------------------
     252  // Get/Set methods
     253  //------------------------------------------------------------------------
     254
     255  inline G4VEmFluctuationModel* GetModelOfFluctuations();
     256
     257  inline G4double HighEnergyLimit() const;
     258
     259  inline G4double LowEnergyLimit() const;
     260
     261  inline G4double PolarAngleLimit() const;
     262
     263  inline G4double SecondaryThreshold() const;
     264
     265  inline G4bool LPMFlag() const;
     266
     267  inline G4bool DeexcitationFlag() const;
     268
     269  inline void SetHighEnergyLimit(G4double);
     270
     271  inline void SetLowEnergyLimit(G4double);
     272
     273  inline void SetPolarAngleLimit(G4double);
     274
     275  inline void SetSecondaryThreshold(G4double);
     276
     277  inline void SetLPMFlag(G4bool val);
     278
     279  inline void SetDeexcitationFlag(G4bool val);
     280
     281  inline void ActivateNuclearStopping(G4bool);
     282
     283  inline G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle);
     284
     285  inline const G4String& GetName() const;
     286
     287  inline void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
     288
     289  inline void SetCurrentCouple(const G4MaterialCutsCouple*);
    204290
    205291protected:
    206292
    207   const G4Element* GetCurrentElement() const;
    208 
    209   void SetCurrentElement(const G4Element*);
     293  inline const G4MaterialCutsCouple* CurrentCouple() const;
     294
     295  inline void SetCurrentElement(const G4Element*);
     296
     297  inline const G4Element* GetCurrentElement() const;
    210298
    211299private:
     
    215303  G4VEmModel(const  G4VEmModel&);
    216304
     305  // ======== Parameters of the class fixed at construction =========
     306
     307  G4VEmFluctuationModel* fluc;
     308  const G4String   name;
     309
     310  // ======== Parameters of the class fixed at initialisation =======
     311
    217312  G4double        lowLimit;
    218313  G4double        highLimit;
    219   G4double        xsec[40];
    220 
    221   G4VEmFluctuationModel* fluc;
    222 
    223   const G4String   name;
    224   const G4Element* currentElement;
     314  G4double        polarAngleLimit;
     315  G4double        secondaryThreshold;
     316  G4bool          theLPMflag;
     317
     318  G4int           nSelectors;
     319  std::vector<G4EmElementSelector*> elmSelectors;
    225320
    226321protected:
    227322
    228323  G4VParticleChange*  pParticleChange;
     324  G4bool              nuclearStopping;
     325
     326  // ======== Cashed values - may be state dependent ================
     327
     328private:
     329
     330  const G4MaterialCutsCouple* currentCouple;
     331  const G4Element*            currentElement;
     332
     333  G4int                  nsec;
     334  G4bool                 flagDeexcitation;
     335  std::vector<G4double>  xsec;
     336
    229337};
    230338
    231339//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    233 
    234 inline G4double G4VEmModel::HighEnergyLimit()
    235 {
    236   return highLimit;
    237 }
    238 
    239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    240 
    241 inline G4double G4VEmModel::LowEnergyLimit()
    242 {
    243   return lowLimit;
    244 }
    245 
    246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    247 
    248 inline void G4VEmModel::SetHighEnergyLimit(G4double val)
    249 {
    250   highLimit = val;
    251 }
    252 
    253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    254 
    255 inline void G4VEmModel::SetLowEnergyLimit(G4double val)
    256 {
    257   lowLimit = val;
    258 }
    259 
    260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    261 
    262 inline void G4VEmModel::SetParticleChange(G4VParticleChange* p, 
    263                                           G4VEmFluctuationModel* f = 0)
    264 {
    265   if(p && pParticleChange != p) pParticleChange = p;
    266   fluc = f;
    267 }
    268 
    269 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    270 
    271 
    272 inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
    273 {
    274   return fluc;
    275 }
    276 
    277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    278 
    279 inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
    280                                          const G4MaterialCutsCouple*)
    281 {
    282   return 0.0;
    283 }
    284 
    285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    286 
    287 inline G4double G4VEmModel::ComputeDEDXPerVolume(
    288                                         const G4Material*,
    289                                         const G4ParticleDefinition*,
    290                                         G4double,
    291                                         G4double)
    292 {
    293   return 0.0;
    294 }
    295 
    296340//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    297341
     
    301345                                        G4double cutEnergy)
    302346{
     347  currentCouple = c;
    303348  return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
    304349}
     
    312357                                         G4double maxEnergy)
    313358{
    314   return
    315     CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
     359  currentCouple = c;
     360  return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
     361}
     362
     363//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     364
     365inline G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
     366                                                G4double ekin,
     367                                                const G4Material* material,     
     368                                                G4double emin,
     369                                                G4double emax)
     370{
     371  G4double mfp = DBL_MAX;
     372  G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
     373  if (cross > DBL_MIN) mfp = 1./cross;
     374  return mfp;
    316375}
    317376
     
    319378
    320379inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
    321                                          const G4ParticleDefinition*,
    322                                          G4double, G4double, G4double,
    323                                          G4double, G4double)
    324 {
    325   return 0.0;
    326 }
    327 
    328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    329 
    330 inline const G4Element* G4VEmModel::SelectRandomAtom(
    331                                          const G4Material* material,
    332                                          const G4ParticleDefinition* pd,
    333                                          G4double kinEnergy,
    334                                          G4double tcut,
    335                                          G4double tmax)
     380                const G4ParticleDefinition* part,
     381                const G4Element* elm,
     382                G4double kinEnergy,
     383                G4double cutEnergy,
     384                G4double maxEnergy)
     385{
     386  currentElement = elm;
     387  return ComputeCrossSectionPerAtom(part,kinEnergy,elm->GetZ(),elm->GetN(),
     388                                    cutEnergy,maxEnergy);
     389}
     390
     391//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     392
     393inline
     394const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple,
     395                                              const G4ParticleDefinition* p,
     396                                              G4double kinEnergy,
     397                                              G4double cutEnergy,
     398                                              G4double maxEnergy)
     399{
     400  currentCouple = couple;
     401  if(nSelectors > 0) {
     402    currentElement =
     403      elmSelectors[couple->GetIndex()]->SelectRandomAtom(kinEnergy);
     404  } else {
     405    currentElement = SelectRandomAtom(couple->GetMaterial(),p,kinEnergy,
     406                                      cutEnergy,maxEnergy);
     407  }
     408  return currentElement;
     409}
     410
     411//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     412
     413inline
     414const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material,
     415                                              const G4ParticleDefinition* pd,
     416                                              G4double kinEnergy,
     417                                              G4double tcut,
     418                                              G4double tmax)
    336419{
    337420  const G4ElementVector* theElementVector = material->GetElementVector();
    338   G4int nelm = material->GetNumberOfElements();
    339   currentElement = (*theElementVector)[nelm-1];
    340   if (nelm > 1) {
     421  G4int n = material->GetNumberOfElements() - 1;
     422  currentElement = (*theElementVector)[n];
     423  if (n > 0) {
    341424    G4double x = G4UniformRand()*
    342                  CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
    343     for(G4int i=0; i<nelm; i++) {
     425                 G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
     426    for(G4int i=0; i<n; i++) {
    344427      if (x <= xsec[i]) {
    345428        currentElement = (*theElementVector)[i];
     
    353436//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    354437
     438inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm)
     439{
     440  G4int N = G4int(elm->GetN() + 0.5);
     441  G4int ni = elm->GetNumberOfIsotopes();
     442  if(ni > 0) {
     443    G4int idx = 0;
     444    if(ni > 1) {
     445      G4double* ab = currentElement->GetRelativeAbundanceVector();
     446      G4double x = G4UniformRand();
     447      for(; idx<ni; idx++) {
     448        x -= ab[idx];
     449        if (x <= 0.0) break;
     450      }
     451      if(idx >= ni) idx = ni - 1;
     452    }
     453    N = elm->GetIsotope(idx)->GetN();
     454  }
     455  return N;
     456}
     457
     458//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     459
     460inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
     461{
     462  return fluc;
     463}
     464
     465//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     466
     467inline G4double G4VEmModel::HighEnergyLimit() const
     468{
     469  return highLimit;
     470}
     471
     472//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     473
     474inline G4double G4VEmModel::LowEnergyLimit() const
     475{
     476  return lowLimit;
     477}
     478
     479//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     480
     481inline G4double G4VEmModel::PolarAngleLimit() const
     482{
     483  return polarAngleLimit;
     484}
     485
     486//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     487
     488inline G4double G4VEmModel::SecondaryThreshold() const
     489{
     490  return secondaryThreshold;
     491}
     492
     493//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     494
     495inline G4bool G4VEmModel::LPMFlag() const
     496{
     497  return theLPMflag;
     498}
     499
     500//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     501
     502inline G4bool G4VEmModel::DeexcitationFlag() const
     503{
     504  return flagDeexcitation;
     505}
     506
     507//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     508
     509inline void G4VEmModel::SetHighEnergyLimit(G4double val)
     510{
     511  highLimit = val;
     512}
     513
     514//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     515
     516inline void G4VEmModel::SetLowEnergyLimit(G4double val)
     517{
     518  lowLimit = val;
     519}
     520
     521//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     522
     523inline void G4VEmModel::SetPolarAngleLimit(G4double val)
     524{
     525  polarAngleLimit = val;
     526}
     527
     528//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     529
     530inline void G4VEmModel::SetSecondaryThreshold(G4double val)
     531{
     532  secondaryThreshold = val;
     533}
     534
     535//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     536
     537inline void G4VEmModel::SetLPMFlag(G4bool val)
     538{
     539  theLPMflag = val;
     540}
     541
     542//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     543
     544inline void G4VEmModel::SetDeexcitationFlag(G4bool val)
     545{
     546  flagDeexcitation = val;
     547}
     548
     549//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     550
     551inline void G4VEmModel::ActivateNuclearStopping(G4bool val)
     552{
     553  nuclearStopping = val;
     554}
     555
     556//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     557
     558inline
     559G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart)
     560{
     561  return MaxSecondaryEnergy(dynPart->GetDefinition(),
     562                            dynPart->GetKineticEnergy());
     563}
     564
     565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     566
     567inline const G4String& G4VEmModel::GetName() const
     568{
     569  return name;
     570}
     571
     572//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     573
     574inline void G4VEmModel::SetParticleChange(G4VParticleChange* p, 
     575                                          G4VEmFluctuationModel* f = 0)
     576{
     577  if(p && pParticleChange != p) pParticleChange = p;
     578  fluc = f;
     579}
     580
     581//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     582
     583inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p)
     584{
     585  currentCouple = p;
     586}
     587
     588//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     589
     590inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const
     591{
     592  return currentCouple;
     593}
     594
     595//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     596
     597inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
     598{
     599  currentElement = elm;
     600}
     601
     602//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     603
    355604inline const G4Element* G4VEmModel::GetCurrentElement() const
    356605{
     
    360609//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    361610
    362 inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
    363 {
    364   currentElement = elm;
    365 }
    366 
    367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    368 
    369 inline G4double G4VEmModel::MaxSecondaryKinEnergy(
    370                                           const G4DynamicParticle* dynParticle)
    371 {
    372   return MaxSecondaryEnergy(dynParticle->GetDefinition(),
    373                             dynParticle->GetKineticEnergy());
    374 }
    375 
    376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    377 
    378 inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
    379                                                G4double kineticEnergy)
    380 {
    381   return kineticEnergy;
    382 }
    383 
    384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    385 
    386 inline const G4String& G4VEmModel::GetName() const
    387 {
    388   return name;
    389 }
    390 
    391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    392 // Methods for msc simulation
    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    394 
    395 inline void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
    396 {}
    397 
    398 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    399 
    400 inline G4double G4VEmModel::ComputeTruePathLengthLimit(
    401                                 const G4Track&,
    402                                 G4PhysicsTable*,
    403                                 G4double)
    404 {
    405   return DBL_MAX;
    406 }
    407 
    408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    409 
    410 inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
    411 {
    412   return truePathLength;
    413 }
    414 
    415 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    416 
    417 inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
    418 {
    419   return geomPathLength;
    420 }
    421 
    422 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    423 
    424 inline void G4VEmModel::DefineForRegion(const G4Region*)
    425 {}
    426 
    427 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    428 
    429611#endif
    430612
  • trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmProcess.hh,v 1.43 2007/10/29 08:38:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VEmProcess.hh,v 1.50 2009/02/19 09:57:36 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555//          PostStepGetPhysicalInteractionLength (V.Ivanchenko)
    5656// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
     57// 15-07-08 Reorder class members for further multi-thread development (VI)
    5758//
    5859// Class Description:
     
    9091
    9192  G4VEmProcess(const G4String& name,
    92                      G4ProcessType type = fElectromagnetic);
     93               G4ProcessType type = fElectromagnetic);
    9394
    9495  virtual ~G4VEmProcess();
     
    107108
    108109  //------------------------------------------------------------------------
    109   // Methods with standard implementation; may be overwritten if needed
    110   //------------------------------------------------------------------------
    111 
    112   inline G4double RecalculateLambda(G4double kinEnergy,
    113                                     const G4MaterialCutsCouple* couple);
    114 
    115   //------------------------------------------------------------------------
    116   // Generic methods common to all Discrete processes
     110  // Implementation of virtual methods common to all Discrete processes
    117111  //------------------------------------------------------------------------
    118112
    119113public:
    120114
     115  // Initialise for build of tables
     116  void PreparePhysicsTable(const G4ParticleDefinition&);
     117
     118  // Build physics table during initialisation
     119  void BuildPhysicsTable(const G4ParticleDefinition&);
     120
    121121  void PrintInfoDefinition();
    122122
    123   G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
    124 
    125   void PreparePhysicsTable(const G4ParticleDefinition&);
    126   // Initialise for build of tables
    127 
    128   void BuildPhysicsTable(const G4ParticleDefinition&);
    129   // Build physics table during initialisation
    130 
    131   G4bool StorePhysicsTable(const G4ParticleDefinition*,
    132                            const G4String& directory,
    133                            G4bool ascii = false);
    134   // Store PhysicsTable in a file.
    135   // Return false in case of failure at I/O
    136 
    137   G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
    138                               const G4String& directory,
    139                               G4bool ascii);
    140     // Retrieve Physics from a file.
    141     // (return true if the Physics Table can be build by using file)
    142     // (return false if the process has no functionality or in case of failure)
    143     // File name should is constructed as processName+particleName and the
    144     // should be placed under the directory specifed by the argument.
    145 
    146   //------------------------------------------------------------------------
    147   // Specific methods for Discrete EM post step simulation
    148   //------------------------------------------------------------------------
    149 
    150   inline G4double MicroscopicCrossSection(G4double kineticEnergy,
    151                                           const G4MaterialCutsCouple* couple);
    152   // It returns the cross section of the process for energy/ material
    153 
    154   inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
    155                                              G4double Z, G4double A=0.,
    156                                              G4double cut=0.0);
    157   // It returns the cross section of the process per atom
    158 
    159   inline G4double MeanFreePath(const G4Track& track);
    160 
    161   virtual G4double PostStepGetPhysicalInteractionLength(
     123  // implementation of virtual method, specific for G4VEmProcess
     124  G4double PostStepGetPhysicalInteractionLength(
    162125                             const G4Track& track,
    163126                             G4double   previousStepSize,
     
    165128                            );
    166129
     130  // implementation of virtual method, specific for G4VEmProcess
     131  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
     132
     133  // Store PhysicsTable in a file.
     134  // Return false in case of failure at I/O
     135  G4bool StorePhysicsTable(const G4ParticleDefinition*,
     136                           const G4String& directory,
     137                           G4bool ascii = false);
     138
     139  // Retrieve Physics from a file.
     140  // (return true if the Physics Table can be build by using file)
     141  // (return false if the process has no functionality or in case of failure)
     142  // File name should is constructed as processName+particleName and the
     143  // should be placed under the directory specifed by the argument.
     144  G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
     145                              const G4String& directory,
     146                              G4bool ascii);
     147
     148  // deexcitation activated per G4Region
     149  void ActivateDeexcitation(G4bool, const G4Region* r = 0);
     150
     151  //------------------------------------------------------------------------
     152  // Specific methods for Discrete EM post step simulation
     153  //------------------------------------------------------------------------
     154
     155  // It returns the cross section per volume for energy/ material
     156  G4double CrossSectionPerVolume(G4double kineticEnergy,
     157                                 const G4MaterialCutsCouple* couple);
     158
     159  // It returns the cross section of the process per atom
     160  inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
     161                                             G4double Z, G4double A=0.,
     162                                             G4double cut=0.0);
     163
     164  inline G4double MeanFreePath(const G4Track& track);
     165
     166  // It returns cross section per volume
     167  inline G4double GetLambda(G4double& kinEnergy,
     168                            const G4MaterialCutsCouple* couple);
     169
     170  //------------------------------------------------------------------------
     171  // Specific methods to build and access Physics Tables
     172  //------------------------------------------------------------------------
     173
     174  // Binning for lambda table
     175  inline void SetLambdaBinning(G4int nbins);
     176  inline G4int LambdaBinning() const;
     177
     178  // Min kinetic energy for tables
     179  inline void SetMinKinEnergy(G4double e);
     180  inline G4double MinKinEnergy() const;
     181
     182  // Max kinetic energy for tables
     183  inline void SetMaxKinEnergy(G4double e);
     184  inline G4double MaxKinEnergy() const;
     185
     186  inline void SetPolarAngleLimit(G4double a);
     187  inline G4double PolarAngleLimit() const;
     188
     189  inline const G4PhysicsTable* LambdaTable() const;
     190
     191  //------------------------------------------------------------------------
     192  // Define and access particle type
     193  //------------------------------------------------------------------------
     194
     195  inline const G4ParticleDefinition* Particle() const;
     196  inline const G4ParticleDefinition* SecondaryParticle() const;
     197
     198  //------------------------------------------------------------------------
     199  // Specific methods to set, access, modify models and basic parameters
     200  //------------------------------------------------------------------------
     201
     202protected:
     203  // Select model in run time
     204  inline void SelectModel(G4double& kinEnergy);
     205
     206public:
     207  // Select model by energy and region index
    167208  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
    168209                                            size_t& idxRegion) const;
    169 
    170   inline G4double GetLambda(G4double& kinEnergy,
    171                             const G4MaterialCutsCouple* couple);
    172   // It returns the Lambda of the process
    173 
    174   //------------------------------------------------------------------------
    175   // Specific methods to build and access Physics Tables
    176   //------------------------------------------------------------------------
    177 
    178   inline void SetLambdaBinning(G4int nbins);
    179   inline G4int LambdaBinning() const;
    180   // Binning for lambda table
    181 
    182   inline void SetMinKinEnergy(G4double e);
    183   inline G4double MinKinEnergy() const;
    184   // Min kinetic energy for tables
    185 
    186   inline void SetMaxKinEnergy(G4double e);
    187   inline G4double MaxKinEnergy() const;
    188   // Max kinetic energy for tables
    189 
    190   inline const G4PhysicsTable* LambdaTable() const;
    191 
    192   //------------------------------------------------------------------------
    193   // Define and access particle type
    194   //------------------------------------------------------------------------
    195 
    196   inline const G4ParticleDefinition* Particle() const;
    197   inline const G4ParticleDefinition* SecondaryParticle() const;
    198 
    199   //------------------------------------------------------------------------
    200   // Specific methods to set, access, modify models
    201   //------------------------------------------------------------------------
    202 
     210   
     211  // Add model for region, smaller value of order defines which
     212  // model will be selected for a given energy interval 
    203213  inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
    204   // Add EM model coupled for the region
    205    
    206   inline void SetModel(G4VEmModel*);
     214
    207215  // Assign a model to a process
     216  inline void SetModel(G4VEmModel*, G4int index = 1);
    208217 
    209   inline G4VEmModel* Model();
    210218  // return the assigned model
     219  inline G4VEmModel* Model(G4int index = 1);
    211220   
     221  // Define new energy range for the model identified by the name
    212222  inline void UpdateEmModel(const G4String&, G4double, G4double);
    213   // Define new energy range for the model identified by the name
    214223
    215224  // Access to models
    216   inline G4VEmModel* GetModelByIndex(G4int idx = 0);
    217 
    218   //------------------------------------------------------------------------
    219   // Get/set parameters used for simulation of energy loss
    220   //------------------------------------------------------------------------
    221 
    222   inline void ActivateDeexcitation(G4bool, const G4Region* r = 0);
     225  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
    223226
    224227  inline void SetLambdaFactor(G4double val);
     
    228231
    229232  inline void SetApplyCuts(G4bool val);
     233
     234  //------------------------------------------------------------------------
     235  // Other generic methods
     236  //------------------------------------------------------------------------
    230237 
    231238protected:
     
    237244  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
    238245
     246  inline G4double RecalculateLambda(G4double kinEnergy,
     247                                    const G4MaterialCutsCouple* couple);
     248
     249  inline G4ParticleChangeForGamma* GetParticleChange();
     250
    239251  inline void SetParticle(const G4ParticleDefinition* p);
    240252 
    241253  inline void SetSecondaryParticle(const G4ParticleDefinition* p);
    242254
    243   inline G4VEmModel* SelectModel(G4double& kinEnergy);
    244 
    245255  inline size_t CurrentMaterialCutsCoupleIndex() const;
    246256
     
    273283  inline G4double ComputeCurrentLambda(G4double kinEnergy);
    274284
    275   // hide  assignment operator
    276 
     285  // copy constructor and hide assignment operator
    277286  G4VEmProcess(G4VEmProcess &);
    278287  G4VEmProcess & operator=(const G4VEmProcess &right);
    279288
    280 // =====================================================================
    281 
    282 protected:
    283 
    284   G4ParticleChangeForGamma     fParticleChange;
    285 
    286 private:
    287 
    288   std::vector<G4DynamicParticle*> secParticles;
     289  // ======== Parameters of the class fixed at construction =========
    289290
    290291  G4EmModelManager*            modelManager;
    291   G4VEmModel*                  selectedModel; 
     292  const G4ParticleDefinition*  theGamma;
     293  const G4ParticleDefinition*  theElectron;
     294  const G4ParticleDefinition*  thePositron;
     295  const G4ParticleDefinition*  secondaryParticle;
     296
     297  G4bool                       buildLambdaTable;
     298
     299  // ======== Parameters of the class fixed at initialisation =======
     300
     301  std::vector<G4VEmModel*>     emModels;
    292302
    293303  // tables and vectors
     
    296306  G4double*                    theCrossSectionMax;
    297307
    298   const G4ParticleDefinition*  particle;
    299   const G4ParticleDefinition*  secondaryParticle;
    300   const G4ParticleDefinition*  theGamma;
    301   const G4ParticleDefinition*  theElectron;
    302   const G4ParticleDefinition*  thePositron;
    303 
    304308  const std::vector<G4double>* theCuts;
    305309  const std::vector<G4double>* theCutsGamma;
     
    312316  G4double                     maxKinEnergy;
    313317  G4double                     lambdaFactor;
     318  G4double                     polarAngleLimit;
     319
     320  G4bool                       integral;
     321  G4bool                       applyCuts;
     322  G4bool                       startFromNull;
     323  G4bool                       useDeexcitation;
     324
     325  G4int                        nDERegions;
     326  std::vector<const G4Region*> deRegions;
     327  G4bool*                      idxDERegions;
     328
     329  // ======== Cashed values - may be state dependent ================
     330
     331protected:
     332
     333  G4ParticleChangeForGamma     fParticleChange;
     334
     335private:
     336
     337  std::vector<G4DynamicParticle*> secParticles;
     338
     339  G4VEmModel*                  currentModel; 
     340
     341  const G4ParticleDefinition*  particle;
    314342
    315343  // cash
     
    322350  G4double                     preStepLambda;
    323351
    324   G4bool                       integral;
    325   G4bool                       buildLambdaTable;
    326   G4bool                       applyCuts;
    327   G4bool                       startFromNull;
    328 
    329   G4int                        nRegions;
    330   std::vector<G4Region*>       regions;
    331   std::vector<G4bool>          flagsDeexcitation;
    332 
    333352};
    334353
    335354//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     355//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     356
     357inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
     358                 G4double kineticEnergy, G4double Z, G4double A, G4double cut)
     359{
     360  SelectModel(kineticEnergy);
     361  G4double x = 0.0;
     362  if(currentModel) {
     363   x = currentModel->ComputeCrossSectionPerAtom(particle,kineticEnergy,
     364                                                 Z,A,cut);
     365  }
     366  return x;
     367}
     368
     369//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     370
     371inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
     372{
     373  DefineMaterial(track.GetMaterialCutsCouple());
     374  preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
     375  G4double x = DBL_MAX;
     376  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
     377  return x;
     378}
     379
     380//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     381
     382inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
     383                                        const G4MaterialCutsCouple* couple)
     384{
     385  DefineMaterial(couple);
     386  return GetCurrentLambda(kineticEnergy);
     387}
     388
     389//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     390
     391inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
     392{
     393  nLambdaBins = nbins;
     394}
     395
     396//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     397
     398inline G4int G4VEmProcess::LambdaBinning() const
     399{
     400  return nLambdaBins;
     401}
     402
     403//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     404
     405inline void G4VEmProcess::SetMinKinEnergy(G4double e)
     406{
     407  minKinEnergy = e;
     408}
     409
     410//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     411
     412inline G4double G4VEmProcess::MinKinEnergy() const
     413{
     414  return minKinEnergy;
     415}
     416
     417//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     418
     419inline void G4VEmProcess::SetMaxKinEnergy(G4double e)
     420{
     421  maxKinEnergy = e;
     422}
     423
     424//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     425
     426inline G4double G4VEmProcess::MaxKinEnergy() const
     427{
     428  return maxKinEnergy;
     429}
     430
     431//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     432
     433inline void G4VEmProcess::SetPolarAngleLimit(G4double val)
     434{
     435  if(val < 0.0)     polarAngleLimit = 0.0;
     436  else if(val > pi) polarAngleLimit = pi;
     437  else              polarAngleLimit = val;
     438}
     439
     440//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     441
     442inline G4double G4VEmProcess::PolarAngleLimit() const
     443{
     444  return polarAngleLimit;
     445}
     446
     447//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     448
     449inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
     450{
     451  return theLambdaTable;
     452}
     453
     454//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     455
     456inline const G4ParticleDefinition* G4VEmProcess::Particle() const
     457{
     458  return particle;
     459}
     460
     461//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     462
     463inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
     464{
     465  return secondaryParticle;
     466}
     467
     468//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     469
     470inline void G4VEmProcess::SelectModel(G4double& kinEnergy)
     471{
     472  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
     473  currentModel->SetCurrentCouple(currentCouple);
     474}
     475
     476//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     477
     478inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
     479                                   G4double kinEnergy, size_t& idxRegion) const
     480{
     481  return modelManager->SelectModel(kinEnergy, idxRegion);
     482}
     483
     484//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     485
     486inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
     487                                     const G4Region* region)
     488{
     489  G4VEmFluctuationModel* fm = 0;
     490  modelManager->AddEmModel(order, p, fm, region);
     491  if(p) p->SetParticleChange(pParticleChange);
     492}
     493
     494//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     495
     496inline void G4VEmProcess::SetModel(G4VEmModel* p, G4int index)
     497{
     498  G4int n = emModels.size();
     499  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
     500  emModels[index] = p;
     501}
     502
     503//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     504
     505inline G4VEmModel* G4VEmProcess::Model(G4int index)
     506{
     507  G4VEmModel* p = 0;
     508  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
     509  return p;
     510}
     511
     512//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     513
     514inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
     515                                        G4double emin, G4double emax)
     516{
     517  modelManager->UpdateEmModel(nam, emin, emax);
     518}
     519
     520//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     521
     522inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver)
     523{
     524  return modelManager->GetModel(idx, ver);
     525}
     526
     527//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     528
     529inline void G4VEmProcess::SetLambdaFactor(G4double val)
     530{
     531  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
     532}
     533
     534//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     535
     536inline void G4VEmProcess::SetIntegral(G4bool val)
     537{
     538  if(particle && particle != theGamma) integral = val;
     539  if(integral) buildLambdaTable = true;
     540}
     541
     542//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     543
     544inline G4bool G4VEmProcess::IsIntegral() const
     545{
     546  return integral;
     547}
     548
     549//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     550
     551inline void G4VEmProcess::SetApplyCuts(G4bool val)
     552{
     553  applyCuts = val;
     554}
     555
     556//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     557
     558inline G4double G4VEmProcess::RecalculateLambda(G4double e,
     559                                                const G4MaterialCutsCouple* couple)
     560{
     561  DefineMaterial(couple);
     562  return ComputeCurrentLambda(e);
     563}
     564
     565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     566
     567inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
     568{
     569  return &fParticleChange;
     570}
     571
     572//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     573
     574inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
     575{
     576  particle = p;
     577}
     578
     579//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     580
     581inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
     582{
     583  secondaryParticle = p;
     584}
     585
     586//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     587
     588inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
     589{
     590  return currentMaterialIndex;
     591}
     592
     593//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     594
     595inline G4double G4VEmProcess::GetGammaEnergyCut()
     596{
     597  return (*theCutsGamma)[currentMaterialIndex];
     598}
     599
     600//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     601
     602inline G4double G4VEmProcess::GetElectronEnergyCut()
     603{
     604  return (*theCutsElectron)[currentMaterialIndex];
     605}
     606
     607//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     608
     609inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
     610{
     611  buildLambdaTable = val;
     612  if(!val) integral = false;
     613}
     614
     615//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     616
     617inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
     618{
     619  startFromNull = val;
     620}
     621
     622//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     623
     624inline void G4VEmProcess::InitialiseStep(const G4Track& track)
     625{
     626  preStepKinEnergy = track.GetKineticEnergy();
     627  DefineMaterial(track.GetMaterialCutsCouple());
     628  if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
     629}
     630
    336631//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    337632
     
    344639    mfpKinEnergy = DBL_MAX;
    345640  }
    346 }
    347 
    348 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    349 
    350 inline void G4VEmProcess::InitialiseStep(const G4Track& track)
    351 {
    352   preStepKinEnergy = track.GetKineticEnergy();
    353   DefineMaterial(track.GetMaterialCutsCouple());
    354   if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
    355 }
    356 
    357 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    358 
    359 inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
    360                                   const G4MaterialCutsCouple* couple)
    361 {
    362   DefineMaterial(couple);
    363   return GetCurrentLambda(kineticEnergy);
    364 }
    365 
    366 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    367 
    368 inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
    369 {
    370   G4double x = 0.0;
    371   if(theLambdaTable) x = GetLambdaFromTable(e);
    372   else               x = ComputeCurrentLambda(e);
    373   return x;
    374 }
    375 
    376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    377 
    378 inline G4double G4VEmProcess::RecalculateLambda(G4double e,
    379                                                 const G4MaterialCutsCouple* couple)
    380 {
    381   DefineMaterial(couple);
    382   return ComputeCurrentLambda(e);
    383 }
    384 
    385 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    386 
    387 inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
    388 {
    389   G4VEmModel* currentModel = SelectModel(e);
    390   G4double x = 0.0;
    391   if(currentModel)
    392     x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
    393                                             e,(*theCuts)[currentMaterialIndex]);
    394   return x;
    395 }
    396 
    397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    398 
    399 inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
    400 {
    401   G4bool b;
    402   return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
    403641}
    404642
     
    428666//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    429667
    430 inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
    431 {
    432   DefineMaterial(track.GetMaterialCutsCouple());
    433   preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
    434   G4double x = DBL_MAX;
    435   if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
     668inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
     669{
     670  G4bool b;
     671  return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
     672}
     673
     674//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     675
     676inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
     677{
     678  G4double x = 0.0;
     679  if(theLambdaTable) x = GetLambdaFromTable(e);
     680  else               x = ComputeCurrentLambda(e);
    436681  return x;
    437682}
     
    439684//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    440685
    441 inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy)
    442 {
    443   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
    444 }
    445 
    446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    447 
    448 inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
    449                                    G4double kinEnergy, size_t& idxRegion) const
    450 {
    451   return modelManager->SelectModel(kinEnergy, idxRegion);
    452 }
    453 
    454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    455 
    456 inline const G4ParticleDefinition* G4VEmProcess::Particle() const
    457 {
    458   return particle;
    459 }
    460 
    461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    462 
    463 inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
    464 {
    465   return secondaryParticle;
    466 }
    467 
    468 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    469 
    470 inline G4double G4VEmProcess::GetGammaEnergyCut()
    471 {
    472   return (*theCutsGamma)[currentMaterialIndex];
    473 }
    474 
    475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    476 
    477 inline G4double G4VEmProcess::GetElectronEnergyCut()
    478 {
    479   return (*theCutsElectron)[currentMaterialIndex];
    480 }
    481 
    482 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    483 
    484 inline void G4VEmProcess::SetLambdaFactor(G4double val)
    485 {
    486   if(val > 0.0 && val <= 1.0) lambdaFactor = val;
    487 }
    488 
    489 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    490 
    491 inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx)
    492 {
    493   return modelManager->GetModel(idx);
    494 }
    495 
    496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    497 
    498 inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
    499 {
    500   particle = p;
    501 }
    502 
    503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    504 
    505 inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
    506 {
    507   secondaryParticle = p;
    508 }
    509 
    510 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    511 
    512 inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
    513                                      const G4Region* region)
    514 {
    515   G4VEmFluctuationModel* fm = 0;
    516   modelManager->AddEmModel(order, p, fm, region);
    517   if(p) p->SetParticleChange(pParticleChange);
    518 }
    519 
    520 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    521 
    522 inline void G4VEmProcess::SetModel(G4VEmModel* model)
    523 {
    524   selectedModel = model;
    525 }
    526 
    527 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    528 
    529 inline G4VEmModel* G4VEmProcess::Model()
    530 {
    531   return selectedModel;
    532 }
    533 
    534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    535 
    536 inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
    537                                         G4double emin, G4double emax)
    538 {
    539   modelManager->UpdateEmModel(nam, emin, emax);
    540 }
    541 
    542 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    543 
    544 inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
    545                  G4double kineticEnergy, G4double Z, G4double A, G4double cut)
    546 {
    547   G4VEmModel* model = SelectModel(kineticEnergy);
    548   return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut);
    549 }
    550 
    551 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    552 
    553 inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
    554 {
    555   nLambdaBins = nbins;
    556 }
    557 
    558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    559 
    560 inline G4int G4VEmProcess::LambdaBinning() const
    561 {
    562   return nLambdaBins;
    563 }
    564 
    565 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    566 
    567 inline void G4VEmProcess::SetMinKinEnergy(G4double e)
    568 {
    569   minKinEnergy = e;
    570 }
    571 
    572 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    573 
    574 inline G4double G4VEmProcess::MinKinEnergy() const
    575 {
    576   return minKinEnergy;
    577 }
    578 
    579 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    580 
    581 inline void G4VEmProcess::SetMaxKinEnergy(G4double e)
    582 {
    583   maxKinEnergy = e;
    584 }
    585 
    586 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    587 
    588 inline G4double G4VEmProcess::MaxKinEnergy() const
    589 {
    590   return maxKinEnergy;
    591 }
    592 
    593 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    594 
    595 inline void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
    596 {}
    597 
    598 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    599 
    600 inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
    601 {
    602   return theLambdaTable;
    603 }
    604 
    605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    606 
    607 inline void G4VEmProcess::SetIntegral(G4bool val)
    608 {
    609   if(particle && particle != theGamma) integral = val;
    610   if(integral) buildLambdaTable = true;
    611 }
    612 
    613 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    614 
    615 inline G4bool G4VEmProcess::IsIntegral() const
    616 {
    617   return integral;
    618 }
    619 
    620 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    621 
    622 inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
    623 {
    624   buildLambdaTable = val;
    625   if(!val) integral = false;
    626 }
    627 
    628 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    629 
    630 inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
    631 {
    632   startFromNull = val;
    633 }
    634 
    635 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    636 
    637 inline void G4VEmProcess::SetApplyCuts(G4bool val)
    638 {
    639   applyCuts = val;
    640 }
    641 
    642 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    643 
    644 inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
    645 {
    646   return currentMaterialIndex;
     686inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
     687{
     688  SelectModel(e);
     689  G4double x = 0.0;
     690  if(currentModel) {
     691    x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
     692                                            e,(*theCuts)[currentMaterialIndex]);
     693  }
     694  return x;
    647695}
    648696
  • trunk/source/processes/electromagnetic/utils/include/G4VEnergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4VEnergyLoss.hh,v 1.18 2006/06/29 19:54:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEnergyLossProcess.hh,v 1.76 2007/11/07 18:38:49 vnivanch Exp $
     26// $Id: G4VEnergyLossProcess.hh,v 1.86 2009/02/19 09:57:36 vnivanch Exp $
    2727// GEANT4 tag $Name:
    2828//
     
    7979//          PostStepGetPhysicalInteractionLength (V.Ivanchenko)
    8080// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
     81// 15-07-08 Reorder class members for further multi-thread development (VI)
    8182//
    8283// Class Description:
     
    125126  virtual ~G4VEnergyLossProcess();
    126127
     128private:
     129  // clean vectors and arrays
     130  void Clean();
     131
    127132  //------------------------------------------------------------------------
    128133  // Virtual methods to be implemented in concrete processes
    129134  //------------------------------------------------------------------------
    130135
     136public:
    131137  virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
    132138 
     
    141147  // Methods with standard implementation; may be overwritten if needed
    142148  //------------------------------------------------------------------------
    143 protected:
    144149
    145150  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
    146151                                    const G4Material*, G4double cut);
    147152
    148   virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
    149                                     const G4DynamicParticle*,
    150                                     G4double& eloss,
    151                                     G4double& length);
    152 
    153   //------------------------------------------------------------------------
    154   // Generic methods common to all ContinuousDiscrete processes
    155   //------------------------------------------------------------------------
     153  //------------------------------------------------------------------------
     154  // Virtual methods implementation common to all EM ContinuousDiscrete
     155  // processes. Further inheritance is not assumed
     156  //------------------------------------------------------------------------
     157
    156158public:
    157159
     160  // prepare all tables
     161  void PreparePhysicsTable(const G4ParticleDefinition&);
     162
     163  // build all tables
     164  void BuildPhysicsTable(const G4ParticleDefinition&);
     165
     166  // build a table
     167  G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
     168
     169  // build a table
     170  G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
     171
     172  // summary printout after initialisation
    158173  void PrintInfoDefinition();
    159174
    160   void PreparePhysicsTable(const G4ParticleDefinition&);
    161 
    162   void BuildPhysicsTable(const G4ParticleDefinition&);
    163 
     175  // Add subcutoff option for the region
     176  void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
     177
     178  // Activate deexcitation code for region
     179  void ActivateDeexcitation(G4bool, const G4Region* region = 0);
     180
     181  // Step limit from AlongStep
     182  G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
     183                                                 G4double  previousStepSize,
     184                                                 G4double  currentMinimumStep,
     185                                                 G4double& currentSafety,
     186                                                 G4GPILSelection* selection);
     187
     188  // Step limit from cross section
     189  G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
     190                                                G4double   previousStepSize,
     191                                                G4ForceCondition* condition);
     192
     193  // AlongStep computations
    164194  G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
    165195
     196  // Sampling of secondaries in vicinity of geometrical boundary
     197  void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
     198                               G4VEmModel* model, G4int matIdx,
     199                               G4double& extraEdep);
     200
     201  // PostStep sampling of secondaries
    166202  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
    167203
    168   // Store PhysicsTable in a file.
    169   // Return false in case of failure at I/O
     204  // Store all PhysicsTable in files.
     205  // Return false in case of any fatal failure at I/O 
    170206  G4bool StorePhysicsTable(const G4ParticleDefinition*,
    171207                           const G4String& directory,
    172208                           G4bool ascii = false);
    173209
    174   // Retrieve Physics from a file.
    175   // (return true if the Physics Table can be build by using file)
    176   // (return false if the process has no functionality or in case of failure)
    177   // File name should is constructed as processName+particleName and the
    178   // should be placed under the directory specifed by the argument.
     210  // Retrieve all Physics from a files.
     211  // Return true if all the Physics Table are built.
     212  // Return false if any fatal failure.
    179213  G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
    180214                              const G4String& directory,
    181215                              G4bool ascii);
    182216
     217private:
     218  // store a table
     219  G4bool StoreTable(const G4ParticleDefinition* p,
     220                    G4PhysicsTable*, G4bool ascii,
     221                    const G4String& directory,
     222                    const G4String& tname);
     223
     224  // retrieve a table
     225  G4bool RetrieveTable(const G4ParticleDefinition* p,
     226                       G4PhysicsTable*, G4bool ascii,
     227                       const G4String& directory,
     228                       const G4String& tname,
     229                       G4bool mandatory);
     230
     231  //------------------------------------------------------------------------
     232  // Public interface to cross section, mfp and sampling of fluctuations
     233  // These methods are not used in run time
     234  //------------------------------------------------------------------------
     235
     236public:
     237  // access to dispersion of restricted energy loss
     238  G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
     239                             const G4DynamicParticle* dp,
     240                             G4double length);
     241
     242  // Access to cross section table
     243  G4double CrossSectionPerVolume(G4double kineticEnergy,
     244                                 const G4MaterialCutsCouple* couple);
     245
     246  // access to cross section
     247  G4double MeanFreePath(const G4Track& track);
     248
     249  // access to step limit
     250  G4double ContinuousStepLimit(const G4Track& track,
     251                               G4double previousStepSize,
     252                               G4double currentMinimumStep,
     253                               G4double& currentSafety);
     254
    183255protected:
    184256
     257  // implementation of the pure virtual method
    185258  G4double GetMeanFreePath(const G4Track& track,
    186259                           G4double previousStepSize,
    187260                           G4ForceCondition* condition);
    188261
     262  // implementation of the pure virtual method
    189263  G4double GetContinuousStepLimit(const G4Track& track,
    190264                                  G4double previousStepSize,
     
    193267
    194268  //------------------------------------------------------------------------
    195   // Specific methods for along/post step EM processes
    196   //------------------------------------------------------------------------
     269  // Run time method which may be also used by derived processes
     270  //------------------------------------------------------------------------
     271
     272  // creeation of an empty vector for cross section
     273  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
     274                                       G4double cut);
     275
     276  inline G4ParticleChangeForLoss* GetParticleChange();
     277
     278  inline size_t CurrentMaterialCutsCoupleIndex() const;
     279
     280  inline G4double GetCurrentRange() const;
     281
     282  //------------------------------------------------------------------------
     283  // Specific methods to set, access, modify models
     284  //------------------------------------------------------------------------
     285
     286  // Select model in run time
     287  inline void SelectModel(G4double kinEnergy);
    197288
    198289public:
    199 
     290  // Select model by energy and region index
     291  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
     292                                            size_t& idx) const;
     293
     294  // Add EM model coupled with fluctuation model for region, smaller value
     295  // of order defines which pair of models will be selected for a given
     296  // energy interval 
     297  inline void AddEmModel(G4int, G4VEmModel*,
     298                         G4VEmFluctuationModel* fluc = 0,
     299                         const G4Region* region = 0);
     300
     301  // Define new energy range for the model identified by the name
     302  inline void UpdateEmModel(const G4String&, G4double, G4double);
     303
     304  // Assign a model to a process
     305  inline void SetEmModel(G4VEmModel*, G4int index=1);
     306 
     307  // return the assigned model
     308  inline G4VEmModel* EmModel(G4int index=1);
     309 
     310  // Access to models
     311  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
     312
     313  inline G4int NumberOfModels();
     314
     315  // Assign a fluctuation model to a process
     316  inline void SetFluctModel(G4VEmFluctuationModel*);
     317 
     318  // return the assigned fluctuation model
     319  inline G4VEmFluctuationModel* FluctModel();
     320   
     321  //------------------------------------------------------------------------
     322  // Define and access particle type
     323  //------------------------------------------------------------------------
     324
     325protected:
     326  inline void SetParticle(const G4ParticleDefinition* p);
     327  inline void SetSecondaryParticle(const G4ParticleDefinition* p);
     328
     329public:
     330  inline void SetBaseParticle(const G4ParticleDefinition* p);
     331  inline const G4ParticleDefinition* Particle() const;
     332  inline const G4ParticleDefinition* BaseParticle() const;
     333  inline const G4ParticleDefinition* SecondaryParticle() const;
     334
     335  //------------------------------------------------------------------------
     336  // Get/set parameters to configure the process at initialisation time
     337  //------------------------------------------------------------------------
     338
     339  // Add subcutoff process (bremsstrahlung) to sample secondary
     340  // particle production in vicinity of the geometry boundary
    200341  void AddCollaborativeProcess(G4VEnergyLossProcess*);
    201342
    202   void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
    203                                G4VEmModel* model, G4int matIdx,
    204                                G4double& extraEdep);
    205 
    206   G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
    207                              const G4DynamicParticle* dp,
    208                              G4double length);
    209 
    210 
    211   virtual G4double AlongStepGetPhysicalInteractionLength(
    212                              const G4Track&,
    213                              G4double  previousStepSize,
    214                              G4double  currentMinimumStep,
    215                              G4double& currentSafety,
    216                              G4GPILSelection* selection
    217                             );
    218 
    219   virtual G4double PostStepGetPhysicalInteractionLength(
    220                              const G4Track& track,
    221                              G4double   previousStepSize,
    222                              G4ForceCondition* condition
    223                             );
    224 
    225   //------------------------------------------------------------------------
    226   // Specific methods to build and access Physics Tables
    227   //------------------------------------------------------------------------
    228 
    229   G4double MicroscopicCrossSection(G4double kineticEnergy,
    230                                    const G4MaterialCutsCouple* couple);
    231 
    232   G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
    233 
    234   G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
     343  inline void SetLossFluctuations(G4bool val);
     344  inline void SetRandomStep(G4bool val);
     345
     346  inline void SetIntegral(G4bool val);
     347  inline G4bool IsIntegral() const;
     348
     349  // Set/Get flag "isIonisation"
     350  inline void SetIonisation(G4bool val);
     351  inline G4bool IsIonisationProcess() const;
     352
     353  // Redefine parameteters for stepping control
     354  //
     355  inline void SetLinearLossLimit(G4double val);
     356  inline void SetMinSubRange(G4double val);
     357  inline void SetLambdaFactor(G4double val);
     358  inline void SetStepFunction(G4double v1, G4double v2);
     359
     360  inline G4int NumberOfSubCutoffRegions() const;
     361  inline G4int NumberOfDERegions() const;
     362
     363  //------------------------------------------------------------------------
     364  // Specific methods to path Physics Tables to the process
     365  //------------------------------------------------------------------------
    235366
    236367  void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
    237368  void SetCSDARangeTable(G4PhysicsTable* pRange);
    238369  void SetRangeTableForLoss(G4PhysicsTable* p);
     370  void SetSecondaryRangeTable(G4PhysicsTable* p);
    239371  void SetInverseRangeTable(G4PhysicsTable* p);
    240   void SetSecondaryRangeTable(G4PhysicsTable* p);
    241372
    242373  void SetLambdaTable(G4PhysicsTable* p);
     
    260391  // Max kinetic energy for tables
    261392  inline void SetMaxKinEnergyForCSDARange(G4double e);
     393
     394  // Return values for given G4MaterialCutsCouple
     395  inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     396  inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
     397                                   const G4MaterialCutsCouple*);
     398  inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     399  inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     400  inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     401  inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
     402  inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     403
     404  inline G4bool TablesAreBuilt() const;
    262405
    263406  // Access to specific tables
     
    273416  inline G4PhysicsTable* SubLambdaTable();
    274417
    275   // Return values for given G4MaterialCutsCouple
    276   inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    277   inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
    278                                    const G4MaterialCutsCouple*);
    279   inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    280   inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    281   inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    282   inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
    283   inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    284 
    285   inline G4bool TablesAreBuilt() const;
    286 
    287   //------------------------------------------------------------------------
    288   // Define and access particle type
    289   //------------------------------------------------------------------------
    290 
    291   inline void SetBaseParticle(const G4ParticleDefinition* p);
    292   inline const G4ParticleDefinition* Particle() const;
    293   inline const G4ParticleDefinition* BaseParticle() const;
    294   inline const G4ParticleDefinition* SecondaryParticle() const;
    295 
    296   //------------------------------------------------------------------------
    297   // Specific methods to set, access, modify models
    298   //------------------------------------------------------------------------
    299 
    300   // Add EM model coupled with fluctuation model for the region
    301   inline void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,
    302                                 const G4Region* region = 0);
    303 
    304   // Assign a model to a process
    305   inline void SetEmModel(G4VEmModel*, G4int index=1);
    306  
    307   // return the assigned model
    308   inline G4VEmModel* EmModel(G4int index=1);
    309  
    310   // Assign a fluctuation model to a process
    311   inline void SetFluctModel(G4VEmFluctuationModel*);
    312  
    313   // return the assigned fluctuation model
    314   inline G4VEmFluctuationModel* FluctModel();
    315    
    316   // Define new energy range for the model identified by the name
    317   inline void UpdateEmModel(const G4String&, G4double, G4double);
    318 
    319   // Access to models
    320   inline G4VEmModel* GetModelByIndex(G4int idx = 0);
    321 
    322   inline G4int NumberOfModels();
    323 
    324   //------------------------------------------------------------------------
    325   // Get/set parameters used for simulation of energy loss
    326   //------------------------------------------------------------------------
    327 
    328   inline void SetLossFluctuations(G4bool val);
    329   inline void SetRandomStep(G4bool val);
    330   inline void SetIntegral(G4bool val);
    331   inline G4bool IsIntegral() const;
    332 
    333   // Set/Get flag "isIonisation"
    334   inline void SetIonisation(G4bool val);
    335   inline G4bool IsIonisationProcess() const;
    336 
    337   // Redefine parameteters for stepping control
    338   //
    339   inline void SetLinearLossLimit(G4double val);
    340   inline void SetMinSubRange(G4double val);
    341   inline void SetStepFunction(G4double v1, G4double v2);
    342   inline void SetLambdaFactor(G4double val);
    343 
    344 
    345   // Add subcutoff option for the region
    346   void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
    347 
    348   inline G4int NumberOfSubCutoffRegions() const;
    349 
    350   // Activate deexcitation code
    351   virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
    352 
    353418  //------------------------------------------------------------------------
    354419  // Run time method for simulation of ionisation
    355420  //------------------------------------------------------------------------
    356421
     422  // sample range at the end of a step
    357423  inline G4double SampleRange();
    358424
    359   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
    360 
    361 
    362   // Set scaling parameters
     425  // Set scaling parameters for ions is needed to G4EmCalculator
    363426  inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
    364427
    365   // Helper functions
    366   inline G4double MeanFreePath(const G4Track& track);
    367 
    368   inline G4double ContinuousStepLimit(const G4Track& track,
    369                                       G4double previousStepSize,
    370                                       G4double currentMinimumStep,
    371                                       G4double& currentSafety);
    372 
    373 protected:
    374 
    375   G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
    376                                        G4double cut);
    377 
    378   inline virtual void InitialiseMassCharge(const G4Track&);
    379 
    380   inline void SetParticle(const G4ParticleDefinition* p);
    381 
    382   inline void SetSecondaryParticle(const G4ParticleDefinition* p);
    383 
    384   inline G4VEmModel* SelectModel(G4double kinEnergy);
    385 
    386   inline size_t CurrentMaterialCutsCoupleIndex() const;
    387 
    388   inline G4double GetCurrentRange() const;
    389 
    390428private:
    391429
    392   // Clear tables
    393   void Clear();
    394 
    395   inline void InitialiseStep(const G4Track&);
    396 
     430  // define material and indexes
    397431  inline void DefineMaterial(const G4MaterialCutsCouple* couple);
    398432
    399   // Returnd values for scaled energy and base particles mass
    400   //
     433  //------------------------------------------------------------------------
     434  // Compute values using scaling relation, mass and charge of based particle
     435  //------------------------------------------------------------------------
     436
    401437  inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
    402438  inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
     
    405441  inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
    406442  inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
     443  inline G4double ScaledKinEnergyForLoss(G4double range);
    407444  inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
    408   inline G4double ScaledKinEnergyForLoss(G4double range);
    409445  inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
    410446
    411447  // hide  assignment operator
    412 
    413448  G4VEnergyLossProcess(G4VEnergyLossProcess &);
    414449  G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right);
    415450
    416 // =====================================================================
    417 
    418 protected:
    419 
    420   G4ParticleChangeForLoss               fParticleChange;
    421 
    422 private:
    423 
    424   G4EmModelManager*                     modelManager;
     451  // ======== Parameters of the class fixed at construction =========
     452
     453  G4EmModelManager*           modelManager;
     454  G4SafetyHelper*             safetyHelper;
     455
     456  const G4ParticleDefinition* secondaryParticle;
     457  const G4ParticleDefinition* theElectron;
     458  const G4ParticleDefinition* thePositron;
     459  const G4ParticleDefinition* theGenericIon;
     460
     461  G4PhysicsVector*            vstrag;
     462
     463  // ======== Parameters of the class fixed at initialisation =======
     464
    425465  std::vector<G4VEmModel*>              emModels;
    426466  G4VEmFluctuationModel*                fluctModel;
    427467  std::vector<const G4Region*>          scoffRegions;
     468  std::vector<const G4Region*>          deRegions;
    428469  G4int                                 nSCoffRegions;
    429   G4int*                                idxSCoffRegions;
    430   std::vector<G4DynamicParticle*>       secParticles;
    431   std::vector<G4Track*>                 scTracks;
     470  G4int                                 nDERegions;
     471  G4bool*                               idxSCoffRegions;
     472  G4bool*                               idxDERegions;
     473
    432474  std::vector<G4VEnergyLossProcess*>    scProcesses;
    433475  G4int                                 nProcesses;
     
    453495  const G4DataVector*         theSubCuts;
    454496
    455   G4SafetyHelper*             safetyHelper;
    456 
    457   const G4ParticleDefinition* particle;
    458497  const G4ParticleDefinition* baseParticle;
    459   const G4ParticleDefinition* secondaryParticle;
    460   const G4ParticleDefinition* theElectron;
    461   const G4ParticleDefinition* thePositron;
    462 
    463   G4PhysicsVector*            vstrag;
    464 
    465   // cash
    466   const G4Material*           currentMaterial;
    467   const G4MaterialCutsCouple* currentCouple;
    468   size_t                      currentMaterialIndex;
    469498
    470499  G4int    nBins;
    471500  G4int    nBinsCSDA;
    472   G4int    nWarnings;
    473501
    474502  G4double lowestKinEnergy;
     
    477505  G4double maxKinEnergyCSDA;
    478506
    479   G4double massRatio;
    480   G4double reduceFactor;
    481   G4double chargeSquare;
    482   G4double chargeSqRatio;
    483 
    484   G4double preStepLambda;
    485   G4double fRange;
    486   G4double preStepKinEnergy;
    487   G4double preStepScaledEnergy;
    488507  G4double linLossLimit;
    489508  G4double minSubRange;
     
    491510  G4double finalRange;
    492511  G4double lambdaFactor;
    493   G4double mfpKinEnergy;
    494 
    495   G4GPILSelection  aGPILSelection;
    496512
    497513  G4bool   lossFluctuationFlag;
     
    499515  G4bool   tablesAreBuilt;
    500516  G4bool   integral;
     517  G4bool   isIon;
    501518  G4bool   isIonisation;
    502519  G4bool   useSubCutoff;
     520  G4bool   useDeexcitation;
     521
     522protected:
     523
     524  G4ParticleChangeForLoss          fParticleChange;
     525
     526  // ======== Cashed values - may be state dependent ================
     527
     528private:
     529
     530  std::vector<G4DynamicParticle*>  secParticles;
     531  std::vector<G4Track*>            scTracks;
     532
     533  const G4ParticleDefinition* particle;
     534
     535  G4VEmModel*                 currentModel;
     536  const G4Material*           currentMaterial;
     537  const G4MaterialCutsCouple* currentCouple;
     538  size_t                      currentMaterialIndex;
     539
     540  G4int    nWarnings;
     541
     542  G4double massRatio;
     543  G4double reduceFactor;
     544  G4double chargeSqRatio;
     545
     546  G4double preStepLambda;
     547  G4double fRange;
     548  G4double preStepKinEnergy;
     549  G4double preStepScaledEnergy;
     550  G4double mfpKinEnergy;
     551
     552  G4GPILSelection  aGPILSelection;
     553
    503554};
    504555
     
    506557//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    507558
    508 inline void G4VEnergyLossProcess::DefineMaterial(
    509             const G4MaterialCutsCouple* couple)
    510 {
    511   if(couple != currentCouple) {
    512     currentCouple   = couple;
    513     currentMaterial = couple->GetMaterial();
    514     currentMaterialIndex = couple->GetIndex();
    515     mfpKinEnergy = DBL_MAX;
    516   }
    517 }
    518 
    519 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    520 
    521 inline void G4VEnergyLossProcess::InitialiseStep(const G4Track& track)
    522 {
    523   InitialiseMassCharge(track);
    524   preStepKinEnergy = track.GetKineticEnergy();
    525   preStepScaledEnergy = preStepKinEnergy*massRatio;
    526   DefineMaterial(track.GetMaterialCutsCouple());
    527   if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
    528 }
    529 
    530 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    531 
    532 inline void G4VEnergyLossProcess::InitialiseMassCharge(const G4Track&)
    533 {}
     559inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange()
     560{
     561  return &fParticleChange;
     562}
     563
     564//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     565
     566inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
     567{
     568  return currentMaterialIndex;
     569}
     570
     571//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     572 
     573inline G4double G4VEnergyLossProcess::GetCurrentRange() const
     574{
     575  return fRange;
     576}
     577
     578//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     579
     580inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
     581{
     582  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
     583  currentModel->SetCurrentCouple(currentCouple);
     584}
     585
     586//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     587
     588inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
     589                   G4double kinEnergy, size_t& idx) const
     590{
     591  return modelManager->SelectModel(kinEnergy, idx);
     592}
     593
     594//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     595
     596inline
     597void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
     598                                      G4VEmFluctuationModel* fluc,
     599                                      const G4Region* region)
     600{
     601  modelManager->AddEmModel(order, p, fluc, region);
     602  if(p) p->SetParticleChange(pParticleChange, fluc);
     603}
     604
     605//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     606
     607inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
     608                                                G4double emin, G4double emax)
     609{
     610  modelManager->UpdateEmModel(nam, emin, emax);
     611}
     612
     613//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     614
     615inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
     616{
     617  G4int n = emModels.size();
     618  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
     619  emModels[index] = p;
     620}
     621
     622//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     623
     624inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
     625{
     626  G4VEmModel* p = 0;
     627  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
     628  return p;
     629}
     630
     631//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     632
     633inline
     634G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver)
     635{
     636  return modelManager->GetModel(idx, ver);
     637}
     638
     639//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     640
     641inline G4int G4VEnergyLossProcess::NumberOfModels()
     642{
     643  return modelManager->NumberOfModels();
     644}
     645
     646//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     647
     648inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
     649{
     650  fluctModel = p;
     651}
     652
     653//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     654
     655inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
     656{
     657  return fluctModel;
     658}
     659
     660//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     661
     662inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
     663{
     664  particle = p;
     665}
     666
     667//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     668
     669inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
     670{
     671  secondaryParticle = p;
     672}
     673
     674//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     675
     676inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
     677{
     678  baseParticle = p;
     679}
     680
     681//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     682
     683inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
     684{
     685  return particle;
     686}
     687
     688//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     689
     690inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
     691{
     692  return baseParticle;
     693}
     694
     695//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     696
     697inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
     698{
     699  return secondaryParticle;
     700}
     701
     702//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     703
     704inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
     705{
     706  lossFluctuationFlag = val;
     707}
     708
     709//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     710
     711inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
     712{
     713  rndmStepFlag = val;
     714}
     715
     716//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     717
     718inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
     719{
     720  integral = val;
     721}
     722
     723//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     724 
     725inline G4bool G4VEnergyLossProcess::IsIntegral() const
     726{
     727  return integral;
     728}
     729
     730//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     731
     732inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
     733{
     734  isIonisation = val;
     735  if(val) aGPILSelection = CandidateForSelection;
     736  else    aGPILSelection = NotCandidateForSelection;
     737}
     738
     739//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     740
     741inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
     742{
     743  return isIonisation;
     744}
     745
     746//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     747
     748inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
     749{
     750  linLossLimit = val;
     751}
     752
     753//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     754
     755inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
     756{
     757  minSubRange = val;
     758}
     759
     760//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     761
     762inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
     763{
     764  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
     765}
     766
     767//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     768
     769void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
     770{
     771  dRoverRange = v1;
     772  finalRange = v2;
     773  if (dRoverRange > 0.999) dRoverRange = 1.0;
     774  currentCouple = 0;
     775  mfpKinEnergy  = DBL_MAX;
     776}
     777
     778//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     779
     780inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
     781{
     782  return nSCoffRegions;
     783}
     784
     785//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     786
     787inline G4int G4VEnergyLossProcess::NumberOfDERegions() const
     788{
     789  return nDERegions;
     790}
     791
     792//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     793
     794inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
     795{
     796  nBins = nbins;
     797}
     798
     799//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     800
     801inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
     802{
     803  nBins = nbins;
     804}
     805
     806//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     807
     808inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
     809{
     810  nBinsCSDA = nbins;
     811}
     812
     813//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     814
     815inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
     816{
     817  minKinEnergy = e;
     818}
     819
     820//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     821
     822inline G4double G4VEnergyLossProcess::MinKinEnergy() const
     823{
     824  return minKinEnergy;
     825}
     826
     827//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     828
     829inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
     830{
     831  maxKinEnergy = e;
     832  if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
     833}
     834
     835//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     836
     837inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
     838{
     839  return maxKinEnergy;
     840}
     841
     842//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     843
     844inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
     845{
     846  maxKinEnergyCSDA = e;
     847}
    534848
    535849//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    549863  DefineMaterial(couple);
    550864  return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
    551 }
    552 
    553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    554 
    555 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
    556 {
    557   G4bool b;
    558   G4double x =
    559     ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
    560   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    561   return x;
    562 }
    563 
    564 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    565 
    566 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
    567 {
    568   G4bool b;
    569   G4double x =
    570     ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
    571   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    572   return x;
    573 }
    574 
    575 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    576 
    577 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
    578 {
    579   G4bool b;
    580   G4double x = 0.0;
    581   //  if(theIonisationTable) {
    582   x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
    583     *chargeSqRatio;
    584   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    585   //}
    586   return x;
    587 }
    588 
    589 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    590 
    591 inline
    592 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
    593 {
    594   G4bool b;
    595   G4double x = 0.0;
    596   //if(theIonisationSubTable) {
    597   x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
    598     *chargeSqRatio;
    599   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    600   //}
    601   return x;
    602865}
    603866
     
    634897//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    635898
     899inline G4double G4VEnergyLossProcess::GetRangeForLoss(
     900                G4double& kineticEnergy,
     901                const G4MaterialCutsCouple* couple)
     902{
     903  DefineMaterial(couple);
     904  G4double x = DBL_MAX;
     905  if(theRangeTableForLoss)
     906    x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
     907  //  G4cout << "Range from " << GetProcessName()
     908  //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
     909  return x;
     910}
     911
     912//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     913
     914inline G4double G4VEnergyLossProcess::GetKineticEnergy(
     915                G4double& range,
     916                const G4MaterialCutsCouple* couple)
     917{
     918  DefineMaterial(couple);
     919  G4double r = range/reduceFactor;
     920  G4double e = ScaledKinEnergyForLoss(r)/massRatio;
     921  return e;
     922}
     923
     924//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     925
     926inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
     927                                          const G4MaterialCutsCouple* couple)
     928{
     929  DefineMaterial(couple);
     930  G4double x = 0.0;
     931  if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
     932  return x;
     933}
     934
     935//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     936
     937inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
     938{
     939  return  tablesAreBuilt;
     940}
     941
     942//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     943
     944inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
     945{
     946  return theDEDXTable;
     947}
     948
     949//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     950
     951inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
     952{
     953  return theDEDXSubTable;
     954}
     955
     956//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     957
     958inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
     959{
     960  return theDEDXunRestrictedTable;
     961}
     962
     963//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     964
     965inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
     966{
     967  G4PhysicsTable* t = theDEDXTable;
     968  if(theIonisationTable) t = theIonisationTable;
     969  return t;
     970}
     971
     972//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     973
     974inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
     975{
     976  G4PhysicsTable* t = theDEDXSubTable;
     977  if(theIonisationSubTable) t = theIonisationSubTable;
     978  return t;
     979}
     980
     981//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     982
     983inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
     984{
     985  return theCSDARangeTable;
     986}
     987
     988//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     989
     990inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
     991{
     992  return theRangeTableForLoss;
     993}
     994
     995//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     996
     997inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
     998{
     999  return theInverseRangeTable;
     1000}
     1001
     1002//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1003
     1004inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
     1005{
     1006  return theLambdaTable;
     1007}
     1008
     1009//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1010
     1011inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
     1012{
     1013  return theSubLambdaTable;
     1014}
     1015
     1016//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1017
     1018inline G4double G4VEnergyLossProcess::SampleRange()
     1019{
     1020  G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
     1021  G4bool b;
     1022  G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
     1023  G4double x = fRange + G4RandGauss::shoot(0.0,s);
     1024  if(x > 0.0) fRange = x;
     1025  return fRange;
     1026}
     1027
     1028//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1029
     1030inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
     1031                                                       G4double charge2ratio)
     1032{
     1033  massRatio     = massratio;
     1034  chargeSqRatio = charge2ratio;
     1035  reduceFactor  = 1.0/(chargeSqRatio*massRatio);
     1036}
     1037
     1038//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1039
     1040inline void G4VEnergyLossProcess::DefineMaterial(
     1041            const G4MaterialCutsCouple* couple)
     1042{
     1043  if(couple != currentCouple) {
     1044    currentCouple   = couple;
     1045    currentMaterial = couple->GetMaterial();
     1046    currentMaterialIndex = couple->GetIndex();
     1047    mfpKinEnergy = DBL_MAX;
     1048  }
     1049}
     1050
     1051//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1052
     1053inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
     1054{
     1055  G4bool b;
     1056  G4double x =
     1057    ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
     1058  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1059  return x;
     1060}
     1061
     1062//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1063
     1064inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
     1065{
     1066  G4bool b;
     1067  G4double x =
     1068    ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
     1069  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1070  return x;
     1071}
     1072
     1073//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1074
     1075inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
     1076{
     1077  G4bool b;
     1078  G4double x = 0.0;
     1079  //  if(theIonisationTable) {
     1080  x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
     1081    *chargeSqRatio;
     1082  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1083  //}
     1084  return x;
     1085}
     1086
     1087//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1088
     1089inline
     1090G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
     1091{
     1092  G4bool b;
     1093  G4double x = 0.0;
     1094  //if(theIonisationSubTable) {
     1095  x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
     1096    *chargeSqRatio;
     1097  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1098  //}
     1099  return x;
     1100}
     1101
     1102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1103
     1104inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
     1105{
     1106  G4bool b;
     1107  G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
     1108  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1109  return x;
     1110}
     1111
     1112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1113
    6361114inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
    6371115                G4double e)
     
    6481126  }
    6491127  return x;
    650 }
    651 
    652 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    653 
    654 inline G4double G4VEnergyLossProcess::GetRangeForLoss(
    655                 G4double& kineticEnergy,
    656                 const G4MaterialCutsCouple* couple)
    657 {
    658   DefineMaterial(couple);
    659   G4double x = DBL_MAX;
    660   if(theRangeTableForLoss)
    661     x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
    662   //  G4cout << "Range from " << GetProcessName()
    663   //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
    664   return x;
    665 }
    666 
    667 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    668 
    669 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
    670 {
    671   G4bool b;
    672   G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
    673   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    674   return x;
    675 }
    676 
    677 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    678 
    679 inline G4double G4VEnergyLossProcess::GetKineticEnergy(
    680                 G4double& range,
    681                 const G4MaterialCutsCouple* couple)
    682 {
    683   DefineMaterial(couple);
    684   G4double r = range/reduceFactor;
    685   G4double e = ScaledKinEnergyForLoss(r)/massRatio;
    686   return e;
    6871128}
    6881129
     
    7021143  }
    7031144  return e;
    704 }
    705 
    706 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    707 
    708 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
    709                                           const G4MaterialCutsCouple* couple)
    710 {
    711   DefineMaterial(couple);
    712   G4double x = 0.0;
    713   if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
    714   return x;
    7151145}
    7161146
     
    7491179//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7501180
    751 inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
    752          const G4Track& track, G4double x, G4double y, G4double& z)
    753 {
    754   G4GPILSelection sel;
    755   return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
    756 }
    757 
    758 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    759 
    760 inline G4double G4VEnergyLossProcess::SampleRange()
    761 {
    762   G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
    763   G4bool b;
    764   G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
    765   G4double x = fRange + G4RandGauss::shoot(0.0,s);
    766   if(x > 0.0) fRange = x;
    767   return fRange;
    768 }
    769 
    770 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    771 
    772 inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
    773 {
    774   DefineMaterial(track.GetMaterialCutsCouple());
    775   preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
    776   G4double x = DBL_MAX;
    777   if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
    778   return x;
    779 }
    780 
    781 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    782 
    783 inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
    784                 const G4ParticleDefinition*, const G4Material*, G4double cut)
    785 {
    786   return cut;
    787 }
    788 
    789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    790 
    791 inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
    792 {
    793   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
    794 }
    795 
    796 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    797 
    798 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
    799                    G4double kinEnergy, size_t& idx) const
    800 {
    801   return modelManager->SelectModel(kinEnergy, idx);
    802 }
    803 
    804 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    805 
    806 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
    807 {
    808   return particle;
    809 }
    810 
    811 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    812 
    813 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
    814 {
    815   return baseParticle;
    816 }
    817 
    818 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    819 
    820 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
    821 {
    822   return secondaryParticle;
    823 }
    824 
    825 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    826 
    827 inline void G4VEnergyLossProcess::CorrectionsAlongStep(
    828                              const G4MaterialCutsCouple*,
    829                              const G4DynamicParticle*,
    830                              G4double&,
    831                              G4double&)
    832 {}
    833 
    834 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    835 
    836 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
    837 {
    838   return theDEDXTable;
    839 }
    840 
    841 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    842 
    843 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
    844 {
    845   return theDEDXSubTable;
    846 }
    847 
    848 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    849 
    850 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
    851 {
    852   return theDEDXunRestrictedTable;
    853 }
    854 
    855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    856 
    857 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
    858 {
    859   G4PhysicsTable* t = theDEDXTable;
    860   if(theIonisationTable) t = theIonisationTable;
    861   return t;
    862 }
    863 
    864 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    865 
    866 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
    867 {
    868   G4PhysicsTable* t = theDEDXSubTable;
    869   if(theIonisationSubTable) t = theIonisationSubTable;
    870   return t;
    871 }
    872 
    873 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    874 
    875 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
    876 {
    877   return theCSDARangeTable;
    878 }
    879 
    880 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    881 
    882 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
    883 {
    884   return theRangeTableForLoss;
    885 }
    886 
    887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    888 
    889 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
    890 {
    891   return theInverseRangeTable;
    892 }
    893 
    894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    895 
    896 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
    897 {
    898   return theLambdaTable;
    899 }
    900 
    901 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    902 
    903 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
    904 {
    905   return theSubLambdaTable;
    906 }
    907 
    908 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    909  
    910 inline G4bool G4VEnergyLossProcess::IsIntegral() const
    911 {
    912   return integral;
    913 }
    914 
    915 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    916 
    917 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
    918 {
    919   return currentMaterialIndex;
    920 }
    921 
    922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    923 
    924 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
    925                                                        G4double charge2ratio)
    926 {
    927   massRatio     = massratio;
    928   chargeSqRatio = charge2ratio;
    929   chargeSquare  = charge2ratio*eplus*eplus;
    930   if(chargeSqRatio > 0.0) reduceFactor  = 1.0/(chargeSqRatio*massRatio);
    931 }
    932  
    933 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    934  
    935 inline G4double G4VEnergyLossProcess::GetCurrentRange() const
    936 {
    937   return fRange;
    938 }
    939 
    940 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    941 
    942 void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
    943                                       G4VEmFluctuationModel* fluc,
    944                                       const G4Region* region)
    945 {
    946   modelManager->AddEmModel(order, p, fluc, region);
    947   if(p) p->SetParticleChange(pParticleChange, fluc);
    948 }
    949 
    950 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    951 
    952 inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx)
    953 {
    954   return modelManager->GetModel(idx);
    955 }
    956 
    957 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    958 
    959 inline G4int G4VEnergyLossProcess::NumberOfModels()
    960 {
    961   return modelManager->NumberOfModels();
    962 }
    963 
    964 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    965 
    966 inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
    967 {
    968   G4int n = emModels.size();
    969   if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
    970   emModels[index] = p;
    971 }
    972 
    973 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    974 
    975 inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
    976 {
    977   G4VEmModel* p = 0;
    978   if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
    979   return p;
    980 }
    981 
    982 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    983 
    984 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
    985 {
    986   fluctModel = p;
    987 }
    988 
    989 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    990 
    991 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
    992 {
    993   return fluctModel;
    994 }
    995 
    996 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    997 
    998 inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
    999                                                 G4double emin, G4double emax)
    1000 {
    1001   modelManager->UpdateEmModel(nam, emin, emax);
    1002 }
    1003 
    1004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1005 
    1006 inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
    1007 {
    1008   integral = val;
    1009 }
    1010 
    1011 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1012 
    1013 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
    1014 {
    1015   particle = p;
    1016 }
    1017 
    1018 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1019 
    1020 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
    1021 {
    1022   baseParticle = p;
    1023 }
    1024 
    1025 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1026 
    1027 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
    1028 {
    1029   secondaryParticle = p;
    1030 }
    1031 
    1032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1033 
    1034 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
    1035 {
    1036   linLossLimit = val;
    1037 }
    1038 
    1039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1040 
    1041 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
    1042 {
    1043   lossFluctuationFlag = val;
    1044 }
    1045 
    1046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1047 
    1048 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
    1049 {
    1050   rndmStepFlag = val;
    1051 }
    1052 
    1053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1054 
    1055 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
    1056 {
    1057   minSubRange = val;
    1058 }
    1059 
    1060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1061 
    1062 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
    1063 {
    1064   return  tablesAreBuilt;
    1065 }
    1066 
    1067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1068 
    1069 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
    1070 {
    1071   return nSCoffRegions;
    1072 }
    1073 
    1074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1075 
    1076 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
    1077 {
    1078   nBins = nbins;
    1079 }
    1080 
    1081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1082 
    1083 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
    1084 {
    1085   nBins = nbins;
    1086 }
    1087 
    1088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1089 
    1090 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
    1091 {
    1092   nBinsCSDA = nbins;
    1093 }
    1094 
    1095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1096 
    1097 inline G4double G4VEnergyLossProcess::MinKinEnergy() const
    1098 {
    1099   return minKinEnergy;
    1100 }
    1101 
    1102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1103 
    1104 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
    1105 {
    1106   minKinEnergy = e;
    1107 }
    1108 
    1109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1110 
    1111 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
    1112 {
    1113   maxKinEnergy = e;
    1114   if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
    1115 }
    1116 
    1117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1118 
    1119 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
    1120 {
    1121   maxKinEnergyCSDA = e;
    1122 }
    1123 
    1124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1125 
    1126 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
    1127 {
    1128   return maxKinEnergy;
    1129 }
    1130 
    1131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1132 
    1133 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
    1134 {
    1135   if(val > 0.0 && val <= 1.0) lambdaFactor = val;
    1136 }
    1137 
    1138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1139 
    1140 inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
    1141 {
    1142   isIonisation = val;
    1143   if(val) aGPILSelection = CandidateForSelection;
    1144   else    aGPILSelection = NotCandidateForSelection;
    1145 }
    1146 
    1147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1148 
    1149 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
    1150 {
    1151   return isIonisation;
    1152 }
    1153 
    1154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1155 
    1156 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
    1157 {
    1158   dRoverRange = v1;
    1159   finalRange = v2;
    1160   if (dRoverRange > 0.999) dRoverRange = 1.0;
    1161   currentCouple = 0;
    1162   mfpKinEnergy  = DBL_MAX;
    1163 }
    1164 
    1165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1166 
    11671181#endif
  • trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VMultipleScattering.hh,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VMultipleScattering.hh,v 1.55 2009/02/18 12:19:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6363// 12-02-07 Add get/set skin (V.Ivanchenko)
    6464// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
     65// 15-07-08 Reorder class members for further multi-thread development (VI)
    6566//
    6667
     
    7273
    7374#include "G4VContinuousDiscreteProcess.hh"
    74 #include "G4LossTableManager.hh"
    7575#include "globals.hh"
    7676#include "G4Material.hh"
     
    9595
    9696  G4VMultipleScattering(const G4String& name = "msc",
    97                               G4ProcessType type = fElectromagnetic);
     97                        G4ProcessType type = fElectromagnetic);
    9898
    9999  virtual ~G4VMultipleScattering();
     
    104104
    105105  virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
    106     // True for all charged particles
    107106
    108107  virtual void PrintInfo() = 0;
     
    112111  virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
    113112
    114   //------------------------------------------------------------------------
    115   // Methods with standard implementation; may be overwritten if needed
    116   //------------------------------------------------------------------------
    117113public:
    118114
     
    138134  G4bool StorePhysicsTable(const G4ParticleDefinition*,
    139135                           const G4String& directory,
    140                                  G4bool ascii = false);
     136                           G4bool ascii = false);
    141137
    142138  // Retrieve Physics from a file.
     
    147143  G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
    148144                              const G4String& directory,
    149                                     G4bool ascii);
    150 
    151   //------------------------------------------------------------------------
    152   // Specific methods for msc processes
    153   //------------------------------------------------------------------------
     145                              G4bool ascii);
    154146
    155147  // The function overloads the corresponding function of the base
     
    158150  G4double AlongStepGetPhysicalInteractionLength(
    159151                                            const G4Track&,
    160                                                   G4double  previousStepSize,
    161                                                   G4double  currentMinimalStep,
    162                                                   G4double& currentSafety,
    163                                                   G4GPILSelection* selection);
     152                                            G4double  previousStepSize,
     153                                            G4double  currentMinimalStep,
     154                                            G4double& currentSafety,
     155                                            G4GPILSelection* selection);
    164156
    165157  // The function overloads the corresponding function of the base
     
    188180  inline void SetMinKinEnergy(G4double e);
    189181  inline G4double MinKinEnergy() const;
    190     // Print out of the class parameters
    191182
    192183  inline void SetMaxKinEnergy(G4double e);
     
    197188  inline G4PhysicsTable* LambdaTable() const;
    198189
    199   //------------------------------------------------------------------------
    200   // Define and access particle type
    201   //------------------------------------------------------------------------
    202 
     190  // access particle type
    203191  inline const G4ParticleDefinition* Particle() const;
    204   inline void SetParticle(const G4ParticleDefinition*);
    205192
    206193  //------------------------------------------------------------------------
     
    208195  //------------------------------------------------------------------------
    209196
    210   inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
    211 
     197protected:
     198  // Select model in run time
     199  inline G4VEmModel* SelectModel(G4double kinEnergy);
     200
     201public:
     202  // Select model in run time
    212203  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
    213204                                            size_t& idxRegion) const;
    214205
    215   // Access to models
    216   inline G4VEmModel* GetModelByIndex(G4int idx = 0);
    217 
    218   //------------------------------------------------------------------------
    219   // Parameters for simulation of multiple scattering
    220   //------------------------------------------------------------------------
    221 
     206  // Add model for region, smaller value of order defines which
     207  // model will be selected for a given energy interval 
     208  inline void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
     209
     210  // Access to models by index
     211  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
     212
     213  //------------------------------------------------------------------------
     214  // Get/Set parameters for simulation of multiple scattering
     215  //------------------------------------------------------------------------
     216
     217  inline G4bool LateralDisplasmentFlag() const;
    222218  inline void SetLateralDisplasmentFlag(G4bool val);
    223      // lateral displacement to be/not to be computed
    224 
     219
     220  inline G4double Skin() const;
    225221  inline void SetSkin(G4double val);
    226      // skin parameter
    227 
     222
     223  inline G4double RangeFactor() const;
    228224  inline void SetRangeFactor(G4double val);
    229      // FactorRange parameter
    230 
     225
     226  inline G4double GeomFactor() const;
    231227  inline void SetGeomFactor(G4double val);
    232      // FactorRange parameter
    233 
     228
     229  inline G4double PolarAngleLimit() const;
     230  inline void SetPolarAngleLimit(G4double val);
     231
     232  inline G4MscStepLimitType StepLimitType() const;
    234233  inline void SetStepLimitType(G4MscStepLimitType val);
    235      // FactorRange parameter
     234
     235  //------------------------------------------------------------------------
     236  // Run time methods
     237  //------------------------------------------------------------------------
    236238
    237239protected:
     
    241243                           G4double,
    242244                           G4ForceCondition* condition);
    243 
    244   //------------------------------------------------------------------------
    245   // Run time methods
    246   //------------------------------------------------------------------------
    247245
    248246  // This method is not used for tracking, it returns step limit
     
    252250                                  G4double& currentSafety);
    253251
    254   inline G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
     252  inline G4double GetLambda(const G4ParticleDefinition* p,
     253                            G4double& kineticEnergy);
    255254
    256255  // This method is used for tracking, it returns step limit
    257256  inline G4double GetMscContinuousStepLimit(const G4Track& track,
    258                                             G4double previousStepSize,
     257                                            G4double scaledKinEnergy,
    259258                                            G4double currentMinimalStep,
    260259                                            G4double& currentSafety);
    261260
    262   inline G4VEmModel* SelectModel(G4double kinEnergy);
    263   // Select concrete model
     261  // define current material
     262  inline void DefineMaterial(const G4MaterialCutsCouple* couple);
    264263
    265264  inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
    266   // Return current G4MaterialCutsCouple
    267 
    268   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
    269   // define current material
    270 
    271   //------------------------------------------------------------------------
    272   // Parameters for simulation of multiple scattering
    273   //------------------------------------------------------------------------
    274 
    275   inline G4double Skin() const;
    276 
    277   inline G4double RangeFactor() const;
    278 
    279   inline G4double GeomFactor() const;
    280 
    281   inline G4MscStepLimitType StepLimitType() const;
    282 
    283   inline G4bool LateralDisplasmentFlag() const;
     265
     266  inline G4ParticleChangeForMSC* GetParticleChange();
     267
    284268
    285269private:
    286270
    287271  // hide  assignment operator
    288 
    289272  G4VMultipleScattering(G4VMultipleScattering &);
    290273  G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
    291274
    292   // =====================================================================
    293 
    294 protected:
    295 
    296   G4GPILSelection             valueGPILSelectionMSC;
    297   G4ParticleChangeForMSC      fParticleChange;
    298 
    299 private:
     275  // ======== Parameters of the class fixed at construction =========
    300276
    301277  G4EmModelManager*           modelManager;
    302   G4VEmModel*                 currentModel;
     278  G4bool                      buildLambdaTable;
     279
     280  // ======== Parameters of the class fixed at initialisation =======
     281
    303282  G4PhysicsTable*             theLambdaTable;
    304 
    305   // cache
    306283  const G4ParticleDefinition* firstParticle;
    307   const G4ParticleDefinition* currentParticle;
    308   const G4MaterialCutsCouple* currentCouple;
    309   size_t                      currentMaterialIndex;
    310 
    311   G4int                       nBins;
    312284
    313285  G4MscStepLimitType          stepLimit;
     
    318290  G4double                    facrange;
    319291  G4double                    facgeom;
     292  G4double                    polarAngleLimit;
     293
     294  G4int                       nBins;
    320295
    321296  G4bool                      latDisplasment;
    322   G4bool                      buildLambdaTable;
     297
     298  // ======== Cashed values - may be state dependent ================
     299
     300protected:
     301
     302  G4GPILSelection             valueGPILSelectionMSC;
     303  G4ParticleChangeForMSC      fParticleChange;
     304
     305private:
     306
     307  G4VEmModel*                 currentModel;
     308
     309  // cache
     310  const G4ParticleDefinition* currentParticle;
     311  const G4MaterialCutsCouple* currentCouple;
     312  size_t                      currentMaterialIndex;
     313
    323314};
    324315
    325316//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    326 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    327 
    328 inline void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
    329 {
    330   if(couple != currentCouple) {
    331     currentCouple   = couple;
    332     currentMaterialIndex = couple->GetIndex();
    333   }
    334 }
    335 
    336 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    337 
    338 inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
    339                                           const G4Track& track,
    340                                                 G4double,
    341                                                 G4double currentMinimalStep,
    342                                                 G4double&)
    343 {
    344   G4double x = currentMinimalStep;
    345   G4double e = track.GetKineticEnergy();
    346   DefineMaterial(track.GetMaterialCutsCouple());
    347   currentModel = SelectModel(e);
    348   if(x > 0.0 && e > 0.0) {
    349     G4double tPathLength =
    350       currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x);
    351     if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection;
    352     x = currentModel->ComputeGeomPathLength(tPathLength); 
    353     //  G4cout << "tPathLength= " << tPathLength
    354     //         << " stepLimit= " << x
    355     //        << " currentMinimalStep= " << currentMinimalStep<< G4endl;
    356   }
    357   return x;
    358 }
    359 
    360317//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    361318
     
    367324{
    368325  return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
    369                                       currentSafety);
    370 }
    371 
    372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    373 
    374 inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, G4double& e)
     326                                   currentSafety);
     327}
     328
     329//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     330
     331inline void G4VMultipleScattering::SetBinning(G4int nbins)
     332{
     333  nBins = nbins;
     334}
     335
     336//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     337
     338inline G4int G4VMultipleScattering::Binning() const
     339{
     340  return nBins;
     341}
     342
     343//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     344
     345inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
     346{
     347  minKinEnergy = e;
     348}
     349
     350//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     351
     352inline G4double G4VMultipleScattering::MinKinEnergy() const
     353{
     354  return minKinEnergy;
     355}
     356
     357//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     358
     359inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
     360{
     361  maxKinEnergy = e;
     362}
     363
     364//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     365
     366inline G4double G4VMultipleScattering::MaxKinEnergy() const
     367{
     368  return maxKinEnergy;
     369}
     370
     371//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     372
     373inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
     374{
     375  buildLambdaTable = val;
     376}
     377
     378//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     379
     380inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
     381{
     382  return theLambdaTable;
     383}
     384
     385//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     386
     387inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
     388{
     389  return currentParticle;
     390}
     391
     392//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     393
     394inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
     395                                              const G4Region* region)
     396{
     397  G4VEmFluctuationModel* fm = 0;
     398  modelManager->AddEmModel(order, p, fm, region);
     399  if(p) p->SetParticleChange(pParticleChange);
     400}
     401
     402//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     403
     404inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
     405{
     406  return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
     407}
     408
     409//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     410
     411inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
     412                   G4double kinEnergy, size_t& idxRegion) const
     413{
     414  return modelManager->SelectModel(kinEnergy, idxRegion);
     415}
     416
     417//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     418
     419inline
     420G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver)
     421{
     422  return modelManager->GetModel(idx, ver);
     423}
     424
     425//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     426
     427inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
     428{
     429  return latDisplasment;
     430}
     431
     432//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     433
     434inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
     435{
     436  latDisplasment = val;
     437}
     438
     439//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     440
     441inline  G4double G4VMultipleScattering::Skin() const
     442{
     443  return skin;
     444}
     445
     446//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     447
     448inline  void G4VMultipleScattering::SetSkin(G4double val)
     449{
     450  if(val < 1.0) skin = 0.0;
     451  else          skin = val;
     452}
     453
     454//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     455
     456inline  G4double G4VMultipleScattering::RangeFactor() const
     457{
     458  return facrange;
     459}
     460
     461//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     462
     463inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
     464{
     465  if(val > 0.0) facrange = val;
     466}
     467
     468//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     469
     470inline  G4double G4VMultipleScattering::GeomFactor() const
     471{
     472  return facgeom;
     473}
     474
     475//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     476
     477inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
     478{
     479  if(val > 0.0) facgeom = val;
     480}
     481
     482//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     483
     484inline  G4double G4VMultipleScattering::PolarAngleLimit() const
     485{
     486  return polarAngleLimit;
     487}
     488
     489//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     490
     491inline  void G4VMultipleScattering::SetPolarAngleLimit(G4double val)
     492{
     493  if(val < 0.0)     polarAngleLimit = 0.0;
     494  else if(val > pi) polarAngleLimit = pi;
     495  else              polarAngleLimit = val;
     496}
     497
     498//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     499
     500inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
     501{
     502  return stepLimit;
     503}
     504
     505//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     506
     507inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val)
     508{
     509  stepLimit = val;
     510  if(val == fMinimal) facrange = 0.2;
     511}
     512
     513//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     514
     515inline
     516G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
     517                                          G4double& e)
    375518{
    376519  G4double x;
     
    388531//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    389532
    390 inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
    391 {
    392   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
    393 }
    394 
    395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    396 
    397 inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
    398                                            G4double kinEnergy, size_t& idxRegion) const
    399 {
    400   return modelManager->SelectModel(kinEnergy, idxRegion);
    401 }
    402 
    403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    404 
    405 inline void G4VMultipleScattering::SetBinning(G4int nbins)
    406 {
    407   nBins = nbins;
    408 }
    409 
    410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    411 
    412 inline G4int G4VMultipleScattering::Binning() const
    413 {
    414   return nBins;
    415 }
    416 
    417 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    418 
    419 inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
    420 {
    421   minKinEnergy = e;
    422 }
    423 
    424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    425 
    426 inline G4double G4VMultipleScattering::MinKinEnergy() const
    427 {
    428   return minKinEnergy;
    429 }
    430 
    431 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    432 
    433 inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
    434 {
    435   maxKinEnergy = e;
    436 }
    437 
    438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    439 
    440 inline G4double G4VMultipleScattering::MaxKinEnergy() const
    441 {
    442   return maxKinEnergy;
    443 }
    444 
    445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    446 
    447 inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
    448 {
    449   return latDisplasment;
    450 }
    451 
    452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    453 
    454 inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
    455 {
    456   latDisplasment = val;
    457 }
    458 
    459 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    460 
    461 inline  G4double G4VMultipleScattering::Skin() const
    462 {
    463   return skin;
    464 }
    465 
    466 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    467 
    468 inline  void G4VMultipleScattering::SetSkin(G4double val)
    469 {
    470   if(val <= 0.99999) {
    471     skin = 0.0;
    472     stepLimit = fUseSafety;
    473   } else {
    474     skin = val;
    475     stepLimit = fUseDistanceToBoundary;
     533inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
     534                                          const G4Track& track,
     535                                          G4double scaledKinEnergy,
     536                                          G4double currentMinimalStep,
     537                                          G4double&)
     538{
     539  G4double x = currentMinimalStep;
     540  DefineMaterial(track.GetMaterialCutsCouple());
     541  currentModel = SelectModel(scaledKinEnergy);
     542  if(x > 0.0 && scaledKinEnergy > 0.0) {
     543    G4double tPathLength =
     544      currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x);
     545    if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection;
     546    x = currentModel->ComputeGeomPathLength(tPathLength); 
     547    //  G4cout << "tPathLength= " << tPathLength
     548    //         << " stepLimit= " << x
     549    //        << " currentMinimalStep= " << currentMinimalStep<< G4endl;
    476550  }
    477 }
    478 
    479 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    480 
    481 inline  G4double G4VMultipleScattering::RangeFactor() const
    482 {
    483   return facrange;
    484 }
    485 
    486 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    487 
    488 inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
    489 {
    490   if(val > 0.0) facrange = val;
    491 }
    492 
    493 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    494 
    495 inline  G4double G4VMultipleScattering::GeomFactor() const
    496 {
    497   return facgeom;
    498 }
    499 
    500 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    501 
    502 inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
    503 {
    504   if(val > 0.0) facgeom = val;
    505 }
    506 
    507 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    508 
    509 inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
    510 {
    511   return stepLimit;
    512 }
    513 
    514 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    515 
    516 inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val)
    517 {
    518   stepLimit = val;
    519   if(val == fMinimal) {
    520     skin = 0;
    521     facrange = 0.2;
    522   } else if(val == fUseSafety) {
    523     skin = 0;
     551  return x;
     552}
     553
     554//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     555
     556inline
     557void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
     558{
     559  if(couple != currentCouple) {
     560    currentCouple   = couple;
     561    currentMaterialIndex = couple->GetIndex();
    524562  }
    525563}
     
    527565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    528566
    529 inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
    530 {
    531    buildLambdaTable = val;
    532 }
    533 
    534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    535 
    536 inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
    537 {
    538   return currentParticle;
    539 }
    540 
    541 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    542 
    543 inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
    544 {
    545   return theLambdaTable;
    546 }
    547 
    548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    549 
    550 inline
    551 const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
     567inline const G4MaterialCutsCouple*
     568G4VMultipleScattering::CurrentMaterialCutsCouple() const
    552569{
    553570  return currentCouple;
     
    556573//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    557574
    558 inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
    559                                               const G4Region* region)
    560 {
    561   G4VEmFluctuationModel* fm = 0;
    562   modelManager->AddEmModel(order, p, fm, region);
    563   if(p)p->SetParticleChange(pParticleChange);
    564 }
    565 
    566 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    567 
    568 inline G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx)
    569 {
    570   return modelManager->GetModel(idx);
     575inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange()
     576{
     577  return &fParticleChange;
    571578}
    572579
  • trunk/source/processes/electromagnetic/utils/include/G4ionEffectiveCharge.hh

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionEffectiveCharge.hh,v 1.8 2006/08/15 16:21:39 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionEffectiveCharge.hh,v 1.12 2008/09/20 19:39:34 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5656
    5757#include "globals.hh"
     58#include "G4ParticleDefinition.hh"
    5859
    5960class G4Material;
    60 class G4ParticleDefinition;
     61class G4NistManager;
    6162
    6263class G4ionEffectiveCharge
     
    8485  G4ionEffectiveCharge(const G4ionEffectiveCharge&);
    8586
     87  G4NistManager*              nist;
     88
     89  const G4ParticleDefinition* lastPart;
     90  const G4Material*           lastMat;
     91  G4double                    lastKinEnergy;
     92
    8693  G4double                    chargeCorrection;
     94  G4double                    effCharge;
     95
    8796  G4double                    energyHighLimit;
    8897  G4double                    energyLowLimit;
     
    100109                                 G4double kineticEnergy)
    101110{
    102   G4double charge = EffectiveCharge(p,material,kineticEnergy)/eplus;
    103   charge *= chargeCorrection;
     111  G4double charge = effCharge;
     112  if( kineticEnergy != lastKinEnergy || material != lastMat || p != lastPart) {
     113    charge = EffectiveCharge(p,material,kineticEnergy);
     114  }
     115  charge *= chargeCorrection/CLHEP::eplus;
    104116
    105117  return charge*charge;
  • trunk/source/processes/electromagnetic/utils/src/G4DummyModel.cc

    r819 r961  
    2525//
    2626// $Id: G4DummyModel.cc,v 1.3 2007/05/22 17:31:58 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/utils/src/G4EmCalculator.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmCalculator.cc,v 1.37 2007/08/16 15:55:42 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4EmCalculator.cc,v 1.46 2009/02/24 09:56:03 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555//            10 keV to 1 keV (V. Ivanchenko)
    5656// 15.03.2007 Add ComputeEnergyCutFromRangeCut methods (V.Ivanchenko)
     57// 21.04.2008 Updated computations for ions (V.Ivanchenko)
    5758//
    5859// Class Description:
     
    126127  if(couple && UpdateParticle(p, kinEnergy) ) {
    127128    res = manager->GetDEDX(p, kinEnergy, couple);
     129    if(isIon) {
     130      G4double eth = 2.0*MeV/massRatio;
     131      if(kinEnergy > eth) {
     132        G4double x1 = corr->ComputeIonCorrections(p,mat,kinEnergy);
     133        G4double x2 = corr->ComputeIonCorrections(p,mat,eth);
     134        res += x1 - x2*eth/kinEnergy;
     135        /*     
     136        G4cout << "### GetDEDX: E= " << kinEnergy << " res= " << res
     137               << " x1= " << x1 << " x2= " << x2
     138               << " del= " << x1 - x2*eth/kinEnergy << G4endl;;
     139        */
     140      }
     141    }
     142
    128143    if(verbose>0) {
    129144      G4cout << "G4EmCalculator::GetDEDX: E(MeV)= " << kinEnergy/MeV
     
    406421        res = currentModel->ComputeDEDXPerVolume(
    407422              mat, baseParticle, escaled, cut) * chargeSquare;
    408         if(verbose > 1)
     423        if(verbose > 1) {
    409424          G4cout <<  baseParticle->GetParticleName()
    410425                 << " Escaled(MeV)= " << escaled;
     426        }
    411427      } else {
    412428        res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
    413429        if(verbose > 1) G4cout <<  " no basePart E(MeV)= " << kinEnergy;
    414430      }
    415       if(verbose > 1)
     431      if(verbose > 1) {
    416432        G4cout << " DEDX(MeV/mm)= " << res*mm/MeV
    417433               << " DEDX(MeV*cm^2/g)= "
    418434               << res*gram/(MeV*cm2*mat->GetDensity())
    419435               << G4endl;
    420 
    421       if(isIon) {
    422         if(currentModel->HighEnergyLimit() > 100.*MeV)
    423           res += corr->HighOrderCorrections(p,mat,kinEnergy);
    424         else
    425           res *= corr->EffectiveChargeCorrection(p,mat,kinEnergy);
    426         if(verbose > 1)
    427           G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
    428                  << " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
    429                  << G4endl;
    430       }
    431 
    432      
     436      }
     437
    433438      // emulate boundary region for different parameterisations
    434439      G4double eth = currentModel->LowEnergyLimit();
     
    447452          res0 = loweModel->ComputeDEDXPerVolume(mat, p, eth, cut);
    448453        }
    449         if(verbose > 1)
     454        if(verbose > 1) {
    450455          G4cout << "At boundary energy(MeV)= " << eth/MeV
    451456                 << " DEDX(MeV/mm)= " << res1*mm/MeV
    452457                 << G4endl;
    453         if(isIon) res1 += corr->HighOrderCorrections(p,mat,eth/massRatio);
    454         //G4cout << "eth= " << eth << " escaled= " << escaled
    455         //  << " res0= " << res0 << " res1= "
    456         //       << res1 <<  "  q2= " << chargeSquare << G4endl;
     458        }
     459        /*
     460        G4cout << "eth= " << eth << " escaled= " << escaled
     461               << " res0= " << res0 << " res1= "
     462               << res1 <<  "  q2= " << chargeSquare << G4endl;
     463        */
    457464        res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
     465
     466        if(isIon) {
     467          G4double ethscaled = eth/massRatio;
     468          if(kinEnergy > ethscaled) {
     469            G4double x1 = corr->ComputeIonCorrections(p,mat,kinEnergy);
     470            G4double x2 = corr->ComputeIonCorrections(p,mat,ethscaled);
     471            res += x1 - x2*ethscaled/kinEnergy;
     472          }
     473       
     474          if(verbose > 1) {
     475            G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
     476                   << " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
     477                   << G4endl;
     478          }
     479        }
    458480      }
    459481     
     
    507529//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    508530
    509 G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition* part,
    510                                           const G4Material* mat, G4double cut)
     531G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy,
     532                                          const G4ParticleDefinition* part,
     533                                          const G4Material* mat,
     534                                          G4double cut)
    511535{
    512536  G4double dedx = ComputeElectronicDEDX(kinEnergy,part,mat,cut);
     
    517541//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    518542
    519 G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4String& part,
    520                                           const G4String& mat, G4double cut)
     543G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy,
     544                                          const G4String& part,
     545                                          const G4String& mat,
     546                                          G4double cut)
    521547{
    522548  return ComputeTotalDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
     
    729755    if(currentProcess) currentProcessName = currentProcess->GetProcessName();
    730756
    731     if(p->GetParticleType() == "nucleus" &&
    732        currentParticleName  != "deuteron" && currentParticleName != "triton") {
     757    if(p->GetParticleType() == "nucleus"
     758       && currentParticleName != "deuteron" 
     759       && currentParticleName != "triton"
     760       && currentParticleName != "alpha+"
     761       && currentParticleName != "helium"
     762       && currentParticleName != "hydrogen"
     763      ) {
    733764      baseParticle = theGenericIon;
    734765      massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
     
    755786  if(isIon) {
    756787    chargeSquare =
    757      ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
    758     if(currentProcess)
     788     ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy)
     789      * corr->EffectiveChargeCorrection(p,currentMaterial,kinEnergy);
     790    if(currentProcess) {
    759791      currentProcess->SetDynamicMassCharge(massRatio,chargeSquare);
    760     // G4cout << "massR= " << massRatio << "   q2= " << chargeSquare << G4endl;
     792      //G4cout << "NewP: massR= " << massRatio << "   q2= " << chargeSquare << G4endl;
     793    }
    761794  }
    762795  return true;
  • trunk/source/processes/electromagnetic/utils/src/G4EmCorrections.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmCorrections.cc,v 1.23.2.1 2008/04/22 15:28:13 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4EmCorrections.cc,v 1.51 2008/12/18 13:01:44 gunter Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4444// 08.05.2007 V.Ivanchenko Use G4IonTable for ion mass instead of NistTable to avoid
    4545//                         division by zero
     46// 29.02.2008 V.Ivanchenko use expantions for log and power function
     47// 21.04.2008 Updated computations for ions (V.Ivanchenko)
     48// 20.05.2008 Removed Finite Size correction (V.Ivanchenko)
    4649//
    4750//
     
    5659#include "G4EmCorrections.hh"
    5760#include "Randomize.hh"
    58 #include "G4NistManager.hh"
    5961#include "G4ParticleTable.hh"
    6062#include "G4IonTable.hh"
    6163#include "G4VEmModel.hh"
    6264#include "G4Proton.hh"
     65#include "G4GenericIon.hh"
    6366#include "G4LPhysicsFreeVector.hh"
     67#include "G4PhysicsLogVector.hh"
     68#include "G4ProductionCutsTable.hh"
     69#include "G4MaterialCutsCouple.hh"
    6470
    6571//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    6773G4EmCorrections::G4EmCorrections()
    6874{
    69   Initialise();
    7075  particle   = 0;
    7176  curParticle= 0;
     
    7479  curVector  = 0;
    7580  kinEnergy  = 0.0;
    76   ionModel   = 0;
     81  ionLEModel = 0;
     82  ionHEModel = 0;
    7783  nIons      = 0;
    7884  verbose    = 1;
     85  ncouples   = 0;
    7986  massFactor = 1.0;
     87  eth        = 2.0*MeV;
     88  nbinCorr   = 20;
     89  eCorrMin   = 25.*keV;
     90  eCorrMax   = 250.*MeV;
    8091  nist = G4NistManager::Instance();
    8192  ionTable = G4ParticleTable::GetParticleTable()->GetIonTable();
     93  Initialise();
    8294}
    8395
     
    93105G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
    94106                                               const G4Material* mat,
    95                                                G4double e)
     107                                               G4double e, G4double)
    96108{
    97109// . Z^3 Barkas effect in the stopping power of matter for charged particles
     
    108120  G4double Bloch  = BlochCorrection (p, mat, e);
    109121  G4double Mott   = MottCorrection (p, mat, e);
    110   G4double FSize  = FiniteSizeCorrection (p, mat, e);
    111 
    112   G4double sum = (2.0*(Barkas + Bloch) + FSize + Mott);
     122
     123  G4double sum = (2.0*(Barkas + Bloch) + Mott);
    113124
    114125  if(verbose > 1)
    115126    G4cout << "EmCorrections: E(MeV)= " << e/MeV << " Barkas= " << Barkas
    116            << " Bloch= " << Bloch << " Mott= " << Mott << " Fsize= " << FSize
     127           << " Bloch= " << Bloch << " Mott= " << Mott
    117128           << " Sum= " << sum << G4endl;
    118129
    119130  sum *= material->GetElectronDensity() * q2 *  twopi_mc2_rcl2 /beta2;
     131  return sum;
     132}
     133
     134//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     135
     136G4double G4EmCorrections::IonBarkasCorrection(const G4ParticleDefinition* p,
     137                                              const G4Material* mat,
     138                                              G4double e)
     139{
     140// . Z^3 Barkas effect in the stopping power of matter for charged particles
     141//   J.C Ashley and R.H.Ritchie
     142//   Physical review B Vol.5 No.7 1 April 1972 pagg. 2393-2397
     143//   and ICRU49 report
     144//   valid for kineticEnergy < 0.5 MeV
     145
     146  SetupKinematics(p, mat, e);
     147  G4double res = 0.0;
     148  if(tau > 0.0)
     149    res = 2.0*BarkasCorrection(p, mat, e)*
     150      material->GetElectronDensity() * q2 *  twopi_mc2_rcl2 /beta2;
     151  return res;
     152}
     153
     154//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     155
     156G4double G4EmCorrections::ComputeIonCorrections(const G4ParticleDefinition* p,
     157                                                const G4Material* mat,
     158                                                G4double e)
     159{
     160// . Z^3 Barkas effect in the stopping power of matter for charged particles
     161//   J.C Ashley and R.H.Ritchie
     162//   Physical review B Vol.5 No.7 1 April 1972 pagg. 2393-2397
     163//   and ICRU49 report
     164//   valid for kineticEnergy < 0.5 MeV
     165//   Other corrections from S.P.Ahlen Rev. Mod. Phys., Vol 52, No1, 1980
     166  SetupKinematics(p, mat, e);
     167  if(tau <= 0.0) return 0.0;
     168
     169  G4double Barkas = BarkasCorrection (p, mat, e);
     170  G4double Bloch  = BlochCorrection (p, mat, e);
     171  G4double Mott   = MottCorrection (p, mat, e);
     172
     173  G4double sum = 2.0*(Barkas*(charge - 1.0)/charge + Bloch) + Mott;
     174
     175  if(verbose > 1) {
     176    G4cout << "EmCorrections: E(MeV)= " << e/MeV << " Barkas= " << Barkas
     177           << " Bloch= " << Bloch << " Mott= " << Mott
     178           << " Sum= " << sum << G4endl;
     179  }
     180  sum *= material->GetElectronDensity() * q2 *  twopi_mc2_rcl2 /beta2;
     181
     182  if(verbose > 1) G4cout << " Sum= " << sum << G4endl;
     183  return sum;
     184}
     185
     186//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     187
     188G4double G4EmCorrections::IonHighOrderCorrections(const G4ParticleDefinition* p,
     189                                                  const G4MaterialCutsCouple* couple,
     190                                                  G4double e)
     191{
     192// . Z^3 Barkas effect in the stopping power of matter for charged particles
     193//   J.C Ashley and R.H.Ritchie
     194//   Physical review B Vol.5 No.7 1 April 1972 pagg. 2393-2397
     195//   and ICRU49 report
     196//   valid for kineticEnergy < 0.5 MeV
     197//   Other corrections from S.P.Ahlen Rev. Mod. Phys., Vol 52, No1, 1980
     198
     199  G4double sum = 0.0;
     200
     201  if(ionHEModel) {
     202    G4int Z = G4int(p->GetPDGCharge()/eplus + 0.5);
     203    if(Z >= 100)   Z = 99;
     204    else if(Z < 1) Z = 1;
     205
     206    // fill vector
     207    if(thcorr[Z].size() == 0) {
     208      thcorr[Z].resize(ncouples);
     209      G4double ethscaled = eth*p->GetPDGMass()/proton_mass_c2;
     210
     211      for(size_t i=0; i<ncouples; i++) {
     212        (thcorr[Z])[i] = ethscaled*ComputeIonCorrections(p, currmat[i], ethscaled);
     213        //G4cout << i << ". ethscaled= " << ethscaled
     214        //<< " corr= " << (thcorr[Z])[i]/ethscaled << G4endl;
     215      }
     216    }
     217    G4double rest = (thcorr[Z])[couple->GetIndex()];
     218
     219    sum = ComputeIonCorrections(p,couple->GetMaterial(),e) - rest/e;
     220
     221    if(verbose > 1) G4cout << " Sum= " << sum << " dSum= " << rest/e << G4endl;
     222  }
    120223  return sum;
    121224}
     
    226329    G4int ieta = Index(y, Eta, nEtaK);
    227330    corr = Value2(x, y, TheK[itet], TheK[itet+1], Eta[ieta], Eta[ieta+1],
    228                   CK[itet][ieta], CK[itet+1][ieta], CK[itet][ieta+1], CK[itet+1][ieta+1]);
     331                  CK[itet][ieta], CK[itet+1][ieta],
     332                  CK[itet][ieta+1], CK[itet+1][ieta+1]);
    229333    //G4cout << "   x= " <<x<<" y= "<<y<<" tet= " <<TheK[itet]
    230334    //<<" "<< TheK[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
     
    439543    else {
    440544      G4int iw = Index(W, engBarkas, 47);
    441       val = Value(W, engBarkas[iw], engBarkas[iw+1], corBarkas[iw], corBarkas[iw+1]);
     545      val = Value(W, engBarkas[iw], engBarkas[iw+1],
     546                  corBarkas[iw], corBarkas[iw+1]);
    442547    }
    443548    //    G4cout << "i= " << i << " b= " << b << " W= " << W
     
    479584{
    480585  SetupKinematics(p, mat, e);
    481   G4double mterm = pi*fine_structure_const*beta*charge;
    482   /*
    483   G4double mterm = 0.0;
    484   if(beta > 0.0) {
    485 
    486     // Estimation of mean square root of the ionisation potential
    487     G4double Zeff = 0.0;
    488     G4double norm = 0.0;
    489 
    490     for (G4int i = 0; i<numberOfElements; i++) {
    491       G4double Z = (*theElementVector)[i]->GetZ();
    492       Zeff += Z*atomDensity[i];
    493       norm += atomDensity[i];
    494     }
    495     Zeff *= (2.0/norm);
    496     G4double ze1 = std::log(Zeff);
    497     G4double eexc= material->GetIonisation()->GetMeanExcitationEnergy()*ze1*ze1/Zeff;
    498 
    499     G4double invbeta = 1.0/beta;
    500     G4double invbeta2= invbeta*invbeta;
    501     G4double za  = charge*fine_structure_const;
    502     G4double za2 = za*za;
    503     G4double za3 = za2*za;
    504     G4double x   = za*invbeta;
    505     G4double cosx;
    506     if(x < COSEB[13]) {
    507       G4int i = Index(x,COSEB,14);
    508       cosx    = Value(x,COSEB[i], COSEB[i+1],COSXI[i],COSXI[i+1]);
    509     } else {
    510       cosx = COSXI[13]*COSEB[13]/x;
    511     }
    512 
    513     mterm =
    514       za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))));
    515       + za2*(3.246 - 0.451*beta2)
    516       + za3*(1.522*beta + 0.987*invbeta)
    517       + za2*za2*(4.569 - 0.494*beta2 - 2.696*invbeta2)
    518       + za3*za2*(1.254*beta + 0.222*invbeta - 1.17*invbeta*invbeta2);
    519   }
    520 */ 
     586  G4double mterm = CLHEP::pi*fine_structure_const*beta*charge;
    521587  return mterm;
    522 }
    523 
    524 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    525 
    526 G4double G4EmCorrections::FiniteSizeCorrection(const G4ParticleDefinition* p,
    527                                                const G4Material* mat,
    528                                                G4double e)
    529   // Finite size corrections are parameterized according to
    530   // J.D.Jackson Phys. Rev. D59 (1998) 017301
    531 {
    532   if(p) return 0.0;
    533   SetupKinematics(p, mat, e);
    534   G4double term = 0.0;
    535   G4double numlim = 0.2;
    536 
    537   //Leptons
    538   if(p->GetLeptonNumber() != 0) {
    539     G4double x =  tmax/(e + mass);
    540     term = x*x;
    541 
    542     // Pions and Kaons
    543   } else if(p->GetPDGSpin() == 0.0 && q2 < 1.5) {
    544     G4double xpi = 0.736*GeV;
    545     G4double x   = 2.0*electron_mass_c2*tmax0/(xpi*xpi);
    546     if(x <= numlim) term = -x*(1.0 - 0.5*x);
    547     else            term = -std::log(1.0 + x);
    548 
    549     // Protons and baryons
    550   } else if(q2 < 1.5) {
    551     G4double xp = 0.8426*GeV;
    552     G4double x  = 2.0*electron_mass_c2*tmax0/(xp*xp);
    553     G4double ksi2 = 2.79285*2.79285;
    554     if(x <= numlim) term = -x*((1.0 + 5.0*x/6.0)/((1.0 + x)*(1 + x)) + 0.5*x);
    555     else term = -x*(1.0 + 5.0*x/6.0)/((1.0 + x)*(1 + x)) - std::log(1.0 + x);
    556     G4double b  = xp*0.5/mass;
    557     G4double c  = xp*mass/(electron_mass_c2*(mass + e));
    558     G4double lb = b*b;
    559     G4double lb2= lb*lb;
    560     G4double nu = 0.5*c*c;
    561     G4double x1 = 1.0 + x;
    562     G4double x2 = x1*x1;
    563     G4double l1 = 1.0 - lb;
    564     G4double l2 = l1*l1;
    565     G4double lx = 1.0 + lb*x;
    566     G4double ia = lb2*(lx*std::log(lx/x1)/x + l1 -
    567                        0.5*x*l2/(lb*x1) +
    568                        x*(3.0 + 2.0*x)*l2*l1/(6.0*x2*lb2))/(l2*l2);
    569     G4double ib = x*x*(3.0 + x)/(6.0*x2*x1);
    570     term += lb*((ksi2 - 1.0)*ia + nu*ksi2*ib);
    571     // G4cout << "Proton F= " << term << " ia= " << ia << " ib= " << ib << " lb= " << lb<< G4endl;
    572    
    573     //ions
    574   } else {
    575     G4double xp = 0.8426*GeV/std::pow(mass/proton_mass_c2,-0.33333333);
    576     G4double x  = 2.0*electron_mass_c2*tmax0/(xp*xp);
    577     if(x <= numlim) term = -x*(1.0 - 0.5*x);
    578     else            term = -std::log(1.0 + x);
    579     //G4cout << "Ion F= " << term << G4endl;
    580   }
    581 
    582   return term;
    583588}
    584589
     
    629634  if (er >= ed[0])       nloss = a[0];
    630635  else {
     636    // the table is inverse in energy
    631637    for (G4int i=102; i>=0; i--)
    632638    {
     
    657663//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    658664
    659 G4ionEffectiveCharge* G4EmCorrections::GetIonEffectiveCharge(G4VEmModel* m)
    660 {
    661   if(m) ionModel = m;
    662   return &effCharge;
    663 }
    664 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    665 
    666 G4int G4EmCorrections::GetNumberOfStoppingVectors()
    667 {
    668   return nIons;
    669 }
    670 
    671 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    672 
    673665G4double G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
    674666                                                    const G4Material* mat,
     
    676668{
    677669  G4double factor = 1.0;
    678   if(p->GetPDGCharge() <= 2.5*eplus) return factor;
    679   if(verbose > 1)
    680     G4cout << "EffectiveChargeCorrection: " << p->GetParticleName() << " in " << mat->GetName()
     670  if(p->GetPDGCharge() <= 2.5*eplus || nIons <= 0) return factor;
     671  /*
     672  if(verbose > 1) {
     673    G4cout << "EffectiveChargeCorrection: " << p->GetParticleName()
     674           << " in " << mat->GetName()
    681675           << " ekin(MeV)= " << ekin/MeV << G4endl;
     676  }
     677  */
    682678  if(p != curParticle || mat != curMaterial) {
    683679    curParticle = p;
    684     curMaterial = 0;
     680    curMaterial = mat;
    685681    curVector   = 0;
    686     G4int Z = p->GetAtomicNumber();
    687     G4int A = p->GetAtomicMass();
    688     if(verbose > 1) G4cout << "Zion= " << Z << " Aion= " << A << G4endl;
    689     massFactor = proton_mass_c2/ionTable->GetIonMass(Z,A);
    690     idx = 0;
    691     for(; idx<nIons; idx++) {
    692       if(Z == Zion[idx] && A == Aion[idx]) {
    693         if(materialList[idx] == mat) {
    694           curMaterial = mat;
    695           curVector = stopData[idx];
    696           break;
    697         } else if(materialList[idx] == 0) {
    698           if(materialName[idx] == mat->GetName())
    699             curVector = InitialiseMaterial(mat);
    700         }
     682    currentZ = p->GetAtomicNumber();
     683    if(verbose > 1) {
     684      G4cout << "G4EmCorrections::EffectiveChargeCorrection: Zion= "
     685             << currentZ << " Aion= " << p->GetPDGMass()/amu_c2 << G4endl;
     686    }
     687    massFactor = proton_mass_c2/p->GetPDGMass();
     688    idx = -1;
     689    G4int dz = 1000;
     690
     691    for(G4int i=0; i<nIons; i++) {
     692      if(materialList[i] == mat) {
     693        G4int delz = currentZ - Zion[i];
     694        if(delz < 0) delz = -delz;
     695        if(delz < dz) {
     696          idx = i;
     697          dz = delz;
     698          if(0 == delz) break;
     699        }
    701700      }
     701    }
     702    //    G4cout << " idx= " << idx << " dz= " << dz << G4endl;
     703    if(idx > 0) {
     704      if(!ionList[idx]) BuildCorrectionVector();
     705      if(ionList[idx])  curVector = stopData[idx];
    702706    }
    703707  }
     
    705709    G4bool b;
    706710    factor = curVector->GetValue(ekin*massFactor,b);
    707   }
    708   if(verbose > 1) G4cout << "  factor= " << factor << G4endl;
     711    if(verbose > 1) {
     712      G4cout << "E= " << ekin << " factor= " << factor << " massfactor= "
     713             << massFactor << G4endl;
     714    }
     715  }
    709716  return factor;
    710717}
     
    714721void G4EmCorrections::AddStoppingData(G4int Z, G4int A,
    715722                                      const G4String& mname,
    716                                       G4PhysicsVector& dVector)
    717 {
    718   idx = 0;
    719   for(; idx<nIons; idx++) {
    720     if(Z == Zion[idx] && A == Aion[idx] && mname == materialName[idx])
    721       break;
    722   }
    723   if(idx == nIons) {
     723                                      G4PhysicsVector* dVector)
     724{
     725  G4int i = 0;
     726  for(; i<nIons; i++) {
     727    if(Z == Zion[i] && A == Aion[i] && mname == materialName[i]) break;
     728  }
     729  if(i == nIons) {
    724730    Zion.push_back(Z);
    725731    Aion.push_back(A);
    726732    materialName.push_back(mname);
    727733    materialList.push_back(0);
    728     stopData.push_back(0);
     734    ionList.push_back(0);
     735    stopData.push_back(dVector);
    729736    nIons++;
    730   } else {
    731     if(stopData[idx]) delete stopData[idx];
    732   }
    733   size_t nbins = dVector.GetVectorLength();
    734   size_t n = 0;
    735   for(; n<nbins; n++) {
    736     if(dVector.GetLowEdgeEnergy(n) > 2.0*MeV) break;
    737   }
    738   if(n < nbins) nbins = n + 1;
    739   G4LPhysicsFreeVector* v =
    740     new G4LPhysicsFreeVector(nbins,
    741                              dVector.GetLowEdgeEnergy(0),
    742                              dVector.GetLowEdgeEnergy(nbins-1));
     737    if(verbose>1) {
     738      G4cout << "AddStoppingData Z= " << Z << " A= " << A << " " << mname
     739             << "  idx= " << i << G4endl;
     740    }
     741  }
     742}
     743
     744//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     745
     746void G4EmCorrections::BuildCorrectionVector()
     747{
     748  if(!ionLEModel || !ionHEModel) {
     749    return;
     750  }
     751
     752  const G4ParticleDefinition* ion = curParticle;
     753  G4int Z = Zion[idx];
     754  if(currentZ != Z) {
     755    ion = G4ParticleTable::GetParticleTable()->FindIon(Z, Aion[idx], 0, Z);
     756  }
     757  //G4cout << "BuildCorrectionVector: idx= " << idx << " Z= " << Z
     758  //     << " curZ= " << currentZ << G4endl;
     759
     760  // G4double A = nist->GetAtomicMassAmu(Z);
     761  G4double A = G4double(ion->GetBaryonNumber());
     762  G4PhysicsVector* v = stopData[idx];
     763   
     764  const G4ParticleDefinition* p = G4GenericIon::GenericIon();
     765  G4double massRatio = proton_mass_c2/ion->GetPDGMass();
     766
     767  if(verbose>1) {
     768    G4cout << "BuildCorrectionVector: Stopping for "
     769           << curParticle->GetParticleName() << " in "
     770           << materialName[idx] << " Ion Z= " << Z << " A= " << A
     771           << " massRatio= " << massRatio << G4endl;
     772  }
    743773  G4bool b;
    744   for(size_t i=0; i<nbins; i++) {
    745     G4double e = dVector.GetLowEdgeEnergy(i);
    746     G4double dedx = dVector.GetValue(e, b);
    747     v->PutValues(i, e, dedx);
    748   }
    749   //  G4cout << *v << G4endl;
    750   stopData[idx] = v;
    751 }
    752 
    753 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    754 
    755 G4PhysicsVector* G4EmCorrections::InitialiseMaterial(const G4Material* mat)
    756 {
    757   G4PhysicsVector* v = 0;
    758   const G4Material* m = nist->FindOrBuildMaterial(materialName[idx],false);
    759   if(m) {
    760     materialList[idx] = m;
    761     curMaterial = mat;
    762     v = stopData[idx];
    763     size_t nbins = v->GetVectorLength();
    764     const G4ParticleDefinition* p = G4Proton::Proton();
    765     if(verbose>1) G4cout << "G4ionIonisation::InitialiseMaterial Stooping data for "
    766                          << materialName[idx] << G4endl;
    767     G4bool b;
    768     for(size_t i=0; i<nbins; i++) {
    769       G4double e = v->GetLowEdgeEnergy(i);
    770       G4double dedx = v->GetValue(e, b);
    771       G4double dedx1= ionModel->ComputeDEDXPerVolume(mat, p, e, e)*
    772         effCharge.EffectiveChargeSquareRatio(curParticle,mat,e/massFactor);
    773       v->PutValue(i, dedx/dedx1);
    774       if(verbose>1) G4cout << "  E(meV)= " << e/MeV << "   Correction= " << dedx/dedx1
    775                            << "   "  << dedx << " " << dedx1 << G4endl;
    776     }
    777   }
    778   return v;
     774
     775  G4PhysicsLogVector* vv =
     776    new G4PhysicsLogVector(eCorrMin,eCorrMax,nbinCorr);
     777  vv->SetSpline(true);
     778  G4double e, eion, dedx, dedx1;
     779  G4double eth0 = v->GetLowEdgeEnergy(0);
     780  G4double escal = eth/massRatio;
     781  G4double qe =
     782    effCharge.EffectiveChargeSquareRatio(ion, curMaterial, escal);
     783  G4double dedxt =
     784    ionLEModel->ComputeDEDXPerVolume(curMaterial, p, eth, eth)*qe;
     785  G4double dedx1t =
     786    ionHEModel->ComputeDEDXPerVolume(curMaterial, p, eth, eth)*qe
     787    + ComputeIonCorrections(curParticle, curMaterial, escal);
     788  G4double rest = escal*(dedxt - dedx1t);
     789  //G4cout << "Escal(MeV)= "<<escal<<" dedxt0= " <<dedxt
     790  //     << " dedxt1= " << dedx1t << G4endl;   
     791
     792  for(G4int i=0; i<nbinCorr; i++) {
     793    e = vv->GetLowEdgeEnergy(i);
     794    escal = e/massRatio;
     795    eion  = escal/A;
     796    if(eion <= eth0) {
     797      dedx = v->GetValue(eth0, b)*std::sqrt(eion/eth0);
     798    } else {
     799      dedx = v->GetValue(eion, b);
     800    }
     801    qe = effCharge.EffectiveChargeSquareRatio(curParticle,curMaterial,escal);
     802    if(e <= eth) {
     803      dedx1 = ionLEModel->ComputeDEDXPerVolume(curMaterial, p, e, e)*qe;
     804    } else {
     805      dedx1 = ionHEModel->ComputeDEDXPerVolume(curMaterial, p, e, e)*qe +
     806        ComputeIonCorrections(curParticle, curMaterial, escal) + rest/escal;
     807    }
     808    vv->PutValue(i, dedx/dedx1);
     809    if(verbose>1) {
     810      G4cout << "  E(meV)= " << e/MeV << "   Correction= " << dedx/dedx1
     811             << "   "  << dedx << " " << dedx1
     812             << "  massF= " << massFactor << G4endl;
     813    }
     814  }
     815  delete v;
     816  ionList[idx]  = ion;
     817  stopData[idx] = vv;
     818  if(verbose>1) G4cout << "End data set " << G4endl;
     819}
     820
     821//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     822
     823void G4EmCorrections::InitialiseForNewRun()
     824{
     825  G4ProductionCutsTable* tb = G4ProductionCutsTable::GetProductionCutsTable();
     826  ncouples = tb->GetTableSize();
     827  if(currmat.size() != ncouples) {
     828    currmat.resize(ncouples);
     829    size_t i;
     830    for(i=0; i<100; i++) {thcorr[i].clear();}
     831    for(i=0; i<ncouples; i++) {
     832      currmat[i] = tb->GetMaterialCutsCouple(i)->GetMaterial();
     833      G4String nam = currmat[i]->GetName();
     834      for(G4int j=0; j<nIons; j++) {
     835        if(nam == materialName[j]) { materialList[j] = currmat[i]; }
     836      }
     837    }
     838  }
    779839}
    780840
  • trunk/source/processes/electromagnetic/utils/src/G4EmModelManager.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmModelManager.cc,v 1.40 2007/11/09 11:35:54 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4EmModelManager.cc,v 1.46 2008/10/13 14:56:56 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7878//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7979
    80 G4RegionModels::G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE)
     80G4RegionModels::G4RegionModels(G4int nMod, std::vector<G4int>& indx,
     81                               G4DataVector& lowE, const G4Region* reg)
    8182{
    8283  nModelsForRegion      = nMod;
    8384  theListOfModelIndexes = new G4int [nModelsForRegion];
    84   lowKineticEnergy      = new G4double [nModelsForRegion];
     85  lowKineticEnergy      = new G4double [nModelsForRegion+1];
    8586  for (G4int i=0; i<nModelsForRegion; i++) {
    86     theListOfModelIndexes[i] = list[i];
     87    theListOfModelIndexes[i] = indx[i];
    8788    lowKineticEnergy[i] = lowE[i];
    8889  }
     90  lowKineticEnergy[nModelsForRegion] = lowE[nModelsForRegion];
     91  theRegion = reg;
    8992}
    9093
     
    99102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    100103
    101 #include "G4LossTableManager.hh"
    102104#include "G4Step.hh"
    103105#include "G4ParticleDefinition.hh"
     
    107109#include "G4MaterialCutsCouple.hh"
    108110#include "G4ProductionCutsTable.hh"
    109 #include "G4Region.hh"
    110111#include "G4RegionStore.hh"
    111112#include "G4Gamma.hh"
    112113#include "G4Positron.hh"
     114#include "G4UnitsTable.hh"
    113115
    114116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    128130  regions.clear();
    129131  orderOfModels.clear();
    130   upperEkin.clear();
    131132  maxCutInRange    = 12.*cm;
    132133  maxSubCutInRange = 0.7*mm;
     
    139140G4EmModelManager::~G4EmModelManager()
    140141{
    141   G4int i,j;
    142142  Clear();
     143}
     144
     145//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     146
     147void G4EmModelManager::Clear()
     148{
    143149  if(1 < verboseLevel) {
    144     G4cout << "G4EmModelManager:: delete models ";
    145     if(particle) G4cout << " for " << particle->GetParticleName();
    146     G4cout << " nModels=" << nEmModels <<G4endl;
    147   }
    148 
    149   for(i = 0; i<nEmModels; i++) {
    150     orderOfModels[i] = 1;
    151   }
    152   for(i = 0; i<nEmModels; i++) {
    153     if (orderOfModels[i]) {
    154       orderOfModels[i] = 0;
    155       for(j = i+1; j<nEmModels; j++) {
    156         if(models[i] == models[j]) orderOfModels[j] = 0;
    157       }
    158       G4String nam = models[i]->GetName();
    159       if(nam != "PAI" && nam != "PAIModel" ) delete models[i];
    160     }
    161   }
    162   for(i = 0; i<nEmModels; i++) {
    163     orderOfModels[i] = 1;
    164   }
    165   for(i = 0; i<nEmModels; i++) {
    166     if (orderOfModels[i]) {
    167       orderOfModels[i] = 0;
    168       for(j = i+1; j<nEmModels; j++) {
    169         if(flucModels[i] == flucModels[j]) orderOfModels[j] = 0;
    170       }
    171       delete flucModels[i];
    172     }
    173   }
    174   if(1 < verboseLevel)
    175     G4cout << "G4EmModelManager:: models are deleted!" << G4endl;
    176 }
    177 
    178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    179 
    180 void G4EmModelManager::Clear()
    181 {
    182   if(1 < verboseLevel) {
    183     G4cout << "G4EmModelManager::Clear()";
    184     if(particle) G4cout << " for " << particle->GetParticleName();
    185     G4cout << G4endl;
     150    G4cout << "G4EmModelManager::Clear()" << G4endl;
    186151  }
    187152
    188153  theCuts.clear();
    189154  theSubCuts.clear();
    190   upperEkin.clear();
    191155  if(idxOfRegionModels) delete [] idxOfRegionModels;
    192156  if(setOfRegionModels && nRegions) {
     
    215179  orderOfModels.push_back(num);
    216180  p->DefineForRegion(r);
    217   if (nEmModels>0) {
    218     G4int idx = nEmModels;
    219     do {idx--;} while (idx && num < orderOfModels[idx]);
    220     if (num >= orderOfModels[idx] && num <= orderOfModels[idx+1]) idx++;
    221     if (idx < nEmModels) {
    222       models[nEmModels] = models[idx];
    223       flucModels[nEmModels] = flucModels[idx];
    224       regions[nEmModels] = regions[idx];
    225       orderOfModels[nEmModels] = orderOfModels[idx];
    226       models[idx] = p;
    227       flucModels[idx] = fm;
    228       regions[idx] = r;
    229       orderOfModels[idx] = num;
    230     }
    231   }
    232181  nEmModels++;
    233182}
     
    254203//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    255204
    256 G4VEmModel* G4EmModelManager::GetModel(G4int i)
     205G4VEmModel* G4EmModelManager::GetModel(G4int i, G4bool ver)
    257206{
    258207  G4VEmModel* m = 0;
    259   if(i >= 0 && i < nEmModels) m = models[i];
    260   else if(verboseLevel > 0)
     208  if(i >= 0 && i < nEmModels) {m = models[i];}
     209  else if(verboseLevel > 0 && ver) {
    261210    G4cout << "G4EmModelManager::GetModel WARNING: "
    262211           << "index " << i << " is wrong Nmodels= "
    263            << nEmModels << G4endl;
     212           << nEmModels;
     213    if(particle) G4cout << " for " << particle->GetParticleName();
     214    G4cout<< G4endl;
     215  }
    264216  return m;
    265217}
     
    269221const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
    270222                                                 const G4ParticleDefinition* sp,
    271                                                        G4double theMinSubRange,
    272                                                       G4int val)
     223                                                 G4double theMinSubRange,
     224                                                G4int val)
    273225{
    274226  verboseLevel = val;
     
    293245  // Identify the list of regions with different set of models
    294246  nRegions = 1;
    295   std::vector<const G4Region*> set;
    296   set.push_back(world);
     247  std::vector<const G4Region*> setr;
     248  setr.push_back(world);
    297249  G4bool isWorld = false;
    298250
     
    306258      if (nRegions>1) {
    307259        for (G4int j=1; j<nRegions; j++) {
    308           if ( r == set[j] ) newRegion = false;
     260          if ( r == setr[j] ) newRegion = false;
    309261        }
    310262      }
    311263      if (newRegion) {
    312         set.push_back(r);
     264        setr.push_back(r);
    313265        nRegions++;
    314266      }
     
    322274  idxOfRegionModels[numOfCouples] = 0;
    323275  setOfRegionModels = new G4RegionModels*[nRegions];
    324   upperEkin.resize(nEmModels);
     276
     277  std::vector<G4int>    modelAtRegion(nEmModels);
     278  std::vector<G4int>    modelOrd(nEmModels);
     279  G4DataVector          eLow(nEmModels);
     280  G4DataVector          eHigh(nEmModels);
     281  G4int nmax = nEmModels;
    325282
    326283  // Order models for regions
    327284  for (G4int reg=0; reg<nRegions; reg++) {
    328     const G4Region* region = set[reg];
    329 
     285    const G4Region* region = setr[reg];
    330286    G4int n = 0;
    331 
    332     std::vector<G4int>    modelAtRegion;
    333     G4DataVector            eLow;
    334     G4DataVector            eHigh;
    335     modelAtRegion.clear();
    336     eLow.clear();
    337     eHigh.clear();
    338287
    339288    if(isWorld || 0 < reg) {
     
    346295          G4double tmin = model->LowEnergyLimit();
    347296          G4double tmax = model->HighEnergyLimit();
    348           if (n>0) tmin = std::max(tmin, eHigh[n-1]);
     297          G4int  ord    = orderOfModels[ii];
     298          G4bool push   = true;
     299          G4bool insert = false;
     300          G4int  idx    = n;
    349301
    350302          if(1 < verboseLevel) {
     
    355307                 << " tmin(MeV)= " << tmin/MeV
    356308                 << "; tmax(MeV)= " << tmax/MeV
    357                  << "; order= " << orderOfModels[ii]
     309                 << "; order= " << ord
    358310                 << G4endl;
    359311          }
    360 
    361           if (tmin < tmax) {
    362             modelAtRegion.push_back(ii);
    363             eLow.push_back(tmin);
    364             eHigh.push_back(tmax);
    365             upperEkin[ii] = tmax;
    366             n++;
     312       
     313          if (n == 0) n++;
     314          else {
     315            tmin = std::min(tmin, eHigh[n-1]);
     316            if(tmin >= tmax) push = false;
     317            else {
     318
     319              // high energy model
     320              if(tmin == eHigh[n-1] && tmax > eHigh[n-1]) n++;
     321              else if (tmax > eHigh[n-1]) {
     322
     323                // compare order of models
     324                for(G4int k = n-1; k>=0; k--) {
     325       
     326                  if (ord >= modelOrd[k]) {
     327                    tmin = std::max(tmin, eHigh[k]);           
     328                    if(k < n-1) n = k + 2;
     329                    break;
     330                  } else if (tmin > eLow[k]) {
     331                    eHigh[k] = tmin;
     332                    n = k + 2;
     333                    break;
     334                  } else if (tmin == eLow[k]) {
     335                    n = k + 1;
     336                    break;
     337                  }
     338                }
     339                if(tmin < eLow[0]) n = 1;
     340                idx = n - 1;
     341
     342                // low energy model
     343              } else {
     344
     345                tmax = std::max(tmax, eLow[0]);
     346                insert = true;
     347                push = false;
     348                idx = 0;
     349                if(tmax <= eLow[0]) tmax = eLow[0];
     350                else {
     351
     352                  for(G4int k=0; k<n; k++) {
     353       
     354                    if (ord >= modelOrd[k]) {
     355                      if(k == 0) {
     356                        if(tmin < eLow[0]) tmax = eLow[0];
     357                        else insert = false;
     358                        break;
     359                      } else {
     360                        insert = false;
     361                        break;
     362                      }
     363                    } else if(tmax < eHigh[k]) {
     364                      idx = k;
     365                      if(k > 0) tmin = eLow[k];
     366                      eLow[k] = tmax;               
     367                      break;
     368                    } else if(tmax == eHigh[k]) {           
     369                      insert = false;
     370                      push = true;
     371                      idx = k;
     372                      if(k > 0) tmin = eLow[k];
     373                      else tmin = std::min(tmin,eLow[0]);
     374                      break;
     375                    } else {
     376                      modelAtRegion[k] = ii;
     377                      modelOrd[k] = ord;
     378                      if(k == 0) eLow[idx] = std::min(tmin,eLow[0]);
     379                    }
     380                  }
     381                }
     382                if(insert && idx < n) n++;
     383                else insert = false;
     384              }
     385            }
     386          }
     387          if(n > nmax) {
     388            nmax = n;
     389            modelAtRegion.resize(nmax);
     390            modelOrd.resize(nmax);
     391            eLow.resize(nmax);
     392            eHigh.resize(nmax);
     393          }
     394          if(insert) {
     395            for(G4int k=n-2; k>=idx; k--) {           
     396              modelAtRegion[k+1] = modelAtRegion[k];
     397              modelOrd[k+1] = modelOrd[k];
     398              eLow[k+1]  = eLow[k];
     399              eHigh[k+1] = eHigh[k];
     400            }
     401          }
     402          if (push || insert) {
     403            modelAtRegion[idx] = ii;
     404            modelOrd[idx] = ord;
     405            eLow[idx]  = tmin;
     406            eHigh[idx] = tmax;
    367407          }
    368408        }
     
    374414      eLow.push_back(0.0);
    375415      eHigh.push_back(DBL_MAX);
    376       upperEkin.push_back(DBL_MAX);
    377416    }
    378417    eLow[0] = 0.0;
     418    if(n >= nmax) eLow.resize(nmax+1);
     419    eLow[n] = eHigh[n-1];
    379420
    380421    if(1 < verboseLevel) {
     
    382423      if (region) G4cout << region->GetName();
    383424      G4cout << ">  Elow(MeV)= ";
    384       for(G4int ii=0; ii<n; ii++) {G4cout << eLow[ii]/MeV << " ";}
     425      for(G4int ii=0; ii<=n; ii++) {G4cout << eLow[ii]/MeV << " ";}
    385426      G4cout << G4endl;
    386427    }
    387     G4RegionModels* rm = new G4RegionModels(n, modelAtRegion, eLow);
     428    G4RegionModels* rm = new G4RegionModels(n, modelAtRegion, eLow, region);
    388429    setOfRegionModels[reg] = rm;
    389430  }
     
    399440 
    400441    G4int reg = nRegions;
    401     do {reg--;} while (reg>0 && pcuts != (set[reg]->GetProductionCuts()));
     442    do {reg--;} while (reg>0 && pcuts != (setr[reg]->GetProductionCuts()));
    402443    idxOfRegionModels[i] = reg;
    403444
     
    474515{
    475516
    476   // vectors to provide continues dE/dx
    477   G4DataVector factor;
    478   G4DataVector dedxLow;
    479   G4DataVector dedxHigh;
    480 
    481517  G4double e;
    482518
     
    491527    G4cout << "G4EmModelManager::FillDEDXVector() for "
    492528           << couple->GetMaterial()->GetName()
    493            << "  Ecut(MeV)= " << cut
    494            << "  Esubcut(MeV)= " << subcut
     529           << "  cut(MeV)= " << cut
     530           << "  subcut(MeV)= " << subcut
    495531           << "  Type " << tType
    496532           << "  for " << particle->GetParticleName()
     
    501537  const G4RegionModels* regModels = setOfRegionModels[reg];
    502538  G4int nmod = regModels->NumberOfModels();
    503   factor.resize(nmod);
    504   dedxLow.resize(nmod);
    505   dedxHigh.resize(nmod);
     539
     540  // vectors to provide continues dE/dx
     541  G4DataVector factor(nmod);
     542  G4DataVector eLow(nmod+1);
     543  G4DataVector dedxLow(nmod);
     544  G4DataVector dedxHigh(nmod);
    506545
    507546  if(1 < verboseLevel) {
     
    512551  }
    513552
    514 
    515553  // calculate factors to provide continuity of energy loss
     554
     555
    516556  factor[0] = 1.0;
    517557  G4int j;
     
    519559  G4int totBinsLoss = aVector->GetVectorLength();
    520560
    521   dedxLow[0]  = 0.0;
    522 
    523   e = upperEkin[regModels->ModelIndex(0)];
     561  dedxLow[0] = 0.0;
     562  eLow[0]    = 0.0;
     563
     564  e = regModels->LowEdgeEnergy(1);
     565  eLow[1]    = e;
    524566  G4VEmModel* model = models[regModels->ModelIndex(0)];
    525567  dedxHigh[0] = 0.0;
    526568  if(model && cut > subcut) {
    527569    dedxHigh[0] = model->ComputeDEDX(couple,particle,e,cut);
    528     if(subcut > 0.0)
     570    if(subcut > 0.0) {
    529571      dedxHigh[0] -= model->ComputeDEDX(couple,particle,e,subcut);
     572    }
    530573  }
    531574  if(nmod > 1) {
    532575    for(j=1; j<nmod; j++) {
    533576
    534       e = upperEkin[regModels->ModelIndex(j-1)];
     577      e = regModels->LowEdgeEnergy(j);
     578      eLow[j]   = e;
    535579      G4int idx = regModels->ModelIndex(j);
    536580
    537581      dedxLow[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
    538       if(subcut > 0.0)
     582      if(subcut > 0.0) {
    539583        dedxLow[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
     584      }
    540585      if(subcut == cut) dedxLow[j] = 0.0;
    541586
    542       e = upperEkin[idx];
     587      e = regModels->LowEdgeEnergy(j+1);
     588      eLow[j+1] = e;
    543589      dedxHigh[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
    544       if(subcut > 0.0)
     590      if(subcut > 0.0) {
    545591        dedxHigh[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
     592      }
    546593      if(subcut == cut) dedxHigh[j] = 0.0;
    547594    }
     595    if(1 < verboseLevel) {
     596      G4cout << " model #0" 
     597             << "  dedx(" << eLow[0] << ")=  " << dedxLow[0]
     598             << "  dedx(" << eLow[1] << ")=  " << dedxHigh[0]
     599             << G4endl;
     600    }
    548601
    549602    for(j=1; j<nmod; j++) {
    550       if(dedxLow[j] > 0.0) factor[j] = (dedxHigh[j-1]/dedxLow[j] - 1.0);
    551       else                 factor[j] = 0.0;
     603      if(dedxLow[j] > 0.0) {
     604        factor[j] = (dedxHigh[j-1]/dedxLow[j] - 1.0)*eLow[j];
     605      } else  factor[j] = 0.0;
     606      if(1 < verboseLevel) {
     607        G4cout << " model #" << j
     608               << "  dedx(" << eLow[j] << ")=  " << dedxLow[j]
     609               << "  dedx(" << eLow[j+1] << ")=  " << dedxHigh[j]
     610               << "  factor= " << factor[j]/eLow[j]
     611               << G4endl;
     612      }
    552613    }
    553614
     
    565626      // Choose a model of energy losses
    566627    G4int k = 0;
    567     if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
     628    if (nmod > 1 && e > eLow[1]) {
    568629      do {
    569630        k++;
    570         fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
    571       } while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
     631        fac *= (1.0 + factor[k]/e);
     632      } while (k+1 < nmod && e > eLow[k+1]);
    572633    }
    573634
     
    602663                                        G4EmTableType tType)
    603664{
    604   // vectors to provide continues cross section
    605   G4DataVector factor;
    606   G4DataVector sigmaLow;
    607   G4DataVector sigmaHigh;
    608 
    609665  G4double e;
    610666
     
    630686  const G4RegionModels* regModels = setOfRegionModels[reg];
    631687  G4int nmod = regModels->NumberOfModels();
    632   factor.resize(nmod);
    633   sigmaLow.resize(nmod);
    634   sigmaHigh.resize(nmod);
     688
     689  // vectors to provide continues dE/dx
     690  G4DataVector factor(nmod);
     691  G4DataVector eLow(nmod+1);
     692  G4DataVector sigmaLow(nmod);
     693  G4DataVector sigmaHigh(nmod);
    635694
    636695  if(2 < verboseLevel) {
     
    644703  G4int totBinsLambda = aVector->GetVectorLength();
    645704
    646   sigmaLow[0]  = 0.0;
    647 
    648   e = upperEkin[regModels->ModelIndex(0)];
     705  sigmaLow[0] = 0.0;
     706  eLow[0]     = 0.0;
     707
     708  e = regModels->LowEdgeEnergy(1);
     709  eLow[1]     = e;
    649710  G4VEmModel* model = models[regModels->ModelIndex(0)];
    650711  sigmaHigh[0] = 0.0;
     
    668729    for(j=1; j<nmod; j++) {
    669730
    670       e  = upperEkin[regModels->ModelIndex(j-1)];
    671       sigmaLow[j] =
    672         models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
    673       e  = upperEkin[regModels->ModelIndex(j)];
    674       sigmaHigh[j] =
    675         models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
     731      e  = regModels->LowEdgeEnergy(j);
     732      eLow[j]   = e;
     733      G4int idx = regModels->ModelIndex(j);
     734
     735      sigmaLow[j] = models[idx]->CrossSection(couple,particle,e,cut,tmax);
     736      e  = regModels->LowEdgeEnergy(j+1);
     737      eLow[j+1] = e;
     738      sigmaHigh[j] = models[idx]->CrossSection(couple,particle,e,cut,tmax);
     739    }
     740    if(1 < verboseLevel) {
     741      G4cout << " model #0" 
     742             << "  sigma(" << eLow[0] << ")=  " << sigmaLow[0]
     743             << "  sigma(" << eLow[1] << ")=  " << sigmaHigh[0]
     744             << G4endl;
     745    }
     746    for(j=1; j<nmod; j++) {
     747      if(sigmaLow[j] > 0.0) {
     748        factor[j] = (sigmaHigh[j-1]/sigmaLow[j] - 1.0)*eLow[j];
     749      } else  factor[j] = 0.0;
    676750      if(1 < verboseLevel) {
    677         G4cout << " model #" << j << "   eUp= " << e
    678                << "  sigmaUp= " << sigmaHigh[j]
    679                << "  sigmaDown= " << sigmaLow[j]
     751        G4cout << " model #" << j
     752               << "  sigma(" << eLow[j] << ")=  " << sigmaLow[j]
     753               << "  sigma(" << eLow[j+1] << ")=  " << sigmaHigh[j]
     754               << "  factor= " << factor[j]/eLow[j]
    680755               << G4endl;
    681756      }
    682     }
    683     for(j=1; j<nmod; j++) {
    684       if(sigmaLow[j] > 0.0) factor[j] = (sigmaHigh[j-1]/sigmaLow[j] - 1.0);
    685       else                  factor[j] = 0.0;
    686757    }
    687758  }
     
    695766    G4int k = 0;
    696767    G4double fac = 1.0;
    697     if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
     768    if (nmod > 1 && e > eLow[1]) {
    698769      do {
    699770        k++;
    700         fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
    701       } while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
     771        fac *= (1.0 + factor[k]/e);
     772      } while ( k+1 < nmod && e > eLow[k+1] );
    702773    }
    703774
     
    721792
    722793//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     794
     795void G4EmModelManager::DumpModelList(G4int verb)
     796{
     797  if(verb == 0) return;
     798  for(G4int i=0; i<nRegions; i++) {
     799    G4RegionModels* r = setOfRegionModels[i];
     800    const G4Region* reg = r->Region();
     801    if(verb > 1 || nRegions > 1) {
     802    }
     803    G4int n = r->NumberOfModels(); 
     804    if(verb > 1 || n > 0) {
     805      G4cout << "      ===== EM models for the G4Region  " << reg->GetName()
     806             << " ======" << G4endl;;
     807      for(G4int j=0; j<n; j++) {
     808        const G4VEmModel* m = models[r->ModelIndex(j)];
     809        G4cout << std::setw(20);
     810        G4cout << m->GetName() << " :     Emin= "
     811               << std::setw(10) << G4BestUnit(r->LowEdgeEnergy(j),"Energy")
     812               << "        Emax=   "
     813               << G4BestUnit(r->LowEdgeEnergy(j+1),"Energy")
     814               << G4endl;
     815      } 
     816    }
     817  }
     818}
     819
     820//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/utils/src/G4EmMultiModel.cc

    r819 r961  
    2525//
    2626// $Id: G4EmMultiModel.cc,v 1.6 2007/05/22 17:31:58 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
  • trunk/source/processes/electromagnetic/utils/src/G4EmProcessOptions.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4EmProcessOptions.cc,v 1.22 2007/11/07 18:38:49 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4EmProcessOptions.cc,v 1.26 2009/02/18 14:43:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5959#include "G4VMultipleScattering.hh"
    6060#include "G4Region.hh"
     61#include "G4RegionStore.hh"
    6162
    6263//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    392393//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    393394
    394 void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
    395 {
    396   const std::vector<G4VEnergyLossProcess*>& v =
    397         theManager->GetEnergyLossProcessVector();
    398   std::vector<G4VEnergyLossProcess*>::const_iterator itr;
    399   for(itr = v.begin(); itr != v.end(); itr++) {
    400     G4VEnergyLossProcess* p = *itr;
    401     if(p) p->ActivateDeexcitation(val,r);
    402   }
    403   const std::vector<G4VEmProcess*>& w =
    404         theManager->GetEmProcessVector();
    405   std::vector<G4VEmProcess*>::const_iterator itp;
    406   for(itp = w.begin(); itp != w.end(); itp++) {
    407     G4VEmProcess* q = *itp;
    408     if(q) q->ActivateDeexcitation(val,r);
     395void G4EmProcessOptions::ActivateDeexcitation(const G4String& pname,
     396                                              G4bool val,
     397                                              const G4String& reg)
     398{
     399  G4RegionStore* regionStore = G4RegionStore::GetInstance();
     400  const G4Region* r = 0;
     401  if(reg == "" || reg == "World") {
     402    r = regionStore->GetRegion("DefaultRegionForTheWorld", false);
     403  } else {
     404    r = regionStore->GetRegion(reg, false);
     405  }
     406  if(!r) {
     407    G4cout << "G4EmProcessOptions::ActivateDeexcitation ERROR: G4Region <"
     408           << reg << "> not found, the command ignored" << G4endl;
     409    return;
     410  }
     411
     412  const std::vector<G4VEnergyLossProcess*>& v =
     413        theManager->GetEnergyLossProcessVector();
     414  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
     415  for(itr = v.begin(); itr != v.end(); itr++) {
     416    G4VEnergyLossProcess* p = *itr;
     417    if(p) {
     418      if(pname == p->GetProcessName()) p->ActivateDeexcitation(val,r);
     419    }
     420  }
     421  const std::vector<G4VEmProcess*>& w =
     422        theManager->GetEmProcessVector();
     423  std::vector<G4VEmProcess*>::const_iterator itp;
     424  for(itp = w.begin(); itp != w.end(); itp++) {
     425    G4VEmProcess* q = *itp;
     426    if(q) {
     427      if(pname == q->GetProcessName()) q->ActivateDeexcitation(val,r);
     428    }
    409429  }
    410430}
     
    477497//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    478498
     499void G4EmProcessOptions::SetPolarAngleLimit(G4double val)
     500{
     501  const std::vector<G4VMultipleScattering*>& u =
     502        theManager->GetMultipleScatteringVector();
     503  std::vector<G4VMultipleScattering*>::const_iterator itm;
     504  for(itm = u.begin(); itm != u.end(); itm++) {
     505    if(*itm) (*itm)->SetPolarAngleLimit(val);
     506  }
     507  const std::vector<G4VEmProcess*>& w =
     508        theManager->GetEmProcessVector();
     509  std::vector<G4VEmProcess*>::const_iterator itp;
     510  for(itp = w.begin(); itp != w.end(); itp++) {
     511    G4VEmProcess* q = *itp;
     512    if(q) q->SetPolarAngleLimit(val);
     513  }
     514}
     515
     516//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     517
    479518void G4EmProcessOptions::SetLPMFlag(G4bool val)
    480519{
     
    484523//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    485524
     525void G4EmProcessOptions::SetSplineFlag(G4bool val)
     526{
     527  theManager->SetSplineFlag(val);
     528}
     529
     530//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     531
    486532void G4EmProcessOptions::SetLinearLossLimit(G4double val)
    487533{
  • trunk/source/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EnergyLossMessenger.cc,v 1.29 2007/06/11 14:56:51 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4EnergyLossMessenger.cc,v 1.37 2009/02/18 14:43:27 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
     
    4949// 16-03-07 modify /process/eLoss/minsubsec command (V.Ivanchenko)
    5050// 18-05-07 add /process/msc directory and commands (V.Ivanchenko)
     51// 11-03-08 add /process/em directory and commands (V.Ivanchenko)
    5152//
    5253// -------------------------------------------------------------------
     
    8485  mscDirectory = new G4UIdirectory("/process/msc/");
    8586  mscDirectory->SetGuidance("Commands for EM scattering processes.");
     87  emDirectory = new G4UIdirectory("/process/em/");
     88  emDirectory->SetGuidance("General commands for EM processes.");
    8689
    8790  RndmStepCmd = new G4UIcmdWithABool("/process/eLoss/rndmStep",this);
     
    146149
    147150  IntegCmd = new G4UIcmdWithABool("/process/eLoss/integral",this);
    148   IntegCmd->SetGuidance("Switch true/false the integration of cross section over step.");
     151  IntegCmd->SetGuidance("Switch true/false the integral option");
    149152  IntegCmd->SetParameterName("integ",true);
    150153  IntegCmd->SetDefaultValue(true);
     
    152155
    153156  rangeCmd = new G4UIcmdWithABool("/process/eLoss/CSDARange",this);
    154   rangeCmd->SetGuidance("Switch true/false the precise range calculation.");
     157  rangeCmd->SetGuidance("Switch true/false the CSDA range calculation");
    155158  rangeCmd->SetParameterName("range",true);
    156159  rangeCmd->SetDefaultValue(true);
     
    158161
    159162  lpmCmd = new G4UIcmdWithABool("/process/eLoss/LPM",this);
    160   lpmCmd->SetGuidance("Switch true/false the LPM effect calculation.");
     163  lpmCmd->SetGuidance("The flag of the LPM effect calculation");
    161164  lpmCmd->SetParameterName("lpm",true);
    162165  lpmCmd->SetDefaultValue(true);
    163166  lpmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    164167
     168  splCmd = new G4UIcmdWithABool("/process/em/spline",this);
     169  splCmd->SetGuidance("The flag of usage spline for Physics Vectors");
     170  splCmd->SetParameterName("spl",true);
     171  splCmd->SetDefaultValue(false);
     172  splCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
     173
     174  aplCmd = new G4UIcmdWithABool("/process/em/applyCuts",this);
     175  aplCmd->SetGuidance("The flag to Apply Cuts for gamma processes");
     176  aplCmd->SetParameterName("apl",true);
     177  aplCmd->SetDefaultValue(false);
     178  aplCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
     179
     180  deexCmd = new G4UIcommand("/process/em/deexcitation",this);
     181  deexCmd->SetGuidance("Set deexcitation flag per process and G4Region.");
     182  deexCmd->SetGuidance("  procName  : process name");
     183  deexCmd->SetGuidance("  flag      : flag");
     184  deexCmd->SetGuidance("  regName   : G4Region name");
     185
     186  G4UIparameter* pName = new G4UIparameter("pName",'s',false);
     187  deexCmd->SetParameter(pName);
     188
     189  G4UIparameter* flag = new G4UIparameter("flag",'s',false);
     190  deexCmd->SetParameter(flag);
     191
     192  G4UIparameter* regName = new G4UIparameter("regName",'s',false);
     193  deexCmd->SetParameter(regName);
     194
    165195  dedxCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsDEDX",this);
    166   dedxCmd->SetGuidance("Set number of bins for DEDX tables.");
     196  dedxCmd->SetGuidance("Set number of bins for DEDX tables");
    167197  dedxCmd->SetParameterName("binsDEDX",true);
    168198  dedxCmd->SetDefaultValue(120);
     
    170200
    171201  lamCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsLambda",this);
    172   lamCmd->SetGuidance("Set number of bins for Lambda tables.");
     202  lamCmd->SetGuidance("Set number of bins for Lambda tables");
    173203  lamCmd->SetParameterName("binsL",true);
    174204  lamCmd->SetDefaultValue(120);
     
    176206
    177207  verCmd = new G4UIcmdWithAnInteger("/process/eLoss/verbose",this);
    178   verCmd->SetGuidance("Set verbose level for EM physics.");
     208  verCmd->SetGuidance("Set verbose level for EM physics");
    179209  verCmd->SetParameterName("verb",true);
    180210  verCmd->SetDefaultValue(1);
    181211  verCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    182212
     213  ver1Cmd = new G4UIcmdWithAnInteger("/process/em/verbose",this);
     214  ver1Cmd->SetGuidance("Set verbose level for EM physics");
     215  ver1Cmd->SetParameterName("verb1",true);
     216  ver1Cmd->SetDefaultValue(1);
     217  ver1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
     218
    183219  lllCmd = new G4UIcmdWithADouble("/process/eLoss/linLossLimit",this);
    184   lllCmd->SetGuidance("Set linearLossLimit parameter.");
     220  lllCmd->SetGuidance("Set linearLossLimit parameter");
    185221  lllCmd->SetParameterName("linlim",true);
    186222  lllCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    187223
    188   labCmd = new G4UIcmdWithADouble("/process/eLoss/lambdaFactor",this);
    189   labCmd->SetGuidance("Set lambdaFactor parameter.");
     224  labCmd = new G4UIcmdWithADouble("/process/eLoss/LambdaFactor",this);
     225  labCmd->SetGuidance("Set lambdaFactor parameter for integral option");
    190226  labCmd->SetParameterName("Fl",true);
    191227  labCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    192228
    193229  mscCmd = new G4UIcmdWithAString("/process/msc/StepLimit",this);
    194   mscCmd->SetGuidance("Set msc step limitation type.");
     230  mscCmd->SetGuidance("Set msc step limitation type");
    195231  mscCmd->SetParameterName("StepLim",true);
    196232  mscCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    197233
    198234  latCmd = new G4UIcmdWithABool("/process/msc/LateralDisplacement",this);
    199   latCmd->SetGuidance("Switch true/false sampling of latra dislacent.");
     235  latCmd->SetGuidance("Set flag of sampling of lateral displacement");
    200236  latCmd->SetParameterName("lat",true);
    201237  latCmd->SetDefaultValue(true);
     
    203239
    204240  frCmd = new G4UIcmdWithADouble("/process/msc/RangeFactor",this);
    205   frCmd->SetGuidance("Set RangeFactor parameter for msc process.");
     241  frCmd->SetGuidance("Set RangeFactor parameter for msc processes");
    206242  frCmd->SetParameterName("Fr",true);
    207243  frCmd->SetRange("Fr>0");
     
    210246
    211247  fgCmd = new G4UIcmdWithADouble("/process/msc/GeomFactor",this);
    212   fgCmd->SetGuidance("Set GeomFactor parameter for msc process.");
     248  fgCmd->SetGuidance("Set GeomFactor parameter for msc processes");
    213249  fgCmd->SetParameterName("Fg",true);
    214250  fgCmd->SetRange("Fg>0");
     
    217253
    218254  skinCmd = new G4UIcmdWithADouble("/process/msc/Skin",this);
    219   skinCmd->SetGuidance("Set skin parameter for multiple scattering.");
     255  skinCmd->SetGuidance("Set skin parameter for msc processes");
    220256  skinCmd->SetParameterName("skin",true);
    221257  skinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    222258
     259  angCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/ThetaLimit",this);
     260  angCmd->SetGuidance("Set the limit on the polar angle");
     261  angCmd->SetParameterName("theta",true);
     262  angCmd->SetUnitCategory("Angle");
     263  angCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    223264}
    224265
     
    233274  delete MinSubSecCmd;
    234275  delete StepFuncCmd;
     276  delete deexCmd;
    235277  delete eLossDirectory;
    236278  delete mscDirectory;
     279  delete emDirectory;
    237280  delete MinEnCmd;
    238281  delete MaxEnCmd;
     
    240283  delete rangeCmd;
    241284  delete lpmCmd;
     285  delete splCmd;
     286  delete aplCmd;
    242287  delete latCmd;
    243288  delete verCmd;
     289  delete ver1Cmd;
    244290  delete mscCmd;
    245291  delete dedxCmd;
     
    250296  delete labCmd;
    251297  delete skinCmd;
     298  delete angCmd;
    252299}
    253300
     
    289336  }
    290337
     338  if (command == deexCmd) {
     339    G4String s1 (""), s2(""), s3("");
     340    G4bool b = false;
     341    std::istringstream is(newValue);
     342    is >> s1 >> s2 >> s3;
     343    if(s2 == "true") b = true;
     344    opt->ActivateDeexcitation(s1,b,s3);
     345  }
     346
    291347  if (command == mscCmd) {
    292348    if(newValue == "Minimal")
     
    317373  } 
    318374
    319   if (command == IntegCmd)
     375  if (command == IntegCmd) {
    320376    opt->SetIntegral(IntegCmd->GetNewBoolValue(newValue));
    321  
     377  }
    322378  if (command == rangeCmd) {
    323379    opt->SetBuildCSDARange(rangeCmd->GetNewBoolValue(newValue));
     
    330386  }
    331387
     388  if (command == splCmd) {
     389    opt->SetSplineFlag(splCmd->GetNewBoolValue(newValue));
     390    G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
     391  }
     392
     393  if (command == aplCmd) {
     394    opt->SetApplyCuts(aplCmd->GetNewBoolValue(newValue));
     395  }
     396
    332397  if (command == latCmd) {
    333398    opt->SetMscLateralDisplacement(latCmd->GetNewBoolValue(newValue));
     
    335400  }
    336401
    337   if (command == verCmd)
     402  if (command == verCmd) {
    338403    opt->SetVerbose(verCmd->GetNewIntValue(newValue));
    339 
    340   if (command == lllCmd)
     404  }
     405  if (command == ver1Cmd) {
     406    opt->SetVerbose(ver1Cmd->GetNewIntValue(newValue));
     407  }
     408  if (command == lllCmd) {
    341409    opt->SetLinearLossLimit(lllCmd->GetNewDoubleValue(newValue));
    342 
    343   if (command == labCmd)
     410  }
     411  if (command == labCmd) {
    344412    opt->SetLambdaFactor(labCmd->GetNewDoubleValue(newValue));
    345  
     413  }
    346414  if (command == skinCmd) {
    347415    opt->SetSkin(skinCmd->GetNewDoubleValue(newValue));
     
    364432    G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
    365433  }
     434  if (command == angCmd) {
     435    opt->SetPolarAngleLimit(angCmd->GetNewDoubleValue(newValue));
     436    G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
     437  } 
    366438}
    367439
  • trunk/source/processes/electromagnetic/utils/src/G4EnergyLossTables.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4EnergyLossTables.cc,v 1.33 2006/06/29 19:55:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4EnergyLossTables.cc,v 1.34 2008/07/08 10:57:22 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// -------------------------------------------------------------------
     
    998998//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    999999
    1000 void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle, const G4String& q)
    1001 {
    1002   G4String s = "G4EnergyLossTables:: " + q + " table not found for "
    1003              + aParticle->GetParticleName() + "!";
    1004   G4Exception(s);
    1005   exit(1);
    1006 }
    1007 
    1008 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     1000void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle,
     1001                                            const G4String& q)
     1002{
     1003  G4String s = " " + q + " table not found for "
     1004             + aParticle->GetParticleName() + " !";
     1005  G4Exception("G4EnergyLossTables::ParticleHaveNoLoss", "EM01",
     1006              FatalException, s);
     1007}
     1008
     1009//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/utils/src/G4LossTableBuilder.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LossTableBuilder.cc,v 1.24 2007/02/16 11:59:35 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4LossTableBuilder.cc,v 1.28 2009/02/18 16:24:47 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6464
    6565G4LossTableBuilder::G4LossTableBuilder()
    66 {}
     66{
     67  splineFlag = true;
     68}
    6769
    6870//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    7375//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7476
    75 void G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
    76                                   const std::vector<G4PhysicsTable*>& list)
     77void
     78G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
     79                                   const std::vector<G4PhysicsTable*>& list)
    7780{
    7881  size_t n_processes = list.size();
     
    9194
    9295    pv = new G4PhysicsLogVector(elow, ehigh, nbins);
     96    pv->SetSpline(splineFlag);
    9397    for (size_t j=0; j<nbins; j++) {
    9498      G4double dedx = 0.0;
     
    128132      G4double dedx1  = pv->GetValue(elow, b);
    129133
     134      //G4cout << "nbins= " << nbins << " dedx1= " << dedx1 << G4endl;
     135
     136      // protection for specific cases dedx=0
    130137      if(dedx1 == 0.0) {
    131         for (size_t k=1; k<nbins; k++) {
     138        for (size_t k=1; k<nbins-1; k++) {
    132139          bin0++;
    133140          elow  = pv->GetLowEdgeEnergy(k);
     
    138145      }
    139146
     147      //G4cout << "nbins= " << nbins << " elow= " << elow << " ehigh= " << ehigh << G4endl;
     148      // initialisation of a new vector
    140149      G4PhysicsLogVector* v = new G4PhysicsLogVector(elow, ehigh, nbins);
    141 
     150      // dedx is exect zero
     151      if(nbins <= 2) {
     152        v->PutValue(0,1000.);
     153        v->PutValue(1,2000.);
     154        G4PhysicsTableHelper::SetPhysicsVector(rangeTable, i, v);
     155        return;
     156      }
     157      v->SetSpline(splineFlag);
     158
     159      // assumed dedx proportional to beta
    142160      G4double range  = 2.*elow/dedx1;
    143       //G4double range  = elow/dedx1;
    144161      v->PutValue(0,range);
    145162      G4double energy1 = elow;
     
    148165
    149166        G4double energy2 = pv->GetLowEdgeEnergy(j+bin0);
    150         G4double dedx2   = pv->GetValue(energy2, b);
    151167        G4double de      = (energy2 - energy1) * del;
    152         G4double energy  = energy1 - de*0.5;
    153 
    154         G4bool   yes     = true;
    155         //G4bool   yes     = false;
    156         if(dedx1 < DBL_MIN || dedx2 < DBL_MIN) yes = false;   
    157 
    158         G4double fac, f;
    159 
    160         if(yes) fac = std::log(dedx2/dedx1)/std::log(energy2/energy1);
    161         else    fac = (dedx2 - dedx1)/(energy2 - energy1);
    162 
     168        G4double energy  = energy2 + de*0.5;
    163169        for (size_t k=0; k<n; k++) {
    164           energy += de;
    165           if(yes) f = dedx1*std::exp(fac*std::log(energy/energy1));
    166           else    f = dedx1 + fac*(energy - energy1);
    167           if(f > DBL_MIN) range  += de/f;
    168         }
     170          energy -= de;
     171          dedx1 = pv->GetValue(energy, b);
     172          if(dedx1 > 0.0) range += de/dedx1;
     173        }
     174
    169175        //      G4cout << "Range i= " <<i << " j= " << j << G4endl;
    170176        v->PutValue(j,range);
    171177        energy1 = energy2;
    172         dedx1   = dedx2;
    173178      }
    174179      G4PhysicsTableHelper::SetPhysicsVector(rangeTable, i, v);
     
    197202      G4double rlow  = pv->GetValue(elow, b);
    198203      G4double rhigh = pv->GetValue(ehigh, b);
    199 
    200       rhigh *= std::exp(std::log(rhigh/rlow)/((G4double)(nbins-1)));
    201 
    202204     
    203205      G4LPhysicsFreeVector* v = new G4LPhysicsFreeVector(nbins,rlow,rhigh);
     206      v->SetSpline(splineFlag);
     207
    204208      for (size_t j=0; j<nbins; j++) {
    205209        G4double e  = pv->GetLowEdgeEnergy(j);
     
    207211        v->PutValues(j,r,e);
    208212      }
     213      v->PutValues(nbins,rhigh+rlow,ehigh);
    209214
    210215      G4PhysicsTableHelper::SetPhysicsVector(invRangeTable, i, v);
  • trunk/source/processes/electromagnetic/utils/src/G4LossTableManager.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LossTableManager.cc,v 1.84 2007/06/14 07:28:48 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4LossTableManager.cc,v 1.95 2008/11/13 18:23:39 schaelic Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    7070// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
    7171// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
     72// 21-02-08 Add G4EmSaturation (V.Ivanchenko)
    7273//
    7374// Class Description:
     
    9192#include "G4PhysicsTableHelper.hh"
    9293#include "G4EmCorrections.hh"
     94#include "G4EmSaturation.hh"
    9395#include "G4EmTableType.hh"
    9496#include "G4LossTableBuilder.hh"
     
    116118  size_t msc = msc_vector.size();
    117119  for (size_t j=0; j<msc; j++) {
    118     if(msc_vector[j] ) delete msc_vector[j];
     120    if( msc_vector[j] ) delete msc_vector[j];
    119121  }
    120122  size_t emp = emp_vector.size();
    121123  for (size_t k=0; k<emp; k++) {
    122     if(emp_vector[k] ) delete emp_vector[k];
     124    if( emp_vector[k] ) delete emp_vector[k];
     125  }
     126  size_t mod = mod_vector.size();
     127  for (size_t a=0; a<mod; a++) {
     128    if( mod_vector[a] ) delete mod_vector[a];
     129  }
     130  size_t fmod = fmod_vector.size();
     131  for (size_t b=0; b<fmod; b++) {
     132    if( fmod_vector[b] ) delete fmod_vector[b];
    123133  }
    124134  Clear();
     
    126136  delete tableBuilder;
    127137  delete emCorrections;
     138  delete emSaturation;
    128139}
    129140
     
    152163  tableBuilder = new G4LossTableBuilder();
    153164  emCorrections= new G4EmCorrections();
     165  emSaturation = new G4EmSaturation();
    154166  integral = true;
    155167  integralActive = false;
     
    160172  stepFunctionActive = false;
    161173  flagLPM = true;
     174  splineFlag = true;
    162175  bremsTh = DBL_MAX;
    163176  verbose = 1;
     177  tableBuilder->SetSplineFlag(splineFlag);
    164178}
    165179
     
    226240{
    227241  msc_vector.push_back(p);
    228   if(verbose > 1)
     242  if(verbose > 1) {
    229243    G4cout << "G4LossTableManager::Register G4VMultipleScattering : "
    230244           << p->GetProcessName() << G4endl;
     245  }
    231246}
    232247
     
    246261{
    247262  emp_vector.push_back(p);
    248   if(verbose > 1)
     263  if(verbose > 1) {
    249264    G4cout << "G4LossTableManager::Register G4VEmProcess : "
    250265           << p->GetProcessName() << G4endl;
     266  }
    251267}
    252268
     
    258274  for (size_t i=0; i<emp; i++) {
    259275    if(emp_vector[i] == p) emp_vector[i] = 0;
     276  }
     277}
     278
     279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     280
     281void G4LossTableManager::Register(G4VEmModel* p)
     282{
     283  mod_vector.push_back(p);
     284  if(verbose > 1) {
     285    G4cout << "G4LossTableManager::Register G4VEmModel : "
     286           << p->GetName() << G4endl;
     287  }
     288}
     289
     290//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     291
     292void G4LossTableManager::DeRegister(G4VEmModel* p)
     293{
     294  size_t n = mod_vector.size();
     295  for (size_t i=0; i<n; i++) {
     296    if(mod_vector[i] == p) mod_vector[i] = 0;
     297  }
     298}
     299
     300//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     301
     302void G4LossTableManager::Register(G4VEmFluctuationModel* p)
     303{
     304  fmod_vector.push_back(p);
     305  if(verbose > 1) {
     306    G4cout << "G4LossTableManager::Register G4VEmFluctuationModel : "
     307           << p->GetName() << G4endl;
     308  }
     309}
     310
     311//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     312
     313void G4LossTableManager::DeRegister(G4VEmFluctuationModel* p)
     314{
     315  size_t n = fmod_vector.size();
     316  for (size_t i=0; i<n; i++) {
     317    if(fmod_vector[i] == p) fmod_vector[i] = 0;
    260318  }
    261319}
     
    364422     const G4ParticleDefinition* aParticle)
    365423{
    366   G4String s = "G4LossTableManager:: dE/dx table not found for "
    367              + aParticle->GetParticleName() + "!";
    368   G4Exception(s);
    369   exit(1);
     424  G4String s = " dE/dx table not found for "
     425             + aParticle->GetParticleName() + " !";
     426  G4Exception("G4LossTableManager::ParticleHaveNoLoss", "EM01",
     427              FatalException, s);
     428
    370429}
    371430
     
    476535    p = loss_vector[i];
    477536    if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
    478       if (p->IsIonisationProcess() && isActive[i] || !em || (em && !isActive[iem]) ) {
     537      if ((p->IsIonisationProcess() && isActive[i]) ||
     538          !em || (em && !isActive[iem]) ) {
    479539        em = p;
    480540        iem= i;
     
    509569  dedx = em->IonisationTable();
    510570  if (1 < n_dedx) {
    511     em->SetDEDXTable(dedx, fIonisation);
     571    em->SetDEDXTable(dedx, fIsIonisation);
    512572    dedx = 0;
    513573    dedx  = G4PhysicsTableHelper::PreparePhysicsTable(dedx);
     
    560620    G4PhysicsTable* dedxSub = em->IonisationTableForSubsec();
    561621    if (1 < listSub.size()) {
    562       em->SetDEDXTable(dedxSub, fSubIonisation);
     622      em->SetDEDXTable(dedxSub, fIsSubIonisation);
    563623      dedxSub = 0;
    564624      dedxSub = G4PhysicsTableHelper::PreparePhysicsTable(dedxSub);
     
    829889}
    830890
     891//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     892
     893void G4LossTableManager::SetSplineFlag(G4bool val)
     894{
     895  splineFlag = val;
     896  tableBuilder->SetSplineFlag(splineFlag);
     897}
     898
     899//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     900
     901G4bool G4LossTableManager::SplineFlag() const
     902{
     903  return splineFlag;
     904}
     905
    831906//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    832907
     
    843918}
    844919
     920//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     921
     922G4EmCorrections* G4LossTableManager::EmCorrections()
     923{
     924  return emCorrections;
     925}
     926
     927//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     928
     929G4EmSaturation* G4LossTableManager::EmSaturation()
     930{
     931  return emSaturation;
     932}
     933
    845934//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/source/processes/electromagnetic/utils/src/G4VEmFluctuationModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmFluctuationModel.cc,v 1.2 2006/06/29 19:55:15 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: G4VEmFluctuationModel.cc,v 1.4 2009/02/19 11:25:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4949
    5050#include "G4VEmFluctuationModel.hh"
    51 
     51#include "G4LossTableManager.hh"
    5252
    5353//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    5656G4VEmFluctuationModel::G4VEmFluctuationModel(const G4String& nam)
    5757  : name(nam)
     58{
     59  G4LossTableManager::Instance()->Register(this);
     60}
     61
     62G4VEmFluctuationModel::~G4VEmFluctuationModel()
     63{
     64  G4LossTableManager::Instance()->DeRegister(this);
     65}
     66
     67void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
    5868{}
    5969
    60 G4VEmFluctuationModel::~G4VEmFluctuationModel()
     70void G4VEmFluctuationModel::SetParticleAndCharge(const G4ParticleDefinition*,
     71                                                 G4double)
    6172{}
    6273
  • trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmModel.cc,v 1.8 2007/09/25 10:19:07 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VEmModel.cc,v 1.25 2009/02/19 09:57:36 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    4141// 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
    4242// 06.02.2006 add method ComputeMeanFreePath() (mma)
     43// 16.02.2009 Move implementations of virtual methods to source (VI)
    4344//
    4445//
     
    5152
    5253#include "G4VEmModel.hh"
     54#include "G4LossTableManager.hh"
     55#include "G4ProductionCutsTable.hh"
    5356
    5457//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5659
    5760G4VEmModel::G4VEmModel(const G4String& nam):
    58  lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
    59 {}
     61  fluc(0), name(nam), lowLimit(0.1*keV), highLimit(100.0*TeV),
     62  polarAngleLimit(0.0),secondaryThreshold(DBL_MAX),theLPMflag(false),
     63  pParticleChange(0),nuclearStopping(false),
     64  currentCouple(0),currentElement(0),
     65  nsec(5),flagDeexcitation(false)
     66{
     67  xsec.resize(nsec);
     68  nSelectors = 0;
     69  G4LossTableManager::Instance()->Register(this);
     70}
    6071
    6172//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    6273
    6374G4VEmModel::~G4VEmModel()
    64 {}
     75{
     76  G4LossTableManager::Instance()->DeRegister(this);
     77  G4int n = elmSelectors.size();
     78  if(n > 0) {
     79    for(G4int i=0; i<n; i++) {
     80      delete elmSelectors[i];
     81    }
     82  }
     83}
     84
     85//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     86
     87void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* p,
     88                                            const G4DataVector& cuts)
     89{
     90  // initialise before run
     91  flagDeexcitation = false;
     92
     93  G4int nbins = G4int(std::log10(highLimit/lowLimit) + 0.5);
     94  if(nbins < 3) nbins = 3;
     95  G4bool spline = G4LossTableManager::Instance()->SplineFlag();
     96
     97  G4ProductionCutsTable* theCoupleTable=
     98    G4ProductionCutsTable::GetProductionCutsTable();
     99  G4int numOfCouples = theCoupleTable->GetTableSize();
     100
     101  // prepare vector
     102  if(numOfCouples > nSelectors) {
     103    elmSelectors.resize(numOfCouples);
     104    nSelectors = numOfCouples;
     105  }
     106
     107  // initialise vector
     108  for(G4int i=0; i<numOfCouples; i++) {
     109    const G4MaterialCutsCouple* couple =
     110      theCoupleTable->GetMaterialCutsCouple(i);
     111    const G4Material* material = couple->GetMaterial();
     112    G4int idx = couple->GetIndex();
     113
     114    // selector already exist check if should be deleted
     115    G4bool create = true;
     116    if(elmSelectors[i]) {
     117      if(material == elmSelectors[i]->GetMaterial()) create = false;
     118      else delete elmSelectors[i];
     119    }
     120    if(create) {
     121      elmSelectors[i] = new G4EmElementSelector(this,material,nbins,
     122                                                lowLimit,highLimit,spline);
     123    }
     124    elmSelectors[i]->Initialise(p, cuts[idx]);
     125    //elmSelectors[i]->Dump(p);
     126  }
     127}
     128
     129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     130
     131G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*,
     132                                          const G4ParticleDefinition*,
     133                                          G4double,G4double)
     134{
     135  return 0.0;
     136}
    65137
    66138//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    68140G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
    69141                                           const G4ParticleDefinition* p,
    70                                                  G4double ekin,
    71                                                  G4double emin,
    72                                                  G4double emax)
    73 {
     142                                           G4double ekin,
     143                                           G4double emin,
     144                                           G4double emax)
     145{
     146  SetupForMaterial(p, material, ekin);
    74147  G4double cross = 0.0;
    75148  const G4ElementVector* theElementVector = material->GetElementVector();
    76149  const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
    77   size_t nelm = material->GetNumberOfElements();
    78   for (size_t i=0; i<nelm; i++) {
    79     const G4Element* elm = (*theElementVector)[i];
     150  G4int nelm = material->GetNumberOfElements();
     151  if(nelm > nsec) {
     152    xsec.resize(nelm);
     153    nsec = nelm;
     154  }
     155  for (G4int i=0; i<nelm; i++) {
    80156    cross += theAtomNumDensityVector[i]*
    81       ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
     157      ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax);
    82158    xsec[i] = cross;
    83159  }
     
    87163//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    88164
    89 G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
    90                                                G4double ekin,
    91                                          const G4Material* material,     
    92                                                G4double emin,
    93                                                G4double emax)
    94 {
    95   G4double mfp = DBL_MAX;
    96   G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
    97   if (cross > DBL_MIN) mfp = 1./cross;
    98   return mfp;
    99 }
    100 
    101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    102 
    103 
     165G4double G4VEmModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
     166                                                G4double, G4double, G4double,
     167                                                G4double, G4double)
     168{
     169  return 0.0;
     170}
     171
     172//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     173
     174G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
     175                                  const G4MaterialCutsCouple*)
     176{
     177  return 0.0;
     178}
     179
     180//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     181
     182G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
     183                                          const G4Material*, G4double)
     184{
     185  G4double q = p->GetPDGCharge()/CLHEP::eplus;
     186  return q*q;
     187}
     188
     189//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     190
     191G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p,
     192                                       const G4Material*, G4double)
     193{
     194  return p->GetPDGCharge();
     195}
     196
     197//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     198
     199void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
     200                                      const G4DynamicParticle*,
     201                                      G4double&,G4double&,G4double)
     202{}
     203
     204//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     205
     206void G4VEmModel::SampleDeexcitationAlongStep(const G4Material*,
     207                                             const G4Track&,
     208                                             G4double& )
     209{}
     210
     211//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     212
     213G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
     214                                        G4double kineticEnergy)
     215{
     216  return kineticEnergy;
     217}
     218
     219//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     220
     221void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
     222{}
     223
     224//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     225
     226G4double G4VEmModel::ComputeTruePathLengthLimit(const G4Track&,
     227                                                G4PhysicsTable*,
     228                                                G4double)
     229{
     230  return DBL_MAX;
     231}
     232
     233//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     234
     235G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
     236{
     237  return truePathLength;
     238}
     239
     240//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     241
     242G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
     243{
     244  return geomPathLength;
     245}
     246
     247//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     248
     249void G4VEmModel::DefineForRegion(const G4Region*)
     250{}
     251
     252//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     253
     254void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
     255                                  const G4Material*, G4double)
     256{}
     257
     258//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEmProcess.cc,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VEmProcess.cc,v 1.62 2009/02/19 09:57:36 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    8282
    8383G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
    84                       G4VDiscreteProcess(name, type),
    85   selectedModel(0),                   
     84  G4VDiscreteProcess(name, type),
     85  secondaryParticle(0),
     86  buildLambdaTable(true),
    8687  theLambdaTable(0),
    8788  theEnergyOfCrossSectionMax(0),
    8889  theCrossSectionMax(0),
    89   particle(0),
    90   secondaryParticle(0),
    91   nLambdaBins(90),
    92   lambdaFactor(0.8),
    93   currentCouple(0),
    9490  integral(false),
    95   buildLambdaTable(true),
    9691  applyCuts(false),
    9792  startFromNull(true),
    98   nRegions(0)
     93  useDeexcitation(false),
     94  nDERegions(0),
     95  idxDERegions(0),
     96  currentModel(0),
     97  particle(0),
     98  currentCouple(0)
    9999{
    100100  SetVerboseLevel(1);
     101
     102  // Size of tables assuming spline
    101103  minKinEnergy = 0.1*keV;
    102   maxKinEnergy = 100.0*GeV;
     104  maxKinEnergy = 100.0*TeV;
     105  nLambdaBins  = 84;
     106
     107  // default lambda factor
     108  lambdaFactor  = 0.8;
     109
     110  // default limit on polar angle
     111  polarAngleLimit = 0.0;
     112
     113  // particle types
    103114  theGamma     = G4Gamma::Gamma();
    104115  theElectron  = G4Electron::Electron();
     
    126137  delete modelManager;
    127138  (G4LossTableManager::Instance())->DeRegister(this);
     139}
     140
     141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     142
     143void G4VEmProcess::Clear()
     144{
     145  delete [] theEnergyOfCrossSectionMax;
     146  delete [] theCrossSectionMax;
     147  delete [] idxDERegions;
     148  theEnergyOfCrossSectionMax = 0;
     149  theCrossSectionMax = 0;
     150  idxDERegions = 0;
     151  currentCouple = 0;
     152  preStepLambda = 0.0;
     153  mfpKinEnergy  = DBL_MAX;
     154  deRegions.clear();
     155  nDERegions = 0;
    128156}
    129157
     
    153181      theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
    154182  }
    155 }
    156 
    157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    158 
    159 void G4VEmProcess::Clear()
    160 {
    161   if(theEnergyOfCrossSectionMax) delete [] theEnergyOfCrossSectionMax;
    162   if(theCrossSectionMax) delete [] theCrossSectionMax;
    163   theEnergyOfCrossSectionMax = 0;
    164   theCrossSectionMax = 0;
    165   currentCouple = 0;
    166   preStepLambda = 0.0;
    167   mfpKinEnergy  = DBL_MAX;
     183  // Sub Cutoff and Deexcitation
     184  if (nDERegions>0) {
     185
     186    const G4ProductionCutsTable* theCoupleTable=
     187          G4ProductionCutsTable::GetProductionCutsTable();
     188    size_t numOfCouples = theCoupleTable->GetTableSize();
     189
     190    idxDERegions = new G4bool[numOfCouples];
     191
     192    for (size_t j=0; j<numOfCouples; j++) {
     193
     194      const G4MaterialCutsCouple* couple =
     195        theCoupleTable->GetMaterialCutsCouple(j);
     196      const G4ProductionCuts* pcuts = couple->GetProductionCuts();
     197      G4bool reg = false;
     198      for(G4int i=0; i<nDERegions; i++) {
     199        if(deRegions[i]) {
     200          if(pcuts == deRegions[i]->GetProductionCuts()) reg = true;
     201        }
     202      }
     203      idxDERegions[j] = reg;
     204    }
     205  }
     206  if (1 < verboseLevel && nDERegions>0) {
     207    G4cout << " Deexcitation is activated for regions: " << G4endl;
     208    for (G4int i=0; i<nDERegions; i++) {
     209      const G4Region* r = deRegions[i];
     210      G4cout << "           " << r->GetName() << G4endl;
     211    }
     212  }
    168213}
    169214
     
    228273      G4cout << *theLambdaTable << G4endl;
    229274    }
     275  }
     276}
     277
     278//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     279
     280void G4VEmProcess::PrintInfoDefinition()
     281{
     282  if(verboseLevel > 0) {
     283    G4cout << G4endl << GetProcessName() << ":   for  "
     284           << particle->GetParticleName();
     285    if(integral) G4cout << ", integral: 1 ";
     286    if(applyCuts) G4cout << ", applyCuts: 1 ";
     287    G4cout << "    SubType= " << GetProcessSubType() << G4endl;
     288    if(buildLambdaTable) {
     289      G4cout << "      Lambda tables from "
     290             << G4BestUnit(minKinEnergy,"Energy")
     291             << " to "
     292             << G4BestUnit(maxKinEnergy,"Energy")
     293             << " in " << nLambdaBins << " bins, spline: "
     294             << (G4LossTableManager::Instance())->SplineFlag()
     295             << G4endl;
     296    }
     297    PrintInfo();
     298    modelManager->DumpModelList(verboseLevel);
     299  }
     300
     301  if(verboseLevel > 2 && buildLambdaTable) {
     302    G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
     303    if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
    230304  }
    231305}
     
    295369//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    296370
    297 G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
    298                                        G4double,
    299                                        G4ForceCondition* condition)
    300 {
    301   *condition = NotForced;
    302   return G4VEmProcess::MeanFreePath(track);
    303 }
    304 
    305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    306 
    307371G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
    308372                                              const G4Step&)
     
    333397  }
    334398
    335   G4VEmModel* currentModel = SelectModel(finalT);
    336 
     399  SelectModel(finalT);
     400  if(useDeexcitation) {
     401    currentModel->SetDeexcitationFlag(idxDERegions[currentMaterialIndex]);
     402  }
    337403  /* 
    338404  if(0 < verboseLevel) {
     
    373439
    374440        } else if (p == thePositron) {
    375           if (e < (*theCutsPositron)[currentMaterialIndex]) {
     441          if (electron_mass_c2 < (*theCutsGamma)[currentMaterialIndex] &&
     442              e < (*theCutsPositron)[currentMaterialIndex]) {
    376443            good = false;
    377444            e += 2.0*electron_mass_c2;
     
    394461//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    395462
    396 void G4VEmProcess::PrintInfoDefinition()
    397 {
    398   if(verboseLevel > 0) {
    399     G4cout << G4endl << GetProcessName() << ": " ;
    400     PrintInfo();
    401     if(integral) {
    402       G4cout << "      Integral mode is used  "<< G4endl;
    403     }
    404   }
    405 
    406   if (!buildLambdaTable)  return;
    407  
    408   if(verboseLevel > 0) {
    409     G4cout << "      tables are built for  "
    410            << particle->GetParticleName()
    411            << G4endl
    412            << "      Lambda tables from "
    413            << G4BestUnit(minKinEnergy,"Energy")
    414            << " to "
    415            << G4BestUnit(maxKinEnergy,"Energy")
    416            << " in " << nLambdaBins << " bins."
    417            << G4endl;
    418   }
    419 
    420   if(verboseLevel > 1) {
    421     G4cout << "Tables are built for " << particle->GetParticleName()
    422            << G4endl;
    423 
    424   if(verboseLevel > 2) {
    425     G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
    426     if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
    427     }
    428   }
    429 }
    430 
    431 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    432 
    433 G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
    434                                          const G4MaterialCutsCouple* couple)
    435 {
    436   // Cross section per atom is calculated
    437   DefineMaterial(couple);
    438   G4double cross = 0.0;
    439   G4bool b;
    440   if(theLambdaTable) {
    441     cross = (((*theLambdaTable)[currentMaterialIndex])->
    442                            GetValue(kineticEnergy, b));
    443 
    444     cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
    445   } else {
    446     G4VEmModel* model = SelectModel(kineticEnergy);
    447     cross =
    448       model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
    449   }
    450 
    451   return cross;
    452 }
    453 
    454 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    455 
    456463G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
    457464                                       const G4String& directory,
     
    508515             << G4endl;
    509516    }
     517    if((G4LossTableManager::Instance())->SplineFlag()) {
     518      size_t n = theLambdaTable->length();
     519      for(size_t i=0; i<n; i++) {(* theLambdaTable)[i]->SetSpline(true);}
     520    }
    510521  } else {
    511522    if (1 < verboseLevel) {
     
    517528
    518529  return yes;
     530}
     531
     532//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     533
     534void G4VEmProcess::ActivateDeexcitation(G4bool val, const G4Region* r)
     535{
     536  G4RegionStore* regionStore = G4RegionStore::GetInstance();
     537  const G4Region* reg = r;
     538  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
     539
     540  // the region is in the list
     541  if (nDERegions) {
     542    for (G4int i=0; i<nDERegions; i++) {
     543      if (reg == deRegions[i]) {
     544        if(!val) deRegions[i] = 0;
     545        return;
     546      }
     547    }
     548  }
     549
     550  // new region
     551  if(val) {
     552    useDeexcitation = true;
     553    deRegions.push_back(reg);
     554    nDERegions++;
     555  } else {
     556    useDeexcitation = false;
     557  }
     558}
     559
     560//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     561
     562G4double G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
     563                                             const G4MaterialCutsCouple* couple)
     564{
     565  // Cross section per atom is calculated
     566  DefineMaterial(couple);
     567  G4double cross = 0.0;
     568  G4bool b;
     569  if(theLambdaTable) {
     570    cross = (((*theLambdaTable)[currentMaterialIndex])->
     571                           GetValue(kineticEnergy, b));
     572  } else {
     573    SelectModel(kineticEnergy);
     574    cross = currentModel->CrossSectionPerVolume(currentMaterial,
     575                                                particle,kineticEnergy);
     576  }
     577
     578  return cross;
     579}
     580
     581//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     582
     583G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
     584                                       G4double,
     585                                       G4ForceCondition* condition)
     586{
     587  *condition = NotForced;
     588  return G4VEmProcess::MeanFreePath(track);
    519589}
    520590
     
    568638  G4PhysicsVector* v =
    569639    new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
     640  v->SetSpline((G4LossTableManager::Instance())->SplineFlag());
    570641  return v;
    571642}
  • trunk/source/processes/electromagnetic/utils/src/G4VEnergyLoss.cc

    r819 r961  
    2626//
    2727// $Id: G4VEnergyLoss.cc,v 1.46 2006/06/29 19:55:21 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEnergyLossProcess.cc,v 1.123 2008/01/11 19:55:29 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VEnergyLossProcess.cc,v 1.146 2009/02/19 11:25:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    146146
    147147G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
    148   G4ProcessType type): G4VContinuousDiscreteProcess(name, type),
     148                                           G4ProcessType type):
     149  G4VContinuousDiscreteProcess(name, type),
     150  secondaryParticle(0),
    149151  nSCoffRegions(0),
     152  nDERegions(0),
    150153  idxSCoffRegions(0),
     154  idxDERegions(0),
    151155  nProcesses(0),
    152156  theDEDXTable(0),
     
    165169  theEnergyOfCrossSectionMax(0),
    166170  theCrossSectionMax(0),
    167   particle(0),
    168171  baseParticle(0),
    169   secondaryParticle(0),
    170   currentCouple(0),
    171   nBins(120),
    172   nBinsCSDA(70),
    173   nWarnings(0),
    174   linLossLimit(0.05),
    175172  minSubRange(0.1),
    176   lambdaFactor(0.8),
    177   mfpKinEnergy(0.0),
    178173  lossFluctuationFlag(true),
    179174  rndmStepFlag(false),
    180175  tablesAreBuilt(false),
    181176  integral(true),
     177  isIon(false),
    182178  isIonisation(true),
    183   useSubCutoff(false)
     179  useSubCutoff(false),
     180  useDeexcitation(false),
     181  particle(0),
     182  currentCouple(0),
     183  nWarnings(0),
     184  mfpKinEnergy(0.0)
    184185{
    185186  SetVerboseLevel(1);
    186187
    187   // Size of tables
     188  // low energy limit
    188189  lowestKinEnergy  = 1.*eV;
     190
     191  // Size of tables assuming spline
    189192  minKinEnergy     = 0.1*keV;
    190193  maxKinEnergy     = 100.0*TeV;
     194  nBins            = 84;
    191195  maxKinEnergyCSDA = 1.0*GeV;
     196  nBinsCSDA        = 35;
     197
     198  // default linear loss limit for spline
     199  linLossLimit  = 0.01;
    192200
    193201  // default dRoverRange and finalRange
    194202  SetStepFunction(0.2, 1.0*mm);
    195203
    196   theElectron = G4Electron::Electron();
    197   thePositron = G4Positron::Positron();
     204  // default lambda factor
     205  lambdaFactor  = 0.8;
     206
     207  // particle types
     208  theElectron   = G4Electron::Electron();
     209  thePositron   = G4Positron::Positron();
     210  theGenericIon = 0;
    198211
    199212  // run time objects
     
    208221  fluctModel = 0;
    209222
    210   scoffRegions.clear();
    211   scProcesses.clear();
    212223  scTracks.reserve(5);
    213224  secParticles.reserve(5);
     
    215226  // Data for stragling of ranges from ICRU'37 report
    216227  const G4int nrbins = 7;
    217   vstrag = new G4PhysicsLogVector(keV, GeV, nrbins);
     228  vstrag = new G4PhysicsLogVector(keV, GeV, nrbins-1);
     229  vstrag->SetSpline(true);
    218230  G4double s[nrbins] = {-0.2, -0.85, -1.3, -1.578, -1.76, -1.85, -1.9};
    219231  for(G4int i=0; i<nrbins; i++) {vstrag->PutValue(i, s[i]);}
     
    228240           << G4endl;
    229241  delete vstrag;
    230   Clear();
     242  Clean();
    231243
    232244  if ( !baseParticle ) {
     
    282294//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    283295
    284 void G4VEnergyLossProcess::Clear()
    285 {
    286   if(1 < verboseLevel)
     296void G4VEnergyLossProcess::Clean()
     297{
     298  if(1 < verboseLevel) {
    287299    G4cout << "G4VEnergyLossProcess::Clear() for " << GetProcessName()
    288     << G4endl;
    289 
     300           << G4endl;
     301  }
    290302  delete [] theDEDXAtMaxEnergy;
    291303  delete [] theRangeAtMaxEnergy;
     
    293305  delete [] theCrossSectionMax;
    294306  delete [] idxSCoffRegions;
     307  delete [] idxDERegions;
    295308
    296309  theDEDXAtMaxEnergy = 0;
     
    300313  tablesAreBuilt = false;
    301314
    302   scTracks.clear();
     315  //scTracks.clear();
    303316  scProcesses.clear();
    304 }
    305 
    306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    307 
    308 void G4VEnergyLossProcess::PreparePhysicsTable(
    309      const G4ParticleDefinition& part)
    310 {
    311 
    312   // Are particle defined?
    313   if( !particle ) {
    314     if(part.GetParticleType() == "nucleus" &&
    315        part.GetParticleSubType() == "generic")
    316          particle = G4GenericIon::GenericIon();
    317     else particle = &part;
    318   }
    319 
     317  nProcesses = 0;
     318}
     319
     320//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     321
     322G4double G4VEnergyLossProcess::MinPrimaryEnergy(const G4ParticleDefinition*,
     323                                                const G4Material*,
     324                                                G4double cut)
     325{
     326  return cut;
     327}
     328
     329//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     330
     331void
     332G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
     333{
    320334  if(1 < verboseLevel) {
    321335    G4cout << "G4VEnergyLossProcess::PreparePhysicsTable for "
    322336           << GetProcessName()
    323337           << " for " << part.GetParticleName()
    324            << " local: " << particle->GetParticleName()
    325338           << G4endl;
    326339  }
    327 
    328   G4LossTableManager* lManager = G4LossTableManager::Instance();
    329 
    330   if(&part != particle) {
    331     if(part.GetParticleType() == "nucleus") lManager->RegisterIon(&part, this);
    332     else                          lManager->RegisterExtraParticle(&part, this);
    333     return;
    334   }
    335 
    336   Clear();
    337340
    338341  currentCouple = 0;
     
    341344  fRange        = DBL_MAX;
    342345  preStepKinEnergy = 0.0;
     346  chargeSqRatio = 1.0;
     347  massRatio = 1.0;
     348  reduceFactor = 1.0;
     349
     350  G4LossTableManager* lManager = G4LossTableManager::Instance();
     351
     352  // Are particle defined?
     353  if( !particle ) {
     354    particle = &part;
     355    if(part.GetParticleType() == "nucleus") {
     356      if(!theGenericIon) theGenericIon = G4GenericIon::GenericIon();
     357      if(particle == theGenericIon) { isIon = true; }
     358      else if(part.GetPDGCharge() > eplus) {
     359        isIon = true;
     360
     361        // generic ions created on-fly
     362        if(part.GetPDGCharge() > 2.5*eplus) {
     363          particle = theGenericIon;
     364        }
     365      }
     366    }
     367  }
     368
     369  if( particle != &part) {
     370    if(part.GetParticleType() == "nucleus") {
     371      isIon = true;
     372      lManager->RegisterIon(&part, this);
     373    } else {
     374      lManager->RegisterExtraParticle(&part, this);
     375    }
     376    return;
     377  }
     378
     379  Clean();
    343380
    344381  // Base particle and set of models can be defined here
     
    372409  G4double initialCharge = particle->GetPDGCharge();
    373410  G4double initialMass   = particle->GetPDGMass();
    374   chargeSquare = initialCharge*initialCharge/(eplus*eplus);
    375   chargeSqRatio = 1.0;
    376   massRatio = 1.0;
    377   reduceFactor = 1.0;
    378411
    379412  if (baseParticle) {
     
    387420                                     minSubRange, verboseLevel);
    388421
    389   // Sub Cutoff Regime
    390   scProcesses.clear();
    391   nProcesses = 0;
    392  
    393   if (nSCoffRegions>0) {
     422  // Sub Cutoff and Deexcitation
     423  if (nSCoffRegions>0 || nDERegions>0) {
    394424    theSubCuts = modelManager->SubCutoff();
    395425
     
    397427          G4ProductionCutsTable::GetProductionCutsTable();
    398428    size_t numOfCouples = theCoupleTable->GetTableSize();
    399     idxSCoffRegions = new G4int[numOfCouples];
     429
     430    if(nSCoffRegions>0) idxSCoffRegions = new G4bool[numOfCouples];
     431    if(nDERegions>0) idxDERegions = new G4bool[numOfCouples];
    400432 
    401433    for (size_t j=0; j<numOfCouples; j++) {
     
    404436        theCoupleTable->GetMaterialCutsCouple(j);
    405437      const G4ProductionCuts* pcuts = couple->GetProductionCuts();
    406       G4int reg = 0;
    407       for(G4int i=0; i<nSCoffRegions; i++) {
    408         if( pcuts == scoffRegions[i]->GetProductionCuts()) reg = 1;
    409       }
    410       idxSCoffRegions[j] = reg;
     438     
     439      if(nSCoffRegions>0) {
     440        G4bool reg = false;
     441        for(G4int i=0; i<nSCoffRegions; i++) {
     442          if( pcuts == scoffRegions[i]->GetProductionCuts()) reg = true;
     443        }
     444        idxSCoffRegions[j] = reg;
     445      }
     446      if(nDERegions>0) {
     447        G4bool reg = false;
     448        for(G4int i=0; i<nDERegions; i++) {
     449          if( pcuts == deRegions[i]->GetProductionCuts()) reg = true;
     450        }
     451        idxDERegions[j] = reg;
     452      }
    411453    }
    412454  }
     
    416458  if (1 < verboseLevel) {
    417459    G4cout << "G4VEnergyLossProcess::Initialise() is done "
     460           << " for local " << particle->GetParticleName()
     461           << " isIon= " << isIon
    418462           << " chargeSqRatio= " << chargeSqRatio
    419463           << " massRatio= " << massRatio
     
    426470      }
    427471    }
     472    if (nDERegions) {
     473      G4cout << " Deexcitation is ON for regions: " << G4endl;
     474      for (G4int i=0; i<nDERegions; i++) {
     475        const G4Region* r = deRegions[i];
     476        G4cout << "           " << r->GetName() << G4endl;
     477      }
     478    }
    428479  }
    429480}
     
    442493  }
    443494
    444   if(!tablesAreBuilt && &part == particle)
    445     G4LossTableManager::Instance()->BuildPhysicsTable(particle, this);
    446 
    447   if(0 < verboseLevel && (&part == particle) && !baseParticle) {
    448     PrintInfoDefinition();
    449     safetyHelper->InitialiseHelper();
     495  if(&part == particle) {
     496    if(!tablesAreBuilt) {
     497      G4LossTableManager::Instance()->BuildPhysicsTable(particle, this);
     498    }
     499    if(!baseParticle) {
     500      if(0 < verboseLevel) PrintInfoDefinition();
     501   
     502      // needs to be done only once
     503      safetyHelper->InitialiseHelper();
     504    }
    450505  }
    451506
     
    456511    if(isIonisation) G4cout << "  isIonisation  flag = 1";
    457512    G4cout << G4endl;
    458   }
    459 }
    460 
    461 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    462 
    463 void G4VEnergyLossProcess::ActivateSubCutoff(G4bool val, const G4Region* r)
    464 {
    465   G4RegionStore* regionStore = G4RegionStore::GetInstance();
    466   if(val) {
    467     useSubCutoff = true;
    468     if (!r) r = regionStore->GetRegion("DefaultRegionForTheWorld", false);
    469     if (nSCoffRegions) {
    470       for (G4int i=0; i<nSCoffRegions; i++) {
    471         if (r == scoffRegions[i]) return;
    472       }
    473     }
    474     scoffRegions.push_back(r);
    475     nSCoffRegions++;
    476   } else {
    477     useSubCutoff = false;
    478513  }
    479514}
     
    528563  for(size_t i=0; i<numOfCouples; i++) {
    529564
    530     if(1 < verboseLevel)
     565    if(1 < verboseLevel) {
    531566      G4cout << "G4VEnergyLossProcess::BuildDEDXVector flag=  "
    532567             << table->GetFlag(i) << G4endl;
    533 
     568    }
    534569    if (table->GetFlag(i)) {
    535570
     
    538573        theCoupleTable->GetMaterialCutsCouple(i);
    539574      G4PhysicsVector* aVector = new G4PhysicsLogVector(emin, emax, bin);
     575      aVector->SetSpline((G4LossTableManager::Instance())->SplineFlag());
     576
    540577      modelManager->FillDEDXVector(aVector, couple, tType);
    541578
     
    580617           << G4endl;
    581618  }
    582   if(!table) return table;
     619  if(!table) {return table;}
    583620
    584621  // Access to materials
     
    615652//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    616653
    617 G4double G4VEnergyLossProcess::GetContinuousStepLimit(
    618                 const G4Track&,
    619                 G4double, G4double, G4double&)
    620 {
    621   return DBL_MAX;
     654void G4VEnergyLossProcess::PrintInfoDefinition()
     655{
     656  if(0 < verboseLevel) {
     657    G4cout << G4endl << GetProcessName() << ":   for  "
     658           << particle->GetParticleName()
     659           << "    SubType= " << GetProcessSubType()
     660           << G4endl
     661           << "      dE/dx and range tables from "
     662           << G4BestUnit(minKinEnergy,"Energy")
     663           << " to " << G4BestUnit(maxKinEnergy,"Energy")
     664           << " in " << nBins << " bins" << G4endl
     665           << "      Lambda tables from threshold to "
     666           << G4BestUnit(maxKinEnergy,"Energy")
     667           << " in " << nBins << " bins, spline: "
     668           << (G4LossTableManager::Instance())->SplineFlag()
     669           << G4endl;
     670    if(theRangeTableForLoss && isIonisation) {
     671      G4cout << "      finalRange(mm)= " << finalRange/mm
     672             << ", dRoverRange= " << dRoverRange
     673             << ", integral: " << integral
     674             << ", fluct: " << lossFluctuationFlag
     675             << ", linLossLimit= " << linLossLimit
     676             << G4endl;
     677    }
     678    PrintInfo();
     679    modelManager->DumpModelList(verboseLevel);
     680    if(theCSDARangeTable && isIonisation) {
     681      G4cout << "      CSDA range table up"
     682             << " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
     683             << " in " << nBinsCSDA << " bins" << G4endl;
     684    }
     685    if(nSCoffRegions>0 && isIonisation) {
     686      G4cout << "      Subcutoff sampling in " << nSCoffRegions
     687             << " regions" << G4endl;
     688    }
     689    if(2 < verboseLevel) {
     690      G4cout << "      DEDXTable address= " << theDEDXTable << G4endl;
     691      if(theDEDXTable && isIonisation) G4cout << (*theDEDXTable) << G4endl;
     692      G4cout << "non restricted DEDXTable address= "
     693             << theDEDXunRestrictedTable << G4endl;
     694      if(theDEDXunRestrictedTable && isIonisation) {
     695           G4cout << (*theDEDXunRestrictedTable) << G4endl;
     696      }
     697      if(theDEDXSubTable && isIonisation) {
     698        G4cout << (*theDEDXSubTable) << G4endl;
     699      }
     700      G4cout << "      CSDARangeTable address= " << theCSDARangeTable
     701             << G4endl;
     702      if(theCSDARangeTable && isIonisation) {
     703        G4cout << (*theCSDARangeTable) << G4endl;
     704      }
     705      G4cout << "      RangeTableForLoss address= " << theRangeTableForLoss
     706             << G4endl;
     707      if(theRangeTableForLoss && isIonisation) {
     708             G4cout << (*theRangeTableForLoss) << G4endl;
     709      }
     710      G4cout << "      InverseRangeTable address= " << theInverseRangeTable
     711             << G4endl;
     712      if(theInverseRangeTable && isIonisation) {
     713             G4cout << (*theInverseRangeTable) << G4endl;
     714      }
     715      G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
     716      if(theLambdaTable && isIonisation) {
     717        G4cout << (*theLambdaTable) << G4endl;
     718      }
     719      G4cout << "      SubLambdaTable address= " << theSubLambdaTable << G4endl;
     720      if(theSubLambdaTable && isIonisation) {
     721        G4cout << (*theSubLambdaTable) << G4endl;
     722      }
     723    }
     724  }
     725}
     726
     727//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     728
     729void G4VEnergyLossProcess::ActivateSubCutoff(G4bool val, const G4Region* r)
     730{
     731  G4RegionStore* regionStore = G4RegionStore::GetInstance();
     732  const G4Region* reg = r;
     733  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
     734
     735  // the region is in the list
     736  if (nSCoffRegions) {
     737    for (G4int i=0; i<nSCoffRegions; i++) {
     738      if (reg == scoffRegions[i]) {
     739        if(!val) deRegions[i] = 0;
     740        return;
     741      }
     742    }
     743  }
     744
     745  // new region
     746  if(val) {
     747    useSubCutoff = true;
     748    scoffRegions.push_back(reg);
     749    nSCoffRegions++;
     750  } else {
     751    useSubCutoff = false;
     752  }
     753}
     754
     755//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     756
     757void G4VEnergyLossProcess::ActivateDeexcitation(G4bool val, const G4Region* r)
     758{
     759  G4RegionStore* regionStore = G4RegionStore::GetInstance();
     760  const G4Region* reg = r;
     761  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
     762
     763  // the region is in the list
     764  if (nDERegions) {
     765    for (G4int i=0; i<nDERegions; i++) {
     766      if (reg == deRegions[i]) {
     767        if(!val) deRegions[i] = 0;
     768        return;
     769      }
     770    }
     771  }
     772
     773  // new region
     774  if(val) {
     775    useDeexcitation = true;
     776    deRegions.push_back(reg);
     777    nDERegions++;
     778  } else {
     779    useDeexcitation = false;
     780  }
    622781}
    623782
     
    641800    if(x > finalRange && y < currentMinStep) {
    642801      x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange);
    643     } else if (rndmStepFlag) x = SampleRange();
    644     //    G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
    645     //    <<" range= "<<fRange <<" cMinSt="<<currentMinStep
    646     //    <<" safety= " << safety<< " limit= " << x <<G4endl;
    647   }
    648   //  G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
     802    } else if (rndmStepFlag) {x = SampleRange();}
     803    //G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
     804    //  <<" range= "<<fRange <<" cMinSt="<<currentMinStep
     805    //  << " limit= " << x <<G4endl;
     806  }
     807  //G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
    649808  //  <<" stepLimit= "<<x<<G4endl;
    650809  return x;
    651 }
    652 
    653 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    654 
    655 G4double G4VEnergyLossProcess::GetMeanFreePath(
    656                              const G4Track& track,
    657                              G4double,
    658                              G4ForceCondition* condition)
    659 
    660 {
    661   *condition = NotForced;
    662   return MeanFreePath(track);
    663810}
    664811
     
    673820  *condition = NotForced;
    674821  G4double x = DBL_MAX;
     822
     823  // initialisation of material, mass, charge, model at the beginning of the step
     824  DefineMaterial(track.GetMaterialCutsCouple());
     825
     826  const G4ParticleDefinition* currPart = track.GetDefinition();
     827  if(theGenericIon == particle) {
     828    massRatio = proton_mass_c2/currPart->GetPDGMass();
     829  } 
     830  preStepKinEnergy    = track.GetKineticEnergy();
     831  preStepScaledEnergy = preStepKinEnergy*massRatio;
     832  SelectModel(preStepScaledEnergy);
     833
     834  if(isIon) {
     835    chargeSqRatio =
     836      currentModel->GetChargeSquareRatio(currPart,currentMaterial,preStepKinEnergy);
     837    reduceFactor  = 1.0/(chargeSqRatio*massRatio);
     838  }
     839  //G4cout << "q2= " << chargeSqRatio << " massRatio= " << massRatio << G4endl;
     840  // initialisation for sampling of the interaction length
    675841  if(previousStepSize <= DBL_MIN) theNumberOfInteractionLengthLeft = -1.0;
    676   InitialiseStep(track);
    677 
     842  if(theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
     843
     844  // compute mean free path
    678845  if(preStepScaledEnergy < mfpKinEnergy) {
    679846    if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy);
     
    686853    if (theNumberOfInteractionLengthLeft < 0.0) {
    687854      // beggining of tracking (or just after DoIt of this process)
     855      //G4cout<<"G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength Reset"<<G4endl;
    688856      ResetNumberOfInteractionLengthLeft();
    689857    } else if(currentInteractionLength < DBL_MAX) {
     
    702870      G4cout << "G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength ";
    703871      G4cout << "[ " << GetProcessName() << "]" << G4endl;
    704       G4cout << " for " << particle->GetParticleName()
     872      G4cout << " for " << currPart->GetParticleName()
    705873             << " in Material  " <<  currentMaterial->GetName()
    706874             << " Ekin(MeV)= " << preStepKinEnergy/MeV
     
    710878    }
    711879#endif
    712 
    713880    // zero cross section case
    714881  } else {
     
    738905  if(length <= DBL_MIN) return &fParticleChange;
    739906  G4double eloss  = 0.0;
    740 
    741   /*
     907  G4double esecdep = 0.0;
     908 
     909  /* 
    742910  if(-1 < verboseLevel) {
    743911    const G4ParticleDefinition* d = track.GetDefinition();
     
    755923  */
    756924
     925  const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
     926
    757927  // stopping
    758928  if (length >= fRange) {
     929    eloss = preStepKinEnergy;
     930    if (useDeexcitation) {
     931      if(idxDERegions[currentMaterialIndex]) {
     932        currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss);
     933        if(eloss < 0.0) eloss = 0.0;
     934      }
     935    }
    759936    fParticleChange.SetProposedKineticEnergy(0.0);
    760     fParticleChange.ProposeLocalEnergyDeposit(preStepKinEnergy);
     937    fParticleChange.ProposeLocalEnergyDeposit(eloss);
    761938    return &fParticleChange;
    762939  }
     
    772949      GetScaledRangeForScaledEnergy(preStepScaledEnergy) - length/reduceFactor;
    773950    eloss = preStepKinEnergy - ScaledKinEnergyForLoss(x)/massRatio;
     951   
    774952    /*
    775953    if(-1 < verboseLevel)
     
    781959             << " eloss0(MeV)= "
    782960             << GetDEDXForScaledEnergy(preStepScaledEnergy)*length/MeV
     961             << " lim(MeV)= " << preStepKinEnergy*linLossLimit/MeV
    783962             << G4endl;
    784963    */
    785964  }
    786965
    787   const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
    788   G4VEmModel* currentModel = SelectModel(preStepScaledEnergy);
    789   /*   
     966  /*   
    790967  G4double eloss0 = eloss;
    791968  if(-1 < verboseLevel ) {
     
    801978  G4double cut  = (*theCuts)[currentMaterialIndex];
    802979  G4double esec = 0.0;
    803   G4double esecdep = 0.0;
    804980
    805981  // SubCutOff
     
    807983    if(idxSCoffRegions[currentMaterialIndex]) {
    808984
    809       G4double currentMinSafety = 0.0;
     985      G4bool yes = false;
    810986      G4StepPoint* prePoint  = step.GetPreStepPoint();
    811       G4StepPoint* postPoint = step.GetPostStepPoint();
    812       G4double preSafety  = prePoint->GetSafety();
    813       G4double postSafety = preSafety - length;
    814       G4double rcut = currentCouple->GetProductionCuts()->GetProductionCut(1);
    815 
    816       // recompute safety
    817       if(prePoint->GetStepStatus() != fGeomBoundary &&
    818          postPoint->GetStepStatus() != fGeomBoundary) {
    819 
    820         /*
    821         //      G4bool yes = (track.GetTrackID() == 5512);
    822         G4bool yes = false;
    823         if(yes)
    824           G4cout << "G4VEnergyLoss: presafety= " << preSafety
    825                  << " rcut= " << rcut << "  length= " << length
    826                  << " dir " << track.GetMomentumDirection()
    827                  << G4endl;
    828         */
    829 
    830         if(preSafety < rcut)
     987
     988      // Check boundary
     989      if(prePoint->GetStepStatus() == fGeomBoundary) yes = true;
     990
     991      // Check PrePoint
     992      else {
     993        G4double preSafety  = prePoint->GetSafety();
     994        G4double rcut = currentCouple->GetProductionCuts()->GetProductionCut(1);
     995
     996        // recompute presafety
     997        if(preSafety < rcut) {
    831998          preSafety = safetyHelper->ComputeSafety(prePoint->GetPosition());
    832 
    833         //if(yes) {
    834         //  G4cout << "G4VEnergyLoss: newsafety= " << preSafety << G4endl;
    835           //       if(preSafety==0.0 && track.GetTrackID() == 5512 ) exit(1);
    836         //}
    837         if(postSafety < rcut)
    838           postSafety = safetyHelper->ComputeSafety(postPoint->GetPosition());
    839         /*     
    840           if(-1 < verboseLevel)
    841           G4cout << "Subcutoff: presafety(mm)= " << preSafety/mm
    842                  << " postsafety(mm)= " << postSafety/mm
    843                  << " rcut(mm)= " << rcut/mm
    844                  << G4endl;
    845         */
    846         currentMinSafety = std::min(preSafety,postSafety);
    847       }
    848 
     999        }
     1000
     1001        if(preSafety < rcut) yes = true;
     1002
     1003        // Check PostPoint
     1004        else {
     1005          G4double postSafety = preSafety - length;
     1006          if(postSafety < rcut) {
     1007            postSafety =
     1008              safetyHelper->ComputeSafety(step.GetPostStepPoint()->GetPosition());
     1009            if(postSafety < rcut) yes = true;
     1010          }
     1011        }
     1012      }
     1013 
    8491014      // Decide to start subcut sampling
    850       if(currentMinSafety < rcut) {
     1015      if(yes) {
    8511016
    8521017        cut = (*theSubCuts)[currentMaterialIndex];
     
    8561021                                currentModel,currentMaterialIndex,
    8571022                                esecdep);
     1023        // add bremsstrahlung sampling
    8581024        /*
    8591025        if(nProcesses > 0) {
     
    8761042            esec += e;
    8771043            pParticleChange->AddSecondary(t);
    878             //  mom -= t->GetMomentum();
    8791044          }     
    880           //        fParticleChange.SetProposedMomentum(mom);           
    8811045        }
    8821046      }
     
    8851049
    8861050  // Corrections, which cannot be tabulated
    887   CorrectionsAlongStep(currentCouple, dynParticle, eloss, length);
     1051  currentModel->CorrectionsAlongStep(currentCouple, dynParticle,
     1052                                     eloss, esecdep, length);
    8881053
    8891054  // Sample fluctuations
     
    8951060      G4double tmax =
    8961061        std::min(currentModel->MaxSecondaryKinEnergy(dynParticle),cut);
     1062      G4double emean = eloss;
    8971063      eloss = fluc->SampleFluctuations(currentMaterial,dynParticle,
    898                                        tmax,length,eloss);
    899       /*           
     1064                                       tmax,length,emean);
     1065      /*                            
    9001066      if(-1 < verboseLevel)
    9011067      G4cout << "After fluct: eloss(MeV)= " << eloss/MeV
    9021068             << " fluc= " << (eloss-eloss0)/MeV
    903              << " currentChargeSquare= " << chargeSquare
     1069             << " ChargeSqRatio= " << chargeSqRatio
    9041070             << " massRatio= " << massRatio
    9051071             << " tmax= " << tmax
     
    9111077  eloss += esecdep;
    9121078  if(eloss < 0.0) eloss = 0.0;
     1079
     1080  // deexcitation
     1081  else if (useDeexcitation) {
     1082    if(idxDERegions[currentMaterialIndex]) {
     1083      currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss);
     1084      if(eloss < 0.0) eloss = 0.0;
     1085    }
     1086  }
    9131087
    9141088  // Energy balanse
     
    9171091    eloss  = preStepKinEnergy - esec;
    9181092    finalT = 0.0;
     1093  } else if(isIon) {
     1094    fParticleChange.SetProposedCharge(
     1095      currentModel->GetParticleCharge(track.GetDefinition(),currentMaterial,finalT));
    9191096  }
    9201097
     
    9221099  fParticleChange.ProposeLocalEnergyDeposit(eloss);
    9231100
    924   /*
     1101  /* 
    9251102  if(-1 < verboseLevel) {
    9261103    G4cout << "Final value eloss(MeV)= " << eloss/MeV
     
    9311108           << G4endl;
    9321109  }
    933   */
     1110  */ 
    9341111
    9351112  return &fParticleChange;
     
    9431120       G4VEmModel* model,
    9441121       G4int idx,
    945        G4double& extraEdep)
     1122       G4double& /*extraEdep*/)
    9461123{
    9471124  // Fast check weather subcutoff can work
     
    9521129  const G4Track* track = step.GetTrack();
    9531130  const G4DynamicParticle* dp = track->GetDynamicParticle();
     1131  G4double e = dp->GetKineticEnergy()*massRatio;
    9541132  G4bool b;
    955   G4double cross =
    956     chargeSqRatio*(((*theSubLambdaTable)[idx])->GetValue(dp->GetKineticEnergy(),b));
     1133  G4double cross = chargeSqRatio*(((*theSubLambdaTable)[idx])->GetValue(e,b));
    9571134  G4double length = step.GetStepLength();
    9581135
    9591136  // negligible probability to get any interaction
    9601137  if(length*cross < perMillion) return;
    961   /*   
     1138  /*     
    9621139  if(-1 < verboseLevel)
    9631140    G4cout << "<<< Subcutoff for " << GetProcessName()
     
    9701147  // Sample subcutoff secondaries
    9711148  G4StepPoint* preStepPoint = step.GetPreStepPoint();
     1149  G4StepPoint* postStepPoint = step.GetPostStepPoint();
    9721150  G4ThreeVector prepoint = preStepPoint->GetPosition();
    973   G4ThreeVector dr = step.GetPostStepPoint()->GetPosition() - prepoint;
     1151  G4ThreeVector dr = postStepPoint->GetPosition() - prepoint;
    9741152  G4double pretime = preStepPoint->GetGlobalTime();
    975   //  G4double dt = length/preStepPoint->GetVelocity();
     1153  G4double dt = postStepPoint->GetGlobalTime() - pretime;
     1154  //G4double dt = length/preStepPoint->GetVelocity();
    9761155  G4double fragment = 0.0;
    9771156
     
    9921171
    9931172      G4bool addSec = true;
     1173      /*
    9941174      // do not track very low-energy delta-electrons
    9951175      if(theSecondaryRangeTable && (*it)->GetDefinition() == theElectron) {
     
    10041184        }
    10051185      }
     1186      */
    10061187      if(addSec) {
    1007         //      G4Track* t = new G4Track((*it), pretime + fragment*dt, r);
    1008         G4Track* t = new G4Track((*it), pretime, r);
     1188        G4Track* t = new G4Track((*it), pretime + fragment*dt, r);
     1189        //G4Track* t = new G4Track((*it), pretime, r);
    10091190        t->SetTouchableHandle(track->GetTouchableHandle());
    10101191        tracks.push_back(t);
    10111192
    1012         /*
    1013           if(-1 < verboseLevel)
    1014           G4cout << "New track " << p->GetDefinition()->GetParticleName()
    1015           << " e(keV)= " << p->GetKineticEnergy()/keV
    1016           << " fragment= " << fragment
    1017           << G4endl;
     1193        /*     
     1194        if(-1 < verboseLevel)
     1195          G4cout << "New track " << t->GetDefinition()->GetParticleName()
     1196                 << " e(keV)= " << t->GetKineticEnergy()/keV
     1197                << " fragment= " << fragment
     1198                << G4endl;
    10181199        */
    10191200      }
     
    10591240  }
    10601241
    1061   G4VEmModel* currentModel = SelectModel(postStepScaledEnergy);
     1242  SelectModel(postStepScaledEnergy);
     1243  if(useDeexcitation) {
     1244    currentModel->SetDeexcitationFlag(idxDERegions[currentMaterialIndex]);
     1245  }
     1246
    10621247  const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
    10631248  G4double tcut = (*theCuts)[currentMaterialIndex];
     
    10941279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    10951280
    1096 void G4VEnergyLossProcess::PrintInfoDefinition()
    1097 {
    1098   if(0 < verboseLevel) {
    1099     G4cout << G4endl << GetProcessName() << ":   tables are built for  "
    1100            << particle->GetParticleName()
    1101            << G4endl
    1102            << "      dE/dx and range tables from "
    1103            << G4BestUnit(minKinEnergy,"Energy")
    1104            << " to " << G4BestUnit(maxKinEnergy,"Energy")
    1105            << " in " << nBins << " bins." << G4endl
    1106            << "      Lambda tables from threshold to "
    1107            << G4BestUnit(maxKinEnergy,"Energy")
    1108            << " in " << nBins << " bins."
     1281G4bool G4VEnergyLossProcess::StorePhysicsTable(
     1282       const G4ParticleDefinition* part, const G4String& directory,
     1283       G4bool ascii)
     1284{
     1285  G4bool res = true;
     1286  if ( baseParticle || part != particle ) return res;
     1287
     1288  if(!StoreTable(part,theDEDXTable,ascii,directory,"DEDX"))
     1289    {res = false;}
     1290
     1291  if(!StoreTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr"))
     1292    {res = false;}
     1293
     1294  if(!StoreTable(part,theDEDXSubTable,ascii,directory,"SubDEDX"))
     1295    {res = false;}
     1296
     1297  if(!StoreTable(part,theIonisationTable,ascii,directory,"Ionisation"))
     1298    {res = false;}
     1299
     1300  if(!StoreTable(part,theIonisationSubTable,ascii,directory,"SubIonisation"))
     1301    {res = false;}
     1302
     1303  if(isIonisation &&
     1304     !StoreTable(part,theCSDARangeTable,ascii,directory,"CSDARange"))
     1305    {res = false;}
     1306
     1307  if(isIonisation &&
     1308     !StoreTable(part,theRangeTableForLoss,ascii,directory,"Range"))
     1309    {res = false;}
     1310 
     1311  if(isIonisation &&
     1312     !StoreTable(part,theInverseRangeTable,ascii,directory,"InverseRange"))
     1313    {res = false;}
     1314 
     1315  if(!StoreTable(part,theLambdaTable,ascii,directory,"Lambda"))
     1316    {res = false;}
     1317
     1318  if(!StoreTable(part,theSubLambdaTable,ascii,directory,"SubLambda"))
     1319    {res = false;}
     1320
     1321  if ( res ) {
     1322    if(0 < verboseLevel) {
     1323      G4cout << "Physics tables are stored for " << particle->GetParticleName()
     1324             << " and process " << GetProcessName()
     1325             << " in the directory <" << directory
     1326             << "> " << G4endl;
     1327    }
     1328  } else {
     1329    G4cout << "Fail to store Physics Tables for "
     1330           << particle->GetParticleName()
     1331           << " and process " << GetProcessName()
     1332           << " in the directory <" << directory
     1333           << "> " << G4endl;
     1334  }
     1335  return res;
     1336}
     1337
     1338//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     1339
     1340G4bool G4VEnergyLossProcess::RetrievePhysicsTable(
     1341       const G4ParticleDefinition* part, const G4String& directory,
     1342       G4bool ascii)
     1343{
     1344  G4bool res = true;
     1345  const G4String particleName = part->GetParticleName();
     1346
     1347  if(1 < verboseLevel) {
     1348    G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
     1349           << particleName << " and process " << GetProcessName()
     1350           << "; tables_are_built= " << tablesAreBuilt
    11091351           << G4endl;
    1110     PrintInfo();
    1111     if(theRangeTableForLoss && isIonisation)
    1112       G4cout << "      Step function: finalRange(mm)= " << finalRange/mm
    1113              << ", dRoverRange= " << dRoverRange
    1114              << ", integral: " << integral
    1115              << ", fluct: " << lossFluctuationFlag
    1116              << G4endl;
    1117    
    1118     if(theCSDARangeTable && isIonisation)
    1119       G4cout << "      CSDA range table up"
    1120              << " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
    1121              << " in " << nBinsCSDA << " bins." << G4endl;
    1122    
    1123     if(nSCoffRegions>0)
    1124       G4cout << "      Subcutoff sampling in " << nSCoffRegions
    1125              << " regions" << G4endl;
    1126 
    1127     if(2 < verboseLevel) {
    1128       G4cout << "DEDXTable address= " << theDEDXTable << G4endl;
    1129       if(theDEDXTable && isIonisation) G4cout << (*theDEDXTable) << G4endl;
    1130       G4cout << "non restricted DEDXTable address= "
    1131              << theDEDXunRestrictedTable << G4endl;
    1132       if(theDEDXunRestrictedTable && isIonisation)
    1133            G4cout << (*theDEDXunRestrictedTable) << G4endl;
    1134       if(theDEDXSubTable && isIonisation) G4cout << (*theDEDXSubTable)
    1135                                                  << G4endl;
    1136       G4cout << "CSDARangeTable address= " << theCSDARangeTable
     1352  }
     1353  if(particle == part) {
     1354
     1355    //    G4bool yes = true;
     1356    if ( !baseParticle ) {
     1357
     1358      G4bool fpi = true;
     1359      if(!RetrieveTable(part,theDEDXTable,ascii,directory,"DEDX",fpi))
     1360        {fpi = false;}
     1361
     1362      if(!RetrieveTable(part,theIonisationTable,ascii,directory,"Ionisation",false))
     1363        {fpi = false;}
     1364
     1365      if(!RetrieveTable(part,theRangeTableForLoss,ascii,directory,"Range",fpi))
     1366        {res = false;}
     1367
     1368      if(!RetrieveTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr",false))
     1369        {res = false;}
     1370
     1371      if(!RetrieveTable(part,theCSDARangeTable,ascii,directory,"CSDARange",false))
     1372        {res = false;}
     1373
     1374      if(!RetrieveTable(part,theInverseRangeTable,ascii,directory,"InverseRange",fpi))
     1375        {res = false;}
     1376
     1377      if(!RetrieveTable(part,theLambdaTable,ascii,directory,"Lambda",true))
     1378        {res = false;}
     1379
     1380      G4bool yes = false;
     1381      if(nSCoffRegions > 0) {yes = true;}
     1382
     1383      if(!RetrieveTable(part,theDEDXSubTable,ascii,directory,"SubDEDX",yes))
     1384        {res = false;}
     1385
     1386      if(!RetrieveTable(part,theSubLambdaTable,ascii,directory,"SubLambda",yes))
     1387        {res = false;}
     1388
     1389      if(!fpi) yes = false;
     1390      if(!RetrieveTable(part,theIonisationSubTable,ascii,directory,"SubIonisation",yes))
     1391        {res = false;}
     1392    }
     1393  }
     1394
     1395  return res;
     1396}
     1397
     1398//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     1399
     1400G4bool G4VEnergyLossProcess::StoreTable(const G4ParticleDefinition* part,
     1401                                        G4PhysicsTable* aTable, G4bool ascii,
     1402                                        const G4String& directory,
     1403                                        const G4String& tname)
     1404{
     1405  G4bool res = true;
     1406  if ( aTable ) {
     1407    const G4String name = GetPhysicsTableFileName(part,directory,tname,ascii);
     1408    if( !aTable->StorePhysicsTable(name,ascii)) res = false;
     1409  }
     1410  return res;
     1411}
     1412
     1413//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
     1414
     1415G4bool G4VEnergyLossProcess::RetrieveTable(const G4ParticleDefinition* part,
     1416                                           G4PhysicsTable* aTable, G4bool ascii,
     1417                                           const G4String& directory,
     1418                                           const G4String& tname,
     1419                                           G4bool mandatory)
     1420{
     1421  G4bool res = true;
     1422  G4String filename = GetPhysicsTableFileName(part,directory,tname,ascii);
     1423  G4bool yes = aTable->ExistPhysicsTable(filename);
     1424  if(yes) {
     1425    yes = G4PhysicsTableHelper::RetrievePhysicsTable(aTable,filename,ascii);
     1426    if((G4LossTableManager::Instance())->SplineFlag()) {
     1427      size_t n = aTable->length();
     1428      for(size_t i=0; i<n; i++) {(*aTable)[i]->SetSpline(true);}
     1429    }
     1430  }
     1431  if(yes) {
     1432    if (0 < verboseLevel) {
     1433      G4cout << tname << " table for " << part->GetParticleName()
     1434             << " is Retrieved from <" << filename << ">"
    11371435             << G4endl;
    1138       if(theCSDARangeTable && isIonisation) G4cout << (*theCSDARangeTable)
    1139             << G4endl;
    1140       G4cout << "RangeTableForLoss address= " << theRangeTableForLoss
     1436    }
     1437  } else {
     1438    if(mandatory) res = false;
     1439    if(mandatory || 1 < verboseLevel) {
     1440      G4cout << tname << " table for " << part->GetParticleName()
     1441             << " from file <"
     1442             << filename << "> is not Retrieved"
    11411443             << G4endl;
    1142       if(theRangeTableForLoss && isIonisation)
    1143              G4cout << (*theRangeTableForLoss) << G4endl;
    1144       G4cout << "InverseRangeTable address= " << theInverseRangeTable
    1145              << G4endl;
    1146       if(theInverseRangeTable && isIonisation)
    1147              G4cout << (*theInverseRangeTable) << G4endl;
    1148       G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
    1149       if(theLambdaTable && isIonisation) G4cout << (*theLambdaTable) << G4endl;
    1150       G4cout << "SubLambdaTable address= " << theSubLambdaTable << G4endl;
    1151       if(theSubLambdaTable && isIonisation) G4cout << (*theSubLambdaTable)
    1152              << G4endl;
     1444    }
     1445  }
     1446  return res;
     1447}
     1448
     1449//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1450
     1451G4double G4VEnergyLossProcess::GetDEDXDispersion(
     1452                                  const G4MaterialCutsCouple *couple,
     1453                                  const G4DynamicParticle* dp,
     1454                                        G4double length)
     1455{
     1456  DefineMaterial(couple);
     1457  G4double ekin = dp->GetKineticEnergy();
     1458  SelectModel(ekin*massRatio);
     1459  G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
     1460  tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
     1461  G4double d = 0.0;
     1462  G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
     1463  if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
     1464  return d;
     1465}
     1466
     1467//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1468
     1469G4double G4VEnergyLossProcess::CrossSectionPerVolume(
     1470         G4double kineticEnergy, const G4MaterialCutsCouple* couple)
     1471{
     1472  // Cross section per volume is calculated
     1473  DefineMaterial(couple);
     1474  G4double cross = 0.0;
     1475  G4bool b;
     1476  if(theLambdaTable) {
     1477    cross =
     1478      ((*theLambdaTable)[currentMaterialIndex])->GetValue(kineticEnergy, b);
     1479  } else {
     1480    SelectModel(kineticEnergy);
     1481    cross =
     1482      currentModel->CrossSectionPerVolume(currentMaterial,
     1483                                          particle, kineticEnergy,
     1484                                          (*theCuts)[currentMaterialIndex]);
     1485  }
     1486
     1487  return cross;
     1488}
     1489
     1490//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1491
     1492G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
     1493{
     1494  DefineMaterial(track.GetMaterialCutsCouple());
     1495  preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
     1496  G4double x = DBL_MAX;
     1497  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
     1498  return x;
     1499}
     1500
     1501//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1502
     1503G4double G4VEnergyLossProcess::ContinuousStepLimit(const G4Track& track,
     1504                                                   G4double x, G4double y,
     1505                                                   G4double& z)
     1506{
     1507  G4GPILSelection sel;
     1508  return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
     1509}
     1510
     1511//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1512
     1513G4double G4VEnergyLossProcess::GetMeanFreePath(
     1514                             const G4Track& track,
     1515                             G4double,
     1516                             G4ForceCondition* condition)
     1517
     1518{
     1519  *condition = NotForced;
     1520  return MeanFreePath(track);
     1521}
     1522
     1523//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1524
     1525G4double G4VEnergyLossProcess::GetContinuousStepLimit(
     1526                const G4Track&,
     1527                G4double, G4double, G4double&)
     1528{
     1529  return DBL_MAX;
     1530}
     1531
     1532//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1533
     1534G4PhysicsVector* G4VEnergyLossProcess::LambdaPhysicsVector(
     1535                 const G4MaterialCutsCouple* couple, G4double cut)
     1536{
     1537  //  G4double cut  = (*theCuts)[couple->GetIndex()];
     1538  //  G4int nbins = nLambdaBins;
     1539  G4double tmin =
     1540    std::max(MinPrimaryEnergy(particle, couple->GetMaterial(), cut),
     1541             minKinEnergy);
     1542  if(tmin >= maxKinEnergy) tmin = 0.5*maxKinEnergy;
     1543  G4PhysicsVector* v = new G4PhysicsLogVector(tmin, maxKinEnergy, nBins);
     1544  v->SetSpline((G4LossTableManager::Instance())->SplineFlag());
     1545
     1546  return v;
     1547}
     1548
     1549//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1550 
     1551void G4VEnergyLossProcess::AddCollaborativeProcess(
     1552            G4VEnergyLossProcess* p)
     1553{
     1554  G4bool add = true;
     1555  if(p->GetProcessName() != "eBrem") add = false;
     1556  if(add && nProcesses > 0) {
     1557    for(G4int i=0; i<nProcesses; i++) {
     1558      if(p == scProcesses[i]) {
     1559        add = false;
     1560        break;
     1561      }
     1562    }
     1563  }
     1564  if(add) {
     1565    scProcesses.push_back(p);
     1566    nProcesses++;
     1567    if (1 < verboseLevel) {
     1568      G4cout << "### The process " << p->GetProcessName()
     1569             << " is added to the list of collaborative processes of "
     1570             << GetProcessName() << G4endl;
    11531571    }
    11541572  }
     
    11821600  } else if(fSubRestricted == tType) {   
    11831601    theDEDXSubTable = p;
    1184   } else if(fIonisation == tType && theIonisationTable != p) {   
     1602  } else if(fIsIonisation == tType && theIonisationTable != p) {   
    11851603    if(theIonisationTable) theIonisationTable->clearAndDestroy();
    11861604    theIonisationTable = p;
    1187   } else if(fSubIonisation == tType && theIonisationSubTable != p) {   
     1605  } else if(fIsSubIonisation == tType && theIonisationSubTable != p) {   
    11881606    if(theIonisationSubTable) theIonisationSubTable->clearAndDestroy();
    11891607    theIonisationSubTable = p;
     
    13191737//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    13201738
    1321 G4PhysicsVector* G4VEnergyLossProcess::LambdaPhysicsVector(
    1322                  const G4MaterialCutsCouple* couple, G4double cut)
    1323 {
    1324   //  G4double cut  = (*theCuts)[couple->GetIndex()];
    1325   //  G4int nbins = nLambdaBins;
    1326   G4double tmin =
    1327     std::max(MinPrimaryEnergy(particle, couple->GetMaterial(), cut),
    1328              minKinEnergy);
    1329   if(tmin >= maxKinEnergy) tmin = 0.5*maxKinEnergy;
    1330   G4PhysicsVector* v = new G4PhysicsLogVector(tmin, maxKinEnergy, nBins);
    1331   return v;
    1332 }
    1333 
    1334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1335 
    1336 G4double G4VEnergyLossProcess::MicroscopicCrossSection(
    1337          G4double kineticEnergy, const G4MaterialCutsCouple* couple)
    1338 {
    1339   // Cross section per atom is calculated
    1340   DefineMaterial(couple);
    1341   G4double cross = 0.0;
    1342   G4bool b;
    1343   if(theLambdaTable)
    1344     cross =
    1345       ((*theLambdaTable)[currentMaterialIndex])->GetValue(kineticEnergy, b)/
    1346       currentMaterial->GetTotNbOfAtomsPerVolume();
    1347 
    1348   return cross;
    1349 }
    1350 
    1351 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1352 
    1353 G4bool G4VEnergyLossProcess::StorePhysicsTable(
    1354        const G4ParticleDefinition* part, const G4String& directory,
    1355        G4bool ascii)
    1356 {
    1357   G4bool res = true;
    1358   if ( baseParticle || part != particle ) return res;
    1359 
    1360   if ( theDEDXTable ) {
    1361     const G4String name = GetPhysicsTableFileName(part,directory,"DEDX",ascii);
    1362     if( !theDEDXTable->StorePhysicsTable(name,ascii)) res = false;
    1363   }
    1364 
    1365   if ( theDEDXunRestrictedTable ) {
    1366     const G4String name =
    1367       GetPhysicsTableFileName(part,directory,"DEDXnr",ascii);
    1368     if( !theDEDXTable->StorePhysicsTable(name,ascii)) res = false;
    1369   }
    1370 
    1371   if ( theDEDXSubTable ) {
    1372     const G4String name =
    1373       GetPhysicsTableFileName(part,directory,"SubDEDX",ascii);
    1374     if( !theDEDXSubTable->StorePhysicsTable(name,ascii)) res = false;
    1375   }
    1376 
    1377   if ( theIonisationTable ) {
    1378     const G4String name =
    1379       GetPhysicsTableFileName(part,directory,"Ionisation",ascii);
    1380     if( !theIonisationTable->StorePhysicsTable(name,ascii)) res = false;
    1381   }
    1382 
    1383   if ( theIonisationSubTable ) {
    1384     const G4String name =
    1385       GetPhysicsTableFileName(part,directory,"SubIonisation",ascii);
    1386     if( !theIonisationSubTable->StorePhysicsTable(name,ascii)) res = false;
    1387   }
    1388 
    1389   if ( theCSDARangeTable && isIonisation ) {
    1390     const G4String name =
    1391       GetPhysicsTableFileName(part,directory,"CSDARange",ascii);
    1392     if( !theCSDARangeTable->StorePhysicsTable(name,ascii)) res = false;
    1393   }
    1394 
    1395   if ( theRangeTableForLoss && isIonisation ) {
    1396     const G4String name =
    1397       GetPhysicsTableFileName(part,directory,"Range",ascii);
    1398     if( !theRangeTableForLoss->StorePhysicsTable(name,ascii)) res = false;
    1399   }
    1400 
    1401   if ( theInverseRangeTable && isIonisation ) {
    1402     const G4String name =
    1403       GetPhysicsTableFileName(part,directory,"InverseRange",ascii);
    1404     if( !theInverseRangeTable->StorePhysicsTable(name,ascii)) res = false;
    1405   }
    1406 
    1407   if ( theLambdaTable  && isIonisation) {
    1408     const G4String name =
    1409       GetPhysicsTableFileName(part,directory,"Lambda",ascii);
    1410     if( !theLambdaTable->StorePhysicsTable(name,ascii)) res = false;
    1411   }
    1412 
    1413   if ( theSubLambdaTable  && isIonisation) {
    1414     const G4String name =
    1415       GetPhysicsTableFileName(part,directory,"SubLambda",ascii);
    1416     if( !theSubLambdaTable->StorePhysicsTable(name,ascii)) res = false;
    1417   }
    1418   if ( res ) {
    1419     if(0 < verboseLevel) {
    1420       G4cout << "Physics tables are stored for " << particle->GetParticleName()
    1421              << " and process " << GetProcessName()
    1422              << " in the directory <" << directory
    1423              << "> " << G4endl;
    1424     }
    1425   } else {
    1426     G4cout << "Fail to store Physics Tables for "
    1427            << particle->GetParticleName()
    1428            << " and process " << GetProcessName()
    1429            << " in the directory <" << directory
    1430            << "> " << G4endl;
    1431   }
    1432   return res;
    1433 }
    1434 
    1435 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
    1436 
    1437 G4bool G4VEnergyLossProcess::RetrievePhysicsTable(
    1438        const G4ParticleDefinition* part, const G4String& directory,
    1439        G4bool ascii)
    1440 {
    1441   G4bool res = true;
    1442   const G4String particleName = part->GetParticleName();
    1443 
    1444   if(1 < verboseLevel) {
    1445     G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
    1446            << particleName << " and process " << GetProcessName()
    1447            << "; tables_are_built= " << tablesAreBuilt
    1448            << G4endl;
    1449   }
    1450   if(particle == part) {
    1451 
    1452     G4bool yes = true;
    1453     G4bool fpi = true;
    1454     if ( !baseParticle ) {
    1455       G4String filename;
    1456 
    1457       filename = GetPhysicsTableFileName(part,directory,"DEDX",ascii);
    1458       yes = theDEDXTable->ExistPhysicsTable(filename);
    1459       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1460                     theDEDXTable,filename,ascii);
    1461       if(yes) {
    1462         if (0 < verboseLevel) {
    1463           G4cout << "DEDX table for " << particleName
    1464                  << " is Retrieved from <"
    1465                  << filename << ">"
    1466                  << G4endl;
    1467         }
    1468       } else {
    1469         fpi = false;
    1470         if (1 < verboseLevel) {
    1471           G4cout << "DEDX table for " << particleName << " from file <"
    1472                  << filename << "> is not Retrieved"
    1473                  << G4endl;
    1474         }
    1475       }
    1476 
    1477       filename = GetPhysicsTableFileName(part,directory,"Range",ascii);
    1478       yes = theRangeTableForLoss->ExistPhysicsTable(filename);
    1479       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1480                     theRangeTableForLoss,filename,ascii);
    1481       if(yes) {
    1482         if (0 < verboseLevel) {
    1483           G4cout << "Range table for loss for " << particleName
    1484                  << " is Retrieved from <"
    1485                  << filename << ">"
    1486                  << G4endl;
    1487         }
    1488       } else {
    1489         if(fpi) {
    1490           res = false;
    1491           G4cout << "Range table for loss for " << particleName
    1492                  << " from file <"
    1493                  << filename << "> is not Retrieved"
    1494                  << G4endl;
    1495         }
    1496       }
    1497 
    1498       filename = GetPhysicsTableFileName(part,directory,"DEDXnr",ascii);
    1499       yes = theDEDXunRestrictedTable->ExistPhysicsTable(filename);
    1500       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1501                     theDEDXunRestrictedTable,filename,ascii);
    1502       if(yes) {
    1503         if (0 < verboseLevel) {
    1504           G4cout << "Non-restricted DEDX table for " << particleName
    1505                  << " is Retrieved from <"
    1506                  << filename << ">"
    1507                  << G4endl;
    1508         }
    1509       } else {
    1510         if (1 < verboseLevel) {
    1511           G4cout << "Non-restricted DEDX table for " << particleName
    1512                  << " from file <"
    1513                  << filename << "> is not Retrieved"
    1514                  << G4endl;
    1515         }
    1516       }
    1517 
    1518       filename = GetPhysicsTableFileName(part,directory,"CSDARange",ascii);
    1519       yes = theCSDARangeTable->ExistPhysicsTable(filename);
    1520       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1521                     theCSDARangeTable,filename,ascii);
    1522       if(yes) {
    1523         if (0 < verboseLevel) {
    1524           G4cout << "CSDA Range table for " << particleName
    1525                  << " is Retrieved from <"
    1526                  << filename << ">"
    1527                  << G4endl;
    1528         }
    1529       } else {
    1530         G4cout << "CSDA Range table for loss for " << particleName
    1531                << " does not exist"
    1532                << G4endl;
    1533       }
    1534 
    1535       filename = GetPhysicsTableFileName(part,directory,"InverseRange",ascii);
    1536       yes = theInverseRangeTable->ExistPhysicsTable(filename);
    1537       if(yes)  yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1538                      theInverseRangeTable,filename,ascii);
    1539       if(yes) {
    1540         if (0 < verboseLevel) {
    1541           G4cout << "InverseRange table for " << particleName
    1542                  << " is Retrieved from <"
    1543                  << filename << ">"
    1544                  << G4endl;
    1545         }
    1546       } else {
    1547         if(fpi) {
    1548           res = false;
    1549           G4cout << "InverseRange table for " << particleName
    1550                  << " from file <"
    1551                  << filename << "> is not Retrieved"
    1552                  << G4endl;
    1553 
    1554         }
    1555       }
    1556 
    1557       filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
    1558       yes = theLambdaTable->ExistPhysicsTable(filename);
    1559       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1560                     theLambdaTable,filename,ascii);
    1561       if(yes) {
    1562         if (0 < verboseLevel) {
    1563           G4cout << "Lambda table for " << particleName
    1564                  << " is Retrieved from <"
    1565                  << filename << ">"
    1566                  << G4endl;
    1567         }
    1568       } else {
    1569         if(fpi) {
    1570           res = false;
    1571           G4cout << "Lambda table for " << particleName << " from file <"
    1572                  << filename << "> is not Retrieved"
    1573                  << G4endl;
    1574         }
    1575       }
    1576 
    1577       filename = GetPhysicsTableFileName(part,directory,"SubDEDX",ascii);
    1578       yes = theDEDXSubTable->ExistPhysicsTable(filename);
    1579       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1580                     theDEDXSubTable,filename,ascii);
    1581       if(yes) {
    1582         if (0 < verboseLevel) {
    1583           G4cout << "SubDEDX table for " << particleName
    1584                  << " is Retrieved from <"
    1585                  << filename << ">"
    1586                  << G4endl;
    1587         }
    1588       } else {
    1589         if(nSCoffRegions) {
    1590           res=false;
    1591           G4cout << "SubDEDX table for " << particleName << " from file <"
    1592                  << filename << "> is not Retrieved"
    1593                  << G4endl;
    1594         }
    1595       }
    1596 
    1597       filename = GetPhysicsTableFileName(part,directory,"SubLambda",ascii);
    1598       yes = theSubLambdaTable->ExistPhysicsTable(filename);
    1599       if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1600                     theSubLambdaTable,filename,ascii);
    1601       if(yes) {
    1602         if (0 < verboseLevel) {
    1603           G4cout << "SubLambda table for " << particleName
    1604                  << " is Retrieved from <"
    1605                  << filename << ">"
    1606                  << G4endl;
    1607         }
    1608       } else {
    1609         if(nSCoffRegions) {
    1610           res=false;
    1611           G4cout << "SubLambda table for " << particleName << " from file <"
    1612                  << filename << "> is not Retrieved"
    1613                  << G4endl;
    1614         }
    1615       }
    1616 
    1617       filename = GetPhysicsTableFileName(part,directory,"Ionisation",ascii);
    1618       yes = theIonisationTable->ExistPhysicsTable(filename);
    1619       if(yes) {
    1620         theIonisationTable =
    1621           G4PhysicsTableHelper::PreparePhysicsTable(theIonisationTable);
    1622        
    1623         yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1624                     theIonisationTable,filename,ascii);
    1625       }
    1626       if(yes) {
    1627         if (0 < verboseLevel) {
    1628           G4cout << "Ionisation table for " << particleName
    1629                  << " is Retrieved from <"
    1630                  << filename << ">"
    1631                  << G4endl;
    1632         }
    1633       }
    1634 
    1635       filename = GetPhysicsTableFileName(part,directory,"SubIonisation",ascii);
    1636       yes = theIonisationSubTable->ExistPhysicsTable(filename);
    1637       if(yes) {
    1638         theIonisationSubTable =
    1639           G4PhysicsTableHelper::PreparePhysicsTable(theIonisationSubTable);
    1640         yes = G4PhysicsTableHelper::RetrievePhysicsTable(
    1641                     theIonisationSubTable,filename,ascii);
    1642       }
    1643       if(yes) {
    1644         if (0 < verboseLevel) {
    1645           G4cout << "SubIonisation table for " << particleName
    1646                  << " is Retrieved from <"
    1647                  << filename << ">"
    1648                  << G4endl;
    1649         }
    1650       }
    1651     }
    1652   }
    1653 
    1654   return res;
    1655 }
    1656 
    1657 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1658  
    1659 void G4VEnergyLossProcess::AddCollaborativeProcess(
    1660             G4VEnergyLossProcess* p)
    1661 {
    1662   G4bool add = true;
    1663   if(nProcesses > 0) {
    1664     for(G4int i=0; i<nProcesses; i++) {
    1665       if(p == scProcesses[i]) {
    1666         add = false;
    1667         break;
    1668       }
    1669     }
    1670   }
    1671   if(add) {
    1672     scProcesses.push_back(p);
    1673     nProcesses++;
    1674     if (0 < verboseLevel)
    1675       G4cout << "### The process " << p->GetProcessName()
    1676              << " is added to the list of collaborative processes of "
    1677              << GetProcessName() << G4endl;
    1678   }
    1679 }
    1680 
    1681 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1682 
    1683 G4double G4VEnergyLossProcess::GetDEDXDispersion(
    1684                                   const G4MaterialCutsCouple *couple,
    1685                                   const G4DynamicParticle* dp,
    1686                                         G4double length)
    1687 {
    1688   DefineMaterial(couple);
    1689   G4double ekin = dp->GetKineticEnergy();
    1690   G4VEmModel* currentModel = SelectModel(ekin*massRatio);
    1691   G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
    1692   tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
    1693   G4double d = 0.0;
    1694   G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
    1695   if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
    1696   return d;
    1697 }
    1698 
    1699 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1700 
    1701 void G4VEnergyLossProcess::ActivateDeexcitation(G4bool, const G4Region*)
    1702 {}
    1703 
    1704 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1705 
  • trunk/source/processes/electromagnetic/utils/src/G4VMultipleScattering.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VMultipleScattering.cc,v 1.47 2007/11/09 11:35:54 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4VMultipleScattering.cc,v 1.60 2008/11/20 20:32:40 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5555// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
    5656// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
     57// 11-03-08 Set skin value does not effect step limit type (V.Ivanchenko)
    5758//
    5859// Class Description:
     
    8586//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    8687
    87 G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType type):
    88                  G4VContinuousDiscreteProcess(name, type),
     88G4VMultipleScattering::G4VMultipleScattering(const G4String& name,
     89                                             G4ProcessType type):
     90  G4VContinuousDiscreteProcess(name, type),
     91  buildLambdaTable(true),
    8992  theLambdaTable(0),
    9093  firstParticle(0),
    91   currentParticle(0),
    92   currentCouple(0),
    93   nBins(120),
    9494  stepLimit(fUseSafety),
    95   skin(0.0),
     95  skin(3.0),
    9696  facrange(0.02),
    9797  facgeom(2.5),
    9898  latDisplasment(true),
    99   buildLambdaTable(true)
    100 {
     99  currentParticle(0),
     100  currentCouple(0)
     101{
     102  SetVerboseLevel(1);
     103  SetProcessSubType(fMultipleScattering);
     104
     105  // Size of tables assuming spline
    101106  minKinEnergy = 0.1*keV;
    102107  maxKinEnergy = 100.0*TeV;
    103   SetVerboseLevel(1);
     108  nBins        = 84;
     109
     110  // default limit on polar angle
     111  polarAngleLimit = 0.0;
    104112
    105113  pParticleChange = &fParticleChange;
     
    114122G4VMultipleScattering::~G4VMultipleScattering()
    115123{
    116   if(1 < verboseLevel)
     124  if(1 < verboseLevel) {
    117125    G4cout << "G4VMultipleScattering destruct " << GetProcessName()
    118126           << G4endl;
     127  }
    119128  delete modelManager;
    120129  if (theLambdaTable) {
     
    131140  G4String num = part.GetParticleName();
    132141  if(1 < verboseLevel) {
    133     //    G4cout << "========================================================" << G4endl;
    134142    G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
    135143           << GetProcessName()
     
    148156      if (theLambdaTable->GetFlag(i)) {
    149157        // create physics vector and fill it
    150         const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
     158        const G4MaterialCutsCouple* couple =
     159          theCoupleTable->GetMaterialCutsCouple(i);
    151160        G4PhysicsVector* aVector = PhysicsVector(couple);
    152161        modelManager->FillLambdaVector(aVector, couple, false);
     
    162171  }
    163172  if(verboseLevel>0 && ( num == "e-" || num == "mu+" || 
    164                          num == "proton" || num == "pi-" || num == "GenericIon")) {
     173                         num == "proton" || num == "pi-" ||
     174                         num == "GenericIon")) {
    165175    PrintInfoDefinition();
    166176    if(2 < verboseLevel && theLambdaTable) G4cout << *theLambdaTable << G4endl;
     
    182192    currentCouple = 0;
    183193    if(part.GetParticleType() == "nucleus" &&
    184        part.GetParticleSubType() == "generic")
    185          firstParticle = G4GenericIon::GenericIon();
    186     else firstParticle = &part;
     194       part.GetParticleSubType() == "generic") {
     195      firstParticle = G4GenericIon::GenericIon();
     196    } else {
     197      firstParticle = &part;
     198    }
     199
    187200    currentParticle = &part;
    188201  }
    189202
    190203  if(1 < verboseLevel) {
    191     //    G4cout << "========================================================" << G4endl;
    192204    G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
    193205           << GetProcessName()
     
    217229{
    218230  if (0 < verboseLevel) {
    219     G4cout << G4endl << GetProcessName() << ":  Model variant of multiple scattering "
    220            << "for " << firstParticle->GetParticleName()
     231    G4cout << G4endl << GetProcessName()
     232           << ":   for " << firstParticle->GetParticleName()
     233           << "    SubType= " << GetProcessSubType()
    221234           << G4endl;
    222235    if (theLambdaTable) {
     
    225238             << " to "
    226239             << G4BestUnit(MaxKinEnergy(),"Energy")
    227              << " in " << nBins << " bins."
     240             << " in " << nBins << " bins, spline: "
     241             << (G4LossTableManager::Instance())->SplineFlag()
    228242             << G4endl;
    229243    }
    230     G4cout << "      LateralDisplacementFlag=  " << latDisplasment
    231            << "   Skin= " << skin << G4endl;
    232244    PrintInfo();
     245    modelManager->DumpModelList(verboseLevel);
    233246    if (2 < verboseLevel) {
    234247      G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
     
    242255G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
    243256                             const G4Track& track,
    244                              G4double previousStepSize,
     257                             G4double,
    245258                             G4double currentMinimalStep,
    246259                             G4double& currentSafety,
     
    249262  // get Step limit proposed by the process
    250263  valueGPILSelectionMSC = NotCandidateForSelection;
    251   G4double steplength = GetMscContinuousStepLimit(track,previousStepSize,
    252                                               currentMinimalStep,currentSafety);
     264  G4double steplength = GetMscContinuousStepLimit(track,
     265                                                  track.GetKineticEnergy(),
     266                                                  currentMinimalStep,
     267                                                  currentSafety);
    253268  // G4cout << "StepLimit= " << steplength << G4endl;
    254269  // set return value for G4GPILSelection
     
    315330  if( couple->IsUsed() ) nbins = nBins;
    316331  G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nbins);
     332  v->SetSpline((G4LossTableManager::Instance())->SplineFlag());
    317333  return v;
    318334}
     
    372388               << G4endl;
    373389    }
     390    if((G4LossTableManager::Instance())->SplineFlag()) {
     391      size_t n = theLambdaTable->length();
     392      for(size_t i=0; i<n; i++) {(* theLambdaTable)[i]->SetSpline(true);}
     393    }
    374394  } else {
    375395    if (1 < verboseLevel) {
  • trunk/source/processes/electromagnetic/utils/src/G4ionEffectiveCharge.cc

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4ionEffectiveCharge.cc,v 1.17.2.1 2008/04/22 15:28:13 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: G4ionEffectiveCharge.cc,v 1.24 2008/12/18 13:01:46 gunter Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    5454#include "G4ionEffectiveCharge.hh"
    5555#include "G4UnitsTable.hh"
    56 #include "G4ParticleDefinition.hh"
    5756#include "G4Material.hh"
     57#include "G4NistManager.hh"
    5858
    5959//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    6262{
    6363  chargeCorrection = 1.0;
    64   energyHighLimit  = 10.0*MeV;
     64  energyHighLimit  = 20.0*MeV;
    6565  energyLowLimit   = 1.0*keV;
    6666  energyBohr       = 25.*keV;
    6767  massFactor       = amu_c2/(proton_mass_c2*keV);
    68   minCharge        = 0.1;
     68  minCharge        = 1.0;
     69  lastPart         = 0;
     70  lastMat          = 0;
     71  lastKinEnergy    = 0.0;
     72  effCharge        = eplus;
     73  nist = G4NistManager::Instance();
    6974}
    7075
     
    7883G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
    7984                                               const G4Material* material,
    80                                                      G4double kineticEnergy)
     85                                               G4double kineticEnergy)
    8186{
     87  if(p == lastPart && material == lastMat && kineticEnergy == lastKinEnergy)
     88    return effCharge;
     89
     90  lastPart      = p;
     91  lastMat       = material;
     92  lastKinEnergy = kineticEnergy;
     93
    8294  G4double mass   = p->GetPDGMass();
    8395  G4double charge = p->GetPDGCharge();
     
    8597
    8698  chargeCorrection = 1.0;
     99  effCharge = charge;
    87100
    88101  // The aproximation of ion effective charge from:
     
    94107  if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 || !material) return charge;
    95108
    96   static G4double c[6] = {0.2865,  0.1266, -0.001429,
    97                           0.02402,-0.01135, 0.001475} ;
    98 
    99109  G4double z    = material->GetIonisation()->GetZeffective();
    100   reducedEnergy = std::max(reducedEnergy,energyLowLimit);
    101   G4double q;
     110  //  reducedEnergy = std::max(reducedEnergy,energyLowLimit);
    102111
    103112  // Helium ion case
    104113  if( Zi < 2.5 ) {
     114
     115    static G4double c[6] = {0.2865,  0.1266, -0.001429,
     116                            0.02402,-0.01135, 0.001475} ;
    105117
    106118    G4double Q = std::max(0.0,std::log(reducedEnergy*massFactor));
     
    120132    if(tq2 < 0.2) tt *= (1.0 - tq2 + 0.5*tq2*tq2);
    121133    else          tt *= std::exp(-tq2);
    122     q = (1.0 + tt) * std::sqrt(ex);
     134
     135    effCharge = charge*(1.0 + tt) * std::sqrt(ex);
    123136
    124137    // Heavy ion case
    125138  } else {
    126139   
    127     G4double z23  = std::pow(z, 0.666666);
    128     G4double zi13 = std::pow(Zi, 0.333333);
     140    G4double y;
     141    //    = nist->GetZ13(z);
     142    //G4double z23  = y*y;
     143    G4double zi13 = nist->GetZ13(Zi);
    129144    G4double zi23 = zi13*zi13;
    130     G4double e = std::max(reducedEnergy,energyBohr/z23);
     145    //    G4double e = std::max(reducedEnergy,energyBohr/z23);
     146    //G4double e = reducedEnergy;
    131147
    132148    // v1 is ion velocity in vF unit
    133149    G4double eF   = material->GetIonisation()->GetFermiEnergy();
    134     G4double v1sq = e/eF;
     150    G4double v1sq = reducedEnergy/eF;
    135151    G4double vFsq = eF/energyBohr;
    136     G4double vF   = std::sqrt(vFsq);
    137 
    138     G4double y ;
     152    G4double vF   = std::sqrt(eF/energyBohr);
    139153
    140154    // Faster than Fermi velocity
     
    147161    }
    148162
     163    G4double q;
    149164    G4double y3 = std::pow(y, 0.3) ;
    150     //    G4cout << "y= " << y << " y3= " << y3 << " v1= " << v1 << " vF= " << vF << G4endl;
     165    // G4cout<<"y= "<<y<<" y3= "<<y3<<" v1= "<<v1<<" vF= "<<vF<<G4endl;
    151166    q = 1.0 - std::exp( 0.803*y3 - 1.3167*y3*y3 - 0.38157*y - 0.008983*y*y ) ;
    152 
    153     //    q = 1.0 - std::exp(-0.95*std::sqrt(reducedEnergy/energyBohr)/zi23);
     167   
     168    //y *= 0.77;
     169    //y *= (0.75 + 0.52/Zi);
     170
     171    //if( y < 0.2 ) q = y*(1.0 - 0.5*y);
     172    //else          q = 1.0 - std::exp(-y);
    154173
    155174    G4double qmin = minCharge/Zi;
    156 
    157175    if(q < qmin) q = qmin;
     176 
     177    effCharge = q*charge;
     178
     179    /*
     180    G4double x1 = 1.0*effCharge*(1.0 - 0.132*std::log(y))/(y*std::sqrt(z));
     181    G4double x2 = 0.1*effCharge*effCharge*energyBohr/reducedEnergy;
     182
     183    chargeCorrection = 1.0 + x1 - x2;
     184
     185    G4cout << "x1= "<<x1<<" x2= "<< x2<<" corr= "<<chargeCorrection<<G4endl;
     186    */
    158187   
    159188    G4double tq = 7.6 - std::log(reducedEnergy/keV);
     
    170199
    171200    G4double lambda = 10.0 * vF / (zi13 * (6.0 + q));
    172     if(q < 0.2) lambda *= (1.0 - 0.666666*q - q*q/9.0);
     201    if(q < 0.2) lambda *= (1.0 - 0.66666667*q - q*q/9.0);
    173202    else        lambda *= std::pow(1.0-q, 0.666666);
    174203
     
    180209
    181210    chargeCorrection = sq * (1.0 + xx);
     211   
    182212  }
    183213  //  G4cout << "G4ionEffectiveCharge: charge= " << charge << " q= " << q
    184214  //         << " chargeCor= " << chargeCorrection
    185215  //       << " e(MeV)= " << kineticEnergy/MeV << G4endl;
    186   return q*charge;
     216  return effCharge;
    187217}
    188218
  • trunk/source/processes/electromagnetic/xrays/GNUmakefile

    r819 r961  
    1 # $Id: GNUmakefile,v 1.6 2006/04/05 13:34:23 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.7 2008/06/13 01:06:31 gum Exp $
    22# --------------------------------------------------------------------
    33# GNUmakefile for electromagnetic sub-library.  John Allison, 25/6/98.
     
    2424            -I$(G4BASE)/processes/management/include \
    2525            -I$(G4BASE)/processes/cuts/include \
     26            -I$(G4BASE)/processes/electromagnetic/utils/include \
    2627            -I$(G4BASE)/particles/management/include \
    2728            -I$(G4BASE)/particles/bosons/include \
  • trunk/source/processes/electromagnetic/xrays/History

    r819 r961  
    1 $Id: History,v 1.62 2007/11/02 20:56:36 gum Exp $
     1$Id: History,v 1.69 2008/11/14 20:47:11 gum Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
     2014 November 08: P. Gumplinger (xrays-V09-01-06)
     21- Do not calculate a step limit coming from G4Cerenkov when the
     22  minimum beta for a particle to radiate in the material (vacuum)
     23  is already 1; fix G4Cerenkov.cc
     24
     2512 November 08: V. Ivanchenko (xrays-V09-01-05)
     26- exclude G4MscRadiation from the release
     27
     2821 October 08: P. Gumplinger (xrays-V09-01-04)
     29- Add SetProcessSubType(G4EmProcessSubType) to G4Cerenkov.cc
     30  and G4Scintillation. Modify G4Cerenkov to allow for
     31  MaxBetaChangePerStep, sets PostStepGetPhysicalInteractionLength to
     32  where the particle would drop below the Cerenkov threshold in the
     33  current material. The Cerenkov photon origins are now sampled
     34  according to the linear decrease in the MeanNumberOfPhotons over
     35  the step. G4Cerenkov now inherits from G4VProcess. For this to work
     36  tracking-V09-01-03 or newer is required.
     37
     3804 July 08: P. Gumplinger (xrays-V09-01-03)
     39- In G4Scintillation and G4Cerenkov now
     40  SetTouchableHandle(aStep.GetPreStepPoint()->GetTouchableHandle())
     41  for the secondaries in the DoIt.
     42
     4306 June 08: P. Gumplinger (xrays-V09-01-02)
     44- G4Scintillation: make now use of G4EmSaturation to implement the
     45  Birks Correction.
     46
     4705 June 08: P. Gumplinger (xrays-V09-01-01)
     48- G4Scintillation, G4Cerenkov
     49  trivial name changes: momentum->energy, momenta->energies
     50
     5105 February 08: P. Gumplinger
     52- G4BirkScintillation class was removed and scintillation with Birk's law
     53  was added to the G4Scintillation class directly.
     54
     5501 February 08: V. Grichine
     56- G4BirkScintillation class was added. The class implements the scintillation
     57  process with Birk's law
     58 
    205902 November 07: P. Gumplinger (xrays-V09-00-03)
    2160- G4Cerenkov constructor add warning printout about the change
  • trunk/source/processes/electromagnetic/xrays/include/G4Cerenkov.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Cerenkov.hh,v 1.9 2007/09/30 22:17:04 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4Cerenkov.hh,v 1.10 2008/10/22 01:17:36 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    6060#include "G4ParticleMomentum.hh"
    6161#include "G4Step.hh"
    62 #include "G4VDiscreteProcess.hh"
     62#include "G4VProcess.hh"
    6363#include "G4OpticalPhoton.hh"
    6464#include "G4DynamicParticle.hh"
     
    7777/////////////////////
    7878
    79 class G4Cerenkov : public G4VDiscreteProcess 
     79class G4Cerenkov : public G4VProcess
    8080{
    8181
     
    116116        // condition for the DoIt to be invoked at every step.
    117117
     118        G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
     119                                                      G4double ,
     120                                                      G4ForceCondition* );
     121        // Returns the discrete step limit and sets the 'StronglyForced'
     122        // condition for the DoIt to be invoked at every step.
     123
    118124        G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
    119125                                        const G4Step&  aStep);
    120126        // This is the method implementing the Cerenkov process.
     127
     128        //  no operation in  AtRestDoIt and  AlongStepDoIt
     129        virtual G4double AlongStepGetPhysicalInteractionLength(
     130                               const G4Track&,
     131                               G4double  ,
     132                               G4double  ,
     133                               G4double& ,
     134                               G4GPILSelection*
     135                              ) { return -1.0; };
     136
     137        virtual G4double AtRestGetPhysicalInteractionLength(
     138                               const G4Track& ,
     139                               G4ForceCondition*
     140                              ) { return -1.0; };
     141
     142        //  no operation in  AtRestDoIt and  AlongStepDoIt
     143        virtual G4VParticleChange* AtRestDoIt(
     144                               const G4Track& ,
     145                               const G4Step&
     146                              ) {return 0;};
     147
     148        virtual G4VParticleChange* AlongStepDoIt(
     149                               const G4Track& ,
     150                               const G4Step&
     151                              ) {return 0;};
    121152
    122153        void SetTrackSecondariesFirst(const G4bool state);
     
    125156        // been tracked, the tracking of the primary resumes.
    126157       
     158        void SetMaxBetaChangePerStep(const G4double d);
     159        // Set the maximum allowed change in beta = v/c in % (perCent)
     160        // per step.
     161
    127162        void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
    128163        // Set the maximum number of Cerenkov photons allowed to be
     
    166201
    167202        G4bool fTrackSecondariesFirst;
    168         G4int  fMaxPhotons;
     203        G4double fMaxBetaChange;
     204        G4int  fMaxPhotons;
    169205};
    170206
     
    190226
    191227inline
     228void G4Cerenkov::SetMaxBetaChangePerStep(const G4double value)
     229{
     230        fMaxBetaChange = value*perCent;
     231}
     232
     233inline
    192234void G4Cerenkov::SetMaxNumPhotonsPerStep(const G4int NumPhotons)
    193235{
     
    208250}
    209251
    210 inline G4PhysicsTable* G4Cerenkov::GetPhysicsTable() const
     252inline
     253G4PhysicsTable* G4Cerenkov::GetPhysicsTable() const
    211254{
    212255  return thePhysicsTable;
  • trunk/source/processes/electromagnetic/xrays/include/G4ForwardXrayTR.hh

    r819 r961  
    2626//
    2727// $Id: G4ForwardXrayTR.hh,v 1.14 2006/06/29 19:55:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4ForwardXrayTR -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4GammaXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4GammaXTRadiator.hh,v 1.4 2006/06/29 19:55:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4RegularXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4RegularXTRadiator.hh,v 1.3 2006/06/29 19:55:37 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4Scintillation.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Scintillation.hh,v 1.13 2006/06/29 19:55:39 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Scintillation.hh,v 1.15 2008/06/13 01:04:49 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    7272#include "G4PhysicsOrderedFreeVector.hh"
    7373
     74#include "G4EmSaturation.hh"
     75
    7476// Class Description:
    7577// RestDiscrete Process - Generation of Scintillation Photons.
     
    170172        // Returns the address of the slow scintillation integral table.
    171173
     174        void AddSaturation(G4EmSaturation* sat) { emSaturation = sat; }
     175        // Adds Birks Saturation to the process.
     176
     177        G4EmSaturation* GetSaturation() const { return emSaturation; }
     178        // Returns the Birks Saturation.
     179
    172180        void DumpPhysicsTable() const;
    173181        // Prints the fast and slow scintillation integral tables.
    174182
    175 private:
     183protected:
    176184
    177185        void BuildThePhysicsTable();
     
    183191        ///////////////////////
    184192
    185 protected:
    186193
    187194        G4PhysicsTable* theSlowIntegralTable;
    188195        G4PhysicsTable* theFastIntegralTable;
    189196
     197
     198
     199        G4bool fTrackSecondariesFirst;
     200
     201        G4double YieldFactor;
     202
     203        G4double ExcitationRatio;
     204
    190205private:
    191206
    192         G4bool fTrackSecondariesFirst;
    193 
    194         G4double YieldFactor;
    195 
    196         G4double ExcitationRatio;
     207        G4EmSaturation* emSaturation;
    197208
    198209};
  • trunk/source/processes/electromagnetic/xrays/include/G4StrawTubeXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4StrawTubeXTRadiator.hh,v 1.4 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4SynchrotronRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiation.hh,v 1.4 2006/06/29 19:55:43 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/include/G4SynchrotronRadiationInMat.hh

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiationInMat.hh,v 1.2 2006/06/29 19:55:45 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/include/G4TransitionRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4TransitionRadiation.hh,v 1.9 2006/06/29 19:55:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4TransitionRadiation  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4TransparentRegXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4TransparentRegXTRadiator.hh,v 1.2 2006/06/29 19:55:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4VTRModel.hh

    r819 r961  
    2626//
    2727// $Id: G4VTRModel.hh,v 1.3 2006/06/29 19:55:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTRModel  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4VTransitionRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4VTransitionRadiation.hh,v 1.3 2006/06/29 19:55:53 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTransitionRadiation  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4VXTRenergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4VXTRenergyLoss.hh,v 1.24 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/src/G4Cerenkov.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Cerenkov.cc,v 1.23 2007/10/15 20:05:23 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4Cerenkov.cc,v 1.26 2008/11/14 20:16:51 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    6565#include "G4ios.hh"
    6666#include "G4Poisson.hh"
     67#include "G4EmProcessSubType.hh"
     68
     69#include "G4LossTableManager.hh"
     70#include "G4MaterialCutsCouple.hh"
     71#include "G4ParticleDefinition.hh"
     72
    6773#include "G4Cerenkov.hh"
    6874
     
    8692
    8793G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
    88            : G4VDiscreteProcess(processName, type)
     94           : G4VProcess(processName, type)
    8995{
    9096        G4cout << "G4Cerenkov::G4Cerenkov constructor" << G4endl;
    91         G4cout << "NOTE: this is now a G4VDiscreteProcess!" << G4endl;
     97        G4cout << "NOTE: this is now a G4VProcess!" << G4endl;
    9298        G4cout << "Required change in UserPhysicsList: " << G4endl;
    9399        G4cout << "change: pmanager->AddContinuousProcess(theCerenkovProcess);" << G4endl;
     
    95101        G4cout << "        pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);" << G4endl;
    96102
     103        SetProcessSubType(fCerenkov);
     104
    97105        fTrackSecondariesFirst = false;
     106        fMaxBetaChange = 0.;
    98107        fMaxPhotons = 0;
    99108
     
    141150
    142151{
    143 
    144152        //////////////////////////////////////////////////////
    145153        // Should we ensure that the material is dispersive?
     
    160168        G4MaterialPropertiesTable* aMaterialPropertiesTable =
    161169                               aMaterial->GetMaterialPropertiesTable();
    162         if (!aMaterialPropertiesTable)
    163            return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     170        if (!aMaterialPropertiesTable) return pParticleChange;
    164171
    165172        const G4MaterialPropertyVector* Rindex =
    166173                aMaterialPropertiesTable->GetProperty("RINDEX");
    167         if (!Rindex)
    168            return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     174        if (!Rindex) return pParticleChange;
    169175
    170176        // particle charge
     
    184190                aParticleChange.SetNumberOfSecondaries(0);
    185191 
    186                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     192                return pParticleChange;
    187193
    188194        }
     
    201207                aParticleChange.SetNumberOfSecondaries(0);
    202208               
    203                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     209                return pParticleChange;
    204210        }
    205211
     
    215221        ////////////////////////////////////////////////////////////////
    216222
    217         G4double Pmin = Rindex->GetMinPhotonMomentum();
    218         G4double Pmax = Rindex->GetMaxPhotonMomentum();
     223        G4double Pmin = Rindex->GetMinPhotonEnergy();
     224        G4double Pmax = Rindex->GetMaxPhotonEnergy();
    219225        G4double dp = Pmax - Pmin;
    220226
     
    226232        G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
    227233
     234        const G4double beta1 = pPreStepPoint ->GetBeta();
     235        const G4double beta2 = pPostStepPoint->GetBeta();
     236
     237        G4double MeanNumberOfPhotons1 =
     238                     GetAverageNumberOfPhotons(charge,beta1,aMaterial,Rindex);
     239        G4double MeanNumberOfPhotons2 =
     240                     GetAverageNumberOfPhotons(charge,beta2,aMaterial,Rindex);
     241
    228242        for (G4int i = 0; i < NumPhotons; i++) {
    229243
    230                 // Determine photon momentum
     244                // Determine photon energy
    231245
    232246                G4double rand;
    233                 G4double sampledMomentum, sampledRI;
     247                G4double sampledEnergy, sampledRI;
    234248                G4double cosTheta, sin2Theta;
    235249               
    236                 // sample a momentum
     250                // sample an energy
    237251
    238252                do {
    239253                        rand = G4UniformRand();
    240                         sampledMomentum = Pmin + rand * dp;
    241                         sampledRI = Rindex->GetProperty(sampledMomentum);
     254                        sampledEnergy = Pmin + rand * dp;
     255                        sampledRI = Rindex->GetProperty(sampledEnergy);
    242256                        cosTheta = BetaInverse / sampledRI; 
    243257
     
    256270                G4double cosPhi = cos(phi);
    257271
    258                 // calculate x,y, and z components of photon momentum
     272                // calculate x,y, and z components of photon energy
    259273                // (in coord system with primary particle direction
    260274                //  aligned with the z axis)
     
    299313                                      photonPolarization.z());
    300314
    301                 aCerenkovPhoton->SetKineticEnergy(sampledMomentum);
     315                aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
    302316
    303317                // Generate new G4Track object:
    304318
    305                 rand = G4UniformRand();
    306 
    307                 G4double delta = rand * aStep.GetStepLength();
     319                G4double delta, NumberOfPhotons, N;
     320
     321                do {
     322                   rand = G4UniformRand();
     323                   delta = rand * aStep.GetStepLength();
     324                   NumberOfPhotons = MeanNumberOfPhotons1 - delta *
     325                                (MeanNumberOfPhotons1-MeanNumberOfPhotons2)/
     326                                              aStep.GetStepLength();
     327                   N = G4UniformRand() *
     328                       std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
     329                } while (N > NumberOfPhotons);
     330
    308331                G4double deltaTime = delta /
    309332                       ((pPreStepPoint->GetVelocity()+
     
    318341                new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
    319342
    320                 aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     343                aSecondaryTrack->SetTouchableHandle(
     344                                 aStep.GetPreStepPoint()->GetTouchableHandle());
    321345
    322346                aSecondaryTrack->SetParentID(aTrack.GetTrackID());
     
    330354        }
    331355
    332         return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     356        return pParticleChange;
    333357}
    334358
     
    372396               
    373397                      // Retrieve the first refraction index in vector
    374                       // of (photon momentum, refraction index) pairs
     398                      // of (photon energy, refraction index) pairs
    375399
    376400                      theRefractionIndexVector->ResetIterator();
     
    382406                      if (currentRI > 1.0) {
    383407
    384                          // Create first (photon momentum, Cerenkov Integral)
     408                         // Create first (photon energy, Cerenkov Integral)
    385409                         // pair 
    386410
    387411                         G4double currentPM = theRefractionIndexVector->
    388                                                  GetPhotonMomentum();
     412                                                 GetPhotonEnergy();
    389413                         G4double currentCAI = 0.0;
    390414
     
    398422                         G4double prevRI  = currentRI;
    399423
    400                          // loop over all (photon momentum, refraction index)
     424                         // loop over all (photon energy, refraction index)
    401425                         // pairs stored for this material 
    402426
     
    407431
    408432                                currentPM = theRefractionIndexVector->
    409                                                 GetPhotonMomentum();
     433                                                GetPhotonEnergy();
    410434
    411435                                currentCAI = 0.5*(1.0/(prevRI*prevRI) +
     
    441465//
    442466
    443 G4double G4Cerenkov::GetMeanFreePath(const G4Track& aTrack,
     467G4double G4Cerenkov::GetMeanFreePath(const G4Track&,
     468                                           G4double,
     469                                           G4ForceCondition*)
     470{
     471        return 1.;
     472}
     473
     474G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
     475                                           const G4Track& aTrack,
    444476                                           G4double,
    445477                                           G4ForceCondition* condition)
    446478{
    447         *condition = StronglyForced;
    448 
    449         // If user has defined an average maximum number of photons to
    450         // be generated in a Step, then return the Step length for that
    451         // number of photons.
    452  
    453         if (fMaxPhotons <= 0) return DBL_MAX;
     479        *condition = NotForced;
     480        G4double StepLimit = DBL_MAX;
    454481
    455482        const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
    456483        const G4Material* aMaterial = aTrack.GetMaterial();
    457 
    458         G4MaterialPropertiesTable* aMaterialPropertiesTable =
    459                                aMaterial->GetMaterialPropertiesTable();
    460         if (!aMaterialPropertiesTable) return DBL_MAX;
    461 
    462         const G4MaterialPropertyVector* Rindex =
    463                 aMaterialPropertiesTable->GetProperty("RINDEX");
    464         if (!Rindex) return DBL_MAX;
    465 
    466         // particle charge
    467         const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
     484        const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
     485
     486        const G4double kineticEnergy = aParticle->GetKineticEnergy();
     487        const G4ParticleDefinition* particleType = aParticle->GetDefinition();
     488        const G4double mass = particleType->GetPDGMass();
    468489
    469490        // particle beta
    470491        const G4double beta = aParticle->GetTotalMomentum() /
    471492                              aParticle->GetTotalEnergy();
    472 
    473         G4double MeanNumberOfPhotons =
    474                  GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
    475 
    476         if(MeanNumberOfPhotons <= 0.0) return DBL_MAX;
    477 
    478         G4double StepLimit = fMaxPhotons / MeanNumberOfPhotons;
    479 
    480         return StepLimit;
     493        // particle gamma
     494        const G4double gamma = 1./std::sqrt(1.-beta*beta);
     495
     496        G4MaterialPropertiesTable* aMaterialPropertiesTable =
     497                            aMaterial->GetMaterialPropertiesTable();
     498
     499        const G4MaterialPropertyVector* Rindex = NULL;
     500
     501        if (aMaterialPropertiesTable)
     502                     Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
     503
     504        G4double nMax;
     505        if (Rindex) {
     506           nMax = Rindex->GetMaxProperty();
     507        } else {
     508           return StepLimit;
     509        }
     510
     511        G4double BetaMin = 1./nMax;
     512        if ( BetaMin >= 1. ) return StepLimit;
     513
     514        G4double GammaMin = 1./std::sqrt(1.-BetaMin*BetaMin);
     515
     516        if (gamma < GammaMin ) return StepLimit;
     517
     518        G4double kinEmin = mass*(GammaMin-1.);
     519
     520        G4double RangeMin = G4LossTableManager::Instance()->
     521                                                   GetRange(particleType,
     522                                                            kinEmin,
     523                                                            couple);
     524        G4double Range    = G4LossTableManager::Instance()->
     525                                                   GetRange(particleType,
     526                                                            kineticEnergy,
     527                                                            couple);
     528
     529        G4double Step = Range - RangeMin;
     530        if (Step < 1.*um ) return StepLimit;
     531
     532        if (Step > 0. && Step < StepLimit) StepLimit = Step;
     533
     534        // If user has defined an average maximum number of photons to
     535        // be generated in a Step, then calculate the Step length for
     536        // that number of photons.
     537 
     538        if (fMaxPhotons > 0) {
     539
     540           // particle charge
     541           const G4double charge = aParticle->
     542                                   GetDefinition()->GetPDGCharge();
     543
     544           G4double MeanNumberOfPhotons =
     545                    GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
     546
     547           G4double Step = 0.;
     548           if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons /
     549                                                 MeanNumberOfPhotons;
     550
     551           if (Step > 0. && Step < StepLimit) StepLimit = Step;
     552        }
     553
     554        // If user has defined an maximum allowed change in beta per step
     555        if (fMaxBetaChange > 0.) {
     556
     557           G4double dedx = G4LossTableManager::Instance()->
     558                                                   GetDEDX(particleType,
     559                                                           kineticEnergy,
     560                                                           couple);
     561
     562           G4double deltaGamma = gamma -
     563                                 1./std::sqrt(1.-beta*beta*
     564                                                 (1.-fMaxBetaChange)*
     565                                                 (1.-fMaxBetaChange));
     566
     567           G4double Step = mass * deltaGamma / dedx;
     568
     569           if (Step > 0. && Step < StepLimit) StepLimit = Step;
     570
     571        }
     572
     573        *condition = StronglyForced;
     574        return StepLimit;
    481575}
    482576
     
    512606        if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))return 0.0;
    513607
    514         // Min and Max photon momenta
    515         G4double Pmin = Rindex->GetMinPhotonMomentum();
    516         G4double Pmax = Rindex->GetMaxPhotonMomentum();
     608        // Min and Max photon energies
     609        G4double Pmin = Rindex->GetMinPhotonEnergy();
     610        G4double Pmax = Rindex->GetMaxPhotonEnergy();
    517611
    518612        // Min and Max Refraction Indices
     
    541635        // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then
    542636        // we need to find a P such that the value of n(P) == 1/Beta.
    543         // Interpolation is performed by the GetPhotonMomentum() and
     637        // Interpolation is performed by the GetPhotonEnergy() and
    544638        // GetProperty() methods of the G4MaterialPropertiesTable and
    545639        // the GetValue() method of G4PhysicsVector. 
    546640
    547641        else {
    548                 Pmin = Rindex->GetPhotonMomentum(BetaInverse);
     642                Pmin = Rindex->GetPhotonEnergy(BetaInverse);
    549643                dp = Pmax - Pmin;
    550644
  • trunk/source/processes/electromagnetic/xrays/src/G4ForwardXrayTR.cc

    r819 r961  
    2626//
    2727// $Id: G4ForwardXrayTR.cc,v 1.14 2007/05/11 14:23:04 gcosmo Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4ForwardXrayTR class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4GammaXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4GammaXTRadiator.cc,v 1.5 2006/06/29 19:56:07 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4RegularXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4RegularXTRadiator.cc,v 1.9 2006/06/29 19:56:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4Scintillation.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Scintillation.cc,v 1.26 2006/06/29 19:56:11 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Scintillation.cc,v 1.30 2008/10/22 01:19:11 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    6464
    6565#include "G4ios.hh"
     66#include "G4EmProcessSubType.hh"
     67
    6668#include "G4Scintillation.hh"
    6769
     
    8890                  : G4VRestDiscreteProcess(processName, type)
    8991{
     92        SetProcessSubType(fScintillation);
     93
    9094        fTrackSecondariesFirst = false;
    9195
     
    101105
    102106        BuildThePhysicsTable();
     107
     108        emSaturation = NULL;
    103109}
    104110
     
    180186        G4double ScintillationYield = aMaterialPropertiesTable->
    181187                                      GetConstProperty("SCINTILLATIONYIELD");
     188        ScintillationYield *= YieldFactor;
     189
    182190        G4double ResolutionScale    = aMaterialPropertiesTable->
    183191                                      GetConstProperty("RESOLUTIONSCALE");
    184192
    185         ScintillationYield = YieldFactor * ScintillationYield;
    186 
    187         G4double MeanNumberOfPhotons = ScintillationYield * TotalEnergyDeposit;
     193        // Birks law saturation:
     194
     195        G4double constBirks = 0.0;
     196
     197        constBirks = aMaterial->GetIonisation()->GetBirksConstant();
     198
     199        G4double MeanNumberOfPhotons;
     200
     201        if (emSaturation) {
     202           MeanNumberOfPhotons = ScintillationYield*
     203                              (emSaturation->VisibleEnergyDeposition(&aStep));
     204        } else {
     205           MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
     206        }
    188207
    189208        G4int NumPhotons;
    190         if (MeanNumberOfPhotons > 10.) {
     209
     210        if (MeanNumberOfPhotons > 10.)
     211        {
    191212          G4double sigma = ResolutionScale * sqrt(MeanNumberOfPhotons);
    192213          NumPhotons = G4int(G4RandGauss::shoot(MeanNumberOfPhotons,sigma)+0.5);
    193214        }
    194         else {
     215        else
     216        {
    195217          NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
    196218        }
    197219
    198         if (NumPhotons <= 0) {
    199 
     220        if (NumPhotons <= 0)
     221        {
    200222           // return unchanged particle and no secondaries
    201223
     
    274296            for (G4int i = 0; i < Num; i++) {
    275297
    276                 // Determine photon momentum
     298                // Determine photon energy
    277299
    278300                G4double CIIvalue = G4UniformRand()*CIImax;
    279                 G4double sampledMomentum =
     301                G4double sampledEnergy =
    280302                              ScintillationIntegral->GetEnergy(CIIvalue);
    281303
    282304                if (verboseLevel>1) {
    283                    G4cout << "sampledMomentum = " << sampledMomentum << G4endl;
     305                   G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
    284306                   G4cout << "CIIvalue =        " << CIIvalue << G4endl;
    285307                }
     
    330352                                      photonPolarization.z());
    331353
    332                 aScintillationPhoton->SetKineticEnergy(sampledMomentum);
     354                aScintillationPhoton->SetKineticEnergy(sampledEnergy);
    333355
    334356                // Generate new G4Track object:
     
    358380                new G4Track(aScintillationPhoton,aSecondaryTime,aSecondaryPosition);
    359381
    360                 aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     382                aSecondaryTrack->SetTouchableHandle(
     383                                 aStep.GetPreStepPoint()->GetTouchableHandle());
     384                // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
    361385
    362386                aSecondaryTrack->SetParentID(aTrack.GetTrackID());
     
    417441               
    418442                      // Retrieve the first intensity point in vector
    419                       // of (photon momentum, intensity) pairs
     443                      // of (photon energy, intensity) pairs
    420444
    421445                      theFastLightVector->ResetIterator();
     
    427451                      if (currentIN >= 0.0) {
    428452
    429                          // Create first (photon momentum, Scintillation
     453                         // Create first (photon energy, Scintillation
    430454                         // Integral pair 
    431455
    432456                         G4double currentPM = theFastLightVector->
    433                                                  GetPhotonMomentum();
     457                                                 GetPhotonEnergy();
    434458
    435459                         G4double currentCII = 0.0;
     
    444468                         G4double prevIN  = currentIN;
    445469
    446                          // loop over all (photon momentum, intensity)
     470                         // loop over all (photon energy, intensity)
    447471                         // pairs stored for this material 
    448472
     
    450474                         {
    451475                                currentPM = theFastLightVector->
    452                                                 GetPhotonMomentum();
     476                                                GetPhotonEnergy();
    453477
    454478                                currentIN=theFastLightVector-> 
     
    477501
    478502                      // Retrieve the first intensity point in vector
    479                       // of (photon momentum, intensity) pairs
     503                      // of (photon energy, intensity) pairs
    480504
    481505                      theSlowLightVector->ResetIterator();
     
    487511                      if (currentIN >= 0.0) {
    488512
    489                          // Create first (photon momentum, Scintillation
     513                         // Create first (photon energy, Scintillation
    490514                         // Integral pair
    491515
    492516                         G4double currentPM = theSlowLightVector->
    493                                                  GetPhotonMomentum();
     517                                                 GetPhotonEnergy();
    494518
    495519                         G4double currentCII = 0.0;
     
    504528                         G4double prevIN  = currentIN;
    505529
    506                          // loop over all (photon momentum, intensity)
     530                         // loop over all (photon energy, intensity)
    507531                         // pairs stored for this material
    508532
     
    510534                         {
    511535                                currentPM = theSlowLightVector->
    512                                                 GetPhotonMomentum();
     536                                                GetPhotonEnergy();
    513537
    514538                                currentIN=theSlowLightVector->
  • trunk/source/processes/electromagnetic/xrays/src/G4StrawTubeXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4StrawTubeXTRadiator.cc,v 1.6 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4SynchrotronRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiation.cc,v 1.5 2006/06/29 19:56:15 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/src/G4SynchrotronRadiationInMat.cc

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiationInMat.cc,v 1.2 2006/06/29 19:56:17 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/src/G4TransitionRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4TransitionRadiation.cc,v 1.7 2006/06/29 19:56:19 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4TransitionRadiation class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4TransparentRegXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4TransparentRegXTRadiator.cc,v 1.11 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4VTransitionRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4VTransitionRadiation.cc,v 1.5 2006/06/29 19:56:23 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTransitionRadiation class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4VXTRenergyLoss.cc

    r819 r961  
    2626//
    2727// $Id: G4VXTRenergyLoss.cc,v 1.44 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// History:
Note: See TracChangeset for help on using the changeset viewer.