Ignore:
Timestamp:
Jan 8, 2010, 3:02:48 PM (16 years ago)
Author:
garnier
Message:

update to geant4.9.3

Location:
trunk/examples/extended/electromagnetic
Files:
681 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/electromagnetic/TestEm0/DirectAccess.cc

    r807 r1230  
    2626//
    2727// $Id: DirectAccess.cc,v 1.2 2006/06/29 16:35:25 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// ------------------------------------------------------------
  • trunk/examples/extended/electromagnetic/TestEm0/TestEm0.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: TestEm0.cc,v 1.4 2007/06/21 17:30:53 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: TestEm0.cc,v 1.5 2009/11/17 22:48:26 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5757  // set user action classes
    5858  runManager->SetUserAction(new RunAction(det,prim));
    59    
    60   //Initialize G4 kernel
    61   runManager->Initialize();
    6259 
    6360  if (argc!=1)   // batch mode   
  • trunk/examples/extended/electromagnetic/TestEm0/include/DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:35:29 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm0/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:35:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:35:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.2 2006/06/29 16:35:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:35:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:35:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.3 2006/06/29 16:35:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/src/DetectorConstruction.cc

    r807 r1230  
    2626
    2727//
    28 // $Id: DetectorConstruction.cc,v 1.9 2006/12/08 16:38:38 maire Exp $
    29 // GEANT4 tag $Name: $
     28// $Id: DetectorConstruction.cc,v 1.10 2009/11/14 18:04:20 maire Exp $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131//
     
    8383 
    8484  G4Element* H  = new G4Element("Hydrogen" ,"H" , z= 1., a=   1.01*g/mole);
     85  G4Element* C  = new G4Element("Carbon"   ,"C" , z= 6., a=  12.01*g/mole); 
    8586  G4Element* N  = new G4Element("Nitrogen" ,"N" , z= 7., a=  14.01*g/mole);
    8687  G4Element* O  = new G4Element("Oxygen"   ,"O" , z= 8., a=  16.00*g/mole);
    8788  G4Element* Ge = new G4Element("Germanium","Ge", z=32., a=  72.59*g/mole);
     89  G4Element* Pb = new G4Element("Lead"     ,"Pb", z=82., a= 207.19*g/mole); 
    8890  G4Element* Bi = new G4Element("Bismuth"  ,"Bi", z=83., a= 208.98*g/mole);
    8991 
     
    110112  ///H2O->SetChemicalFormula("H_2O");
    111113  H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
    112  
     114       
    113115  G4Material* steam =
    114116  new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1);
     
    132134  new G4Material("Lead"       , z=82., a=207.19*g/mole, density= 11.35*g/cm3);
    133135  new G4Material("Uranium"    , z=92., a=238.03*g/mole, density= 18.95*g/cm3);
    134  
    135 
     136   
     137  G4Material* ams =
     138  new G4Material("ams", density= 7.409*g/cm3, ncomponents=3);
     139  ams->AddElement(Pb, fractionmass = 94.81*perCent);
     140  ams->AddElement(C , fractionmass =  4.79*perCent);
     141  ams->AddElement(H , fractionmass =  0.40*perCent);   
     142   
    136143  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
    137144}
  • trunk/examples/extended/electromagnetic/TestEm0/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:35:48 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/src/PhysListEmStandard.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmStandard.cc,v 1.2 2006/06/29 16:35:50 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmStandard.cc,v 1.3 2009/11/14 18:04:20 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939#include "G4PhotoElectricEffect.hh"
    4040
    41 #include "G4MultipleScattering.hh"
    42 
     41#include "G4eMultipleScattering.hh"
    4342#include "G4eIonisation.hh"
    4443#include "G4eBremsstrahlung.hh"
    4544#include "G4eplusAnnihilation.hh"
    4645
     46#include "G4MuMultipleScattering.hh"
    4747#include "G4MuIonisation.hh"
    4848#include "G4MuBremsstrahlung.hh"
    4949#include "G4MuPairProduction.hh"
    5050
     51#include "G4hMultipleScattering.hh"
    5152#include "G4hIonisation.hh"
    5253#include "G4ionIonisation.hh"
     
    8384    } else if (particleName == "e-") {
    8485      //electron
    85       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    86       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    87       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     86      pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1);
     87      pmanager->AddProcess(new G4eIonisation,         -1, 2,2);
     88      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3,3);
    8889           
    8990    } else if (particleName == "e+") {
    9091      //positron
    91       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    92       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    93       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    94       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     92      pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1);
     93      pmanager->AddProcess(new G4eIonisation,         -1, 2,2);
     94      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3,3);
     95      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1,4);
    9596     
    9697    } else if( particleName == "mu+" ||
    9798               particleName == "mu-"    ) {
    9899      //muon 
    99       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    100       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    101       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    102       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     100      pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1);
     101      pmanager->AddProcess(new G4MuIonisation,        -1, 2,2);
     102      pmanager->AddProcess(new G4MuBremsstrahlung,    -1, 3,3);
     103      pmanager->AddProcess(new G4MuPairProduction,    -1, 4,4);       
    103104     
    104105    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
    105       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    106       pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
     106      pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
     107      pmanager->AddProcess(new G4ionIonisation,      -1, 2,2);
    107108
    108109    } else if ((!particle->IsShortLived()) &&
     
    110111               (particle->GetParticleName() != "chargedgeantino")) {
    111112      //all others charged particles except geantino
    112       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    113       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     113      pmanager->AddProcess(new G4hMultipleScattering,-1,1,1);
     114      pmanager->AddProcess(new G4hIonisation,        -1,2,2);
    114115    }
    115116  }
  • trunk/examples/extended/electromagnetic/TestEm0/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.5 2006/08/17 13:50:45 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: PhysicsList.cc,v 1.8 2009/11/17 22:48:26 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535 
    3636#include "PhysListEmStandard.hh"
     37#include "G4EmLivermorePhysics.hh"
     38#include "G4EmPenelopePhysics.hh"
    3739
    3840#include "G4LossTableManager.hh"
     
    180182  // Em options
    181183  //
     184  // Main options and setting parameters are shown here.
     185  // Several of them have default values.
     186  //
    182187  G4EmProcessOptions emOptions;
    183   emOptions.SetBuildCSDARange(true);
     188 
     189  //physics tables
     190  //
     191  emOptions.SetMinEnergy(100*eV);       //default   
     192  emOptions.SetMaxEnergy(100*TeV);      //default 
     193  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     194  emOptions.SetLambdaBinning(12*20);    //default=12*7
     195
     196  emOptions.SetBuildCSDARange(true);     
    184197  emOptions.SetMaxEnergyForCSDARange(100*TeV);
    185   emOptions.SetDEDXBinningForCSDARange(120);
     198  emOptions.SetDEDXBinningForCSDARange(12*20);
     199 
     200  emOptions.SetSplineFlag(true);        //default
     201     
    186202  emOptions.SetVerbose(0); 
    187203}
     
    202218    delete emPhysicsList;
    203219    emPhysicsList = new PhysListEmStandard(name);
     220
     221  } else if (name == "penelope"){
     222    emName = name;
     223    delete emPhysicsList;
     224    emPhysicsList = new G4EmPenelopePhysics();
     225
     226  } else if (name == "livermore"){
     227    emName = name;
     228    delete emPhysicsList;
     229    emPhysicsList = new G4EmLivermorePhysics();
    204230       
    205231  } else {
     
    218244
    219245void PhysicsList::SetCuts()
    220 {   
     246{
     247  // fixe lower limit for cut
     248  G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100*eV, 1*GeV);
     249 
    221250  // set cut values for gamma at first and for e- second and next for e+,
    222251  // because some processes for e+/e- need cut values for gamma
  • trunk/examples/extended/electromagnetic/TestEm0/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:35:55 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm0/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:35:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm0/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.9 2006/12/08 16:38:38 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.10 2007/12/17 17:22:44 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5959  //set precision for printing
    6060  G4int prec = G4cout.precision(6);
    61    
     61 
     62  //instanciate EmCalculator
     63  G4EmCalculator emCal;
     64  //  emCal.SetVerbose(2);
     65     
    6266  // get particle
    6367  G4ParticleDefinition* particle = primary->GetParticleGun()
     
    7781         << material->GetName() << " (density: "
    7882         << G4BestUnit(density,"Volumic Mass") << ";   radiation length: "
    79          << G4BestUnit(radl,   "Length")       << ")" << G4endl;         
     83         << G4BestUnit(radl,   "Length")       << ")" << G4endl;
    8084
    8185  // get cuts   
     
    9094          << G4endl;
    9195   }
    92          
     96   
     97  // max energy transfert
     98  if (charge != 0.) {
     99  G4double Mass_c2 = particle->GetPDGMass();
     100  G4double moverM = electron_mass_c2/Mass_c2;
     101  G4double gamM1 = energy/Mass_c2, gam = gamM1 + 1., gamP1 = gam + 1.;
     102  G4double Tmax =
     103            (2*electron_mass_c2*gamM1*gamP1)/(1.+2*gam*moverM+moverM*moverM);
     104  G4double range = emCal.GetCSDARange(Tmax,G4Electron::Electron(),material);
     105 
     106  G4cout << "\n Max_energy _transferable : " << G4BestUnit(Tmax,"Energy")
     107         << " (" << G4BestUnit(range,"Length") << ")" << G4endl;           
     108  }
     109         
    93110  // get processList and extract EM processes (but not MultipleScattering)
    94111  G4ProcessVector* plist = particle->GetProcessManager()->GetProcessList();
     
    114131    G4cout << "\t" << std::setw(13) << emName[j] << "\t";
    115132  G4cout << "\t" << std::setw(13) <<"total";
    116      
    117   //instanciate EmCalculator
    118   G4EmCalculator emCal;
    119   //  emCal.SetVerbose(2);
    120133 
    121134  //compute cross section per atom (only for single material)
  • trunk/examples/extended/electromagnetic/TestEm1/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.13 2006/10/19 17:24:12 maire Exp $
     1# $Id: GNUmakefile,v 1.14 2008/06/11 22:06:28 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib` 
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm1/TestEm1.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm1.cc,v 1.15 2007/06/21 17:10:11 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/annihil.mac

    r807 r1230  
    1 # $Id: annihil.mac,v 1.1 2006/01/25 13:56:40 maire Exp $
     1# $Id: annihil.mac,v 1.2 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1212/testem/det/setSize 20 cm
    1313#
    14 /testem/phys/addPhysics standard
     14/testem/phys/addPhysics local
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/brems.mac

    r807 r1230  
    1 # $Id: brems.mac,v 1.3 2006/04/10 10:22:41 vnivanch Exp $
     1# $Id: brems.mac,v 1.4 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1212/testem/det/setSize 50 cm
    1313#
    14 /testem/phys/addPhysics standard
     14/testem/phys/addPhysics local
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/erange.mac

    r807 r1230  
    1 # $Id: erange.mac,v 1.1 2007/06/20 15:26:33 maire Exp $
     1# $Id: erange.mac,v 1.2 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1010/testem/det/setMat Water
    1111#
    12 /testem/phys/addPhysics  standard
    13 ###/testem/phys/addPhysics  penelope
    14 ###/testem/phys/addPhysics  livermore
     12/testem/phys/addPhysics  local
     13###/testem/phys/addPhysics  empenelope
     14###/testem/phys/addPhysics  emlivermore
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/gammaconversion.mac

    r807 r1230  
    1 # $Id: gammaconversion.mac,v 1.1 2006/01/25 13:56:40 maire Exp $
     1# $Id: gammaconversion.mac,v 1.2 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1212/testem/det/setSize 1 m
    1313#
    14 /testem/phys/addPhysics standard
     14/testem/phys/addPhysics local
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/include/DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:36:04 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm1/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.3 2006/06/29 16:36:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/EventAction.hh

    r807 r1230  
    2626//
    2727// $Id: EventAction.hh,v 1.3 2006/06/29 16:36:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm1/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:36:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.6 2007/11/12 15:48:58 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.4 2007/11/12 15:48:58 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.5 2007/11/12 15:48:58 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.4 2006/06/29 16:36:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.3 2006/06/29 16:36:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:36:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.3 2006/06/29 16:36:39 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/ProcessesCount.hh

    r807 r1230  
    2626//
    2727// $Id: ProcessesCount.hh,v 1.10 2006/06/29 16:36:41 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.8 2006/06/29 16:36:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.2 2006/06/29 16:36:45 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:36:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.4 2006/06/29 16:36:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/include/SteppingVerbose.hh

    r807 r1230  
    2626//
    2727// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:36:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm1/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.4 2006/06/29 16:36:53 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/ionis.mac

    r807 r1230  
    1 # $Id: ionis.mac,v 1.2 2006/01/25 13:56:40 maire Exp $
     1# $Id: ionis.mac,v 1.3 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1212/testem/det/setSize 50 cm
    1313#
    14 /testem/phys/addPhysics standard
     14/testem/phys/addPhysics local
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/range.mac

    r807 r1230  
    1 # $Id: range.mac,v 1.11 2007/06/20 15:26:33 maire Exp $
     1# $Id: range.mac,v 1.12 2009/09/15 12:51:49 maire Exp $
    22#
    33# Macro file for "TestEm1.cc"
     
    1212/testem/det/setSize 10 cm
    1313#
    14 /testem/phys/addPhysics  standard
    15 ###/testem/phys/addPhysics  penelope
    16 ###/testem/phys/addPhysics  livermore
     14/testem/phys/addPhysics  local
     15###/testem/phys/addPhysics  empenelope
     16###/testem/phys/addPhysics  emlivermore
    1717#
    1818/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm1/src/DetectorConstruction.cc

    r807 r1230  
    2727//
    2828// $Id: DetectorConstruction.cc,v 1.8 2007/11/12 15:48:58 maire Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131//
  • trunk/examples/extended/electromagnetic/TestEm1/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.3 2006/06/29 16:36:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/EventAction.cc

    r807 r1230  
    2626//
    2727// $Id: EventAction.cc,v 1.7 2007/11/12 15:48:58 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm1/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.3 2006/06/29 16:37:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.10 2007/11/12 15:48:58 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.13 2008/09/12 16:32:25 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem1";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress";
     56  fileType    = "root";
     57  fileOption  = "export=root";
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    215215void HistoManager::PrintHisto(G4int ih)
    216216{
    217  if (ih < MaxHisto) ascii[ih] = true;
     217 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    218218 else
    219219    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    228228{
    229229#ifdef G4ANALYSIS_USE
     230
     231 if (!ascii[0]) return;
    230232 
    231233 G4String name = fileName[0] + ".ascii";
     
    241243      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    242244         File << "  " << iBin << "\t"
    243               << histo[ih]->binMean(iBin) << "\t"
     245              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     246                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"
    244247              << histo[ih]->binHeight(iBin)
    245248              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm1/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.6 2007/11/12 15:48:58 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/PhysListEmStandard.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmStandard.cc,v 1.14 2007/06/20 15:26:33 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmStandard.cc,v 1.21 2009/11/13 15:44:28 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939#include "G4PhotoElectricEffect.hh"
    4040
    41 #include "G4MultipleScattering.hh"
    42 
     41#include "G4eMultipleScattering.hh"
     42#include "G4UrbanMscModel93.hh"
    4343#include "G4eIonisation.hh"
    4444#include "G4eBremsstrahlung.hh"
    4545#include "G4eplusAnnihilation.hh"
    4646
     47#include "G4MuMultipleScattering.hh"
    4748#include "G4MuIonisation.hh"
    4849#include "G4MuBremsstrahlung.hh"
    4950#include "G4MuPairProduction.hh"
    5051
     52#include "G4hMultipleScattering.hh"
    5153#include "G4hIonisation.hh"
     54#include "G4hBremsstrahlung.hh"
     55#include "G4hPairProduction.hh"
     56
    5257#include "G4ionIonisation.hh"
    5358
     
    8691    } else if (particleName == "e-") {
    8792      //electron
    88       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    89       pmanager->AddProcess(new G4eIonisation,        -1, 2, 2);
    90       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3, 3);
     93      G4eMultipleScattering* msc = new G4eMultipleScattering();
     94      msc->AddEmModel(0, new G4UrbanMscModel93());
     95      pmanager->AddProcess(msc,                       -1, 1, 1);
     96      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     97      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    9198           
    9299    } else if (particleName == "e+") {
    93100      //positron
    94       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    95       pmanager->AddProcess(new G4eIonisation,        -1, 2, 2);
    96       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3, 3);
    97       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 4);
     101      G4eMultipleScattering* msc = new G4eMultipleScattering();
     102      msc->AddEmModel(0, new G4UrbanMscModel93());
     103      pmanager->AddProcess(msc,                       -1, 1, 1);     
     104      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     105      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     106      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    98107     
    99108    } else if( particleName == "mu+" ||
    100109               particleName == "mu-"    ) {
    101110      //muon 
    102       pmanager->AddProcess(new G4MultipleScattering,-1, 1, 1);
    103       pmanager->AddProcess(new G4MuIonisation,      -1, 2, 2);
    104       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3, 3);
    105       pmanager->AddProcess(new G4MuPairProduction,  -1, 4, 4);       
    106      
    107     } else if( particleName == "alpha" || particleName == "He3"
    108                || particleName == "GenericIon" ) {
     111      pmanager->AddProcess(new G4MuMultipleScattering,-1, 1, 1);
     112      pmanager->AddProcess(new G4MuIonisation,        -1, 2, 2);
     113      pmanager->AddProcess(new G4MuBremsstrahlung,    -1, 3, 3);
     114      pmanager->AddProcess(new G4MuPairProduction,    -1, 4, 4);       
     115             
     116    } else if( particleName == "proton" ||
     117               particleName == "pi-" ||
     118               particleName == "pi+"    ) {
     119      //proton 
     120      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     121      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     122      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     123      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
     124         
     125    } else if( particleName == "alpha" ||
     126               particleName == "He3" ||
     127               particleName == "GenericIon" ) {
    109128
    110       pmanager->AddProcess(new G4MultipleScattering,-1, 1, 1);
    111       pmanager->AddProcess(new G4ionIonisation,     -1, 2, 2);
     129      pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
     130      pmanager->AddProcess(new G4ionIonisation,      -1, 2, 2);
    112131
    113132    } else if ((!particle->IsShortLived()) &&
     
    115134               (particle->GetParticleName() != "chargedgeantino")) {
    116135      //all others charged particles except geantino
    117       pmanager->AddProcess(new G4MultipleScattering,-1, 1, 1);
    118       pmanager->AddProcess(new G4hIonisation,       -1, 2, 2);
     136      pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
     137      pmanager->AddProcess(new G4hIonisation,        -1, 2, 2);
    119138    }
    120139  }
    121  
     140
    122141  // Em options
    123142  //
     143  // Main options and setting parameters are shown here.
     144  // Several of them have default values.
     145  //
    124146  G4EmProcessOptions emOptions;
    125    
    126   //coulomb scattering
     147 
     148  //physics tables
    127149  //
    128   emOptions.SetMscStepLimitation(fUseDistanceToBoundary);   
    129   emOptions.SetSkin(2.);
    130  
     150  emOptions.SetMinEnergy(100*eV);       //default   
     151  emOptions.SetMaxEnergy(100*TeV);      //default 
     152  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     153  emOptions.SetLambdaBinning(12*20);    //default=12*7
     154  emOptions.SetSplineFlag(true);        //default
     155     
     156  //multiple coulomb scattering
     157  //
     158  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     159  emOptions.SetMscRangeFactor(0.04);    //default
     160  emOptions.SetMscGeomFactor (2.5);     //default       
     161  emOptions.SetSkin(3.);                //default
     162     
    131163  //energy loss
    132164  //
    133   emOptions.SetLinearLossLimit(1.e-6);
    134   emOptions.SetStepFunction(0.2, 100*um);
     165  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     166  emOptions.SetLinearLossLimit(1.e-2);          //default
    135167   
    136168  //ionization
    137169  //
    138   emOptions.SetSubCutoff(true);
    139    
    140   // define high energy threshold for bremstrahlung
    141   //
    142   emOptions.SetBremsstrahlungTh(10.*GeV);
     170  emOptions.SetSubCutoff(false);                //default=false 
    143171}
    144172
  • trunk/examples/extended/electromagnetic/TestEm1/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.10 2006/10/19 17:24:13 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.cc,v 1.12 2009/09/15 12:51:49 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535 
    3636#include "PhysListEmStandard.hh"
    37 #include "PhysListEmLivermore.hh"
    38 #include "PhysListEmPenelope.hh"
     37
     38#include "G4EmStandardPhysics.hh"
     39#include "G4EmStandardPhysics_option1.hh"
     40#include "G4EmStandardPhysics_option2.hh"
     41#include "G4EmStandardPhysics_option3.hh"
     42#include "G4EmLivermorePhysics.hh"
     43#include "G4EmPenelopePhysics.hh"
    3944
    4045#include "DetectorConstruction.hh"
     
    6166
    6267  // EM physics
    63   emName = G4String("standard");
     68  emName = G4String("local");
    6469  emPhysicsList = new PhysListEmStandard(emName);
    6570
     
    189194  G4EmProcessOptions emOptions;
    190195  emOptions.SetBuildCSDARange(true);
    191  
     196  emOptions.SetDEDXBinningForCSDARange(8*20);
     197   
    192198  // Decay Process
    193199  //
     
    209215  if (name == emName) return;
    210216
    211   if (name == "standard") {
     217  if (name == "local") {
    212218
    213219    emName = name;
    214220    delete emPhysicsList;
    215221    emPhysicsList = new PhysListEmStandard(name);
    216  
    217   } else if (name == "livermore") {
    218 
    219     emName = name;
    220     delete emPhysicsList;
    221     emPhysicsList = new PhysListEmLivermore(name);
    222222   
    223   } else if (name == "penelope") {
    224 
    225     emName = name;
    226     delete emPhysicsList;
    227     emPhysicsList = new PhysListEmPenelope(name);
    228        
     223  } else if (name == "emstandard_opt0") {
     224
     225    emName = name;
     226    delete emPhysicsList;
     227    emPhysicsList = new G4EmStandardPhysics();
     228
     229  } else if (name == "emstandard_opt1") {
     230
     231    emName = name;
     232    delete emPhysicsList;
     233    emPhysicsList = new G4EmStandardPhysics_option1();
     234
     235  } else if (name == "emstandard_opt2") {
     236
     237    emName = name;
     238    delete emPhysicsList;
     239    emPhysicsList = new G4EmStandardPhysics_option2();
     240
     241  } else if (name == "emstandard_opt3") {
     242
     243    emName = name;
     244    delete emPhysicsList;
     245    emPhysicsList = new G4EmStandardPhysics_option3();
     246
     247  } else if (name == "emlivermore") {
     248    emName = name;
     249    delete emPhysicsList;
     250    emPhysicsList = new G4EmLivermorePhysics();
     251   
     252  } else if (name == "empenelope") {
     253    emName = name;
     254    delete emPhysicsList;
     255    emPhysicsList = new G4EmPenelopePhysics();
     256           
    229257  } else {
    230258
  • trunk/examples/extended/electromagnetic/TestEm1/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 16:37:19 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.cc,v 1.4 2006/06/29 16:37:21 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm1/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.4 2006/06/29 16:37:23 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.19 2006/06/29 16:37:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.2 2006/06/29 16:37:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.2 2006/06/29 16:37:29 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.8 2006/06/29 16:37:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/SteppingVerbose.cc

    r807 r1230  
    2626//
    2727// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:37:34 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm1/src/TrackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.cc,v 1.10 2006/06/29 16:37:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm10/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.4 2006/10/26 15:19:21 maire Exp $
     1# $Id: GNUmakefile,v 1.5 2008/06/11 22:34:04 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1515all: lib bin
    1616
    17 ifdef G4ANALYSIS_USE
    18   CPPFLAGS += -DG4ANALYSIS_USE
    19 endif
     17#### G4ANALYSIS_USE := true
    2018
    2119include $(G4INSTALL)/config/architecture.gmk
    22 
    23 # for the aida-config command see the README file
    24 ifdef G4ANALYSIS_USE
    25   CPPFLAGS += `aida-config --include`
    26   LOADLIBS += `aida-config --lib`
    27 endif
    2820
    2921include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm10/TestEm10.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm10.cc,v 1.9 2007/07/27 17:52:04 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10CalorHit.hh

    r807 r1230  
    2626//
    2727// $Id: Em10CalorHit.hh,v 1.4 2006/06/29 16:37:41 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10CalorimeterSD.hh

    r807 r1230  
    2626//
    2727// $Id: Em10CalorimeterSD.hh,v 1.3 2006/06/29 16:37:43 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: Em10DetectorConstruction.hh,v 1.19 2006/06/29 16:37:46 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10DetectorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em10DetectorMessenger.hh,v 1.7 2006/06/29 16:37:48 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10EventAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em10EventAction.hh,v 1.3 2006/06/29 16:37:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10EventActionMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em10EventActionMessenger.hh,v 1.3 2006/06/29 16:37:53 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: Em10PhysicsList.hh,v 1.11 2006/06/29 16:37:57 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10PhysicsListMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em10PhysicsListMessenger.hh,v 1.7 2006/06/29 16:37:59 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10PrimaryGeneratorAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em10PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:38:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10PrimaryGeneratorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em10PrimaryGeneratorMessenger.hh,v 1.3 2006/06/29 16:38:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10RunAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em10RunAction.hh,v 1.5 2006/06/29 16:38:06 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10RunMessenger.hh

    r807 r1230  
    2727//
    2828// $Id: Em10RunMessenger.hh,v 1.3 2006/06/29 16:38:09 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10StepCut.hh

    r807 r1230  
    2626//
    2727// $Id: Em10StepCut.hh,v 1.5 2006/06/29 16:38:12 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10SteppingAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingAction.hh,v 1.3 2006/06/29 16:38:14 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10SteppingMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingMessenger.hh,v 1.3 2006/06/29 16:38:16 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm10/include/Em10SteppingVerbose.hh

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingVerbose.hh,v 1.3 2006/06/29 16:38:19 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// 
  • trunk/examples/extended/electromagnetic/TestEm10/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.2 2006/06/29 16:38:24 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//
  • trunk/examples/extended/electromagnetic/TestEm10/include/TRTDetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: TRTDetectorConstruction.hh,v 1.3 2006/06/29 16:38:27 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/include/TRTMaterials.hh

    r807 r1230  
    2626//
    2727// $Id: TRTMaterials.hh,v 1.3 2006/06/29 16:38:29 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10CalorHit.cc

    r807 r1230  
    2626//
    2727// $Id: Em10CalorHit.cc,v 1.4 2006/06/29 16:38:31 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10CalorimeterSD.cc

    r807 r1230  
    2626//
    2727// $Id: Em10CalorimeterSD.cc,v 1.4 2006/06/29 16:38:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10DetectorConstruction.cc

    r807 r1230  
    2626//
    2727// $Id: Em10DetectorConstruction.cc,v 1.32 2007/07/27 17:52:04 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10DetectorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10DetectorMessenger.cc,v 1.11 2006/06/29 16:38:38 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10EventAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em10EventAction.cc,v 1.6 2006/06/29 16:38:41 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10EventActionMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10EventActionMessenger.cc,v 1.4 2006/06/29 16:38:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10PhysicsList.cc

    r807 r1230  
    2626//
    2727// $Id: Em10PhysicsList.cc,v 1.24 2006/06/29 16:38:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10PhysicsListMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10PhysicsListMessenger.cc,v 1.9 2006/06/29 16:38:52 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em10PrimaryGeneratorAction.cc,v 1.6 2006/06/29 16:38:55 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10PrimaryGeneratorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10PrimaryGeneratorMessenger.cc,v 1.4 2006/06/29 16:38:57 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10RunAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em10RunAction.cc,v 1.9 2006/06/29 16:38:59 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10RunMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10RunMessenger.cc,v 1.5 2006/06/29 16:39:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10StepCut.cc

    r807 r1230  
    2626//
    2727// $Id: Em10StepCut.cc,v 1.3 2006/06/29 16:39:04 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10SteppingAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingAction.cc,v 1.6 2006/06/29 16:39:06 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10SteppingMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingMessenger.cc,v 1.4 2006/06/29 16:39:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm10/src/Em10SteppingVerbose.cc

    r807 r1230  
    2626//
    2727// $Id: Em10SteppingVerbose.cc,v 1.6 2006/06/29 16:39:12 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
  • trunk/examples/extended/electromagnetic/TestEm10/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.2 2006/06/29 16:39:16 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929///////////////////////////////////////////////////////////////////////////
  • trunk/examples/extended/electromagnetic/TestEm11/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.5 2006/09/20 09:29:37 maire Exp $
     1# $Id: GNUmakefile,v 1.10 2008/06/11 22:37:54 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm11/TestEm11.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm11.cc,v 1.3 2006/06/29 16:39:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:39:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:39:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:39:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:39:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.5 2007/11/07 17:22:15 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/HistoMessenger.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoMessenger.hh,v 1.4 2007/11/07 17:22:16 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoMessenger.hh,v 1.5 2008/01/11 13:01:57 jjacquem Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6363   G4UIcmdWithAString*        factoryCmd;
    6464   G4UIcmdWithAString*        typeCmd;
     65   G4UIcmdWithAString*        optionCmd;
    6566   G4UIcommand*               histoCmd;
    6667   G4UIcmdWithAnInteger*      prhistoCmd;
    6768   G4UIcmdWithAnInteger*      rmhistoCmd;   
    6869   G4UIcmdWithADoubleAndUnit* csdaCmd;
     70 
    6971};
    7072
  • trunk/examples/extended/electromagnetic/TestEm11/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:39:41 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.3 2006/06/29 16:39:43 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:39:46 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:39:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.2 2006/06/29 16:39:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.3 2007/08/19 20:52:53 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.3 2006/06/29 16:39:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.3 2006/06/29 16:40:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:40:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:40:06 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.2 2006/06/29 16:40:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/range.mac

    r807 r1230  
    1 # $Id: range.mac,v 1.4 2007/08/19 20:52:53 maire Exp $
     1# $Id: range.mac,v 1.5 2009/09/22 14:20:31 maire Exp $
    22#
    33# Macro file for "TestEm11.cc"
     
    1313/testem/det/setSizeYZ 5 mm
    1414#
    15 /testem/phys/addPhysics  standard
    16 ###/testem/phys/addPhysics  penelope
    17 ###/testem/phys/addPhysics  livermore
     15/testem/phys/addPhysics  local
     16###/testem/phys/addPhysics  empenelope
     17###/testem/phys/addPhysics  emlivermore
    1818#
    1919/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm11/run01.mac

    r807 r1230  
    1 # $Id: run01.mac,v 1.5 2006/07/06 15:56:38 maire Exp $
     1# $Id: run01.mac,v 1.6 2009/09/22 14:20:31 maire Exp $
    22#
    33# limit the step size from histo 1
     
    1010/testem/det/setSizeYZ 1 mm
    1111#
    12 /testem/phys/addPhysics  standard       # em physics
    13 ###/testem/phys/addPhysics  penelope    # em physics
     12/testem/phys/addPhysics  local  # em physics
     13###/testem/phys/addPhysics  empenelope          # em physics
    1414#
    1515/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm11/run02.mac

    r807 r1230  
    1 # $Id: run02.mac,v 1.4 2006/10/26 10:18:59 maire Exp $
     1# $Id: run02.mac,v 1.5 2009/09/22 14:20:31 maire Exp $
    22#
    33# limit the step size by geometry
     
    1111/testem/det/setNbOfLayers 100
    1212#
    13 /testem/phys/addPhysics  standard       # em physics
    14 ###/testem/phys/addPhysics  penelope    # em physics
     13/testem/phys/addPhysics  local  # em physics
     14###/testem/phys/addPhysics  empenelope          # em physics
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm11/sandia.mac

    r807 r1230  
    1 # $Id: sandia.mac,v 1.1 2007/08/19 20:52:53 maire Exp $
     1# $Id: sandia.mac,v 1.9 2009/09/22 14:20:31 maire Exp $
    22#
    33# limit the step size from histo 8
    44#
    5 # G.J.Lockwood et al. Sandia report SAND79-0414.UC-34a, February 1987
     5# G.J.Lockwood et al.
     6#     Sandia report SAND79-0414.UC-34a, February 1987
    67# O.Kadri et al. NIM B 258 (2007) 381
    78#
     
    1011#
    1112/testem/det/setMat G4_Al
     13###/testem/det/setMat G4_Mo
    1214###/testem/det/setMat G4_Ta
    1315/testem/det/setSizeX  1 cm
    1416/testem/det/setSizeYZ 1 cm
    1517#
    16 /testem/phys/addPhysics  standard       # em physics
     18/testem/phys/addPhysics  local  # em physics
    1719#
    1820/run/initialize
    1921#
    2022/gun/particle e-
    21 /gun/energy 500 keV
     23/gun/energy 314 keV
    2224#
    23 /testem/histo/setFileType hbook
    24 /testem/histo/setFileName Al.500keV
     25###/testem/histo/setFileType hbook
     26/testem/histo/setFileType root
     27/testem/histo/setFileName sandia/Al.314keV
    2528/testem/histo/setHisto 8 100 0.  1.0 none       #normalized Edep profile
    26 ###/testem/histo/setHisto 8 100 0.  0.5 none
     29###/testem/histo/setHisto 8 100 0.  0.5 none    #for Ta
    2730#
    2831/testem/event/printModulo 10000
  • trunk/examples/extended/electromagnetic/TestEm11/src/DetectorConstruction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: DetectorConstruction.cc,v 1.8 2007/11/07 17:22:16 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: DetectorConstruction.cc,v 1.9 2009/11/16 15:09:10 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828
    2929//
     
    9191  man->FindOrBuildMaterial("G4_Si", isotopes);
    9292  man->FindOrBuildMaterial("G4_Fe", isotopes);
     93  man->FindOrBuildMaterial("G4_Cu", isotopes); 
    9394  man->FindOrBuildMaterial("G4_Ge", isotopes);
    9495  man->FindOrBuildMaterial("G4_Mo", isotopes);
  • trunk/examples/extended/electromagnetic/TestEm11/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:40:12 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:40:15 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:40:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.6 2007/11/07 17:22:16 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.10 2008/09/22 15:11:34 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "dummy";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    223223{
    224224 if (ih > MaxHisto) {
    225     G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
    226            << "does not exist" << G4endl;
     225    G4cout << "---> warning from HistoManager::Scale() : histo " << ih
     226           << "does not exist  (fac = " << fac << ")" << G4endl;
    227227    return;
    228228  }
     
    236236void HistoManager::PrintHisto(G4int ih)
    237237{
    238  if (ih < MaxHisto) ascii[ih] = true;
     238 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    239239 else
    240240    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    249249{
    250250#ifdef G4ANALYSIS_USE
     251
     252 if (!ascii[0]) return;
    251253 
    252254 G4String name = fileName[0] + ".ascii";
     
    262264      for (G4int iBin=0; iBin<Nbins[ih]; ++iBin) {
    263265         File << "  " << iBin << "\t"
    264               << histo[ih]->binMean(iBin) << "\t"
     266              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     267                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"           
    265268              << histo[ih]->binHeight(iBin)
    266269              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm11/src/HistoMessenger.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoMessenger.cc,v 1.5 2007/11/07 17:22:16 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoMessenger.cc,v 1.6 2008/01/11 13:01:57 jjacquem Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5656  typeCmd->SetGuidance("set histograms file type: hbook, root, XML");
    5757  typeCmd->SetCandidates("hbook root XML");
     58
     59  optionCmd = new G4UIcmdWithAString("/testem/histo/setFileOption",this);
     60  optionCmd->SetGuidance("set option for the histograms file");
    5861
    5962  histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
     
    112115  delete factoryCmd;
    113116  delete histoDir;
     117  delete optionCmd;
    114118}
    115119
     
    123127  if (command == typeCmd)
    124128    histoManager->SetFileType(newValues);
     129
     130  if (command == optionCmd)
     131    histoManager->SetFileOption(newValues);
    125132
    126133  if (command == histoCmd)
  • trunk/examples/extended/electromagnetic/TestEm11/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmStandard.cc,v 1.3 2006/06/29 16:40:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysListEmStandard.cc,v 1.11 2009/11/16 15:09:10 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3938#include "G4PhotoElectricEffect.hh"
    4039
    41 #include "G4MultipleScattering.hh"
    42 
     40#include "G4eMultipleScattering.hh"
     41#include "G4UrbanMscModel93.hh"
    4342#include "G4eIonisation.hh"
    4443#include "G4eBremsstrahlung.hh"
    4544#include "G4eplusAnnihilation.hh"
    4645
     46#include "G4MuMultipleScattering.hh"
    4747#include "G4MuIonisation.hh"
    4848#include "G4MuBremsstrahlung.hh"
    4949#include "G4MuPairProduction.hh"
    5050
     51#include "G4hMultipleScattering.hh"
    5152#include "G4hIonisation.hh"
     53#include "G4hBremsstrahlung.hh"
     54#include "G4hPairProduction.hh"
     55
    5256#include "G4ionIonisation.hh"
     57#include "G4IonParametrisedLossModel.hh"
     58#include "G4NuclearStopping.hh"
     59
     60#include "G4EmProcessOptions.hh"
     61#include "G4MscStepLimitType.hh"
    5362
    5463//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6877{
    6978  // Add standard EM Processes
    70  
     79  //
     80
    7181  theParticleIterator->reset();
    7282  while( (*theParticleIterator)() ){
     
    7686     
    7787    if (particleName == "gamma") {
    78       // gamma         
     88      // gamma
    7989      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
    8090      pmanager->AddDiscreteProcess(new G4ComptonScattering);
     
    8393    } else if (particleName == "e-") {
    8494      //electron
    85       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    86       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    87       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    88            
     95      G4eMultipleScattering* msc = new G4eMultipleScattering();
     96      msc->AddEmModel(0, new G4UrbanMscModel93());
     97      pmanager->AddProcess(msc,                       -1, 1, 1);     
     98      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     99      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     100           
    89101    } else if (particleName == "e+") {
    90102      //positron
    91       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    92       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    93       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    94       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     103      G4eMultipleScattering* msc = new G4eMultipleScattering();
     104      msc->AddEmModel(0, new G4UrbanMscModel93());
     105      pmanager->AddProcess(msc,                       -1, 1, 1);           
     106      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     107      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     108      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    95109           
    96     } else if( particleName == "mu+" ||
     110    } else if (particleName == "mu+" ||
    97111               particleName == "mu-"    ) {
    98112      //muon 
    99       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    100       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    101       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    102       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     113      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     114      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     115      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     116      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
     117             
     118    } else if( particleName == "proton" ||
     119               particleName == "pi-" ||
     120               particleName == "pi+"    ) {
     121      //proton 
     122      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     123      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     124      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     125      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    103126     
    104     } else if( particleName == "GenericIon" ) {
    105       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    106       pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
    107 
     127    } else if( particleName == "alpha" ||
     128               particleName == "He3"    ) {
     129      //alpha
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
     132      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);
     133           
     134    } else if( particleName == "GenericIon" ) {
     135      //Ions
     136      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     137      G4ionIonisation* ionIoni = new G4ionIonisation();
     138      ionIoni->SetEmModel(new G4IonParametrisedLossModel());
     139      pmanager->AddProcess(ionIoni,                   -1, 2, 2);     
     140      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);     
     141     
    108142    } else if ((!particle->IsShortLived()) &&
    109143               (particle->GetPDGCharge() != 0.0) &&
    110144               (particle->GetParticleName() != "chargedgeantino")) {
    111145      //all others charged particles except geantino
    112       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    113       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     146      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     147      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    114148    }
    115149  }
     150
     151  // Em options
     152  //
     153  // Main options and setting parameters are shown here.
     154  // Several of them have default values.
     155  //
     156  G4EmProcessOptions emOptions;
     157 
     158  //physics tables
     159  //
     160  emOptions.SetMinEnergy(100*eV);       //default   
     161  emOptions.SetMaxEnergy(100*TeV);      //default 
     162  emOptions.SetDEDXBinning(12*20);      //default=12*7
     163  emOptions.SetLambdaBinning(12*20);    //default=12*7
     164  emOptions.SetSplineFlag(true);        //default
     165     
     166  //multiple coulomb scattering
     167  //
     168  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     169  emOptions.SetMscRangeFactor(0.04);    //default
     170  emOptions.SetMscGeomFactor (2.5);     //default       
     171  emOptions.SetSkin(3.);                //default
     172     
     173  //energy loss
     174  //
     175  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     176  emOptions.SetLinearLossLimit(1.e-2);          //default
     177   
     178  //ionization
     179  //
     180  emOptions.SetSubCutoff(false);        //default
    116181}
    117182
  • trunk/examples/extended/electromagnetic/TestEm11/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.5 2006/10/26 10:18:59 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.7 2009/09/22 14:20:31 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3434
    3535#include "PhysListEmStandard.hh"
    36 #include "PhysListEmLivermore.hh"
    37 #include "PhysListEmPenelope.hh"
     36
     37#include "G4EmStandardPhysics.hh"
     38#include "G4EmStandardPhysics_option1.hh"
     39#include "G4EmStandardPhysics_option2.hh"
     40#include "G4EmStandardPhysics_option3.hh"
     41#include "G4EmLivermorePhysics.hh"
     42#include "G4EmPenelopePhysics.hh"
    3843
    3944#include "G4LossTableManager.hh"
     
    5762
    5863  // EM physics
    59   emPhysicsList = new PhysListEmStandard(emName = "standard");
     64  emPhysicsList = new PhysListEmStandard(emName = "local");
    6065
    6166}
     
    186191  G4EmProcessOptions emOptions;
    187192  emOptions.SetBuildCSDARange(true);
    188  
     193  emOptions.SetDEDXBinningForCSDARange(8*20);
     194   
    189195  // decay process
    190196  //
     
    206212  if (name == emName) return;
    207213
    208   if (name == "standard") {
     214  if (name == "local") {
    209215
    210216    emName = name;
    211217    delete emPhysicsList;
    212218    emPhysicsList = new PhysListEmStandard(name);
     219
     220  } else if (name == "emstandard_opt0") {
     221
     222    emName = name;
     223    delete emPhysicsList;
     224    emPhysicsList = new G4EmStandardPhysics();
    213225   
    214   } else if (name == "livermore") {
    215 
    216     emName = name;
    217     delete emPhysicsList;
    218     emPhysicsList = new PhysListEmLivermore(name);
     226  } else if (name == "emstandard_opt1") {
     227
     228    emName = name;
     229    delete emPhysicsList;
     230    emPhysicsList = new G4EmStandardPhysics_option1();
     231
     232  } else if (name == "emstandard_opt2") {
     233
     234    emName = name;
     235    delete emPhysicsList;
     236    emPhysicsList = new G4EmStandardPhysics_option2();
     237       
     238  } else if (name == "emstandard_opt3") {
     239
     240    emName = name;
     241    delete emPhysicsList;
     242    emPhysicsList = new G4EmStandardPhysics_option3();
     243           
     244  } else if (name == "emlivermore") {
     245    emName = name;
     246    delete emPhysicsList;
     247    emPhysicsList = new G4EmLivermorePhysics();
    219248   
    220   } else if (name == "penelope") {
    221 
    222     emName = name;
    223     delete emPhysicsList;
    224     emPhysicsList = new PhysListEmPenelope(name);
     249  } else if (name == "empenelope") {
     250    emName = name;
     251    delete emPhysicsList;
     252    emPhysicsList = new G4EmPenelopePhysics();
    225253       
    226254  } else {
  • trunk/examples/extended/electromagnetic/TestEm11/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:40:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:40:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.2 2006/06/29 16:40:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.7 2007/08/19 20:52:53 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.3 2006/06/29 16:40:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:40:53 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.5 2007/08/19 20:52:53 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:41:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/src/TrackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.cc,v 1.2 2006/06/29 16:41:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm11/water.mac

    r807 r1230  
    1 # $Id: water.mac,v 1.4 2006/09/18 17:26:20 maire Exp $
     1# $Id: water.mac,v 1.5 2009/09/22 14:20:31 maire Exp $
    22#
    33# no constraint on tracking step
     
    1010/testem/det/setSizeYZ 3 cm
    1111#
    12 /testem/phys/addPhysics  standard       # em physics
    13 ###/testem/phys/addPhysics  g4v52       # em physics
     12/testem/phys/addPhysics  local  # em physics
    1413#
    1514/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm12/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.2 2006/10/25 17:27:01 maire Exp $
     1# $Id: GNUmakefile,v 1.5 2008/06/11 22:40:49 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm12/TestEm12.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm12.cc,v 1.4 2006/06/29 16:41:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:42:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:42:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:42:06 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:42:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.6 2007/11/09 17:35:06 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/HistoMessenger.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoMessenger.hh,v 1.3 2007/11/09 17:35:06 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoMessenger.hh,v 1.4 2008/01/11 13:11:31 jjacquem Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6363   G4UIcmdWithAString*        factoryCmd;
    6464   G4UIcmdWithAString*        typeCmd;
     65   G4UIcmdWithAString*        optionCmd;
    6566   G4UIcommand*               histoCmd;
    6667   G4UIcmdWithAnInteger*      prhistoCmd;   
  • trunk/examples/extended/electromagnetic/TestEm12/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:42:25 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.3 2006/06/29 16:42:37 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:42:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:42:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.2 2006/06/29 16:42:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.4 2007/04/27 10:38:11 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.3 2006/06/29 16:42:50 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.3 2006/06/29 16:42:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:42:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:42:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.2 2006/06/29 16:42:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/run01.mac

    r807 r1230  
    1 # $Id: run01.mac,v 1.6 2007/04/27 10:38:11 maire Exp $
     1# $Id: run01.mac,v 1.7 2009/09/22 15:18:20 maire Exp $
    22#
    33# limit the step size from histos 1 and 8
     
    99/testem/det/setRadius  3 cm
    1010#
    11 /testem/phys/addPhysics  standard       # em physics
    12 ###/testem/phys/addPhysics  livermore   # em physics
    13 ###/testem/phys/addPhysics  penelope    # em physics
     11/testem/phys/addPhysics  local  # em physics
     12###/testem/phys/addPhysics  emlivermore # em physics
     13###/testem/phys/addPhysics  empenelope  # em physics
    1414#
    1515/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm12/run02.mac

    r807 r1230  
    1 # $Id: run02.mac,v 1.5 2007/04/27 10:38:11 maire Exp $
     1# $Id: run02.mac,v 1.6 2009/09/22 15:18:20 maire Exp $
    22#
    33# limit the step size by geometry
     
    1010/testem/det/setNbOfLayers 150
    1111#
    12 /testem/phys/addPhysics  standard       # em physics
    13 ###/testem/phys/addPhysics  livermore   # em physics
    14 ###/testem/phys/addPhysics  penelope    # em physics
     12/testem/phys/addPhysics  local  # em physics
     13###/testem/phys/addPhysics  emlivermore         # em physics
     14###/testem/phys/addPhysics  empenelope          # em physics
    1515#
    1616/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm12/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.2 2006/06/29 16:43:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:43:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:43:05 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:43:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.6 2007/11/09 17:35:06 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.11 2008/09/23 20:48:12 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem12";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    224224 if (ih > MaxHisto) {
    225225    G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
    226            << "does not exist" << G4endl;
     226           << "does not exist  (fac = " << fac << ")" << G4endl;
    227227    return;
    228228  }
     
    236236void HistoManager::PrintHisto(G4int ih)
    237237{
    238  if (ih < MaxHisto) ascii[ih] = true;
     238 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    239239 else
    240240    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    249249{
    250250#ifdef G4ANALYSIS_USE
    251  
     251
     252 if (!ascii[0] ) return;
     253 
    252254 G4String name = fileName[0] + ".ascii";
    253255 std::ofstream File(name, std::ios::out);
     
    262264      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    263265         File << "  " << iBin << "\t"
    264               << histo[ih]->binMean(iBin) << "\t"
     266              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     267                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"           
    265268              << histo[ih]->binHeight(iBin)
    266269              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm12/src/HistoMessenger.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoMessenger.cc,v 1.4 2007/11/09 17:35:06 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoMessenger.cc,v 1.5 2008/01/11 13:11:31 jjacquem Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5656  typeCmd->SetGuidance("set histograms file type: hbook, root, XML");
    5757  typeCmd->SetCandidates("hbook root XML");
     58
     59  optionCmd = new G4UIcmdWithAString("/testem/histo/setFileOption",this);
     60  optionCmd->SetGuidance("set option for the histograms file");
     61
    5862
    5963  histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
     
    112116  delete factoryCmd;
    113117  delete histoDir;
     118  delete optionCmd;
    114119}
    115120
     
    123128  if (command == typeCmd)
    124129    histoManager->SetFileType(newValues);
     130
     131  if (command == optionCmd)
     132    histoManager->SetFileOption(newValues);
     133
     134
    125135
    126136  if (command == histoCmd)
  • trunk/examples/extended/electromagnetic/TestEm12/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmStandard.cc,v 1.2 2006/06/29 16:43:25 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmStandard.cc,v 1.8 2009/11/16 16:18:27 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3938#include "G4PhotoElectricEffect.hh"
    4039
    41 #include "G4MultipleScattering.hh"
    42 
     40#include "G4eMultipleScattering.hh"
     41#include "G4UrbanMscModel93.hh"
    4342#include "G4eIonisation.hh"
    4443#include "G4eBremsstrahlung.hh"
    4544#include "G4eplusAnnihilation.hh"
    4645
     46#include "G4MuMultipleScattering.hh"
    4747#include "G4MuIonisation.hh"
    4848#include "G4MuBremsstrahlung.hh"
    4949#include "G4MuPairProduction.hh"
    5050
     51#include "G4hMultipleScattering.hh"
    5152#include "G4hIonisation.hh"
     53#include "G4hBremsstrahlung.hh"
     54#include "G4hPairProduction.hh"
     55
    5256#include "G4ionIonisation.hh"
     57#include "G4IonParametrisedLossModel.hh"
     58#include "G4NuclearStopping.hh"
     59
     60#include "G4EmProcessOptions.hh"
     61#include "G4MscStepLimitType.hh"
    5362
    5463//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6877{
    6978  // Add standard EM Processes
     79  //
    7080
    7181  theParticleIterator->reset();
     
    7686     
    7787    if (particleName == "gamma") {
    78       // gamma         
     88      // gamma
    7989      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
    8090      pmanager->AddDiscreteProcess(new G4ComptonScattering);
     
    8393    } else if (particleName == "e-") {
    8494      //electron
    85       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    86       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    87       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     95      G4eMultipleScattering* msc = new G4eMultipleScattering();
     96      msc->AddEmModel(0, new G4UrbanMscModel93());
     97      pmanager->AddProcess(msc,                       -1, 1, 1);     
     98      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     99      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    88100           
    89101    } else if (particleName == "e+") {
    90102      //positron
    91       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    92       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    93       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    94       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
    95      
    96     } else if( particleName == "mu+" ||
     103      G4eMultipleScattering* msc = new G4eMultipleScattering();
     104      msc->AddEmModel(0, new G4UrbanMscModel93());
     105      pmanager->AddProcess(msc,                       -1, 1, 1);           
     106      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     107      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     108      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
     109           
     110    } else if (particleName == "mu+" ||
    97111               particleName == "mu-"    ) {
    98112      //muon 
    99       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    100       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    101       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    102       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     113      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     114      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     115      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     116      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
     117             
     118    } else if( particleName == "proton" ||
     119               particleName == "pi-" ||
     120               particleName == "pi+"    ) {
     121      //proton 
     122      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     123      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     124      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     125      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    103126     
    104     } else if( particleName == "GenericIon" ) {
    105       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    106       pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
    107 
     127    } else if( particleName == "alpha" ||
     128               particleName == "He3"    ) {
     129      //alpha
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
     132      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);
     133           
     134    } else if( particleName == "GenericIon" ) {
     135      //Ions
     136      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     137      G4ionIonisation* ionIoni = new G4ionIonisation();
     138      ionIoni->SetEmModel(new G4IonParametrisedLossModel());
     139      pmanager->AddProcess(ionIoni,                   -1, 2, 2);     
     140      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);     
     141     
    108142    } else if ((!particle->IsShortLived()) &&
    109143               (particle->GetPDGCharge() != 0.0) &&
    110144               (particle->GetParticleName() != "chargedgeantino")) {
    111145      //all others charged particles except geantino
    112       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    113       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     146      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     147      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    114148    }
    115149  }
     150
     151  // Em options
     152  //
     153  // Main options and setting parameters are shown here.
     154  // Several of them have default values.
     155  //
     156  G4EmProcessOptions emOptions;
     157 
     158  //physics tables
     159  //
     160  emOptions.SetMinEnergy(100*eV);       //default   
     161  emOptions.SetMaxEnergy(100*TeV);      //default 
     162  emOptions.SetDEDXBinning(12*20);      //default=12*7
     163  emOptions.SetLambdaBinning(12*20);    //default=12*7
     164  emOptions.SetSplineFlag(true);        //default
     165     
     166  //multiple coulomb scattering
     167  //
     168  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     169  emOptions.SetMscRangeFactor(0.04);    //default
     170  emOptions.SetMscGeomFactor (2.5);     //default       
     171  emOptions.SetSkin(3.);                //default
     172     
     173  //energy loss
     174  //
     175  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     176  emOptions.SetLinearLossLimit(1.e-2);          //default
     177   
     178  //ionization
     179  //
     180  emOptions.SetSubCutoff(false);        //default
    116181}
    117182
  • trunk/examples/extended/electromagnetic/TestEm12/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.6 2007/08/19 20:57:28 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.8 2009/09/22 15:18:20 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3434
    3535#include "PhysListEmStandard.hh"
    36 #include "PhysListEmLivermore.hh"
    37 #include "PhysListEmPenelope.hh"
     36
     37#include "G4EmStandardPhysics.hh"
     38#include "G4EmStandardPhysics_option1.hh"
     39#include "G4EmStandardPhysics_option2.hh"
     40#include "G4EmStandardPhysics_option3.hh"
     41#include "G4EmLivermorePhysics.hh"
     42#include "G4EmPenelopePhysics.hh"
    3843
    3944#include "G4LossTableManager.hh"
     
    5762
    5863  // EM physics
    59   emPhysicsList = new PhysListEmStandard(emName = "standard");
     64  emPhysicsList = new PhysListEmStandard(emName = "local");
    6065
    6166}
     
    186191  G4EmProcessOptions emOptions;
    187192  emOptions.SetBuildCSDARange(true);
    188  
     193  emOptions.SetDEDXBinningForCSDARange(8*20);
     194   
    189195  // decay process
    190196  //
     
    206212  if (name == emName) return;
    207213
    208   if (name == "standard") {
     214  if (name == "local") {
    209215
    210216    emName = name;
     
    212218    emPhysicsList = new PhysListEmStandard(name);
    213219   
    214   } else if (name == "livermore") {
    215 
    216     emName = name;
    217     delete emPhysicsList;
    218     emPhysicsList = new PhysListEmLivermore(name);
     220  } else if (name == "emstandard_opt0") {
     221
     222    emName = name;
     223    delete emPhysicsList;
     224    emPhysicsList = new G4EmStandardPhysics();
    219225   
    220   } else if (name == "penelope") {
    221 
    222     emName = name;
    223     delete emPhysicsList;
    224     emPhysicsList = new PhysListEmPenelope(name);
     226  } else if (name == "emstandard_opt1") {
     227
     228    emName = name;
     229    delete emPhysicsList;
     230    emPhysicsList = new G4EmStandardPhysics_option1();
     231
     232  } else if (name == "emstandard_opt2") {
     233
     234    emName = name;
     235    delete emPhysicsList;
     236    emPhysicsList = new G4EmStandardPhysics_option2();
     237       
     238  } else if (name == "emstandard_opt3") {
     239
     240    emName = name;
     241    delete emPhysicsList;
     242    emPhysicsList = new G4EmStandardPhysics_option3();
     243           
     244  } else if (name == "emlivermore") {
     245    emName = name;
     246    delete emPhysicsList;
     247    emPhysicsList = new G4EmLivermorePhysics();
     248   
     249  } else if (name == "empenelope") {
     250    emName = name;
     251    delete emPhysicsList;
     252    emPhysicsList = new G4EmPenelopePhysics();
     253
    225254     
    226255  } else {
  • trunk/examples/extended/electromagnetic/TestEm12/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:43:30 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:43:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.2 2006/06/29 16:43:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.8 2007/08/19 20:57:29 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.3 2006/06/29 16:43:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:43:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.4 2007/04/27 10:38:11 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:43:46 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm12/src/TrackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.cc,v 1.2 2006/06/29 16:43:48 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.3 2006/10/24 16:04:29 maire Exp $
     1# $Id: GNUmakefile,v 1.4 2008/06/11 22:44:24 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717include $(G4INSTALL)/config/architecture.gmk
    1818
    19 ifdef G4ANALYSIS_USE
    20   # for the aida-config command see the README file
    21   CPPFLAGS += `aida-config --include`
    22   LOADLIBS += `aida-config --lib` 
    23 endif
    24 
    2519include $(G4INSTALL)/config/binmake.gmk
    2620
  • trunk/examples/extended/electromagnetic/TestEm13/TestEm13.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm13.cc,v 1.5 2007/06/24 22:26:54 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/gamma.mac

    r807 r1230  
    1 # $Id: gamma.mac,v 1.4 2007/06/24 22:26:54 maire Exp $
     1# $Id: gamma.mac,v 1.5 2009/09/25 11:27:13 maire Exp $
    22#
    33# Macro file for "TestEm13.cc"
     
    1212/testem/det/setSize 1 cm
    1313#
    14 /testem/phys/addPhysics standard
    15 #
    1614/run/initialize
    1715#
  • trunk/examples/extended/electromagnetic/TestEm13/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:43:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:43:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:43:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:44:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/PhysListEmLivermore.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmLivermore.hh,v 1.2 2006/06/29 16:44:04 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmLivermore.hh,v 1.4 2009/11/19 17:30:25 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4241{
    4342  public:
    44     PhysListEmLivermore(const G4String& name = "Livermore");
     43    PhysListEmLivermore(const G4String& name = "livermore");
    4544   ~PhysListEmLivermore();
    4645
  • trunk/examples/extended/electromagnetic/TestEm13/include/PhysListEmPenelope.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmPenelope.hh,v 1.2 2006/06/29 16:44:06 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmPenelope.hh,v 1.4 2009/11/19 17:30:25 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4241{
    4342  public:
    44     PhysListEmPenelope(const G4String& name = "Penelope");
     43    PhysListEmPenelope(const G4String& name = "penelope");
    4544   ~PhysListEmPenelope();
    4645
  • trunk/examples/extended/electromagnetic/TestEm13/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:44:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.3 2006/06/29 16:44:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.3 2006/06/29 16:44:12 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:44:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/ProcessesCount.hh

    r807 r1230  
    2525//
    2626// $Id: ProcessesCount.hh,v 1.2 2006/06/29 16:44:16 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.3 2006/06/29 16:44:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.4 2006/06/29 16:44:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:44:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm13/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.5 2006/06/29 16:44:24 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:44:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:44:30 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:44:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/PhysListEmLivermore.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmLivermore.cc,v 1.3 2006/06/29 16:44:34 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmLivermore.cc,v 1.5 2009/11/19 17:30:25 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4LowEnergyCompton.hh"
    38 #include "G4LowEnergyGammaConversion.hh"
    39 #include "G4LowEnergyPhotoElectric.hh"
    40 #include "G4LowEnergyRayleigh.hh"
     37// gamma
    4138
    42 #include "G4LowEnergyIonisation.hh"
    43 #include "G4LowEnergyBremsstrahlung.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4LivermorePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4LivermoreComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4LivermoreGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4LivermoreRayleighModel.hh"
     50
     51// e-
     52
    4453#include "G4eIonisation.hh"
     54#include "G4LivermoreIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
    4557#include "G4eBremsstrahlung.hh"
     58#include "G4LivermoreBremsstrahlungModel.hh"
     59
     60// e+
     61
    4662#include "G4eplusAnnihilation.hh"
     63
     64// mu
    4765
    4866#include "G4MuIonisation.hh"
     
    5068#include "G4MuPairProduction.hh"
    5169
    52 #include "G4hLowEnergyIonisation.hh"
     70// hadrons, ions
     71
     72#include "G4hIonisation.hh"
     73#include "G4ionIonisation.hh"
     74
    5375
    5476//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6789void PhysListEmLivermore::ConstructProcess()
    6890{
    69   // Add LowEn or standard EM Processes
     91  // Add standard EM Processes
    7092
    7193  theParticleIterator->reset();
     
    7496    G4ProcessManager* pmanager = particle->GetProcessManager();
    7597    G4String particleName = particle->GetParticleName();
    76      
     98
     99    //Applicability range for Livermore models
     100    //for higher energies, the Standard models are used   
     101    G4double highEnergyLimit = 1*GeV;
     102         
    77103    if (particleName == "gamma") {
    78104      // gamma         
    79       pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric);
    80       pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
    81       pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
    82       pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
     105
     106      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     107      G4LivermorePhotoElectricModel*
     108      photModel = new G4LivermorePhotoElectricModel();
     109      photModel->SetHighEnergyLimit(highEnergyLimit);
     110      phot->AddEmModel(0, photModel);
     111      pmanager->AddDiscreteProcess(phot);
     112
     113      G4ComptonScattering* compt = new G4ComptonScattering();
     114      G4LivermoreComptonModel*
     115      comptModel = new G4LivermoreComptonModel();
     116      comptModel->SetHighEnergyLimit(highEnergyLimit);
     117      compt->AddEmModel(0, comptModel);
     118      pmanager->AddDiscreteProcess(compt);
     119
     120      G4GammaConversion* conv = new G4GammaConversion();
     121      G4LivermoreGammaConversionModel*
     122      convModel = new G4LivermoreGammaConversionModel();
     123      convModel->SetHighEnergyLimit(highEnergyLimit);
     124      conv->AddEmModel(0, convModel);
     125      pmanager->AddDiscreteProcess(conv);
     126
     127      G4RayleighScattering* rayl = new G4RayleighScattering();
     128      G4LivermoreRayleighModel*
     129      raylModel = new G4LivermoreRayleighModel();
     130      raylModel->SetHighEnergyLimit(highEnergyLimit);
     131      rayl->AddEmModel(0, raylModel);
     132      pmanager->AddDiscreteProcess(rayl);
    83133     
    84134    } else if (particleName == "e-") {
    85135      //electron
    86       pmanager->AddProcess(new G4LowEnergyIonisation,     -1, 1, 1);
    87       pmanager->AddProcess(new G4LowEnergyBremsstrahlung, -1,-1, 2);
    88            
     136
     137      G4eIonisation* eIoni = new G4eIonisation();
     138      G4LivermoreIonisationModel*
     139      eIoniModel = new G4LivermoreIonisationModel();
     140      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     141      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     142      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     143     
     144      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     145      G4LivermoreBremsstrahlungModel*
     146      eBremModel = new G4LivermoreBremsstrahlungModel();
     147      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     148      eBrem->AddEmModel(0, eBremModel);
     149      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     150           
    89151    } else if (particleName == "e+") {
    90152      //positron
    91       pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
    92       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    93       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
     153      pmanager->AddProcess(new G4eIonisation,       -1, 1, 1);
     154      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 2, 2);
     155      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1, 3);
    94156     
    95157    } else if( particleName == "mu+" ||
    96158               particleName == "mu-"    ) {
    97159      //muon 
    98       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    99       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    100       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     160      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     161      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     162      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    101163     
     164    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
     165      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     166
    102167    } else if ((!particle->IsShortLived()) &&
    103168               (particle->GetPDGCharge() != 0.0) &&
    104169               (particle->GetParticleName() != "chargedgeantino")) {
    105170      //all others charged particles except geantino
    106       pmanager->AddProcess(new G4hLowEnergyIonisation, -1, 1, 1);
     171      pmanager->AddProcess(new G4hIonisation,      -1, 1, 1);
    107172    }
    108173  }
  • trunk/examples/extended/electromagnetic/TestEm13/src/PhysListEmPenelope.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmPenelope.cc,v 1.3 2006/06/29 16:44:36 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmPenelope.cc,v 1.6 2009/11/19 17:30:25 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4PenelopeCompton.hh"
    38 #include "G4PenelopeGammaConversion.hh"
    39 #include "G4PenelopePhotoElectric.hh"
    40 #include "G4PenelopeRayleigh.hh"
     37// gamma
    4138
    42 #include "G4PenelopeIonisation.hh"
    43 #include "G4PenelopeBremsstrahlung.hh"
    44 #include "G4PenelopeAnnihilation.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4PenelopePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4PenelopeComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4PenelopeGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4PenelopeRayleighModel.hh"
     50
     51// e-
     52
     53#include "G4eIonisation.hh"
     54#include "G4PenelopeIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
     57#include "G4eBremsstrahlung.hh"
     58#include "G4PenelopeBremsstrahlungModel.hh"
     59
     60// e+
     61
     62#include "G4eplusAnnihilation.hh"
     63#include "G4PenelopeAnnihilationModel.hh"
     64
     65// mu
    4566
    4667#include "G4MuIonisation.hh"
     
    4869#include "G4MuPairProduction.hh"
    4970
     71// hadrons, ions
     72
    5073#include "G4hIonisation.hh"
    5174#include "G4ionIonisation.hh"
     75
    5276
    5377//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6690void PhysListEmPenelope::ConstructProcess()
    6791{
    68   // Add Penelope or standard EM Processes
     92  // Add standard EM Processes
    6993
    7094  theParticleIterator->reset();
     
    7397    G4ProcessManager* pmanager = particle->GetProcessManager();
    7498    G4String particleName = particle->GetParticleName();
    75      
     99
     100    //Applicability range for Penelope models
     101    //for higher energies, the Standard models are used   
     102    G4double highEnergyLimit = 1*GeV;
     103         
    76104    if (particleName == "gamma") {
    77105      // gamma         
    78       pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric);
    79       pmanager->AddDiscreteProcess(new G4PenelopeCompton);
    80       pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion);
    81       pmanager->AddDiscreteProcess(new G4PenelopeRayleigh);
     106
     107      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     108      G4PenelopePhotoElectricModel*
     109      photModel = new G4PenelopePhotoElectricModel();
     110      photModel->SetHighEnergyLimit(highEnergyLimit);
     111      phot->AddEmModel(0, photModel);
     112      pmanager->AddDiscreteProcess(phot);
     113
     114      G4ComptonScattering* compt = new G4ComptonScattering();
     115      G4PenelopeComptonModel*
     116      comptModel = new G4PenelopeComptonModel();
     117      comptModel->SetHighEnergyLimit(highEnergyLimit);
     118      compt->AddEmModel(0, comptModel);
     119      pmanager->AddDiscreteProcess(compt);
     120
     121      G4GammaConversion* conv = new G4GammaConversion();
     122      G4PenelopeGammaConversionModel*
     123      convModel = new G4PenelopeGammaConversionModel();
     124      convModel->SetHighEnergyLimit(highEnergyLimit);
     125      conv->AddEmModel(0, convModel);
     126      pmanager->AddDiscreteProcess(conv);
     127
     128      G4RayleighScattering* rayl = new G4RayleighScattering();
     129      G4PenelopeRayleighModel*
     130      raylModel = new G4PenelopeRayleighModel();
     131      raylModel->SetHighEnergyLimit(highEnergyLimit);
     132      rayl->AddEmModel(0, raylModel);
     133      pmanager->AddDiscreteProcess(rayl);
    82134     
    83135    } else if (particleName == "e-") {
    84136      //electron
    85       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    86       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);
    87            
     137
     138      G4eIonisation* eIoni = new G4eIonisation();
     139      G4PenelopeIonisationModel*
     140      eIoniModel = new G4PenelopeIonisationModel();
     141      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     142      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     143      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     144     
     145      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     146      G4PenelopeBremsstrahlungModel*
     147      eBremModel = new G4PenelopeBremsstrahlungModel();
     148      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     149      eBrem->AddEmModel(0, eBremModel);
     150      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     151           
    88152    } else if (particleName == "e+") {
    89153      //positron
    90       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    91       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);     
    92       pmanager->AddProcess(new G4PenelopeAnnihilation,    0,-1, 3);
     154      G4eIonisation* eIoni = new G4eIonisation();
     155      G4PenelopeIonisationModel*
     156      eIoniModel = new G4PenelopeIonisationModel();
     157      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     158      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     159      pmanager->AddProcess(eIoni,                   -1, 1, 1);
    93160     
     161      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     162      G4PenelopeBremsstrahlungModel*
     163      eBremModel = new G4PenelopeBremsstrahlungModel();
     164      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     165      eBrem->AddEmModel(0, eBremModel);
     166      pmanager->AddProcess(eBrem,                   -1, 2, 2);     
     167
     168      G4eplusAnnihilation* eAnni = new G4eplusAnnihilation();
     169      G4PenelopeAnnihilationModel*
     170      eAnniModel = new G4PenelopeAnnihilationModel();
     171      eAnniModel->SetHighEnergyLimit(highEnergyLimit);
     172      eAnni->AddEmModel(0, eAnniModel);
     173      pmanager->AddProcess(eAnni,                    0,-1, 3);
     174           
    94175    } else if( particleName == "mu+" ||
    95176               particleName == "mu-"    ) {
    96177      //muon 
    97       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    98       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    99       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     178      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     179      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     180      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    100181     
    101182    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
    102       pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
    103      
     183      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     184
    104185    } else if ((!particle->IsShortLived()) &&
    105186               (particle->GetPDGCharge() != 0.0) &&
    106187               (particle->GetParticleName() != "chargedgeantino")) {
    107188      //all others charged particles except geantino
    108       pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
     189      pmanager->AddProcess(new G4hIonisation,       -1, 1, 1);
    109190    }
    110191  }
  • trunk/examples/extended/electromagnetic/TestEm13/src/PhysListEmStandard.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.cc,v 1.3 2006/06/29 16:44:38 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.5 2006/06/29 16:44:40 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.cc,v 1.7 2009/11/19 17:30:25 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    199199
    200200  if (name == "standard") {
    201 
    202201    emName = name;
    203202    delete emPhysicsList;
    204203    emPhysicsList = new PhysListEmStandard(name);
    205       
     204   
    206205  } else if (name == "livermore") {
    207206    emName = name;
     
    213212    delete emPhysicsList;
    214213    emPhysicsList = new PhysListEmPenelope(name);
    215            
     214                         
    216215  } else {
    217216    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
  • trunk/examples/extended/electromagnetic/TestEm13/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 16:44:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:44:45 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.6 2006/06/29 16:44:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/SteppingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.6 2007/06/24 22:26:54 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: SteppingAction.cc,v 1.7 2009/09/25 11:27:13 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm13/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:44:51 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.3 2006/10/24 16:54:16 maire Exp $
     1# $Id: GNUmakefile,v 1.4 2008/06/11 22:47:10 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib` 
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm14/TestEm14.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm14.cc,v 1.4 2007/06/23 22:23:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/compton.mac

    r807 r1230  
    1 # $Id: compton.mac,v 1.3 2006/09/06 09:56:06 maire Exp $
     1# $Id: compton.mac,v 1.4 2009/09/25 11:43:33 maire Exp $
    22#
    33# Macro file for "TestEm14.cc"
     
    1212#
    1313/testem/phys/addPhysics standard
    14 ####/testem/phys/addPhysics livermore
    15 ####/testem/phys/addPhysics penelope
    1614#
    1715/run/initialize
     
    2422/gun/energy 300 keV
    2523#
    26 /testem/histo/setFileName compton
    27 /testem/histo/setFileType hbook
     24/testem/histo/setFileName testem14
     25/testem/histo/setFileType root
    2826/testem/histo/setHisto 1  100 0. 300. keV       #energy  of primary 
    2927/testem/histo/setHisto 2  200 -1. +1. none      #costeta of primary
  • trunk/examples/extended/electromagnetic/TestEm14/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.3 2006/06/29 16:44:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.3 2006/06/29 16:44:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.3 2006/06/29 16:45:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:45:02 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.4 2007/11/13 12:13:32 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.4 2007/11/13 12:13:32 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/PhysListEmLivermore.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmLivermore.hh,v 1.2 2006/06/29 16:45:10 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmLivermore.hh,v 1.4 2009/11/19 10:36:37 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4241{
    4342  public:
    44     PhysListEmLivermore(const G4String& name = "Livermore");
     43    PhysListEmLivermore(const G4String& name = "livermore");
    4544   ~PhysListEmLivermore();
    4645
  • trunk/examples/extended/electromagnetic/TestEm14/include/PhysListEmPenelope.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmPenelope.hh,v 1.2 2006/06/29 16:45:12 gunter Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmPenelope.hh,v 1.4 2009/11/19 10:36:37 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4241{
    4342  public:
    44     PhysListEmPenelope(const G4String& name = "Penelope");
     43    PhysListEmPenelope(const G4String& name = "penelope");
    4544   ~PhysListEmPenelope();
    4645
  • trunk/examples/extended/electromagnetic/TestEm14/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.3 2006/06/29 16:45:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.3 2006/06/29 16:45:16 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.3 2006/06/29 16:45:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:45:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/ProcessesCount.hh

    r807 r1230  
    2525//
    2626// $Id: ProcessesCount.hh,v 1.3 2006/06/29 16:45:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.4 2006/09/06 09:56:06 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.4 2006/09/06 09:56:06 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/SteppingMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingMessenger.hh,v 1.2 2006/06/29 16:45:29 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.3 2006/06/29 16:45:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm14/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.4 2006/06/29 16:45:33 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.3 2006/06/29 16:45:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.3 2006/06/29 16:45:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.3 2006/06/29 16:45:39 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.5 2007/11/13 12:13:32 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.7 2008/09/24 18:53:56 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem14";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    218218void HistoManager::PrintHisto(G4int ih)
    219219{
    220  if (ih < MaxHisto) ascii[ih] = true;
     220 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    221221 else
    222222    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    231231{
    232232#ifdef G4ANALYSIS_USE
     233 
     234 if (!ascii[0]) return;
    233235 
    234236 G4String name = fileName[0] + ".ascii";
  • trunk/examples/extended/electromagnetic/TestEm14/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.4 2007/11/13 12:17:07 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/PhysListEmLivermore.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmLivermore.cc,v 1.2 2006/06/29 16:45:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmLivermore.cc,v 1.4 2009/11/19 10:36:37 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4LowEnergyCompton.hh"
    38 #include "G4LowEnergyGammaConversion.hh"
    39 #include "G4LowEnergyPhotoElectric.hh"
    40 #include "G4LowEnergyRayleigh.hh"
     37// gamma
    4138
    42 #include "G4LowEnergyIonisation.hh"
    43 #include "G4LowEnergyBremsstrahlung.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4LivermorePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4LivermoreComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4LivermoreGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4LivermoreRayleighModel.hh"
     50
     51// e-
     52
    4453#include "G4eIonisation.hh"
     54#include "G4LivermoreIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
    4557#include "G4eBremsstrahlung.hh"
     58#include "G4LivermoreBremsstrahlungModel.hh"
     59
     60// e+
     61
    4662#include "G4eplusAnnihilation.hh"
     63
     64// mu
    4765
    4866#include "G4MuIonisation.hh"
     
    5068#include "G4MuPairProduction.hh"
    5169
    52 #include "G4hLowEnergyIonisation.hh"
     70// hadrons, ions
     71
     72#include "G4hIonisation.hh"
     73#include "G4ionIonisation.hh"
     74
    5375
    5476//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6789void PhysListEmLivermore::ConstructProcess()
    6890{
    69   // Add LowEn or standard EM Processes
     91  // Add standard EM Processes
    7092
    7193  theParticleIterator->reset();
     
    7496    G4ProcessManager* pmanager = particle->GetProcessManager();
    7597    G4String particleName = particle->GetParticleName();
    76      
     98
     99    //Applicability range for Livermore models
     100    //for higher energies, the Standard models are used   
     101    G4double highEnergyLimit = 1*GeV;
     102         
    77103    if (particleName == "gamma") {
    78104      // gamma         
    79       pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric);
    80       pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
    81       pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
    82       pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
     105
     106      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     107      G4LivermorePhotoElectricModel*
     108      photModel = new G4LivermorePhotoElectricModel();
     109      photModel->SetHighEnergyLimit(highEnergyLimit);
     110      phot->AddEmModel(0, photModel);
     111      pmanager->AddDiscreteProcess(phot);
     112
     113      G4ComptonScattering* compt = new G4ComptonScattering();
     114      G4LivermoreComptonModel*
     115      comptModel = new G4LivermoreComptonModel();
     116      comptModel->SetHighEnergyLimit(highEnergyLimit);
     117      compt->AddEmModel(0, comptModel);
     118      pmanager->AddDiscreteProcess(compt);
     119
     120      G4GammaConversion* conv = new G4GammaConversion();
     121      G4LivermoreGammaConversionModel*
     122      convModel = new G4LivermoreGammaConversionModel();
     123      convModel->SetHighEnergyLimit(highEnergyLimit);
     124      conv->AddEmModel(0, convModel);
     125      pmanager->AddDiscreteProcess(conv);
     126
     127      G4RayleighScattering* rayl = new G4RayleighScattering();
     128      G4LivermoreRayleighModel*
     129      raylModel = new G4LivermoreRayleighModel();
     130      raylModel->SetHighEnergyLimit(highEnergyLimit);
     131      rayl->AddEmModel(0, raylModel);
     132      pmanager->AddDiscreteProcess(rayl);
    83133     
    84134    } else if (particleName == "e-") {
    85135      //electron
    86       pmanager->AddProcess(new G4LowEnergyIonisation,     -1, 1, 1);
    87       pmanager->AddProcess(new G4LowEnergyBremsstrahlung, -1,-1, 2);
    88            
     136
     137      G4eIonisation* eIoni = new G4eIonisation();
     138      G4LivermoreIonisationModel*
     139      eIoniModel = new G4LivermoreIonisationModel();
     140      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     141      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     142      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     143     
     144      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     145      G4LivermoreBremsstrahlungModel*
     146      eBremModel = new G4LivermoreBremsstrahlungModel();
     147      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     148      eBrem->AddEmModel(0, eBremModel);
     149      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     150           
    89151    } else if (particleName == "e+") {
    90152      //positron
    91       pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
    92       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    93       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
     153      pmanager->AddProcess(new G4eIonisation,       -1, 1, 1);
     154      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 2, 2);
     155      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1, 3);
    94156     
    95157    } else if( particleName == "mu+" ||
    96158               particleName == "mu-"    ) {
    97159      //muon 
    98       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    99       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    100       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     160      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     161      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     162      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    101163     
     164    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
     165      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     166
    102167    } else if ((!particle->IsShortLived()) &&
    103168               (particle->GetPDGCharge() != 0.0) &&
    104169               (particle->GetParticleName() != "chargedgeantino")) {
    105170      //all others charged particles except geantino
    106       pmanager->AddProcess(new G4hLowEnergyIonisation, -1, 1, 1);
     171      pmanager->AddProcess(new G4hIonisation,      -1, 1, 1);
    107172    }
    108173  }
  • trunk/examples/extended/electromagnetic/TestEm14/src/PhysListEmPenelope.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmPenelope.cc,v 1.2 2006/06/29 16:45:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmPenelope.cc,v 1.4 2009/11/19 10:36:37 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4PenelopeCompton.hh"
    38 #include "G4PenelopeGammaConversion.hh"
    39 #include "G4PenelopePhotoElectric.hh"
    40 #include "G4PenelopeRayleigh.hh"
     37// gamma
    4138
    42 #include "G4PenelopeIonisation.hh"
    43 #include "G4PenelopeBremsstrahlung.hh"
    44 #include "G4PenelopeAnnihilation.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4PenelopePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4PenelopeComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4PenelopeGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4PenelopeRayleighModel.hh"
     50
     51// e-
     52
     53#include "G4eIonisation.hh"
     54#include "G4PenelopeIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
     57#include "G4eBremsstrahlung.hh"
     58#include "G4PenelopeBremsstrahlungModel.hh"
     59
     60// e+
     61
     62#include "G4eplusAnnihilation.hh"
     63#include "G4PenelopeAnnihilationModel.hh"
     64
     65// mu
    4566
    4667#include "G4MuIonisation.hh"
     
    4869#include "G4MuPairProduction.hh"
    4970
     71// hadrons, ions
     72
    5073#include "G4hIonisation.hh"
    5174#include "G4ionIonisation.hh"
     75
    5276
    5377//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6690void PhysListEmPenelope::ConstructProcess()
    6791{
    68   // Add Penelope or standard EM Processes
     92  // Add standard EM Processes
    6993
    7094  theParticleIterator->reset();
     
    7397    G4ProcessManager* pmanager = particle->GetProcessManager();
    7498    G4String particleName = particle->GetParticleName();
    75      
     99
     100    //Applicability range for Penelope models
     101    //for higher energies, the Standard models are used   
     102    G4double highEnergyLimit = 1*GeV;
     103         
    76104    if (particleName == "gamma") {
    77105      // gamma         
    78       pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric);
    79       pmanager->AddDiscreteProcess(new G4PenelopeCompton);
    80       pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion);
    81       pmanager->AddDiscreteProcess(new G4PenelopeRayleigh);
     106
     107      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     108      G4PenelopePhotoElectricModel*
     109      photModel = new G4PenelopePhotoElectricModel();
     110      photModel->SetHighEnergyLimit(highEnergyLimit);
     111      phot->AddEmModel(0, photModel);
     112      pmanager->AddDiscreteProcess(phot);
     113
     114      G4ComptonScattering* compt = new G4ComptonScattering();
     115      G4PenelopeComptonModel*
     116      comptModel = new G4PenelopeComptonModel();
     117      comptModel->SetHighEnergyLimit(highEnergyLimit);
     118      compt->AddEmModel(0, comptModel);
     119      pmanager->AddDiscreteProcess(compt);
     120
     121      G4GammaConversion* conv = new G4GammaConversion();
     122      G4PenelopeGammaConversionModel*
     123      convModel = new G4PenelopeGammaConversionModel();
     124      convModel->SetHighEnergyLimit(highEnergyLimit);
     125      conv->AddEmModel(0, convModel);
     126      pmanager->AddDiscreteProcess(conv);
     127
     128      G4RayleighScattering* rayl = new G4RayleighScattering();
     129      G4PenelopeRayleighModel*
     130      raylModel = new G4PenelopeRayleighModel();
     131      raylModel->SetHighEnergyLimit(highEnergyLimit);
     132      rayl->AddEmModel(0, raylModel);
     133      pmanager->AddDiscreteProcess(rayl);
    82134     
    83135    } else if (particleName == "e-") {
    84136      //electron
    85       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    86       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);
    87            
     137
     138      G4eIonisation* eIoni = new G4eIonisation();
     139      G4PenelopeIonisationModel*
     140      eIoniModel = new G4PenelopeIonisationModel();
     141      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     142      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     143      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     144     
     145      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     146      G4PenelopeBremsstrahlungModel*
     147      eBremModel = new G4PenelopeBremsstrahlungModel();
     148      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     149      eBrem->AddEmModel(0, eBremModel);
     150      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     151           
    88152    } else if (particleName == "e+") {
    89153      //positron
    90       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    91       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);     
    92       pmanager->AddProcess(new G4PenelopeAnnihilation,    0,-1, 3);
     154      G4eIonisation* eIoni = new G4eIonisation();
     155      G4PenelopeIonisationModel*
     156      eIoniModel = new G4PenelopeIonisationModel();
     157      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     158      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     159      pmanager->AddProcess(eIoni,                   -1, 1, 1);
    93160     
     161      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     162      G4PenelopeBremsstrahlungModel*
     163      eBremModel = new G4PenelopeBremsstrahlungModel();
     164      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     165      eBrem->AddEmModel(0, eBremModel);
     166      pmanager->AddProcess(eBrem,                   -1, 2, 2);     
     167
     168      G4eplusAnnihilation* eAnni = new G4eplusAnnihilation();
     169      G4PenelopeAnnihilationModel*
     170      eAnniModel = new G4PenelopeAnnihilationModel();
     171      eAnniModel->SetHighEnergyLimit(highEnergyLimit);
     172      eAnni->AddEmModel(0, eAnniModel);
     173      pmanager->AddProcess(eAnni,                    0,-1, 3);
     174           
    94175    } else if( particleName == "mu+" ||
    95176               particleName == "mu-"    ) {
    96177      //muon 
    97       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    98       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    99       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     178      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     179      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     180      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    100181     
    101182    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
    102       pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
    103      
     183      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     184
    104185    } else if ((!particle->IsShortLived()) &&
    105186               (particle->GetPDGCharge() != 0.0) &&
    106187               (particle->GetParticleName() != "chargedgeantino")) {
    107188      //all others charged particles except geantino
    108       pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
     189      pmanager->AddProcess(new G4hIonisation,       -1, 1, 1);
    109190    }
    110191  }
  • trunk/examples/extended/electromagnetic/TestEm14/src/PhysListEmStandard.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.cc,v 1.4 2006/10/24 16:54:16 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.4 2006/10/24 16:54:16 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.cc,v 1.6 2009/11/19 10:36:37 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535 
    3636#include "PhysListEmStandard.hh"
    37 
    3837#include "PhysListEmLivermore.hh"
    3938#include "PhysListEmPenelope.hh"
     
    200199
    201200  if (name == "standard") {
    202 
    203201    emName = name;
    204202    delete emPhysicsList;
    205203    emPhysicsList = new PhysListEmStandard(name);
    206       
     204   
    207205  } else if (name == "livermore") {
    208206    emName = name;
     
    214212    delete emPhysicsList;
    215213    emPhysicsList = new PhysListEmPenelope(name);
    216            
     214                   
    217215  } else {
    218216    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
  • trunk/examples/extended/electromagnetic/TestEm14/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 16:45:55 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.3 2006/06/29 16:45:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.4 2006/09/06 09:56:06 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.5 2007/06/23 22:23:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/SteppingMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingMessenger.cc,v 1.2 2006/06/29 16:46:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm14/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.3 2006/06/29 16:46:05 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.2 2006/10/24 10:28:10 maire Exp $
     1# $Id: GNUmakefile,v 1.3 2008/06/11 22:50:19 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib` 
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm15/TestEm15.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm15.cc,v 1.2 2006/06/29 16:46:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:46:10 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:46:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:46:17 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:46:19 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.4 2007/11/13 14:13:31 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.3 2007/11/13 14:13:31 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:46:26 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.2 2006/06/29 16:46:28 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:46:30 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:46:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/ProcessesCount.hh

    r807 r1230  
    2525//
    2626// $Id: ProcessesCount.hh,v 1.2 2006/06/29 16:46:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.3 2006/06/29 16:46:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.2 2006/06/29 16:46:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:46:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:46:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:46:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm15/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.3 2006/06/29 16:46:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:46:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:46:51 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:46:53 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.5 2007/11/13 14:13:31 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.8 2008/09/26 19:47:51 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem15";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    221221void HistoManager::PrintHisto(G4int ih)
    222222{
    223  if (ih < MaxHisto) ascii[ih] = true;
     223 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    224224 else
    225225    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    234234{
    235235#ifdef G4ANALYSIS_USE
     236
     237 if (!ascii[0]) return;
    236238 
    237239 G4String name = fileName[0] + ".ascii";
     
    247249      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    248250         File << "  " << iBin << "\t"
    249               << histo[ih]->binMean(iBin) << "\t"
     251              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     252                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"           
    250253              << histo[ih]->binHeight(iBin)
    251254              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm15/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.3 2007/11/13 14:13:31 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/PhysListEmStandard.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmStandard.cc,v 1.2 2006/06/29 16:47:02 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmStandard.cc,v 1.4 2009/11/19 17:58:25 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939#include "G4PhotoElectricEffect.hh"
    4040
    41 #include "G4MultipleScattering.hh"
     41#include "G4eMultipleScattering.hh"
     42#include "G4hMultipleScattering.hh"
     43#include "G4MuMultipleScattering.hh"
    4244
    4345#include "G4eIonisation.hh"
     
    8385    } else if (particleName == "e-") {
    8486      //electron
    85       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    86       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    87       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     87      pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1);
     88      pmanager->AddProcess(new G4eIonisation,         -1, 2,2);
     89      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3,3);
    8890           
    8991    } else if (particleName == "e+") {
    9092      //positron
    91       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    92       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    93       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    94       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     93      pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1);
     94      pmanager->AddProcess(new G4eIonisation,         -1, 2,2);
     95      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3,3);
     96      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1,4);
    9597           
    9698    } else if( particleName == "mu+" ||
    9799               particleName == "mu-"    ) {
    98100      //muon 
    99       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    100       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    101       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    102       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     101      pmanager->AddProcess(new G4MuMultipleScattering,-1, 1,1);
     102      pmanager->AddProcess(new G4MuIonisation,       -1, 2,2);
     103      pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 3,3);
     104      pmanager->AddProcess(new G4MuPairProduction,   -1, 4,4);       
    103105     
    104106    } else if( particleName == "GenericIon" ) {
    105       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    106       pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
     107      pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
     108      pmanager->AddProcess(new G4ionIonisation,      -1, 2,2);
    107109
    108110    } else if ((!particle->IsShortLived()) &&
     
    110112               (particle->GetParticleName() != "chargedgeantino")) {
    111113      //all others charged particles except geantino
    112       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    113       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     114      pmanager->AddProcess(new G4hMultipleScattering,-1,1,1);
     115      pmanager->AddProcess(new G4hIonisation,        -1,2,2);
    114116    }
    115117  }
  • trunk/examples/extended/electromagnetic/TestEm15/src/PhysicsList.cc

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.cc,v 1.2 2006/06/29 16:47:04 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:47:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:47:10 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.5 2006/06/29 16:47:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.2 2006/06/29 16:47:16 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.2 2006/06/29 16:47:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.6 2007/03/15 15:52:39 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm15/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:47:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.5 2007/01/18 10:24:35 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.6 2008/06/11 22:52:28 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # add -v to see what is going on.
    27   # for the aida-config command see the README file
    28   CPPFLAGS += `aida-config --include`
    29   LOADLIBS += `aida-config --lib`
    30 endif
    3120
    3221include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm16/TestEm16.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm16.cc,v 1.3 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.4 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.4 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:47:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:47:33 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/PhysicsList.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsList.hh,v 1.4 2006/06/29 16:47:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.4 2006/06/29 16:47:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:47:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.5 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.3 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:47:46 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm16/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.4 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.3 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:47:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:47:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/HistoManager.cc

    r807 r1230  
    5252 
    5353  fileName[0] = "testem16";
    54   fileType    = "hbook";
    55   fileOption  = "--noErrors uncompress";
     54  fileType    = "root";
     55  fileOption  = "--noErrors export=root uncompress";
    5656  // histograms
    5757  for (G4int k=0; k<MaxHisto; k++) {
  • trunk/examples/extended/electromagnetic/TestEm16/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.4 2006/06/29 16:47:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.5 2009/11/19 18:12:32 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4242#include "G4PhotoElectricEffect.hh"
    4343
    44 #include "G4MultipleScattering.hh"
    45 
     44#include "G4eMultipleScattering.hh"
    4645#include "G4eIonisation.hh"
    4746#include "G4eBremsstrahlung.hh"
    4847#include "G4eplusAnnihilation.hh"
    4948
     49#include "G4MuMultipleScattering.hh"
    5050#include "G4MuIonisation.hh"
    5151#include "G4MuBremsstrahlung.hh"
     
    143143    } else if (particleName == "e-") {
    144144      //electron
    145       pmanager->AddProcess(new G4MultipleScattering,        -1, 1,1);
    146       pmanager->AddProcess(new G4eIonisation,               -1, 2,2);
    147       pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3,3);
     145      pmanager->AddProcess(new G4eMultipleScattering,       -1, 1, 1);
     146      pmanager->AddProcess(new G4eIonisation,               -1, 2, 2);
     147      pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3, 3);
    148148      if (SRType)
    149       pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1,4);
     149      pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1, 4);
    150150      else
    151       pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1,4);
    152       pmanager->AddProcess(new G4StepLimiter,               -1,-1,5);
     151      pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 4);
     152      pmanager->AddProcess(new G4StepLimiter,               -1,-1, 5);
    153153     
    154154    } else if (particleName == "e+") {
    155155      //positron
    156       pmanager->AddProcess(new G4MultipleScattering,        -1, 1,1);
    157       pmanager->AddProcess(new G4eIonisation,               -1, 2,2);
    158       pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3,3);
    159       pmanager->AddProcess(new G4eplusAnnihilation,          0,-1,4);
     156      pmanager->AddProcess(new G4eMultipleScattering,       -1, 1, 1);
     157      pmanager->AddProcess(new G4eIonisation,               -1, 2, 2);
     158      pmanager->AddProcess(new G4eBremsstrahlung,           -1, 3, 3);
     159      pmanager->AddProcess(new G4eplusAnnihilation,          0,-1, 4);
    160160      if (SRType)
    161       pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1,5);
     161      pmanager->AddProcess(new G4SynchrotronRadiation,      -1,-1, 5);
    162162      else
    163       pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1,5);       
    164       pmanager->AddProcess(new G4StepLimiter,               -1,-1,6);
     163      pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5);       
     164      pmanager->AddProcess(new G4StepLimiter,               -1,-1, 6);
    165165     
    166166    } else if( particleName == "mu+" ||
    167167               particleName == "mu-"    ) {
    168168      //muon
    169       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    170       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    171       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    172       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);
     169      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     170      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     171      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     172      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
    173173     
    174174    }
  • trunk/examples/extended/electromagnetic/TestEm16/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.4 2006/06/29 16:47:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.3 2006/06/29 16:48:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.8 2007/01/18 10:24:35 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.5 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm16/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:48:06 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.2 2006/10/24 10:06:21 maire Exp $
     1# $Id: GNUmakefile,v 1.3 2008/06/11 22:55:02 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib` 
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm17/TestEm17.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm17.cc,v 1.2 2006/06/29 16:48:08 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:48:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm17/include/DetectorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorMessenger.hh,v 1.2 2006/06/29 16:48:13 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm17/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:48:15 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.2 2006/06/29 16:48:17 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/HistoManager.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.hh,v 1.2 2006/06/29 16:48:19 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.hh,v 1.3 2008/03/18 15:30:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4646class HistoMessenger;
    4747
    48 const G4int MaxHisto = 5;
     48const G4int MaxHisto = 8;
    4949
    5050//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.2 2006/06/29 16:48:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/MuCrossSections.hh

    r807 r1230  
    2525//
    2626// $Id: MuCrossSections.hh,v 1.2 2006/06/29 16:48:23 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/MuNuclearBuilder.hh

    r807 r1230  
    2525//
    2626// $Id: MuNuclearBuilder.hh,v 1.2 2006/06/29 16:48:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.2 2006/06/29 16:48:30 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/PhysicsList.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsList.hh,v 1.2 2006/06/29 16:48:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:48:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:48:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/ProcessesCount.hh

    r807 r1230  
    2525//
    2626// $Id: ProcessesCount.hh,v 1.2 2006/06/29 16:48:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.2 2006/06/29 16:48:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/StackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: StackingAction.hh,v 1.2 2006/06/29 16:48:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:48:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:48:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm17/src/DetectorConstruction.cc

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.cc,v 1.3 2007/05/12 16:33:53 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/DetectorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:48:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm17/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.2 2006/06/29 16:48:53 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:48:55 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.2 2006/06/29 16:48:58 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.4 2008/09/26 20:15:04 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem17";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress";   
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress";   
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    164164  }
    165165 
    166   const G4String id[] = { "0", "1", "2", "3", "4"};
     166  const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7"};
    167167  const G4String title[] =
    168168                { "dummy",                                              //0
     
    170170                  "log10(Etransfert/Emu) Pair",                         //2
    171171                  "log10(Etransfert/Emu) Brems",                        //3
    172                   "log10(Etransfert/Emu) Nuclear"                       //4
     172                  "log10(Etransfert/Emu) Nuclear",                      //4
     173                  "log10(Etransfert/Emu) Ionization",                   //5
     174                  "log10(Etransfert/Emu) Pair",                         //6
     175                  "log10(Etransfert/Emu) Brems"                         //7
    173176                 };
    174177
  • trunk/examples/extended/electromagnetic/TestEm17/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.2 2006/06/29 16:49:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/MuCrossSections.cc

    r807 r1230  
    2525//
    2626// $Id: MuCrossSections.cc,v 1.2 2006/06/29 16:49:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/MuNuclearBuilder.cc

    r807 r1230  
    2626//
    2727// $Id: MuNuclearBuilder.cc,v 1.2 2006/06/29 16:49:05 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandard.cc,v 1.2 2006/06/29 16:49:09 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysListEmStandard.cc,v 1.4 2008/05/07 13:57:56 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4MuonPlus.hh"
    3636#include "G4MuonMinus.hh"
     37#include "G4PionPlus.hh"
     38#include "G4PionMinus.hh"
     39#include "G4Proton.hh"
    3740
    3841#include "G4ProcessManager.hh"
     
    4043#include "G4MuBremsstrahlung.hh"
    4144#include "G4MuPairProduction.hh"
     45#include "G4hIonisation.hh"
     46#include "G4hBremsstrahlung.hh"
     47#include "G4hPairProduction.hh"
    4248#include "G4LossTableManager.hh"
    4349
     
    5763void PhysListEmStandard::ConstructProcess()
    5864{
    59   // Common processes for mu+ and mu-
    60   //
    61   G4MuIonisation*       muioni = new G4MuIonisation();
    62   G4MuBremsstrahlung*   mubrem = new G4MuBremsstrahlung();
    63   G4MuPairProduction*   mupair = new G4MuPairProduction();
    64 
     65  // mu+
    6566  G4ParticleDefinition* particle = G4MuonPlus::MuonPlus();
    6667  G4ProcessManager* pmanager = particle->GetProcessManager();   
    67   //
    68   pmanager->AddProcess(muioni, -1, 2,2);
    69   pmanager->AddProcess(mubrem, -1,-1,3);
    70   pmanager->AddProcess(mupair, -1,-1,4);
     68  pmanager->AddProcess(new G4MuIonisation(),     -1, 2, 2);
     69  pmanager->AddProcess(new G4MuBremsstrahlung(), -1, 3, 3);
     70  pmanager->AddProcess(new G4MuPairProduction(), -1, 4, 4);
    7171
     72  // mu-
    7273  particle = G4MuonMinus::MuonMinus();
    7374  pmanager = particle->GetProcessManager();   
    74   //
    75   pmanager->AddProcess(muioni, -1, 2,2);
    76   pmanager->AddProcess(mubrem, -1,-1,3);
    77   pmanager->AddProcess(mupair, -1,-1,4);
    78    
     75  pmanager->AddProcess(new G4MuIonisation(),     -1, 2, 2);
     76  pmanager->AddProcess(new G4MuBremsstrahlung(), -1, 3, 3);
     77  pmanager->AddProcess(new G4MuPairProduction(), -1, 4, 4);
     78
     79  // pi+
     80  particle = G4PionPlus::PionPlus();
     81  pmanager = particle->GetProcessManager();   
     82  pmanager->AddProcess(new G4hIonisation(),     -1, 2, 2);
     83  pmanager->AddProcess(new G4hBremsstrahlung(), -1, 3, 3);
     84  pmanager->AddProcess(new G4hPairProduction(), -1, 4, 4);
     85
     86  // pi-
     87  particle = G4PionMinus::PionMinus();
     88  pmanager = particle->GetProcessManager();   
     89  pmanager->AddProcess(new G4hIonisation(),     -1, 2, 2);
     90  pmanager->AddProcess(new G4hBremsstrahlung(), -1, 3, 3);
     91  pmanager->AddProcess(new G4hPairProduction(), -1, 4, 4);
     92
     93  // proton
     94  particle = G4Proton::Proton();
     95  pmanager = particle->GetProcessManager();   
     96  pmanager->AddProcess(new G4hIonisation(),     -1, 2, 2);
     97  pmanager->AddProcess(new G4hBremsstrahlung(), -1, 3, 3);
     98  pmanager->AddProcess(new G4hPairProduction(), -1, 4, 4);
     99
    79100  //extend binning of PhysicsTables
    80101  //
    81   G4LossTableManager::Instance()->SetMaxEnergy(1000.0*PeV);
    82   G4LossTableManager::Instance()->SetDEDXBinning(220);
    83   G4LossTableManager::Instance()->SetLambdaBinning(220);
    84   G4LossTableManager::Instance()->SetVerbose(0);
     102  G4LossTableManager::Instance()->SetMinEnergy(100*eV); 
     103  G4LossTableManager::Instance()->SetMaxEnergy(1000*PeV);
     104  G4LossTableManager::Instance()->SetDEDXBinning(160);
     105  G4LossTableManager::Instance()->SetLambdaBinning(160);
     106  G4LossTableManager::Instance()->SetSplineFlag(true); 
     107  G4LossTableManager::Instance()->SetVerbose(1);
    85108}
    86109
  • trunk/examples/extended/electromagnetic/TestEm17/src/PhysicsList.cc

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.cc,v 1.4 2006/10/24 10:06:21 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:49:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:49:15 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.2 2006/06/29 16:49:17 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.4 2008/03/31 10:22:59 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    139139  //compute theoritical predictions
    140140  //
    141   totalCrossSection = 0.;
    142   for (size_t i=0; i< ProcCounter->size();i++) {
    143      G4String procName = (*ProcCounter)[i]->GetName();
    144      if (procName != "Transportation")
    145        totalCrossSection += ComputeTheory(procName, NbOfEvents);
    146   }
    147  
    148   MeanFreePath     = 1./totalCrossSection;
    149   massCrossSection = totalCrossSection/density;
    150  
    151   G4cout << " Theory:     "
    152          <<    "total CrossSection = " << totalCrossSection*cm << " /cm"
    153          << "\t MeanFreePath = "       << G4BestUnit(MeanFreePath,"Length")
    154          << "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
    155          << G4endl;
    156                  
     141  if(particle == "mu+" || particle == "mu-") {
     142    totalCrossSection = 0.;
     143    for (size_t i=0; i< ProcCounter->size();i++) {
     144      G4String procName = (*ProcCounter)[i]->GetName();
     145      if (procName != "Transportation")
     146        totalCrossSection += ComputeTheory(procName, NbOfEvents);
     147    }
     148 
     149    MeanFreePath     = 1./totalCrossSection;
     150    massCrossSection = totalCrossSection/density;
     151 
     152    G4cout << " Theory:     "
     153           <<    "total CrossSection = " << totalCrossSection*cm << " /cm"
     154           << "\t MeanFreePath = "       << G4BestUnit(MeanFreePath,"Length")
     155           << "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
     156           << G4endl;
     157  }
    157158                                                                   
    158159  G4cout.setf(mode,std::ios::floatfield);
     
    183184
    184185  G4int id = 0; G4double cut = 0.;
    185   if (process == "muIoni")     {id = 1; cut =    GetEnergyCut(material,1); }
    186   if (process == "muPairProd") {id = 2; cut = 2*(GetEnergyCut(material,1)
     186  if (process == "muIoni")          {id = 1; cut =    GetEnergyCut(material,1);}
     187  else if (process == "muPairProd") {id = 2; cut = 2*(GetEnergyCut(material,1)
    187188                                                      + electron_mass_c2); }
    188   if (process == "muBrems")    {id = 3; cut =    GetEnergyCut(material,0); }
    189   if (process == "muNucl")      id = 4;
     189  else if (process == "muBrems")    {id = 3; cut =    GetEnergyCut(material,0);}
     190  else if (process == "muNucl")      id = 4;
     191  else if (process == "hIoni")      {id = 5; cut =    GetEnergyCut(material,1);}
     192  else if (process == "hPairProd")  {id = 6; cut = 2*(GetEnergyCut(material,1)
     193                                                      + electron_mass_c2); }
     194  else if (process == "hBrems")     {id = 7; cut =    GetEnergyCut(material,0);}
    190195  if (id == 0) return 0.;
    191196 
  • trunk/examples/extended/electromagnetic/TestEm17/src/StackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: StackingAction.cc,v 1.2 2006/06/29 16:49:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm17/src/SteppingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.2 2006/06/29 16:49:22 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: SteppingAction.cc,v 1.4 2008/03/31 10:22:59 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7070
    7171  G4int id = 0;
    72   if (procName == "muIoni")     id = 1;
    73   if (procName == "muPairProd") id = 2;
    74   if (procName == "muBrems")    id = 3;
    75   if (procName == "muNucl")     id = 4;   
     72  if (procName == "muIoni")          id = 1;
     73  else if (procName == "muPairProd") id = 2;
     74  else if (procName == "muBrems")    id = 3;
     75  else if (procName == "muNucl")     id = 4;   
     76  else if (procName == "hIoni")      id = 5;
     77  else if (procName == "hPairProd")  id = 6;
     78  else if (procName == "hBrems")     id = 7;
    7679  histoManager->FillHisto(id,lgepsE);                 
    7780}
  • trunk/examples/extended/electromagnetic/TestEm17/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:49:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.1 2007/02/13 17:57:19 maire Exp $
     1# $Id: GNUmakefile,v 1.2 2008/06/11 22:57:25 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm18/TestEm18.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm18.cc,v 1.1 2007/02/13 17:57:19 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/electron.mac

    r807 r1230  
    1 # $Id: electron.mac,v 1.1 2007/02/13 17:57:20 maire Exp $
     1# $Id: electron.mac,v 1.2 2009/10/12 21:47:57 maire Exp $
    22#
    33# macro file for TestEm18.cc
     
    88/testem/det/setMat Water
    99/testem/det/setSize 1 cm
     10#
     11/testem/phys/addPhysics standard
    1012#
    1113/testem/phys/setCuts 100 um
  • trunk/examples/extended/electromagnetic/TestEm18/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/EventMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventMessenger.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.2 2007/11/13 16:43:59 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.2 2007/11/13 16:43:59 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/PhysListEmLivermore.hh

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmLivermore.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    28 // GEANT4 tag $Name:  $
    29 //
    30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     27// $Id: PhysListEmLivermore.hh,v 1.2 2009/10/12 21:47:57 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3229
    3330#ifndef PhysListEmLivermore_h
     
    4138class PhysListEmLivermore : public G4VPhysicsConstructor
    4239{
    43 public: 
     40public:
    4441  PhysListEmLivermore(const G4String& name = "Livermore");
     42
    4543  virtual ~PhysListEmLivermore();
    4644
    47 public:
    48   // This method is dummy for physics
    49   void ConstructParticle() {};
    50  
    51   // This method will be invoked in the Construct() method.
    52   // each physics process will be instantiated and
    53   // registered to the process manager of each particle type
    54   void ConstructProcess();
     45  virtual void ConstructParticle() { };
     46  virtual void ConstructProcess();
    5547};
    5648
     
    6456
    6557
    66 
    67 
  • trunk/examples/extended/electromagnetic/TestEm18/include/PhysListEmPenelope.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmPenelope.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name:  $
    2826//
    29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     27// $Id: PhysListEmPenelope.hh,v 1.2 2009/10/12 21:47:57 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3129
    3230#ifndef PhysListEmPenelope_h
     
    4038class PhysListEmPenelope : public G4VPhysicsConstructor
    4139{
    42 public:
    43   PhysListEmPenelope(const G4String& name = "penelope");
     40public:
     41  PhysListEmPenelope(const G4String& name = "Penelope");
     42
    4443  virtual ~PhysListEmPenelope();
    4544
    46 public:
    47   // This method is dummy for physics
    48   void ConstructParticle() {};
    49  
    50   // This method will be invoked in the Construct() method.
    51   // each physics process will be instantiated and
    52   // registered to the process manager of each particle type
    53   void ConstructProcess();
     45  virtual void ConstructParticle() { };
     46  virtual void ConstructProcess();
    5447};
    5548
     
    6356
    6457
    65 
    66 
  • trunk/examples/extended/electromagnetic/TestEm18/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/PhysicsList.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.hh,v 1.3 2009/03/06 18:24:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5757    void SetCutForElectron(G4double);
    5858    void SetCutForPositron(G4double);
    59    
     59     
    6060  private:
    6161 
  • trunk/examples/extended/electromagnetic/TestEm18/include/PhysicsListMessenger.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsListMessenger.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsListMessenger.hh,v 1.3 2009/03/06 18:24:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6060    G4UIcmdWithADoubleAndUnit* gammaCutCmd;
    6161    G4UIcmdWithADoubleAndUnit* electCutCmd;
    62     G4UIcmdWithADoubleAndUnit* allCutCmd;       
     62    G4UIcmdWithADoubleAndUnit* allCutCmd;
    6363};
    6464
  • trunk/examples/extended/electromagnetic/TestEm18/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/StackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: StackingAction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm18/proton.mac

    r807 r1230  
    1 # $Id: proton.mac,v 1.1 2007/02/13 17:57:20 maire Exp $
     1# $Id: proton.mac,v 1.2 2009/02/22 17:48:53 maire Exp $
    22#
    33# macro file for TestEm18.cc
     
    1616/gun/energy 100 MeV
    1717#
    18 /testem/histo/setFileName proton
     18/testem/histo/setFileName proton
     19/testem/histo/setFileType hbook
     20#
    1921/testem/histo/setHisto 1 100 0 10 MeV   #continuous eLoss
    2022/testem/histo/setHisto 2 100 0 10 MeV   #secondary  eLoss
  • trunk/examples/extended/electromagnetic/TestEm18/src/DetectorConstruction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: DetectorConstruction.cc,v 1.2 2007/02/16 11:59:47 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: DetectorConstruction.cc,v 1.3 2009/03/06 18:24:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    113113  new G4Material("Tungsten"   , z=74., a=183.85*g/mole, density= 19.30*g/cm3);
    114114  new G4Material("Lead"       , z=82., a=207.19*g/mole, density= 11.35*g/cm3);
    115 
     115 
     116  new G4Material("ArgonGas"   , z=18., a=39.948*g/mole, density= 1.782*mg/cm3,
     117                 kStateGas, 273.15*kelvin, 1*atmosphere);
     118                 
    116119  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
    117120}
  • trunk/examples/extended/electromagnetic/TestEm18/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/EventMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventMessenger.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.2 2007/11/13 16:43:59 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.5 2008/09/26 20:26:01 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem18";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    217217void HistoManager::PrintHisto(G4int ih)
    218218{
    219  if (ih < MaxHisto) ascii[ih] = true;
     219 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    220220 else
    221221    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    230230{
    231231#ifdef G4ANALYSIS_USE
    232  
     232
     233 if (!ascii[0]) return;
     234 
    233235 G4String name = fileName[0] + ".ascii";
    234236 std::ofstream File(name, std::ios::out);
     
    243245      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    244246         File << "  " << iBin << "\t"
    245               << histo[ih]->binMean(iBin) << "\t"
     247              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     248                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"
    246249              << histo[ih]->binHeight(iBin)
    247250              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm18/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.2 2007/11/13 16:43:59 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/PhysListEmLivermore.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmLivermore.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmLivermore.cc,v 1.3 2009/11/19 18:46:04 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4LowEnergyCompton.hh"
    38 #include "G4LowEnergyGammaConversion.hh"
    39 #include "G4LowEnergyPhotoElectric.hh"
    40 #include "G4LowEnergyRayleigh.hh"
     37// gamma
    4138
    42 #include "G4LowEnergyIonisation.hh"
    43 #include "G4LowEnergyBremsstrahlung.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4LivermorePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4LivermoreComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4LivermoreGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4LivermoreRayleighModel.hh"
     50
     51// e-
     52
    4453#include "G4eIonisation.hh"
     54#include "G4LivermoreIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
    4557#include "G4eBremsstrahlung.hh"
     58#include "G4LivermoreBremsstrahlungModel.hh"
     59
     60// e+
     61
    4662#include "G4eplusAnnihilation.hh"
     63
     64// mu
    4765
    4866#include "G4MuIonisation.hh"
     
    5068#include "G4MuPairProduction.hh"
    5169
    52 #include "G4hLowEnergyIonisation.hh"
     70// hadrons, ions
     71
     72#include "G4hIonisation.hh"
     73#include "G4ionIonisation.hh"
     74
    5375
    5476//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6789void PhysListEmLivermore::ConstructProcess()
    6890{
    69   // Add LowEn or standard EM Processes
     91  // Add standard EM Processes
    7092
    7193  theParticleIterator->reset();
     
    7496    G4ProcessManager* pmanager = particle->GetProcessManager();
    7597    G4String particleName = particle->GetParticleName();
    76      
     98
     99    //Applicability range for Livermore models
     100    //for higher energies, the Standard models are used   
     101    G4double highEnergyLimit = 1*GeV;
     102         
    77103    if (particleName == "gamma") {
    78104      // gamma         
    79       pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric);
    80       pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
    81       pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
    82       pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
     105
     106      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     107      G4LivermorePhotoElectricModel*
     108      photModel = new G4LivermorePhotoElectricModel();
     109      photModel->SetHighEnergyLimit(highEnergyLimit);
     110      phot->AddEmModel(0, photModel);
     111      pmanager->AddDiscreteProcess(phot);
     112
     113      G4ComptonScattering* compt = new G4ComptonScattering();
     114      G4LivermoreComptonModel*
     115      comptModel = new G4LivermoreComptonModel();
     116      comptModel->SetHighEnergyLimit(highEnergyLimit);
     117      compt->AddEmModel(0, comptModel);
     118      pmanager->AddDiscreteProcess(compt);
     119
     120      G4GammaConversion* conv = new G4GammaConversion();
     121      G4LivermoreGammaConversionModel*
     122      convModel = new G4LivermoreGammaConversionModel();
     123      convModel->SetHighEnergyLimit(highEnergyLimit);
     124      conv->AddEmModel(0, convModel);
     125      pmanager->AddDiscreteProcess(conv);
     126
     127      G4RayleighScattering* rayl = new G4RayleighScattering();
     128      G4LivermoreRayleighModel*
     129      raylModel = new G4LivermoreRayleighModel();
     130      raylModel->SetHighEnergyLimit(highEnergyLimit);
     131      rayl->AddEmModel(0, raylModel);
     132      pmanager->AddDiscreteProcess(rayl);
    83133     
    84134    } else if (particleName == "e-") {
    85135      //electron
    86       pmanager->AddProcess(new G4LowEnergyIonisation,     -1, 1, 1);
    87       pmanager->AddProcess(new G4LowEnergyBremsstrahlung, -1,-1, 2);
    88            
     136
     137      G4eIonisation* eIoni = new G4eIonisation();
     138      G4LivermoreIonisationModel*
     139      eIoniModel = new G4LivermoreIonisationModel();
     140      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     141      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     142      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     143     
     144      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     145      G4LivermoreBremsstrahlungModel*
     146      eBremModel = new G4LivermoreBremsstrahlungModel();
     147      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     148      eBrem->AddEmModel(0, eBremModel);
     149      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     150           
    89151    } else if (particleName == "e+") {
    90152      //positron
    91       pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
    92       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    93       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
     153      pmanager->AddProcess(new G4eIonisation,       -1, 1, 1);
     154      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 2, 2);
     155      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1, 3);
    94156     
    95157    } else if( particleName == "mu+" ||
    96158               particleName == "mu-"    ) {
    97159      //muon 
    98       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    99       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    100       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     160      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     161      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     162      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    101163     
     164    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
     165      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     166
    102167    } else if ((!particle->IsShortLived()) &&
    103168               (particle->GetPDGCharge() != 0.0) &&
    104169               (particle->GetParticleName() != "chargedgeantino")) {
    105170      //all others charged particles except geantino
    106       pmanager->AddProcess(new G4hLowEnergyIonisation, -1, 1, 1);
     171      pmanager->AddProcess(new G4hIonisation,      -1, 1, 1);
    107172    }
    108173  }
  • trunk/examples/extended/electromagnetic/TestEm18/src/PhysListEmPenelope.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmPenelope.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmPenelope.cc,v 1.3 2009/11/19 18:46:04 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "G4ProcessManager.hh"
    3636
    37 #include "G4PenelopeCompton.hh"
    38 #include "G4PenelopeGammaConversion.hh"
    39 #include "G4PenelopePhotoElectric.hh"
    40 #include "G4PenelopeRayleigh.hh"
     37// gamma
    4138
    42 #include "G4PenelopeIonisation.hh"
    43 #include "G4PenelopeBremsstrahlung.hh"
    44 #include "G4PenelopeAnnihilation.hh"
     39#include "G4PhotoElectricEffect.hh"
     40#include "G4PenelopePhotoElectricModel.hh"
     41
     42#include "G4ComptonScattering.hh"
     43#include "G4PenelopeComptonModel.hh"
     44
     45#include "G4GammaConversion.hh"
     46#include "G4PenelopeGammaConversionModel.hh"
     47
     48#include "G4RayleighScattering.hh"
     49#include "G4PenelopeRayleighModel.hh"
     50
     51// e-
     52
     53#include "G4eIonisation.hh"
     54#include "G4PenelopeIonisationModel.hh"
     55#include "G4UniversalFluctuation.hh"
     56
     57#include "G4eBremsstrahlung.hh"
     58#include "G4PenelopeBremsstrahlungModel.hh"
     59
     60// e+
     61
     62#include "G4eplusAnnihilation.hh"
     63#include "G4PenelopeAnnihilationModel.hh"
     64
     65// mu
    4566
    4667#include "G4MuIonisation.hh"
     
    4869#include "G4MuPairProduction.hh"
    4970
     71// hadrons, ions
     72
    5073#include "G4hIonisation.hh"
    5174#include "G4ionIonisation.hh"
     75
    5276
    5377//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6690void PhysListEmPenelope::ConstructProcess()
    6791{
    68   // Add Penelope or standard EM Processes
     92  // Add standard EM Processes
    6993
    7094  theParticleIterator->reset();
     
    7397    G4ProcessManager* pmanager = particle->GetProcessManager();
    7498    G4String particleName = particle->GetParticleName();
    75      
     99
     100    //Applicability range for Penelope models
     101    //for higher energies, the Standard models are used   
     102    G4double highEnergyLimit = 1*GeV;
     103         
    76104    if (particleName == "gamma") {
    77105      // gamma         
    78       pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric);
    79       pmanager->AddDiscreteProcess(new G4PenelopeCompton);
    80       pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion);
    81       pmanager->AddDiscreteProcess(new G4PenelopeRayleigh);
     106
     107      G4PhotoElectricEffect* phot = new G4PhotoElectricEffect();
     108      G4PenelopePhotoElectricModel*
     109      photModel = new G4PenelopePhotoElectricModel();
     110      photModel->SetHighEnergyLimit(highEnergyLimit);
     111      phot->AddEmModel(0, photModel);
     112      pmanager->AddDiscreteProcess(phot);
     113
     114      G4ComptonScattering* compt = new G4ComptonScattering();
     115      G4PenelopeComptonModel*
     116      comptModel = new G4PenelopeComptonModel();
     117      comptModel->SetHighEnergyLimit(highEnergyLimit);
     118      compt->AddEmModel(0, comptModel);
     119      pmanager->AddDiscreteProcess(compt);
     120
     121      G4GammaConversion* conv = new G4GammaConversion();
     122      G4PenelopeGammaConversionModel*
     123      convModel = new G4PenelopeGammaConversionModel();
     124      convModel->SetHighEnergyLimit(highEnergyLimit);
     125      conv->AddEmModel(0, convModel);
     126      pmanager->AddDiscreteProcess(conv);
     127
     128      G4RayleighScattering* rayl = new G4RayleighScattering();
     129      G4PenelopeRayleighModel*
     130      raylModel = new G4PenelopeRayleighModel();
     131      raylModel->SetHighEnergyLimit(highEnergyLimit);
     132      rayl->AddEmModel(0, raylModel);
     133      pmanager->AddDiscreteProcess(rayl);
    82134     
    83135    } else if (particleName == "e-") {
    84136      //electron
    85       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    86       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);
    87            
     137
     138      G4eIonisation* eIoni = new G4eIonisation();
     139      G4PenelopeIonisationModel*
     140      eIoniModel = new G4PenelopeIonisationModel();
     141      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     142      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     143      pmanager->AddProcess(eIoni,                   -1, 1, 1);
     144     
     145      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     146      G4PenelopeBremsstrahlungModel*
     147      eBremModel = new G4PenelopeBremsstrahlungModel();
     148      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     149      eBrem->AddEmModel(0, eBremModel);
     150      pmanager->AddProcess(eBrem,                   -1, 2, 2);
     151           
    88152    } else if (particleName == "e+") {
    89153      //positron
    90       pmanager->AddProcess(new G4PenelopeIonisation,     -1, 1, 1);
    91       pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1, 2);     
    92       pmanager->AddProcess(new G4PenelopeAnnihilation,    0,-1, 3);
     154      G4eIonisation* eIoni = new G4eIonisation();
     155      G4PenelopeIonisationModel*
     156      eIoniModel = new G4PenelopeIonisationModel();
     157      eIoniModel->SetHighEnergyLimit(highEnergyLimit);
     158      eIoni->AddEmModel(0, eIoniModel, new G4UniversalFluctuation() );
     159      pmanager->AddProcess(eIoni,                   -1, 1, 1);
    93160     
     161      G4eBremsstrahlung* eBrem = new G4eBremsstrahlung();
     162      G4PenelopeBremsstrahlungModel*
     163      eBremModel = new G4PenelopeBremsstrahlungModel();
     164      eBremModel->SetHighEnergyLimit(highEnergyLimit);
     165      eBrem->AddEmModel(0, eBremModel);
     166      pmanager->AddProcess(eBrem,                   -1, 2, 2);     
     167
     168      G4eplusAnnihilation* eAnni = new G4eplusAnnihilation();
     169      G4PenelopeAnnihilationModel*
     170      eAnniModel = new G4PenelopeAnnihilationModel();
     171      eAnniModel->SetHighEnergyLimit(highEnergyLimit);
     172      eAnni->AddEmModel(0, eAnniModel);
     173      pmanager->AddProcess(eAnni,                    0,-1, 3);
     174           
    94175    } else if( particleName == "mu+" ||
    95176               particleName == "mu-"    ) {
    96177      //muon 
    97       pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
    98       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
    99       pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);       
     178      pmanager->AddProcess(new G4MuIonisation,      -1, 1, 1);
     179      pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 2, 2);
     180      pmanager->AddProcess(new G4MuPairProduction,  -1, 3, 3);       
    100181     
    101182    } else if( particleName == "alpha" || particleName == "GenericIon" ) {
    102       pmanager->AddProcess(new G4ionIonisation,      -1, 1,1);
    103      
     183      pmanager->AddProcess(new G4ionIonisation,     -1, 1, 1);
     184
    104185    } else if ((!particle->IsShortLived()) &&
    105186               (particle->GetPDGCharge() != 0.0) &&
    106187               (particle->GetParticleName() != "chargedgeantino")) {
    107188      //all others charged particles except geantino
    108       pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
     189      pmanager->AddProcess(new G4hIonisation,       -1, 1, 1);
    109190    }
    110191  }
  • trunk/examples/extended/electromagnetic/TestEm18/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandard.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysListEmStandard.cc,v 1.2 2009/11/19 18:46:04 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8181    } else if (particleName == "e-") {
    8282      //electron
    83       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    84       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
     83      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     84      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    8585           
    8686    } else if (particleName == "e+") {
    8787      //positron
    88       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    89       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
    90       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,3);
     88      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     89      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
     90      pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
    9191           
    9292    } else if (particleName == "mu+" ||
    9393               particleName == "mu-"    ) {
    9494      //muon 
    95       pmanager->AddProcess(new G4MuIonisation,       -1, 1,1);
    96       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2,2);
    97       pmanager->AddProcess(new G4MuPairProduction,   -1, 3,3);
     95      pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
     96      pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
     97      pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);
    9898             
    9999    } else if (particleName == "alpha" || particleName == "GenericIon" ) {
    100       pmanager->AddProcess(new G4ionIonisation,      -1, 1,1);
     100      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
    101101     
    102102    } else if ((!particle->IsShortLived()) &&
     
    104104               (particle->GetParticleName() != "chargedgeantino")) {
    105105      //all others charged particles except geantino
    106       pmanager->AddProcess(new G4hIonisation,        -1,1,1);
     106      pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
    107107    }
    108108  }
  • trunk/examples/extended/electromagnetic/TestEm18/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.2 2007/11/20 14:15:18 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.5 2009/03/06 18:24:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454  cutForGamma     = defaultCutValue;
    5555  cutForElectron  = defaultCutValue;
    56  
     56   
    5757  SetVerboseLevel(1);
    5858}
     
    185185  //physics tables
    186186  //
    187   emOptions.SetMinEnergy(100*eV);   
    188   emOptions.SetMaxEnergy(100*TeV); 
    189   emOptions.SetDEDXBinning(1200); 
    190   emOptions.SetLambdaBinning(1200);
     187  emOptions.SetMinEnergy(100*eV);       //default   
     188  emOptions.SetMaxEnergy(100*TeV);      //default 
     189  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     190  emOptions.SetLambdaBinning(12*20);    //default=12*7
     191  emOptions.SetSplineFlag(true); 
    191192 
    192193  //energy loss
    193194  // 
    194   emOptions.SetStepFunction(0.2, 10*um);
    195   emOptions.SetLinearLossLimit(1.e-6);
     195  emOptions.SetStepFunction(0.2, 10*um);        //default=(0.2, 1*mm)   
     196  emOptions.SetLinearLossLimit(1.e-2);          //default
    196197         
    197198  //build CSDA range
     
    199200  emOptions.SetBuildCSDARange(true);
    200201  emOptions.SetMaxEnergyForCSDARange(100*TeV); 
    201   emOptions.SetDEDXBinningForCSDARange(1200);
     202  emOptions.SetDEDXBinningForCSDARange(12*20);
     203   
     204  //ionization
     205  //
     206  emOptions.SetSubCutoff(false);        //default 
    202207}
    203208
     
    228233void PhysicsList::SetCuts()
    229234{
    230 
    231235  if (verboseLevel >0){
    232236    G4cout << "PhysicsList::SetCuts:";
  • trunk/examples/extended/electromagnetic/TestEm18/src/PhysicsListMessenger.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsListMessenger.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsListMessenger.cc,v 1.3 2009/03/06 18:24:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6969  allCutCmd->SetUnitCategory("Length");
    7070  allCutCmd->SetRange("cut>0.0");
    71   allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
     71  allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    7272}
    7373
     
    101101     pPhysicsList->SetCutForGamma(cut);
    102102     pPhysicsList->SetCutForElectron(cut);
    103     } 
     103    }
    104104}
    105105
  • trunk/examples/extended/electromagnetic/TestEm18/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/RunAction.cc

    r807 r1230  
    2525//
    2626// $Id: RunAction.cc,v 1.2 2007/02/16 11:59:47 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/StackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: StackingAction.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm18/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.1 2007/02/13 17:57:20 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.21 2006/10/20 16:03:39 maire Exp $
     1# $Id: GNUmakefile,v 1.23 2008/06/10 09:33:05 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm2/TestEm2.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm2.cc,v 1.14 2007/06/21 17:47:08 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.9 2006/06/29 16:49:29 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.6 2006/06/29 16:49:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/EmAcceptance.hh

    r807 r1230  
    2525//
    2626// $Id: EmAcceptance.hh,v 1.3 2006/06/29 16:49:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.3 2006/06/29 16:49:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:49:41 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.4 2006/06/29 16:49:50 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.8 2006/06/29 16:49:52 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.5 2006/06/29 16:49:55 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.5 2006/06/29 16:49:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.9 2006/06/29 16:49:59 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/RunActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: RunActionMessenger.hh,v 1.4 2006/06/29 16:50:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.2 2006/06/29 16:50:04 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:50:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.4 2006/06/29 16:50:09 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.3 2006/06/29 16:50:11 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm2/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.4 2006/06/29 16:50:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/run01.mac

    r807 r1230  
    1 # $Id: run01.mac,v 1.25 2007/06/21 14:21:46 maire Exp $
     1# $Id: run01.mac,v 1.27 2009/09/16 18:07:30 maire Exp $
    22#
    33# Macro file for "TestEm2.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/det/setMat PbWO4
     11/testem/det/setMat G4_PbWO4
    1212/testem/det/setLbin 40 0.5
    1313/testem/det/setRbin 50 0.1
    1414#
    15 /testem/phys/addPhysics  standard
     15/testem/phys/addPhysics  emstandard_opt0
    1616#
    1717/testem/phys/setCuts 1 mm
    1818#
    1919# histogram file
    20 /testem/histo/setFileName stand
     20/testem/histo/setFileName run01
    2121/testem/histo/setFileType hbook
    2222#
  • trunk/examples/extended/electromagnetic/TestEm2/run02.mac

    r807 r1230  
    1 # $Id: run02.mac,v 1.10 2006/10/20 16:03:39 maire Exp $
     1# $Id: run02.mac,v 1.12 2009/09/16 18:07:30 maire Exp $
    22#
    33# Macro file for "TestEm2.cc"
     
    1212/run/verbose 2
    1313#
    14 /testem/det/setMat Aluminium
     14/testem/det/setMat G4_Al
    1515/testem/det/setLbin 12 1.1245
    1616/testem/det/setRbin 12 0.11245
    1717#
    18 /testem/phys/addPhysics  standard
     18/testem/phys/addPhysics  emstandard_opt0
    1919#
    2020/testem/phys/setCuts 2.0 mm
  • trunk/examples/extended/electromagnetic/TestEm2/run03.mac

    r807 r1230  
    1 # $Id: run03.mac,v 1.11 2006/10/20 16:03:40 maire Exp $
     1# $Id: run03.mac,v 1.13 2009/09/16 18:07:30 maire Exp $
    22#
    33# Macro file for "TestEm2.cc"
     
    1616/testem/det/setRbin 6 0.111
    1717#
    18 /testem/phys/addPhysics  standard
     18/testem/phys/addPhysics  emstandard_opt0
    1919#
    2020/testem/phys/setCuts 5.0 mm
  • trunk/examples/extended/electromagnetic/TestEm2/run05.mac

    r807 r1230  
    1 # $Id: run05.mac,v 1.5 2006/10/20 16:03:40 maire Exp $
     1# $Id: run05.mac,v 1.7 2009/09/16 18:07:30 maire Exp $
    22#
    33#
     
    1010/run/verbose 2
    1111#
    12 /testem/phys/addPhysics  standard
     12/testem/phys/addPhysics  local
    1313#
    1414/testem/phys/setCuts 1 mm
     
    2020/run/beamOn 10
    2121#
    22 /run/particle/applyCuts
     22/process/em/applyCuts true
    2323/run/beamOn 10
    2424/run/dumpCouples
  • trunk/examples/extended/electromagnetic/TestEm2/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: DetectorConstruction.cc,v 1.12 2006/10/20 16:03:40 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: DetectorConstruction.cc,v 1.14 2009/09/16 18:07:30 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4343#include "G4LogicalVolumeStore.hh"
    4444#include "G4SolidStore.hh"
     45
     46#include "G4FieldManager.hh"
     47#include "G4TransportationManager.hh"
     48
     49#include "G4NistManager.hh"
     50#include "G4RunManager.hh"
    4551
    4652#include "G4UnitsTable.hh"
     
    5662{
    5763  DefineMaterials();
    58   SetMaterial("PbWO4");
     64  SetMaterial("G4_PbWO4");
    5965  detectorMessenger = new DetectorMessenger(this);
    6066}
     
    7783{
    7884  //
    79   // define few Elements
     85  // define few Elements by hand
    8086  //
    8187  G4double a, z;
    8288   
    8389  G4Element* H  = new G4Element("Hydrogen",  "H", z= 1., a=   1.01*g/mole);
    84   G4Element* N  = new G4Element("Nitrogen",  "N", z= 7., a=  14.01*g/mole);
    8590  G4Element* O  = new G4Element("Oxygen"  ,  "O", z= 8., a=  16.00*g/mole);
    8691  G4Element* Ge = new G4Element("Germanium", "Ge",z=32., a=  72.59*g/mole);
    87   G4Element* W  = new G4Element("Tungsten",  "W", z=74., a= 183.84*g/mole);
    88   G4Element* Pb = new G4Element("Lead",      "Pb",z=82., a= 207.19*g/mole);
    8992  G4Element* Bi = new G4Element("Bismuth",   "Bi",z=83., a= 208.98*g/mole);
    9093
     
    9396  //
    9497  G4double density;
    95   G4double fractionmass;  G4int ncomponents, natoms;
    96 
    97   G4Material* Air =
    98   new G4Material("Air", density= 1.29*mg/cm3, ncomponents=2);
    99   Air->AddElement(N, fractionmass=0.7);
    100   Air->AddElement(O, fractionmass=0.3);
    101 
     98  G4int ncomponents, natoms;
     99
     100  // water with ionisation potential 75 eV
    102101  G4Material* H2O =
    103102  new G4Material("Water", density= 1.00*g/cm3, ncomponents=2);
     
    106105  H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
    107106
     107  // pure materails
    108108  new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
    109 
    110109  new G4Material("Aluminium",   z=13., a= 26.98*g/mole, density= 2.7*g/cm3);
    111 
    112   new G4Material("Iron",        z=26., a= 55.85*g/mole, density= 7.87*g/cm3);
    113  
    114   new G4Material("Copper"     , z=29., a= 63.55*g/mole, density= 8.960*g/cm3);
    115  
    116   new G4Material("Lead",        z=82., a=207.19*g/mole, density=11.35*g/cm3);
    117  
     110  new G4Material("Iron",        z=26., a= 55.85*g/mole, density= 7.87*g/cm3); 
     111  new G4Material("Copper",      z=29., a= 63.55*g/mole, density= 8.960*g/cm3);
     112  new G4Material("Tungsten",    z=74., a=183.84*g/mole, density=19.35*g/cm3);   
     113  new G4Material("Lead",        z=82., a=207.19*g/mole, density=11.35*g/cm3); 
    118114  new G4Material("Uranium"    , z=92., a=238.03*g/mole, density= 18.95*g/cm3);
    119    
     115
     116  // compound material
    120117  G4Material* BGO =
    121118  new G4Material("BGO", density= 7.10*g/cm3, ncomponents=3);
     
    124121  BGO->AddElement(Bi, natoms= 4);
    125122
    126   G4Material* PbWO =
    127   new G4Material("PbWO4", density= 8.28*g/cm3, ncomponents=3);
    128   PbWO->AddElement(O , natoms=4);
    129   PbWO->AddElement(Pb, natoms=1);
    130   PbWO->AddElement(W , natoms=1);
    131 
    132123  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
    133124}
     
    171162{
    172163  // search the material by its name
    173   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
    174   if (pttoMaterial) myMaterial = pttoMaterial;
     164  G4Material* pttoMaterial =
     165    G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
     166
     167  if (pttoMaterial) {
     168    myMaterial = pttoMaterial;
     169    if(logicEcal) logicEcal->SetMaterial(myMaterial);
     170    G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     171  }
    175172}
    176173
     
    202199
    203200//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    204 
    205 #include "G4FieldManager.hh"
    206 #include "G4TransportationManager.hh"
    207201
    208202void DetectorConstruction::SetMagField(G4double fieldValue)
     
    226220//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    227221
    228 #include "G4RunManager.hh"
    229 
    230222void DetectorConstruction::UpdateGeometry()
    231223{
  • trunk/examples/extended/electromagnetic/TestEm2/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.8 2006/06/29 16:50:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/EmAcceptance.cc

    r807 r1230  
    2525//
    2626// $Id: EmAcceptance.cc,v 1.5 2006/06/29 16:50:22 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.3 2006/06/29 16:50:24 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/EventActionMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: EventActionMessenger.cc,v 1.3 2006/06/29 16:50:26 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm2/src/PhysListEmStandard.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmStandard.cc,v 1.6 2007/06/21 14:21:46 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmStandard.cc,v 1.13 2009/11/13 16:01:10 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939#include "G4PhotoElectricEffect.hh"
    4040
    41 #include "G4MultipleScattering.hh"
    42 
     41#include "G4eMultipleScattering.hh"
     42#include "G4UrbanMscModel93.hh"
    4343#include "G4eIonisation.hh"
    4444#include "G4eBremsstrahlung.hh"
    4545#include "G4eplusAnnihilation.hh"
    4646
     47#include "G4MuMultipleScattering.hh"
    4748#include "G4MuIonisation.hh"
    4849#include "G4MuBremsstrahlung.hh"
    4950#include "G4MuPairProduction.hh"
    5051
     52#include "G4hMultipleScattering.hh"
    5153#include "G4hIonisation.hh"
     54#include "G4hBremsstrahlung.hh"
     55#include "G4hPairProduction.hh"
     56
    5257#include "G4ionIonisation.hh"
    5358
     
    8792    } else if (particleName == "e-") {
    8893      //electron
    89       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    90       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    91       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     94      G4eMultipleScattering* msc = new G4eMultipleScattering();
     95      msc->AddEmModel(0, new G4UrbanMscModel93());
     96      pmanager->AddProcess(msc,                       -1, 1, 1);
     97      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     98      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    9299           
    93100    } else if (particleName == "e+") {
    94101      //positron
    95       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    96       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    97       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    98       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     102      G4eMultipleScattering* msc = new G4eMultipleScattering();
     103      msc->AddEmModel(0, new G4UrbanMscModel93());
     104      pmanager->AddProcess(msc,                       -1, 1, 1);
     105      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     106      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     107      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    99108           
    100109    } else if( particleName == "mu+" ||
    101110               particleName == "mu-"    ) {
    102111      //muon 
    103       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    104       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    105       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    106       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     112      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     113      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     114      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     115      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);       
     116             
     117    } else if( particleName == "proton" ||
     118               particleName == "pi-" ||
     119               particleName == "pi+"    ) {
     120      //proton 
     121      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     122      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     123      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     124      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    107125     
    108     } else if( particleName == "GenericIon" ) {
    109       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    110       pmanager->AddProcess(new G4ionIonisation,     -1, 2,2);
     126    } else if( particleName == "alpha" ||
     127               particleName == "He3" ||
     128               particleName == "GenericIon" ) {
     129      //Ions
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
    111132
    112133    } else if ((!particle->IsShortLived()) &&
     
    114135               (particle->GetParticleName() != "chargedgeantino")) {
    115136      //all others charged particles except geantino
    116       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    117       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     137      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     138      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    118139    }
    119140  }
    120    
     141
    121142  // Em options
    122143  //
     144  // Main options and setting parameters are shown here.
     145  // Several of them have default values.
     146  //
    123147  G4EmProcessOptions emOptions;
    124    
    125   //coulomb scattering
     148 
     149  //physics tables
    126150  //
    127   emOptions.SetMscStepLimitation(fUseDistanceToBoundary);   
    128   emOptions.SetSkin(2.);
    129  
     151  emOptions.SetMinEnergy(100*eV);       //default   
     152  emOptions.SetMaxEnergy(100*TeV);      //default 
     153  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     154  emOptions.SetLambdaBinning(12*20);    //default=12*7
     155  emOptions.SetSplineFlag(true);        //default
     156     
     157  //multiple coulomb scattering
     158  //
     159  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     160  emOptions.SetMscRangeFactor(0.04);    //default
     161  emOptions.SetMscGeomFactor (2.5);     //default       
     162  emOptions.SetSkin(3.);                //default
     163     
    130164  //energy loss
    131165  //
    132   emOptions.SetLinearLossLimit(1.e-6);
    133   emOptions.SetStepFunction(0.2, 100*um);
     166  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     167  emOptions.SetLinearLossLimit(1.e-2);          //default
    134168   
    135169  //ionization
    136170  //
    137   emOptions.SetSubCutoff(true);
    138    
    139   // define high energy threshold for bremstrahlung
    140   //
    141   emOptions.SetBremsstrahlungTh(10.*GeV);
     171  emOptions.SetSubCutoff(false);                //default=false   
    142172}
    143173
  • trunk/examples/extended/electromagnetic/TestEm2/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.13 2007/06/22 16:35:07 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.16 2009/09/16 18:07:30 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3434
    3535#include "PhysListEmStandard.hh"
    36 #include "PhysListEmLivermore.hh"
    37 #include "PhysListEmPenelope.hh"
    3836
    3937#include "G4EmStandardPhysics.hh"
    4038#include "G4EmStandardPhysics_option1.hh"
    4139#include "G4EmStandardPhysics_option2.hh"
     40#include "G4EmStandardPhysics_option3.hh"
     41#include "G4EmLivermorePhysics.hh"
     42#include "G4EmPenelopePhysics.hh"
     43
     44#include "G4Decay.hh"
     45#include "StepMax.hh"
    4246
    4347#include "G4LossTableManager.hh"
     48#include "G4ProcessManager.hh"
     49
    4450#include "G4UnitsTable.hh"
    45 
    46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    47 
    48 PhysicsList::PhysicsList() : G4VModularPhysicsList()
    49 {
    50   G4LossTableManager::Instance();
    51   defaultCutValue = 1.*mm;
    52   cutForGamma     = defaultCutValue;
    53   cutForElectron  = defaultCutValue;
    54   cutForPositron  = defaultCutValue;
    55 
    56   pMessenger = new PhysicsListMessenger(this);
    57 
    58   SetVerboseLevel(1);
    59 
    60   // EM physics
    61   emPhysicsList = new PhysListEmStandard(emName = "standard");
    62 
    63 }
    64 
    65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    66 
    67 PhysicsList::~PhysicsList()
    68 {
    69   delete pMessenger;
    70   delete emPhysicsList;
    71 }
    72 
    73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    7451
    7552// Bosons
     
    7754#include "G4Geantino.hh"
    7855#include "G4Gamma.hh"
    79 #include "G4OpticalPhoton.hh"
    8056
    8157// leptons
     58#include "G4Electron.hh"
     59#include "G4Positron.hh"
    8260#include "G4MuonPlus.hh"
    8361#include "G4MuonMinus.hh"
     
    11997//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    12098
     99PhysicsList::PhysicsList() : G4VModularPhysicsList()
     100{
     101  G4LossTableManager::Instance();
     102  defaultCutValue = 1.*mm;
     103  cutForGamma     = defaultCutValue;
     104  cutForElectron  = defaultCutValue;
     105  cutForPositron  = defaultCutValue;
     106
     107  pMessenger = new PhysicsListMessenger(this);
     108
     109  SetVerboseLevel(1);
     110
     111  // EM physics
     112  ///emName = "emstandard_opt0"; 
     113  ///emPhysicsList = new G4EmStandardPhysics();
     114  emName = "local";   
     115  emPhysicsList = new PhysListEmStandard(emName);   
     116}
     117
     118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     119
     120PhysicsList::~PhysicsList()
     121{
     122  delete pMessenger;
     123  delete emPhysicsList;
     124}
     125
     126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     127
    121128void PhysicsList::ConstructParticle()
    122129{
    123 // pseudo-particles
     130  // pseudo-particles
    124131  G4Geantino::GeantinoDefinition();
    125132  G4ChargedGeantino::ChargedGeantinoDefinition();
    126133 
    127 // gamma
     134  // gamma
    128135  G4Gamma::GammaDefinition();
    129136 
    130 // optical photon
    131   G4OpticalPhoton::OpticalPhotonDefinition();
    132 
    133 // leptons
     137  // leptons
    134138  G4Electron::ElectronDefinition();
    135139  G4Positron::PositronDefinition();
     
    142146  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
    143147
    144 // mesons
     148  // mesons
    145149  G4PionPlus::PionPlusDefinition();
    146150  G4PionMinus::PionMinusDefinition();
     
    155159  G4KaonZeroShort::KaonZeroShortDefinition();
    156160
    157 // barions
     161  // barions
    158162  G4Proton::ProtonDefinition();
    159163  G4AntiProton::AntiProtonDefinition();
     
    161165  G4AntiNeutron::AntiNeutronDefinition();
    162166
    163 // ions
     167  // ions
    164168  G4Deuteron::DeuteronDefinition();
    165169  G4Triton::TritonDefinition();
     
    170174
    171175//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    172 
    173 #include "G4ProcessManager.hh"
    174176
    175177void PhysicsList::ConstructProcess()
     
    202204  if (name == emName) return;
    203205
    204   if (name == "standard") {
     206  if (name == "local") {
    205207
    206208    emName = name;
     
    208210    emPhysicsList = new PhysListEmStandard(name);
    209211   
    210   } else if (name == "emstandard") {
     212  } else if (name == "emstandard_opt0") {
    211213
    212214    emName = name;
     
    226228    emPhysicsList = new G4EmStandardPhysics_option2();
    227229
    228   } else if (name == "livermore") {
    229 
    230     emName = name;
    231     delete emPhysicsList;
    232     emPhysicsList = new PhysListEmLivermore(name);
     230  } else if (name == "emstandard_opt3") {
     231
     232    emName = name;
     233    delete emPhysicsList;
     234    emPhysicsList = new G4EmStandardPhysics_option3();
    233235   
    234   } else if (name == "penelope") {
    235 
    236     emName = name;
    237     delete emPhysicsList;
    238     emPhysicsList = new PhysListEmPenelope(name);
    239        
     236  } else if (name == "empenelope"){
     237    emName = name;
     238    delete emPhysicsList;
     239    emPhysicsList = new G4EmPenelopePhysics();
     240
     241  } else if (name == "emlivermore"){
     242    emName = name;
     243    delete emPhysicsList;
     244    emPhysicsList = new G4EmLivermorePhysics();
     245
    240246  } else {
    241247
     
    247253
    248254//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    249 
    250 #include "G4Decay.hh"
    251255
    252256void PhysicsList::AddDecay()
     
    275279//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    276280
    277 #include "StepMax.hh"
    278 
    279281void PhysicsList::AddStepMax()
    280282{
     
    295297
    296298//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    297 
    298 #include "G4Gamma.hh"
    299 #include "G4Electron.hh"
    300 #include "G4Positron.hh"
    301299
    302300void PhysicsList::SetCuts()
  • trunk/examples/extended/electromagnetic/TestEm2/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.5 2006/06/29 16:50:41 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.6 2006/06/29 16:50:44 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.21 2006/06/29 16:50:47 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.24 2009/09/16 18:07:30 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8787   
    8888  histoName[0] = "testem2";
    89   histoType    = "hbook"; 
     89  histoType    = "root";
    9090}
    9191
     
    112112  G4bool readOnly  = false;
    113113  G4bool createNew = true;
    114   G4String options = "--noErrors uncompress";
     114  G4String options = "--noErrors export=root uncompress";
    115115  AIDA::ITreeFactory* tf  = af->createTreeFactory(); 
    116116  tree = tf->create(histoName[1], histoType, readOnly, createNew, options);
     
    291291#ifdef G4ANALYSIS_USE
    292292    if(tree) {
    293       G4double bin = i*dLradl;
     293      G4double bin = (i+0.5)*dLradl;
    294294      histo[3]->fill(bin,MeanELongit[i]/dLradl);
    295295      bin = (i+1)*dLradl;
     
    319319#ifdef G4ANALYSIS_USE
    320320    if(tree) {
    321       G4double bin = i*dRradl;
     321      G4double bin = (i+0.5)*dRradl;
    322322      histo[6]->fill(bin,MeanERadial[i]/dRradl);
    323323      bin = (i+1)*dRradl;
  • trunk/examples/extended/electromagnetic/TestEm2/src/RunActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: RunActionMessenger.cc,v 1.4 2006/06/29 16:50:50 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.2 2006/06/29 16:50:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.2 2006/06/29 16:50:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.6 2006/06/29 16:50:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.3 2006/06/29 16:50:59 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm2/src/TrackingAction.cc

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.cc,v 1.3 2006/06/29 16:51:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.20 2006/10/31 12:53:48 maire Exp $
     1# $Id: GNUmakefile,v 1.21 2008/06/11 22:12:32 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm3/TestEm3.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm3.cc,v 1.23 2007/06/22 09:22:05 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/atlashec.mac

    r807 r1230  
    1 # $Id: atlashec.mac,v 1.7 2007/05/18 19:00:43 vnivanch Exp $
     1# $Id: atlashec.mac,v 1.8 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1414/testem/det/setSizeYZ             17 cm
    1515#
    16 /testem/phys/addPhysics  emstandard
     16/testem/phys/addPhysics  emstandard_opt0
    1717/testem/phys/setCuts 0.7 mm
    1818#
  • trunk/examples/extended/electromagnetic/TestEm3/dedx.mac

    r807 r1230  
    1 # $Id: dedx.mac,v 1.4 2006/03/20 12:26:03 maire Exp $
     1# $Id: dedx.mac,v 1.5 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1515/testem/det/setSizeYZ 1 cm
    1616#
    17 /testem/phys/addPhysics  standard
     17/testem/phys/addPhysics  local
    1818/testem/phys/setCuts 1 km
    1919#
  • trunk/examples/extended/electromagnetic/TestEm3/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.13 2006/06/29 16:51:06 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.8 2006/06/29 16:51:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/EmAcceptance.hh

    r807 r1230  
    2525//
    2626// $Id: EmAcceptance.hh,v 1.4 2006/06/29 16:51:11 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.10 2006/06/29 16:51:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:51:17 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/HistoManager.hh

    r807 r1230  
    2525//
    2626// $Id: HistoManager.hh,v 1.8 2007/11/12 17:04:55 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.5 2007/11/12 17:04:55 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.4 2006/06/29 16:51:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/PhysicsList.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.hh,v 1.6 2006/06/29 16:51:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.hh,v 1.8 2009/11/13 17:01:44 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4444class PhysicsList: public G4VModularPhysicsList
    4545{
    46   public:
     46public:
    4747    PhysicsList();
    48    ~PhysicsList();
     48    virtual ~PhysicsList();
    4949
    5050    void ConstructParticle();
  • trunk/examples/extended/electromagnetic/TestEm3/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.3 2006/06/29 16:52:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.4 2006/06/29 16:52:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.3 2006/06/29 16:52:05 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/RunAction.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.hh,v 1.18 2007/04/22 16:25:21 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: RunAction.hh,v 1.19 2008/05/29 16:59:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5656
    5757  RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
    58   virtual ~RunAction();
     58  ~RunAction();
    5959
    6060  void BeginOfRunAction(const G4Run*);
     
    6464   
    6565  void sumEnergyFlow(G4int plane, G4double Eflow)
    66                                                  {EnergyFlow[plane]  += Eflow;};
     66                                            {EnergyFlow[plane]  += Eflow;};
    6767  void sumLateralEleak(G4int cell, G4double Eflow)
    68                                                  {lateralEleak[cell] += Eflow;};
     68                                            {lateralEleak[cell] += Eflow;};
    6969   
    7070  void PrintDedxTables();
  • trunk/examples/extended/electromagnetic/TestEm3/include/RunActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: RunActionMessenger.hh,v 1.10 2007/04/22 16:25:21 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.7 2006/06/29 16:52:11 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:52:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/include/SteppingAction.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.hh,v 1.8 2006/06/29 16:52:16 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: SteppingAction.hh,v 1.9 2008/03/14 15:40:03 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5252    void UserSteppingAction(const G4Step*);
    5353   
    54     G4double BirkAttenuation(const G4Step*);
     54    G4double BirksAttenuation(const G4Step*);
    5555   
    5656  private:
  • trunk/examples/extended/electromagnetic/TestEm3/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.5 2006/06/29 16:52:18 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm3/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.2 2006/06/29 16:52:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/ionC12.mac

    r807 r1230  
    1 # $Id: ionC12.mac,v 1.10 2006/10/31 12:53:48 maire Exp $
     1# $Id: ionC12.mac,v 1.11 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1212#  select EM PhysicsList
    1313#
    14 /testem/phys/addPhysics  standard
     14/testem/phys/addPhysics  local
    1515#
    1616/testem/phys/setCuts 1 mm
  • trunk/examples/extended/electromagnetic/TestEm3/lhcb.mac

    r807 r1230  
    1 # $Id: lhcb.mac,v 1.3 2007/05/18 19:00:44 vnivanch Exp $
     1# $Id: lhcb.mac,v 1.4 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1414/testem/det/setSizeYZ 20 cm
    1515#
    16 /testem/phys/addPhysics  emstandard
     16/testem/phys/addPhysics  emstandard_opt0
    1717#
    1818/gun/particle e-
  • trunk/examples/extended/electromagnetic/TestEm3/linac.mac

    r807 r1230  
    1 # $Id: linac.mac,v 1.5 2006/11/08 10:27:18 maire Exp $
     1# $Id: linac.mac,v 1.6 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3"
     
    1616/testem/det/setSizeYZ  30 cm
    1717#
    18 /testem/phys/addPhysics  standard
     18/testem/phys/addPhysics  local
    1919/testem/phys/setCuts 10 um
    2020#
  • trunk/examples/extended/electromagnetic/TestEm3/lockwood.mac

    r807 r1230  
    1 # $Id: lockwood.mac,v 1.5 2006/03/20 12:26:03 maire Exp $
     1# $Id: lockwood.mac,v 1.6 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1111/run/verbose 2
    1212#
    13 ###/testem/phys/addPhysics  g4v52
    14 /testem/phys/addPhysics  standard
     13/testem/phys/addPhysics  local
    1514#
    1615/testem/det/setNbOfLayers 1
  • trunk/examples/extended/electromagnetic/TestEm3/retrieveTables.mac

    r807 r1230  
    1 # $Id: retrieveTables.mac,v 1.4 2007/05/18 19:00:44 vnivanch Exp $
     1# $Id: retrieveTables.mac,v 1.6 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "exampleN03.cc"
     
    1010#  select EM PhysicsList
    1111#
    12 /testem/phys/addPhysics  emstandard
     12/testem/phys/addPhysics  emstandard_opt0
    1313#
    1414/run/particle/retrievePhysicsTable physdata
    1515/run/initialize
     16/process/eLoss/verbose 1
     17/process/eLoss/CSDARange true
    1618#
    1719/gun/particle e-
  • trunk/examples/extended/electromagnetic/TestEm3/run01.mac

    r807 r1230  
    1 # $Id: run01.mac,v 1.17 2006/10/31 12:53:48 maire Exp $
     1# $Id: run01.mac,v 1.19 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "exampleN03.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/phys/addPhysics  standard
     11/testem/phys/addPhysics  local
    1212#
    13 /testem/phys/setCuts 0.1 um
     13/testem/phys/setCuts 100 um
    1414#
    1515/run/initialize
  • trunk/examples/extended/electromagnetic/TestEm3/run02.mac

    r807 r1230  
    1 # $Id: run02.mac,v 1.15 2006/10/31 12:53:48 maire Exp $
     1# $Id: run02.mac,v 1.16 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/phys/addPhysics  standard
     11/testem/phys/addPhysics  local
    1212#
    1313/testem/det/setNbOfLayers 50
  • trunk/examples/extended/electromagnetic/TestEm3/run07.mac

    r807 r1230  
    1 # $Id: run07.mac,v 1.12 2006/10/31 12:53:48 maire Exp $
     1# $Id: run07.mac,v 1.13 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/phys/addPhysics  standard
     11/testem/phys/addPhysics  local
    1212#
    1313/testem/det/setNbOfLayers 2
  • trunk/examples/extended/electromagnetic/TestEm3/run08.mac

    r807 r1230  
    1 # $Id: run08.mac,v 1.9 2006/10/31 12:53:48 maire Exp $
     1# $Id: run08.mac,v 1.10 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/phys/addPhysics  standard
     11/testem/phys/addPhysics  local
    1212#
    1313/testem/phys/setCuts 1 mm
  • trunk/examples/extended/electromagnetic/TestEm3/run15.mac

    r807 r1230  
    1 # $Id: run15.mac,v 1.15 2006/10/31 12:53:48 maire Exp $
     1# $Id: run15.mac,v 1.16 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    99/run/verbose 2
    1010#
    11 /testem/phys/addPhysics  standard
     11/testem/phys/addPhysics  local
    1212#
    1313/testem/det/setNbOfLayers 20
  • trunk/examples/extended/electromagnetic/TestEm3/sicapo1.mac

    r807 r1230  
    1 # $Id: sicapo1.mac,v 1.4 2006/10/31 12:53:48 maire Exp $
     1# $Id: sicapo1.mac,v 1.5 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1212/run/verbose 2
    1313#
    14 /testem/phys/addPhysics  standard
     14/testem/phys/addPhysics  local
    1515#
    1616/testem/det/setNbOfLayers 15
  • trunk/examples/extended/electromagnetic/TestEm3/sicapo2.mac

    r807 r1230  
    1 # $Id: sicapo2.mac,v 1.4 2006/10/31 12:53:48 maire Exp $
     1# $Id: sicapo2.mac,v 1.5 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1212/run/verbose 2
    1313#
    14 /testem/phys/addPhysics  standard
     14/testem/phys/addPhysics  local
    1515#
    1616/testem/det/setNbOfLayers 15
  • trunk/examples/extended/electromagnetic/TestEm3/sicapo3.mac

    r807 r1230  
    1 # $Id: sicapo3.mac,v 1.5 2006/10/31 12:53:48 maire Exp $
     1# $Id: sicapo3.mac,v 1.6 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "TestEm3.cc"
     
    1111/run/verbose 2
    1212#
    13 /testem/phys/addPhysics  standard
     13/testem/phys/addPhysics  local
    1414#
    1515/testem/det/setNbOfLayers 10
  • trunk/examples/extended/electromagnetic/TestEm3/src/DetectorConstruction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: DetectorConstruction.cc,v 1.20 2007/03/19 20:10:38 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: DetectorConstruction.cc,v 1.23 2009/03/04 18:49:17 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    105105  G4Element* H  = manager->FindOrBuildElement(1);
    106106  G4Element* C  = manager->FindOrBuildElement(6);
     107  G4Element* N  = manager->FindOrBuildElement(7);
    107108  G4Element* O  = manager->FindOrBuildElement(8);
    108109  G4Element* Si = manager->FindOrBuildElement(14);
     
    164165  Sci->AddElement(C, natoms=9);
    165166  Sci->AddElement(H, natoms=10);
     167 
     168  Sci->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
    166169
    167170  G4Material* Lct =
     
    199202  BGO->AddElement(Bi, natoms= 4);
    200203
     204  //SiNx
     205  density= 3.1 *g/cm3;
     206  G4Material* SiNx= new G4Material("SiNx", density, ncomponents=3);
     207  SiNx-> AddElement(Si, 300);
     208  SiNx-> AddElement(N, 310);
     209  SiNx-> AddElement(H, 6);
     210
    201211  //
    202212  // define gaseous materials using G4 NIST database
     
    205215 
    206216  G4Material* Air = manager->FindOrBuildMaterial("G4_AIR");
    207   manager->ConstructNewGasMaterial("Air20","G4_AIR",293.*kelvin, 1.*atmosphere);
     217  manager->ConstructNewGasMaterial("Air20","G4_AIR",293.*kelvin,1.*atmosphere);
    208218
    209219  G4Material* lAr = manager->FindOrBuildMaterial("G4_lAr");
     
    242252                  kStateGas, temperature= 273*kelvin, pressure= 1*atmosphere);
    243253  steam->AddMaterial(H2O, fractionmass=1.);
    244 
     254 
     255  new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3,
     256                 kStateGas, 273.15*kelvin, 1*atmosphere);
    245257  //
    246258  // examples of vacuum
  • trunk/examples/extended/electromagnetic/TestEm3/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.11 2006/06/29 16:52:26 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/EmAcceptance.cc

    r807 r1230  
    2525//
    2626// $Id: EmAcceptance.cc,v 1.6 2006/06/29 16:52:28 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/EventAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: EventAction.cc,v 1.15 2007/04/22 16:25:21 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: EventAction.cc,v 1.16 2008/05/29 16:59:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7171  //initialize EnergyDeposit per event
    7272  //
    73   for (G4int k=0; k<MaxAbsor; k++)
     73  for (G4int k=0; k<MaxAbsor; k++) {
    7474    energyDeposit[k] = trackLengthCh[k] = 0.0;   
     75  }
    7576}
    7677
  • trunk/examples/extended/electromagnetic/TestEm3/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.4 2006/06/29 16:52:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.14 2007/11/12 17:04:55 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: HistoManager.cc,v 1.17 2009/03/04 18:49:17 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem3";
    56   fileType    = "hbook"; 
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root"; 
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    241241void HistoManager::PrintHisto(G4int ih)
    242242{
    243  if (ih < MaxHisto) ascii[ih] = true;
     243 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    244244 else
    245245    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    254254{
    255255#ifdef G4ANALYSIS_USE
    256  
     256
     257 if (!ascii[0]) return;
     258 
    257259 G4String name = fileName[0] + ".ascii";
    258260 std::ofstream File(name, std::ios::out);
     
    267269      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    268270         File << "  " << iBin << "\t"
    269               << histo[ih]->binMean(iBin) << "\t"
     271              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     272                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"
    270273              << histo[ih]->binHeight(iBin)
    271274              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm3/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.9 2007/11/12 17:04:55 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandard.cc,v 1.14 2007/06/22 09:22:05 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysListEmStandard.cc,v 1.23 2009/11/13 17:01:44 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3838#include "G4PhotoElectricEffect.hh"
    3939
    40 #include "G4MultipleScattering.hh"
    41 
     40#include "G4eMultipleScattering.hh"
     41#include "G4UrbanMscModel93.hh"
    4242#include "G4eIonisation.hh"
    4343#include "G4eBremsstrahlung.hh"
    4444#include "G4eplusAnnihilation.hh"
    4545
     46#include "G4MuMultipleScattering.hh"
    4647#include "G4MuIonisation.hh"
    4748#include "G4MuBremsstrahlung.hh"
    4849#include "G4MuPairProduction.hh"
    4950
     51#include "G4hMultipleScattering.hh"
    5052#include "G4hIonisation.hh"
     53#include "G4hBremsstrahlung.hh"
     54#include "G4hPairProduction.hh"
     55
    5156#include "G4ionIonisation.hh"
    5257
     
    8590    } else if (particleName == "e-") {
    8691      //electron
    87       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    88       pmanager->AddProcess(new G4eIonisation,        -1, 2, 2);
    89       pmanager->AddProcess(new G4eBremsstrahlung(),  -1, 3, 3);
     92      G4eMultipleScattering* msc = new G4eMultipleScattering();
     93      msc->AddEmModel(0, new G4UrbanMscModel93());
     94      pmanager->AddProcess(msc,                       -1, 1, 1);     
     95      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     96      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
    9097     
    9198    } else if (particleName == "e+") {
    9299      //positron
    93       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    94       pmanager->AddProcess(new G4eIonisation,        -1, 2, 2);
    95       pmanager->AddProcess(new G4eBremsstrahlung(),  -1, 3, 3);
    96       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 4);
     100      G4eMultipleScattering* msc = new G4eMultipleScattering();
     101      msc->AddEmModel(0, new G4UrbanMscModel93());
     102      pmanager->AddProcess(msc,                       -1, 1, 1);     
     103      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     104      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
     105      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    97106     
    98     } else if( particleName == "mu+" ||
    99                particleName == "mu-"    ) {
     107    } else if( particleName == "mu-" ||
     108               particleName == "mu+"    ) {
    100109      //muon 
    101       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    102       pmanager->AddProcess(new G4MuIonisation,       -1, 2, 2);
    103       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 3, 3);
    104       pmanager->AddProcess(new G4MuPairProduction,   -1, 4, 4);       
     110      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     111      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     112      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     113      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
     114             
     115    } else if( particleName == "proton" ||
     116               particleName == "pi-" ||
     117               particleName == "pi+"    ) {
     118      //proton 
     119      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     120      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     121      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     122      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    105123     
    106124    } else if( particleName == "alpha" ||
    107125               particleName == "He3" ||
    108                particleName == "GenericIon" ) {
    109       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    110       pmanager->AddProcess(new G4ionIonisation,      -1, 2, 2);
     126               particleName == "GenericIon" ) {
     127      //Ions
     128      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     129      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
    111130
    112131    } else if ((!particle->IsShortLived()) &&
     
    114133               (particle->GetParticleName() != "chargedgeantino")) {
    115134      //all others charged particles except geantino
    116       pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
    117       pmanager->AddProcess(new G4hIonisation,        -1, 2, 2);
     135      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     136      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    118137    }
    119138  }
     
    121140  // Em options
    122141  //
     142  // Main options and setting parameters are shown here.
     143  // Several of them have default values.
     144  //
    123145  G4EmProcessOptions emOptions;
    124    
    125   //coulomb scattering
     146 
     147  //physics tables
    126148  //
    127   emOptions.SetMscStepLimitation(fUseDistanceToBoundary);   
    128   emOptions.SetSkin(2.);
    129  
     149  emOptions.SetMinEnergy(100*eV);       //default   
     150  emOptions.SetMaxEnergy(100*TeV);      //default 
     151  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     152  emOptions.SetLambdaBinning(12*20);    //default=12*7
     153  emOptions.SetSplineFlag(true);        //default
     154     
     155  //multiple coulomb scattering
     156  //
     157  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     158  emOptions.SetMscRangeFactor(0.04);    //default
     159  emOptions.SetMscGeomFactor (2.5);     //default       
     160  emOptions.SetSkin(3.);                //default
     161     
    130162  //energy loss
    131163  //
    132   emOptions.SetLinearLossLimit(1.e-6);
    133   emOptions.SetStepFunction(0.2, 100*um);
     164  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)     
     165  emOptions.SetLinearLossLimit(1.e-2);          //default
    134166   
    135167  //ionization
    136168  //
    137   emOptions.SetSubCutoff(true);
     169  emOptions.SetSubCutoff(false);                //default=false
    138170}
    139171
  • trunk/examples/extended/electromagnetic/TestEm3/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.20 2007/11/13 14:37:05 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.30 2009/11/13 17:01:44 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3434
    3535#include "PhysListEmStandard.hh"
    36 #include "PhysListEmStandardIG.hh"
    37 #include "PhysListEmLivermore.hh"
    38 #include "PhysListEmPenelope.hh"
    3936
    4037#include "G4EmStandardPhysics.hh"
    4138#include "G4EmStandardPhysics_option1.hh"
    4239#include "G4EmStandardPhysics_option2.hh"
    43 
    44 #include "G4LossTableManager.hh"
     40#include "G4EmStandardPhysics_option3.hh"
     41#include "G4EmLivermorePhysics.hh"
     42#include "G4EmPenelopePhysics.hh"
     43
    4544#include "G4UnitsTable.hh"
     45#include "G4UrbanMscModel.hh"
    4646
    4747//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4949PhysicsList::PhysicsList() : G4VModularPhysicsList()
    5050{
    51   G4LossTableManager::Instance();
    5251  currentDefaultCut   = 1.0*mm;
    5352  cutForGamma         = currentDefaultCut;
     
    6059
    6160  // EM physics
    62   emName = G4String("standard");
     61  emName = G4String("local");
    6362  emPhysicsList = new PhysListEmStandard(emName);
    6463
     
    214213  if (name == emName) return;
    215214
    216   if (name == "standard") {
     215  if (name == "local") {
    217216
    218217    emName = name;
     
    220219    emPhysicsList = new PhysListEmStandard(name);
    221220
    222   } else if (name == "emstandard") {
     221  } else if (name == "emstandard_opt0") {
    223222
    224223    emName = name;
     
    237236    delete emPhysicsList;
    238237    emPhysicsList = new G4EmStandardPhysics_option2();
    239 
    240   } else if (name == "standardIG") {
    241 
    242     emName = name;
    243     delete emPhysicsList;
    244     emPhysicsList = new PhysListEmStandardIG(name);
    245 
    246   } else if (name == "livermore") {
    247 
    248     emName = name;
    249     delete emPhysicsList;
    250     emPhysicsList = new PhysListEmLivermore(name);
    251 
    252   } else if (name == "penelope") {
    253 
    254     emName = name;
    255     delete emPhysicsList;
    256     emPhysicsList = new PhysListEmPenelope(name);
     238   
     239  } else if (name == "emstandard_opt3") {
     240
     241    emName = name;
     242    delete emPhysicsList;
     243    emPhysicsList = new G4EmStandardPhysics_option3();
     244   
     245  } else if (name == "emlivermore") {
     246
     247    emName = name;
     248    delete emPhysicsList;
     249    emPhysicsList = new G4EmLivermorePhysics();
     250
     251  } else if (name == "empenelope") {
     252
     253    emName = name;
     254    delete emPhysicsList;
     255    emPhysicsList = new G4EmPenelopePhysics();
    257256
    258257  } else {
     
    288287
    289288void PhysicsList::SetCuts()
    290 {
    291      
     289{     
    292290  if (verboseLevel >0){
    293291    G4cout << "PhysicsList::SetCuts:";
     
    306304//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    307305
    308 #include "G4Gamma.hh"
    309 #include "G4Electron.hh"
    310 #include "G4Positron.hh"
    311 
    312306void PhysicsList::SetCutForGamma(G4double cut)
    313307{
  • trunk/examples/extended/electromagnetic/TestEm3/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 16:52:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.7 2006/06/29 16:53:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.3 2006/06/29 16:53:02 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.34 2007/04/24 13:05:14 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.37 2008/05/29 16:59:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    131131  G4cout << "\n------------------------------------------------------------\n";
    132132  G4cout << std::setw(14) << "material"
    133          << std::setw(17) << "Total Edep"
     133         << std::setw(17) << "Edep       RMS"
    134134         << std::setw(33) << "sqrt(E0(GeV))*rmsE/Emean"
    135135         << std::setw(23) << "total tracklen \n \n";
     
    139139      MeanEAbs  = sumEAbs[k]*norm;
    140140      MeanEAbs2 = sum2EAbs[k]*norm;
    141       rmsEAbs  = std::sqrt(std::fabs(MeanEAbs2 - MeanEAbs*MeanEAbs));
    142 
     141      rmsEAbs  = std::sqrt(std::abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
     142      //G4cout << "k= " << k << "  RMS= " <<  rmsEAbs
     143      //     << "  applyLimit: " << applyLimit << G4endl;
    143144      if(applyLimit) {
    144145        G4int    nn    = 0;
     
    159160        MeanEAbs  = sume*norm1;
    160161        MeanEAbs2 = sume2*norm1;
    161         rmsEAbs  = std::sqrt(std::fabs(MeanEAbs2 - MeanEAbs*MeanEAbs));
     162        rmsEAbs  = std::sqrt(std::abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
    162163      }
    163164
     
    171172      MeanLAbs  = sumLAbs[k]*norm;
    172173      MeanLAbs2 = sum2LAbs[k]*norm;
    173       rmsLAbs  = std::sqrt(std::fabs(MeanLAbs2 - MeanLAbs*MeanLAbs));
     174      rmsLAbs  = std::sqrt(std::abs(MeanLAbs2 - MeanLAbs*MeanLAbs));
    174175
    175176      //print
     
    178179       << std::setw(14) << Detector->GetAbsorMaterial(k)->GetName() << ": "
    179180       << std::setprecision(5)
    180        << std::setw(6) << G4BestUnit(MeanEAbs,"Energy") << " +- "
     181       << std::setw(6) << G4BestUnit(MeanEAbs,"Energy") << " : "
    181182       << std::setprecision(4)
    182183       << std::setw(5) << G4BestUnit( rmsEAbs,"Energy") 
     
    189190    }
    190191  G4cout << "\n------------------------------------------------------------\n";
     192
     193  G4cout << " Beam particle "
     194         << Primary->GetParticleGun()->
     195    GetParticleDefinition()->GetParticleName()
     196         << "  E = " << G4BestUnit(beamEnergy,"Energy") << G4endl;
    191197 
    192198  //Energy flow
  • trunk/examples/extended/electromagnetic/TestEm3/src/RunActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: RunActionMessenger.cc,v 1.13 2007/04/25 10:07:27 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.4 2006/06/29 16:53:19 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:53:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/SteppingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.25 2006/06/29 16:53:23 gunter Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: SteppingAction.cc,v 1.28 2008/05/29 16:59:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4747:G4UserSteppingAction(),detector(det),runAct(run),eventAct(evt),
    4848 histoManager(hist)
    49 {}
     49{ }
    5050
    5151//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8181  G4double stepl = 0.;
    8282  if (particle->GetPDGCharge() != 0.) stepl = aStep->GetStepLength();
    83    
     83 
     84  //  G4cout << "Nabs= " << absorNum << "   edep(keV)= " << edep << G4endl;
     85 
    8486  // sum up per event
    8587  eventAct->SumEnergy(absorNum,edep,stepl);
    8688 
    8789  //longitudinal profile of edep per absorber
    88   if (edep>0.) histoManager->FillHisto(MaxAbsor+absorNum, layerNum+1., edep);
     90  if (edep>0.) histoManager->FillHisto(MaxAbsor+absorNum,
     91                                       G4double(layerNum+1), edep);
    8992 
    9093  //energy flow
     
    108111
    109112////  example of Birk attenuation
    110 ///G4double destep   = aStep->GetTotalEnergyDeposit();
    111 ////  G4double response = BirkAttenuation(aStep);
    112 ///G4cout << " Destep: " << destep/keV << " keV"
    113 ////         << " response after Birk: " << response/keV << " keV" << G4endl;
     113///G4double destep   = aStep->GetTotalEnergyDeposit();
     114///G4double response = BirksAttenuation(aStep);
     115///G4cout << " Destep: " << destep/keV << " keV"
     116///       << " response after Birks: " << response/keV << " keV" << G4endl;
    114117}
    115118
    116119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    117120
    118 G4double SteppingAction::BirkAttenuation(const G4Step* aStep)
     121G4double SteppingAction::BirksAttenuation(const G4Step* aStep)
    119122{
    120123 //Example of Birk attenuation law in organic scintillators.
    121124 //adapted from Geant3 PHYS337. See MIN 80 (1970) 239-244
    122125 //
    123  const G4String myMaterial = "Scintillator";
    124  const G4double birk1 = 0.013*g/(MeV*cm2);
    125  //
     126 G4Material* material = aStep->GetTrack()->GetMaterial();
     127 G4double birk1       = material->GetIonisation()->GetBirksConstant();
    126128 G4double destep      = aStep->GetTotalEnergyDeposit();
    127  G4Material* material = aStep->GetTrack()->GetMaterial();
     129 G4double stepl       = aStep->GetStepLength(); 
    128130 G4double charge      = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
    129131 //
    130132 G4double response = destep;
    131  if ((material->GetName()==myMaterial)&&(charge!=0.))
     133 if (birk1*destep*stepl*charge != 0.)
    132134   {
    133      G4double correction =
    134      birk1*destep/((material->GetDensity())*(aStep->GetStepLength()));
    135      response = destep/(1. + correction);
     135     response = destep/(1. + birk1*destep/stepl);
    136136   }
    137137 return response;
  • trunk/examples/extended/electromagnetic/TestEm3/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.4 2006/06/29 16:53:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/src/TrackingAction.cc

    r807 r1230  
    2626//
    2727// $Id: TrackingAction.cc,v 1.2 2006/06/29 16:53:27 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm3/storeTables.mac

    r807 r1230  
    1 # $Id: storeTables.mac,v 1.8 2007/05/18 19:00:44 vnivanch Exp $
     1# $Id: storeTables.mac,v 1.10 2009/09/17 20:06:26 maire Exp $
    22#
    33# Macro file for "testEm3.cc"
     
    88/control/verbose 2
    99#
    10 /testem/phys/addPhysics  emstandard
     10/testem/phys/addPhysics  emstandard_opt0
    1111#
    1212/run/initialize
     13/process/eLoss/verbose 1
     14/process/eLoss/CSDARange true
    1315/run/beamOn 3
    1416#
  • trunk/examples/extended/electromagnetic/TestEm4/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.14 2006/10/20 16:38:15 maire Exp $
     1# $Id: GNUmakefile,v 1.15 2008/06/11 22:15:20 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm4/TestEm4.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm4.cc,v 1.12 2007/06/22 09:55:22 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
  • trunk/examples/extended/electromagnetic/TestEm4/include/DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.hh,v 1.3 2006/06/29 16:53:31 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm4/include/EventAction.hh

    r807 r1230  
    2626//
    2727// $Id: EventAction.hh,v 1.2 2006/06/29 16:53:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/include/EventActionMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:53:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm4/include/PhysicsList.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsList.hh,v 1.2 2006/06/29 16:53:37 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.hh,v 1.2 2006/06/29 16:53:40 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.7 2006/06/29 16:53:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm4/include/SteppingAction.hh

    r807 r1230  
    2626//
    2727// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:53:45 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/include/SteppingVerbose.hh

    r807 r1230  
    2626//
    2727// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:53:48 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm4/src/DetectorConstruction.cc

    r807 r1230  
    2626//
    2727// $Id: DetectorConstruction.cc,v 1.3 2006/06/29 16:53:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
  • trunk/examples/extended/electromagnetic/TestEm4/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.7 2006/06/29 16:53:57 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm4/src/EventActionMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: EventActionMessenger.cc,v 1.3 2006/06/29 16:54:15 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.6 2006/06/29 16:54:17 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.cc,v 1.7 2008/04/07 13:09:43 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
     
    9595#include "G4PhotoElectricEffect.hh"
    9696
    97 #include "G4MultipleScattering.hh"
     97#include "G4eMultipleScattering.hh"
    9898
    9999#include "G4eIonisation.hh"
     
    121121    //electron
    122122
    123       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    124       pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
    125       pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);     
     123      pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
     124      pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
     125      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);     
    126126
    127127    } else if (particleName == "e+") {
    128128    //positron
    129129
    130       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    131       pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
    132       pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
    133       pmanager->AddProcess(new G4eplusAnnihilation,  0,-1,4);     
     130      pmanager->AddProcess(new G4eMultipleScattering,-1, 1,1);
     131      pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
     132      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     133      pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);     
    134134    }
    135135  }
  • trunk/examples/extended/electromagnetic/TestEm4/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.cc,v 1.3 2006/06/29 16:54:19 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.10 2006/06/29 16:54:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: RunAction.cc,v 1.11 2008/09/12 18:46:14 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5959   G4bool readOnly  = false;
    6060   G4bool createNew = true;
    61    G4String options =  "--noErrors uncompress";
    62    tree = tf->create("testem4.hbook","hbook",readOnly,createNew, options);
    63    //tree = tf->create("testem4.root","root",readOnly,createNew, options);
     61   G4String options =  "--noErrors export=root uncompress";
     62   //tree = tf->create("testem4.hbook","hbook",readOnly,createNew, options);
     63   tree = tf->create("testem4.root","root",readOnly,createNew, options);
    6464   //tree = tf->create("testem4.XML" ,"XML" ,readOnly,createNew, options);
    6565   delete tf;
  • trunk/examples/extended/electromagnetic/TestEm4/src/SteppingAction.cc

    r807 r1230  
    2626//
    2727// $Id: SteppingAction.cc,v 1.2 2006/06/29 16:54:23 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm4/src/SteppingVerbose.cc

    r807 r1230  
    2626//
    2727// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:54:26 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.19 2006/09/25 17:06:28 maire Exp $
     1# $Id: GNUmakefile,v 1.22 2008/06/11 22:17:58 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm5/TestEm5.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm5.cc,v 1.17 2007/06/22 10:48:00 maire Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/air.mac

    r807 r1230  
    1 # $Id: air.mac,v 1.2 2007/07/31 16:51:29 maire Exp $
     1# $Id: air.mac,v 1.3 2009/09/18 14:03:24 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1111/testem/det/setAbsYZ    15 cm
    1212#
    13 /testem/phys/addPhysics  standard
     13/testem/phys/addPhysics  local
    1414#### /testem/phys/addPhysics  standardSS
    1515#
  • trunk/examples/extended/electromagnetic/TestEm5/berger.mac

    r807 r1230  
    1 # $Id: berger.mac,v 1.3 2006/03/20 11:41:46 maire Exp $
     1# $Id: berger.mac,v 1.7 2009/01/21 17:49:59 maire Exp $
    22#
    33# macro file for TestEm5.cc   
    44#
    55# energy deposit by 1 MeV electrons in silicon counters.
    6 # M.J.Berger et al. NIM 69 (1969) page 181.
     6# M.J.Berger et al. NIM 69 (1969) page 181
    77#                   
    88/control/verbose 2
     
    1010#
    1111/testem/det/setAbsMat Silicon     
    12 /testem/det/setAbsThick 61 um
     12###/testem/det/setAbsThick 61 um
    1313###/testem/det/setAbsThick 105 um
    1414###/testem/det/setAbsThick 191 um
    15 ###/testem/det/setAbsThick 530 um
     15/testem/det/setAbsThick 530 um
    1616###/testem/det/setAbsThick   1 mm
    1717###/testem/det/setAbsThick   3 mm
    1818/testem/det/setAbsYZ      1 cm
    1919#
    20 /testem/phys/setGCut 2.13 mm   
    21 /testem/phys/setECut 7 um
    22 /testem/phys/setPCut 7 um
     20/testem/phys/setCuts 10 um   
    2321#
    2422/run/initialize
     
    2826/gun/energy 1 MeV
    2927#
    30 /testem/histo/setFileName berger
    31 /testem/histo/setFileType hbook
    32 /testem/histo/setHisto 1  55 0.0 1.1 MeV        #energy deposit 
     28/testem/histo/setFileName berger/Si530um
     29/testem/histo/setFileType root
     30/testem/histo/setHisto 1 105  0  1.05 MeV       #energy deposit 
    3331#
    34 /testem/event/printModulo 100000
     32/testem/event/printModulo 100000
     33#
    3534/run/beamOn 1000000
  • trunk/examples/extended/electromagnetic/TestEm5/dedx1.mac

    r807 r1230  
    1 # $Id: dedx1.mac,v 1.4 2006/03/28 15:03:08 maire Exp $
     1# $Id: dedx1.mac,v 1.6 2009/09/18 14:03:24 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    88/run/verbose 2
    99#
    10 /testem/det/setAbsMat Silicon   
    11 /testem/det/setAbsThick 1 m
    12 /testem/det/setAbsYZ    1 mm
     10/testem/det/setAbsMat Air   
     11/testem/det/setAbsThick 1 c
     12/testem/det/setAbsYZ    1 cm
    1313#
    14 /testem/phys/addPhysics standard
    15 ###/testem/phys/addPhysics livermore
    16 ###/testem/phys/addPhysics penelope
     14/testem/phys/addPhysics local
    1715#
    1816/testem/phys/setCuts 1 km
     
    2422#
    2523/testem/gun/setDefault
    26 /gun/particle e-
    27 /gun/energy 1 MeV
     24/gun/particle proton
     25/gun/energy 10 MeV
    2826#
    2927/tracking/verbose 1
  • trunk/examples/extended/electromagnetic/TestEm5/dedx2.mac

    r807 r1230  
    1 # $Id: dedx2.mac,v 1.5 2006/03/28 15:03:08 maire Exp $
     1# $Id: dedx2.mac,v 1.6 2009/09/18 14:03:24 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1212/testem/det/setAbsYZ    10 um
    1313#
    14 /testem/phys/addPhysics standard
    15 ###/testem/phys/addPhysics livermore
    16 ###/testem/phys/addPhysics penelope
     14/testem/phys/addPhysics local
     15###/testem/phys/addPhysics emlivermore
     16###/testem/phys/addPhysics empenelope
    1717#
    1818/testem/phys/setCuts 1 km
  • trunk/examples/extended/electromagnetic/TestEm5/hadron.mac

    r807 r1230  
    1 # $Id: hadron.mac,v 1.2 2004/11/22 15:43:39 maire Exp $
     1# $Id: hadron.mac,v 1.4 2009/09/18 14:03:24 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1111/testem/det/setAbsYZ    1 m
    1212#
    13 /testem/phys/addPhysics  standard
    14 /testem/phys/addPhysics  binary
    15 /testem/phys/addPhysics  binary_ion
    16 /testem/phys/addPhysics  elastic
     13/testem/phys/addPhysics  local
    1714#
    1815/testem/phys/setCuts 1 km
     
    2724#
    2825/run/beamOn 1
    29 
    30 
  • trunk/examples/extended/electromagnetic/TestEm5/hanson.mac

    r807 r1230  
    1 # $Id: hanson.mac,v 1.4 2007/07/31 16:51:29 maire Exp $
     1# $Id: hanson.mac,v 1.5 2009/06/19 12:42:04 vnivanch Exp $
    22#
    33# macro file for TestEm5.cc   
     
    1919/testem/phys/setPCut 1.12 um
    2020#
     21/testem/phys/addPhysics  emstandard_opt3
     22#/testem/phys/addPhysics  standardGS
     23#
    2124/run/initialize
    2225#
  • trunk/examples/extended/electromagnetic/TestEm5/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.6 2006/06/29 16:54:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.5 2006/06/29 16:54:33 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.3 2006/06/29 16:54:35 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/EventMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventMessenger.hh,v 1.5 2006/06/29 16:54:38 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/HistoManager.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.hh,v 1.13 2007/11/12 17:48:16 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.hh,v 1.14 2007/11/30 11:46:25 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6464    void FillHisto(G4int id, G4double e, G4double weight = 1.0);
    6565    void RemoveHisto (G4int);
     66    void Scale (G4int, G4double);   
    6667    void PrintHisto  (G4int);
    6768   
  • trunk/examples/extended/electromagnetic/TestEm5/include/HistoMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.hh,v 1.8 2007/11/12 17:48:16 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/PhysListEmStandard.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandard.hh,v 1.6 2006/08/10 08:44:39 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/PhysListEmStandardSS.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandardSS.hh,v 1.1 2006/08/10 08:45:14 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/PhysicsList.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.hh,v 1.6 2007/03/20 18:50:53 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.hh,v 1.11 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3737
    3838class G4VPhysicsConstructor;
    39 class StepMax;
    4039class PhysicsListMessenger;
    4140
     
    5554  void AddDecay();
    5655  void AddStepMax();       
    57  
    58   StepMax* GetStepMaxProcess() {return stepMaxProcess;};
    5956   
    6057  void SetCuts();
     
    6461   
    6562private:
    66  
     63
    6764  PhysicsListMessenger* pMessenger;
    6865
    6966  G4String emName;
    7067  G4VPhysicsConstructor*  emPhysicsList;
    71   std::vector<G4VPhysicsConstructor*>  hadronPhys;
    72    
    73   StepMax* stepMaxProcess;
    7468   
    7569  G4double cutForGamma;
    7670  G4double cutForElectron;
    7771  G4double cutForPositron;   
    78 
    79   G4bool helIsRegisted;
    80   G4bool bicIsRegisted;
    81   G4bool biciIsRegisted;
    8272
    8373};
  • trunk/examples/extended/electromagnetic/TestEm5/include/PhysicsListMessenger.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsListMessenger.hh,v 1.7 2006/06/29 16:55:05 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsListMessenger.hh,v 1.9 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4545class PhysicsListMessenger: public G4UImessenger
    4646{
    47   public:
     47public:
    4848 
    49     PhysicsListMessenger(PhysicsList* );
    50    ~PhysicsListMessenger();
     49  PhysicsListMessenger(PhysicsList* );
     50  ~PhysicsListMessenger();
    5151   
    52     void SetNewValue(G4UIcommand*, G4String);
     52  void SetNewValue(G4UIcommand*, G4String);
    5353   
    54   private:
     54private:
    5555 
    56     PhysicsList* pPhysicsList;
     56  PhysicsList* pPhysicsList;
    5757   
    58     G4UIdirectory*             physDir;   
    59     G4UIcmdWithAString*        pListCmd;   
    60     G4UIcmdWithADoubleAndUnit* gammaCutCmd;
    61     G4UIcmdWithADoubleAndUnit* electCutCmd;
    62     G4UIcmdWithADoubleAndUnit* protoCutCmd;   
    63     G4UIcmdWithADoubleAndUnit* allCutCmd;       
     58  G4UIdirectory*             physDir;   
     59  G4UIcmdWithAString*        pListCmd;   
     60  G4UIcmdWithADoubleAndUnit* gammaCutCmd;
     61  G4UIcmdWithADoubleAndUnit* electCutCmd;
     62  G4UIcmdWithADoubleAndUnit* protoCutCmd;   
     63  G4UIcmdWithADoubleAndUnit* allCutCmd;       
    6464};
    6565
  • trunk/examples/extended/electromagnetic/TestEm5/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.4 2006/06/29 16:55:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.4 2006/06/29 16:55:10 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/RunAction.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.hh,v 1.8 2007/11/21 17:41:19 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: RunAction.hh,v 1.9 2009/01/22 17:41:43 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5252class RunAction : public G4UserRunAction
    5353{
    54   public:
     54
     55public:
     56
    5557    RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
    56    ~RunAction();
     58    virtual ~RunAction();
    5759
    58   public:
    5960    void BeginOfRunAction(const G4Run*);
    6061    void   EndOfRunAction(const G4Run*);
    6162
    6263    void AddEnergy (G4double edep)
    63                    {EnergyDeposit += edep; EnergyDeposit2 += edep*edep;};
     64                 {EnergyDeposit += edep; EnergyDeposit2 += edep*edep;};
    6465
    6566    void AddTrakLenCharg (G4double length)
  • trunk/examples/extended/electromagnetic/TestEm5/include/StackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: StackingAction.hh,v 1.4 2006/09/25 17:06:29 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/StackingMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StackingMessenger.hh,v 1.6 2006/09/25 17:06:29 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.3 2006/06/29 16:55:19 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.3 2006/06/29 16:55:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/SteppingAction.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.hh,v 1.3 2006/06/29 16:55:23 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: SteppingAction.hh,v 1.4 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.3 2006/06/29 16:55:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm5/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.4 2006/06/29 16:55:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/mumsc.mac

    r807 r1230  
    1 # $Id: mumsc.mac,v 1.8 2007/07/31 16:51:29 maire Exp $
     1# $Id: mumsc.mac,v 1.20 2009/11/15 22:10:03 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1414/testem/det/setWorldYZ  1 m
    1515#
    16 /testem/phys/setCuts 0.1 mm
     16/testem/phys/addPhysics local
     17#
     18/testem/phys/setCuts 1 mm
    1719#
    1820/run/initialize
     
    2022/testem/gun/setDefault
    2123/gun/particle mu+
    22 /gun/energy 50 GeV
     24/gun/energy 100 GeV
    2325#
    24 /testem/histo/setFileName mumsc
     26/testem/histo/setFileName mumsc/ref09.local
    2527/testem/histo/setFileType hbook
    26 /testem/histo/setHisto 13  200  -20.0  +20.0 mrad       #projected angle
    27 /testem/histo/setHisto 14  200  -10.0  +10.0 mm         #projected deviation 
     28/testem/histo/setHisto 14  100 -5.0  +5.0 mm            #x-position at exit 
     29/testem/histo/setHisto 15  100  0.  +10.0 mm            #radius at exit 
    2830#
    2931/testem/stack/killSecondaries
    3032#
    31 /testem/event/printModulo 1000
    32 /run/beamOn 10000
     33/testem/event/printModulo 4000
     34/run/beamOn 40000
  • trunk/examples/extended/electromagnetic/TestEm5/neutron.mac

    r807 r1230  
    1 # $Id: neutron.mac,v 1.4 2007/07/31 16:51:29 maire Exp $
     1# $Id: neutron.mac,v 1.5 2009/09/18 14:03:24 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1414/testem/det/setAbsYZ    20 cm
    1515#
    16 /testem/phys/addPhysics  standard
    17 /testem/phys/addPhysics  elastic
     16/testem/phys/addPhysics  local
    1817#
    1918/testem/phys/setCuts 1 km
  • trunk/examples/extended/electromagnetic/TestEm5/src/DetectorConstruction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: DetectorConstruction.cc,v 1.13 2006/09/25 17:06:29 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: DetectorConstruction.cc,v 1.15 2009/01/22 17:41:43 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4646#include "G4UnitsTable.hh"
    4747#include "G4NistManager.hh"
     48#include "G4RunManager.hh"
    4849
    4950//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8889void DetectorConstruction::DefineMaterials()
    8990{
    90  //This function illustrates the possible ways to define materials
     91  //This function illustrates the possible ways to define materials
    9192 
    92 G4String symbol;             //a=mass of a mole;
    93 G4double a, z, density;      //z=mean number of protons; 
    94 
    95 G4int ncomponents, natoms;
    96 G4double fractionmass;
    97 G4double temperature, pressure;
    98 
    99 //
    100 // define Elements
    101 //
    102 
    103 G4Element* H  = new G4Element("Hydrogen",symbol="H",  z= 1, a=   1.01*g/mole);
    104 G4Element* C  = new G4Element("Carbon",  symbol="C",  z= 6, a=  12.01*g/mole);
    105 G4Element* N  = new G4Element("Nitrogen",symbol="N",  z= 7, a=  14.01*g/mole);
    106 G4Element* O  = new G4Element("Oxygen",  symbol="O",  z= 8, a=  16.00*g/mole);
    107 G4Element* Na = new G4Element("Sodium",  symbol="Na", z=11, a=  22.99*g/mole);
    108 G4Element* Ar = new G4Element("Argon",   symbol="Ar", z=18, a=  39.95*g/mole);
    109 G4Element* I  = new G4Element("Iodine",  symbol="I" , z=53, a= 126.90*g/mole);
    110 G4Element* Xe = new G4Element("Xenon",   symbol="Xe", z=54, a= 131.29*g/mole);
    111 
    112 //
    113 // define simple materials
    114 //
    115 
    116 new G4Material("H2Liq"    , z= 1, a= 1.01*g/mole, density= 70.8*mg/cm3);
    117 new G4Material("Beryllium", z= 4, a= 9.01*g/mole, density= 1.848*g/cm3);
    118 new G4Material("Aluminium", z=13, a=26.98*g/mole, density= 2.700*g/cm3);
    119 new G4Material("Silicon"  , z=14, a=28.09*g/mole, density= 2.330*g/cm3);
    120 
    121 G4Material* lAr =
    122 new G4Material("liquidArgon", density= 1.390*g/cm3, ncomponents=1);
    123 lAr->AddElement(Ar, natoms=1);
    124 
    125 new G4Material("Iron",     z=26, a= 55.85*g/mole, density= 7.870*g/cm3);
    126 new G4Material("Copper",   z=29, a= 63.55*g/mole, density= 8.960*g/cm3);
    127 new G4Material("Silver",   z=47, a=107.87*g/mole, density= 10.50*g/cm3);
    128 new G4Material("Tungsten", z=74, a=183.85*g/mole, density= 19.30*g/cm3);
    129 new G4Material("Gold",     z=79, a=196.97*g/mole, density= 19.32*g/cm3);
    130 new G4Material("Lead",     z=82, a=207.19*g/mole, density= 11.35*g/cm3);
    131 
    132 //
    133 // define a material from elements.   case 1: chemical molecule
    134 //
    135 
    136 G4Material* H2O = new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
    137 H2O->AddElement(H, natoms=2);
    138 H2O->AddElement(O, natoms=1);
    139 H2O->GetIonisation()->SetMeanExcitationEnergy(75*eV);
    140 
    141 G4Material* CH = new G4Material("Plastic", density= 1.04*g/cm3, ncomponents=2);
    142 CH->AddElement(C, natoms=1);
    143 CH->AddElement(H, natoms=1);
    144 
    145 G4Material* NaI = new G4Material("NaI", density= 3.67*g/cm3, ncomponents=2);
    146 NaI->AddElement(Na, natoms=1);
    147 NaI->AddElement(I , natoms=1);
    148 NaI->GetIonisation()->SetMeanExcitationEnergy(452*eV);
    149 
    150 //
    151 // define a material from elements.   case 2: mixture by fractional mass
    152 //
    153 
    154 G4Material* Air = new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
    155 Air->AddElement(N, fractionmass=0.7);
    156 Air->AddElement(O, fractionmass=0.3);
    157 
    158 G4Material* Air20 =
    159 new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
    160                         kStateGas, 293.*kelvin, 1.*atmosphere);
    161 Air20->AddElement(N, fractionmass=0.7);
    162 Air20->AddElement(O, fractionmass=0.3);
    163 
    164 //Graphite
    165 //
    166 G4Material* Graphite =
    167 new G4Material("Graphite", density= 1.7*g/cm3, ncomponents=1);
    168 Graphite->AddElement(C, fractionmass=1.);
    169 
    170 //Havar
    171 //
    172 G4Element* Cr = new G4Element("Chrome", "Cr", z=25, a=  51.996*g/mole);
    173 G4Element* Fe = new G4Element("Iron"  , "Fe", z=26, a=  55.845*g/mole);
    174 G4Element* Co = new G4Element("Cobalt", "Co", z=27, a=  58.933*g/mole);
    175 G4Element* Ni = new G4Element("Nickel", "Ni", z=28, a=  58.693*g/mole);
    176 G4Element* W  = new G4Element("Tungsten","W", z=74, a= 183.850*g/mole);
    177 
    178 G4Material* Havar =
    179 new G4Material("Havar", density= 8.3*g/cm3, ncomponents=5);
    180 Havar->AddElement(Cr, fractionmass=0.1785);
    181 Havar->AddElement(Fe, fractionmass=0.1822);
    182 Havar->AddElement(Co, fractionmass=0.4452);
    183 Havar->AddElement(Ni, fractionmass=0.1310);
    184 Havar->AddElement(W , fractionmass=0.0631);
    185 
    186 //
    187 // examples of gas
    188 // 
    189 new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3,
    190                            kStateGas, 273.15*kelvin, 1*atmosphere);
     93  G4String symbol;             //a=mass of a mole;
     94  G4double a, z, density;      //z=mean number of protons; 
     95
     96  G4int ncomponents, natoms;
     97  G4double fractionmass;
     98  G4double temperature, pressure;
     99 
     100  //
     101  // define Elements
     102  //
     103
     104  G4Element* H  = new G4Element("Hydrogen",symbol="H",  z= 1, a=   1.01*g/mole);
     105  G4Element* C  = new G4Element("Carbon",  symbol="C",  z= 6, a=  12.01*g/mole);
     106  G4Element* N  = new G4Element("Nitrogen",symbol="N",  z= 7, a=  14.01*g/mole);
     107  G4Element* O  = new G4Element("Oxygen",  symbol="O",  z= 8, a=  16.00*g/mole);
     108  G4Element* Na = new G4Element("Sodium",  symbol="Na", z=11, a=  22.99*g/mole);
     109  G4Element* Ar = new G4Element("Argon",   symbol="Ar", z=18, a=  39.95*g/mole);
     110  G4Element* I  = new G4Element("Iodine",  symbol="I" , z=53, a= 126.90*g/mole);
     111  G4Element* Xe = new G4Element("Xenon",   symbol="Xe", z=54, a= 131.29*g/mole);
     112
     113  //
     114  // define simple materials
     115  //
     116
     117  new G4Material("H2Liq"    , z= 1, a= 1.01*g/mole, density= 70.8*mg/cm3);
     118  new G4Material("Beryllium", z= 4, a= 9.01*g/mole, density= 1.848*g/cm3);
     119  new G4Material("Aluminium", z=13, a=26.98*g/mole, density= 2.700*g/cm3);
     120  new G4Material("Silicon"  , z=14, a=28.09*g/mole, density= 2.330*g/cm3);
     121
     122  G4Material* lAr =
     123    new G4Material("liquidArgon", density= 1.390*g/cm3, ncomponents=1);
     124  lAr->AddElement(Ar, natoms=1);
     125
     126  new G4Material("Iron",     z=26, a= 55.85*g/mole, density= 7.870*g/cm3);
     127  new G4Material("Copper",   z=29, a= 63.55*g/mole, density= 8.960*g/cm3);
     128  new G4Material("Germanium",z=32, a= 72.61*g/mole, density= 5.323*g/cm3);
     129  new G4Material("Silver",   z=47, a=107.87*g/mole, density= 10.50*g/cm3);
     130  new G4Material("Tungsten", z=74, a=183.85*g/mole, density= 19.30*g/cm3);
     131  new G4Material("Gold",     z=79, a=196.97*g/mole, density= 19.32*g/cm3);
     132  new G4Material("Lead",     z=82, a=207.19*g/mole, density= 11.35*g/cm3);
     133
     134  //
     135  // define a material from elements.   case 1: chemical molecule
     136  //
     137
     138  G4Material* H2O = new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
     139  H2O->AddElement(H, natoms=2);
     140  H2O->AddElement(O, natoms=1);
     141  H2O->GetIonisation()->SetMeanExcitationEnergy(75*eV);
     142
     143  G4Material* CH = new G4Material("Plastic", density= 1.04*g/cm3, ncomponents=2);
     144  CH->AddElement(C, natoms=1);
     145  CH->AddElement(H, natoms=1);
     146
     147  G4Material* NaI = new G4Material("NaI", density= 3.67*g/cm3, ncomponents=2);
     148  NaI->AddElement(Na, natoms=1);
     149  NaI->AddElement(I , natoms=1);
     150  NaI->GetIonisation()->SetMeanExcitationEnergy(452*eV);
     151
     152  //
     153  // define a material from elements.   case 2: mixture by fractional mass
     154  //
     155
     156  G4Material* Air = new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
     157  Air->AddElement(N, fractionmass=0.7);
     158  Air->AddElement(O, fractionmass=0.3);
     159
     160  G4Material* Air20 =
     161    new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
     162                   kStateGas, 293.*kelvin, 1.*atmosphere);
     163  Air20->AddElement(N, fractionmass=0.7);
     164  Air20->AddElement(O, fractionmass=0.3);
     165
     166  //Graphite
     167  //
     168  G4Material* Graphite =
     169    new G4Material("Graphite", density= 1.7*g/cm3, ncomponents=1);
     170  Graphite->AddElement(C, fractionmass=1.);
     171
     172  //Havar
     173  //
     174  G4Element* Cr = new G4Element("Chrome", "Cr", z=25, a=  51.996*g/mole);
     175  G4Element* Fe = new G4Element("Iron"  , "Fe", z=26, a=  55.845*g/mole);
     176  G4Element* Co = new G4Element("Cobalt", "Co", z=27, a=  58.933*g/mole);
     177  G4Element* Ni = new G4Element("Nickel", "Ni", z=28, a=  58.693*g/mole);
     178  G4Element* W  = new G4Element("Tungsten","W", z=74, a= 183.850*g/mole);
     179
     180  G4Material* Havar =
     181    new G4Material("Havar", density= 8.3*g/cm3, ncomponents=5);
     182  Havar->AddElement(Cr, fractionmass=0.1785);
     183  Havar->AddElement(Fe, fractionmass=0.1822);
     184  Havar->AddElement(Co, fractionmass=0.4452);
     185  Havar->AddElement(Ni, fractionmass=0.1310);
     186  Havar->AddElement(W , fractionmass=0.0631);
     187
     188  //
     189  // examples of gas
     190  // 
     191  new G4Material("ArgonGas", z=18, a=39.948*g/mole, density= 1.782*mg/cm3,
     192                 kStateGas, 273.15*kelvin, 1*atmosphere);
    191193                           
    192 new G4Material("XenonGas", z=54, a=131.29*g/mole, density= 5.458*mg/cm3,
    193                           kStateGas, 293.15*kelvin, 1*atmosphere);
     194  new G4Material("XenonGas", z=54, a=131.29*g/mole, density= 5.458*mg/cm3,
     195                kStateGas, 293.15*kelvin, 1*atmosphere);
    194196                           
    195 G4Material* CO2 =
    196 new G4Material("CarbonicGas", density= 1.977*mg/cm3, ncomponents=2);
    197 CO2->AddElement(C, natoms=1);
    198 CO2->AddElement(O, natoms=2);
    199 
    200 G4Material* ArCO2 =
    201 new G4Material("ArgonCO2",   density= 1.8223*mg/cm3, ncomponents=2);
    202 ArCO2->AddElement (Ar,  fractionmass=0.7844);
    203 ArCO2->AddMaterial(CO2, fractionmass=0.2156);
    204 
    205 //another way to define mixture of gas per volume
    206 G4Material* NewArCO2 =
    207 new G4Material("NewArgonCO2", density= 1.8223*mg/cm3, ncomponents=3);
    208 NewArCO2->AddElement (Ar, natoms=8);
    209 NewArCO2->AddElement (C,  natoms=2);
    210 NewArCO2->AddElement (O,  natoms=4);
    211 
    212 G4Material* ArCH4 =
    213 new G4Material("ArgonCH4",    density= 1.709*mg/cm3,  ncomponents=3);
    214 ArCH4->AddElement (Ar, natoms=93);
    215 ArCH4->AddElement (C,  natoms=7);
    216 ArCH4->AddElement (H,  natoms=28);
    217 
    218 G4Material* XeCH =
    219 new G4Material("XenonMethanePropane", density= 4.9196*mg/cm3, ncomponents=3,
    220                                       kStateGas, 293.15*kelvin, 1*atmosphere);
    221 XeCH->AddElement (Xe, natoms=875);
    222 XeCH->AddElement (C,  natoms=225);
    223 XeCH->AddElement (H,  natoms=700);
    224 
    225 G4Material* steam =
    226 new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1);
    227 steam->AddMaterial(H2O, fractionmass=1.);
    228 steam->GetIonisation()->SetMeanExcitationEnergy(71.6*eV); 
    229 
    230 //
    231 // example of vacuum
    232 //
    233 
    234 density     = universe_mean_density;    //from PhysicalConstants.h
    235 pressure    = 3.e-18*pascal;
    236 temperature = 2.73*kelvin;
    237 new G4Material("Galactic", z=1, a=1.01*g/mole,density,
    238                                               kStateGas,temperature,pressure);
     197  G4Material* CO2 =
     198    new G4Material("CarbonicGas", density= 1.977*mg/cm3, ncomponents=2);
     199  CO2->AddElement(C, natoms=1);
     200  CO2->AddElement(O, natoms=2);
     201
     202  G4Material* ArCO2 =
     203    new G4Material("ArgonCO2",   density= 1.8223*mg/cm3, ncomponents=2);
     204  ArCO2->AddElement (Ar,  fractionmass=0.7844);
     205  ArCO2->AddMaterial(CO2, fractionmass=0.2156);
     206
     207  //another way to define mixture of gas per volume
     208  G4Material* NewArCO2 =
     209    new G4Material("NewArgonCO2", density= 1.8223*mg/cm3, ncomponents=3);
     210  NewArCO2->AddElement (Ar, natoms=8);
     211  NewArCO2->AddElement (C,  natoms=2);
     212  NewArCO2->AddElement (O,  natoms=4);
     213
     214  G4Material* ArCH4 =
     215    new G4Material("ArgonCH4",    density= 1.709*mg/cm3,  ncomponents=3);
     216  ArCH4->AddElement (Ar, natoms=93);
     217  ArCH4->AddElement (C,  natoms=7);
     218  ArCH4->AddElement (H,  natoms=28);
     219
     220  G4Material* XeCH =
     221    new G4Material("XenonMethanePropane", density= 4.9196*mg/cm3, ncomponents=3,
     222                   kStateGas, 293.15*kelvin, 1*atmosphere);
     223  XeCH->AddElement (Xe, natoms=875);
     224  XeCH->AddElement (C,  natoms=225);
     225  XeCH->AddElement (H,  natoms=700);
     226
     227  G4Material* steam =
     228    new G4Material("WaterSteam", density= 1.0*mg/cm3, ncomponents=1);
     229  steam->AddMaterial(H2O, fractionmass=1.);
     230  steam->GetIonisation()->SetMeanExcitationEnergy(71.6*eV); 
     231
     232  //
     233  // example of vacuum
     234  //
     235
     236  density     = universe_mean_density;    //from PhysicalConstants.h
     237  pressure    = 3.e-18*pascal;
     238  temperature = 2.73*kelvin;
     239  new G4Material("Galactic", z=1, a=1.01*g/mole,density,
     240                kStateGas,temperature,pressure);
    239241}
    240242
     
    300302                                0);                //copy number
    301303                                       
    302    PrintCalorParameters();         
     304  PrintCalorParameters();         
    303305 
    304306  //always return the physical World
     
    336338    G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
    337339
    338   if (pttoMaterial) AbsorberMaterial = pttoMaterial;                 
     340  if (pttoMaterial && AbsorberMaterial != pttoMaterial) {
     341    AbsorberMaterial = pttoMaterial;                 
     342    if(logicAbsorber) logicAbsorber->SetMaterial(AbsorberMaterial);
     343    G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     344  }
    339345}
    340346
     
    347353    G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
    348354
    349   if (pttoMaterial) WorldMaterial = pttoMaterial;
     355  if (pttoMaterial && WorldMaterial != pttoMaterial) {
     356    WorldMaterial = pttoMaterial;                 
     357    if(logicWorld) logicWorld->SetMaterial(WorldMaterial);
     358    G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     359  }
    350360}
    351361   
     
    355365{
    356366  AbsorberThickness = val;
     367  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    357368
    358369
     
    362373{
    363374  AbsorberSizeYZ = val;
     375  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    364376
    365377
     
    370382  WorldSizeX = val;
    371383  defaultWorld = false;
     384  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    372385
    373386
     
    378391  WorldSizeYZ = val;
    379392  defaultWorld = false;
     393  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    380394
    381395
     
    385399{
    386400  XposAbs  = val;
     401  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    387402
    388403
     
    412427//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
    413428
    414 #include "G4RunManager.hh"
    415  
    416429void DetectorConstruction::UpdateGeometry()
    417430{
     431  G4RunManager::GetRunManager()->PhysicsHasBeenModified();
    418432  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
    419433}
  • trunk/examples/extended/electromagnetic/TestEm5/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.4 2006/06/29 16:55:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/EventAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: EventAction.cc,v 1.6 2006/06/29 16:55:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: EventAction.cc,v 1.7 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/EventMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventMessenger.cc,v 1.5 2006/06/29 16:55:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/HistoManager.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.cc,v 1.21 2007/11/28 12:37:56 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: HistoManager.cc,v 1.26 2008/09/13 17:05:40 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5454 
    5555  fileName[0] = "testem5";
    56   fileType    = "hbook";
    57   fileOption  = "--noErrors uncompress"; 
     56  fileType    = "root";
     57  fileOption  = "--noErrors export=root uncompress"; 
    5858  // histograms
    5959  for (G4int k=0; k<MaxHisto; k++) {
     
    199199                  "dummy","dummy","dummy","dummy","dummy","dummy",      //34-39
    200200                  "(reflect , neutral) : kinetic energy at exit",       //40
    201                   "(reflect , neutral) : ener fluence: dE(MeV)/dOmega"  //41
     201                  "(reflect , neutral) : ener fluence: dE(MeV)/dOmega", //41
    202202                  "(reflect , neutral) : space angle: dN/dOmega",       //42
    203203                  "(reflect , neutral) : projected angle at exit",      //43
     
    245245//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    246246
     247void HistoManager::Scale(G4int ih, G4double fac)
     248{
     249 if (ih > MaxHisto) {
     250    G4cout << "---> warning from HistoManager::Scale() : histo " << ih
     251           << "does not exist.  (fac = " << fac << ")" << G4endl;
     252    return;
     253  }
     254#ifdef G4ANALYSIS_USE
     255  if(exist[ih]) histo[ih]->scale(fac);
     256#endif
     257}
     258
     259//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     260
    247261void HistoManager::PrintHisto(G4int ih)
    248262{
    249  if (ih < MaxHisto) ascii[ih] = true;
     263 if (ih < MaxHisto) { ascii[ih] = true; ascii[0] = true; }
    250264 else
    251265    G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
     
    260274{
    261275#ifdef G4ANALYSIS_USE
     276
     277 if (!ascii[0]) return;
    262278 
    263279 G4String name = fileName[0] + ".ascii";
     
    273289      for (G4int iBin=0; iBin<Nbins[ih]; iBin++) {
    274290         File << "  " << iBin << "\t"
    275               << histo[ih]->binMean(iBin) << "\t"
     291              << 0.5*(histo[ih]->axis().binLowerEdge(iBin) +
     292                      histo[ih]->axis().binUpperEdge(iBin)) << "\t"           
    276293              << histo[ih]->binHeight(iBin)
    277294              << G4endl;
  • trunk/examples/extended/electromagnetic/TestEm5/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: HistoMessenger.cc,v 1.8 2007/11/12 17:48:16 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandard.cc,v 1.14 2007/11/21 17:41:19 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysListEmStandard.cc,v 1.24 2009/11/15 22:10:03 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3838#include "G4PhotoElectricEffect.hh"
    3939
    40 #include "G4MultipleScattering.hh"
    41 
     40#include "G4eMultipleScattering.hh"
     41#include "G4UrbanMscModel93.hh"
    4242#include "G4eIonisation.hh"
    4343#include "G4eBremsstrahlung.hh"
    4444#include "G4eplusAnnihilation.hh"
    4545
     46#include "G4MuMultipleScattering.hh"
    4647#include "G4MuIonisation.hh"
    4748#include "G4MuBremsstrahlung.hh"
    4849#include "G4MuPairProduction.hh"
    4950
     51#include "G4hMultipleScattering.hh"
    5052#include "G4hIonisation.hh"
     53#include "G4hBremsstrahlung.hh"
     54#include "G4hPairProduction.hh"
     55
    5156#include "G4ionIonisation.hh"
     57#include "G4IonParametrisedLossModel.hh"
     58#include "G4NuclearStopping.hh"
    5259
    5360#include "G4EmProcessOptions.hh"
     
    8693    } else if (particleName == "e-") {
    8794      //electron
    88       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    89       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    90       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     95      G4eMultipleScattering* msc = new G4eMultipleScattering();
     96      msc->AddEmModel(0, new G4UrbanMscModel93());
     97      pmanager->AddProcess(msc,                       -1, 1, 1);     
     98      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     99      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    91100           
    92101    } else if (particleName == "e+") {
    93102      //positron
    94       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    95       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    96       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    97       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     103      G4eMultipleScattering* msc = new G4eMultipleScattering();
     104      msc->AddEmModel(0, new G4UrbanMscModel93());
     105      pmanager->AddProcess(msc,                       -1, 1, 1);           
     106      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     107      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     108      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    98109           
    99110    } else if (particleName == "mu+" ||
    100111               particleName == "mu-"    ) {
    101112      //muon 
    102       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    103       pmanager->AddProcess(new G4MuIonisation,       -1, 2,2);
    104       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 3,3);
    105       pmanager->AddProcess(new G4MuPairProduction,   -1, 4,4);
     113      pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
     114      pmanager->AddProcess(new G4MuIonisation,         -1, 2, 2);
     115      pmanager->AddProcess(new G4MuBremsstrahlung,     -1, 3, 3);
     116      pmanager->AddProcess(new G4MuPairProduction,     -1, 4, 4);
    106117             
    107     } else if (particleName == "alpha" || particleName == "GenericIon" ) {
    108       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    109       pmanager->AddProcess(new G4ionIonisation,      -1, 2,2);
     118    } else if( particleName == "proton" ||
     119               particleName == "pi-" ||
     120               particleName == "pi+"    ) {
     121      //proton 
     122      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     123      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     124      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     125      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    110126     
     127    } else if( particleName == "alpha" ||
     128               particleName == "He3"    ) {
     129      //alpha
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
     132      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);
     133           
     134    } else if( particleName == "GenericIon" ) {
     135      //Ions
     136      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     137      G4ionIonisation* ionIoni = new G4ionIonisation();
     138      ionIoni->SetEmModel(new G4IonParametrisedLossModel());
     139      pmanager->AddProcess(ionIoni,                   -1, 2, 2);     
     140      pmanager->AddProcess(new G4NuclearStopping,     -1, 3,-1);     
     141     
    111142    } else if ((!particle->IsShortLived()) &&
    112143               (particle->GetPDGCharge() != 0.0) &&
    113144               (particle->GetParticleName() != "chargedgeantino")) {
    114145      //all others charged particles except geantino
    115       pmanager->AddProcess(new G4MultipleScattering, -1,1,1);
    116       pmanager->AddProcess(new G4hIonisation,        -1,2,2);
     146      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     147      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    117148    }
    118149  }
     
    120151  // Em options
    121152  //
     153  // Main options and setting parameters are shown here.
     154  // Several of them have default values.
     155  //
    122156  G4EmProcessOptions emOptions;
    123    
    124   //coulomb scattering
    125   //
    126   emOptions.SetMscStepLimitation(fUseDistanceToBoundary);   
    127   emOptions.SetSkin(4.);
    128157 
    129158  //physics tables
    130159  //
    131   emOptions.SetMinEnergy(100*eV);   
    132   emOptions.SetMaxEnergy(100*TeV); 
    133   emOptions.SetDEDXBinning(1200); 
    134   emOptions.SetLambdaBinning(1200); 
    135  
     160  emOptions.SetMinEnergy(100*eV);       //default   
     161  emOptions.SetMaxEnergy(100*TeV);      //default 
     162  emOptions.SetDEDXBinning(12*20);      //default=12*7
     163  emOptions.SetLambdaBinning(12*20);    //default=12*7
     164  emOptions.SetSplineFlag(true);        //default
     165     
     166  //multiple coulomb scattering
     167  //
     168  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     169  emOptions.SetMscRangeFactor(0.04);    //default
     170  emOptions.SetMscGeomFactor (2.5);     //default       
     171  emOptions.SetSkin(3.);                //default
     172     
    136173  //energy loss
    137174  //
    138   emOptions.SetLinearLossLimit(1.e-6);
    139   emOptions.SetStepFunction(0.2, 100*um);
     175  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     176  emOptions.SetLinearLossLimit(1.e-2);          //default
    140177   
    141178  //ionization
    142179  //
    143   emOptions.SetSubCutoff(false); 
     180  emOptions.SetSubCutoff(false);        //default
    144181}
    145182
  • trunk/examples/extended/electromagnetic/TestEm5/src/PhysListEmStandardSS.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandardSS.cc,v 1.3 2007/07/31 16:51:29 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysListEmStandardSS.cc,v 1.6 2008/11/16 18:51:42 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3131
    3232#include "PhysListEmStandardSS.hh"
     33
    3334#include "G4ParticleDefinition.hh"
    3435#include "G4ProcessManager.hh"
     
    3839#include "G4PhotoElectricEffect.hh"
    3940
    40 #include "G4MultipleScattering.hh"
     41#include "G4CoulombScattering.hh"
    4142
    4243#include "G4eIonisation.hh"
     
    5051#include "G4hIonisation.hh"
    5152#include "G4ionIonisation.hh"
    52 #include "G4CoulombScattering.hh"
     53
     54#include "G4EmProcessOptions.hh"
    5355
    5456//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8385    } else if (particleName == "e-") {
    8486      //electron
    85       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    86       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
    87       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     87      pmanager->AddDiscreteProcess(new G4CoulombScattering);           
     88      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     89      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    8890           
    8991    } else if (particleName == "e+") {
    9092      //positron
    91       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    92       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
    93       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,3);
    94       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     93      pmanager->AddDiscreteProcess(new G4CoulombScattering);           
     94      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     95      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
     96      pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
    9597           
    9698    } else if (particleName == "mu+" ||
    9799               particleName == "mu-"    ) {
    98       //muon 
    99       pmanager->AddProcess(new G4MuIonisation,       -1, 1,1);
    100       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2,2);
    101       pmanager->AddProcess(new G4MuPairProduction,   -1, 3,3);
    102       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     100      //muon
     101      pmanager->AddDiscreteProcess(new G4CoulombScattering);             
     102      pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
     103      pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
     104      pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);
    103105             
    104106    } else if (particleName == "alpha" || particleName == "He3") {
    105       pmanager->AddProcess(new G4ionIonisation,      -1, 1,1);
    106       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     107      pmanager->AddDiscreteProcess(new G4CoulombScattering);         
     108      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
    107109
    108110    } else if (particleName == "GenericIon" ) {
    109       pmanager->AddProcess(new G4ionIonisation,      -1, 1,1);
    110111      G4CoulombScattering* cs = new G4CoulombScattering();
    111112      cs->SetBuildTableFlag(false);
    112113      pmanager->AddDiscreteProcess(cs);
    113      
     114      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);     
    114115     
    115116    } else if ((!particle->IsShortLived()) &&
     
    117118               (particle->GetParticleName() != "chargedgeantino")) {
    118119      //all others charged particles except geantino
    119       pmanager->AddProcess(new G4hIonisation,        -1,1,1);
    120       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     120      pmanager->AddDiscreteProcess(new G4CoulombScattering);           
     121      pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
    121122    }
    122123  }
     124 
     125  // Em options
     126  //
     127  // Main options and setting parameters are shown here.
     128  // Several of them have default values.
     129  //
     130  G4EmProcessOptions emOptions;
     131 
     132  //physics tables
     133  //
     134  emOptions.SetMinEnergy(100*eV);       //default   
     135  emOptions.SetMaxEnergy(100*TeV);      //default 
     136  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     137  emOptions.SetLambdaBinning(12*20);    //default=12*7
     138  emOptions.SetSplineFlag(true);        //default
     139     
     140  //energy loss
     141  //
     142  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)     
     143  emOptions.SetLinearLossLimit(1.e-2);          //default
     144   
     145  //ionization
     146  //
     147  emOptions.SetSubCutoff(false);        //default 
    123148}
    124149
  • trunk/examples/extended/electromagnetic/TestEm5/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.21 2007/11/19 14:57:07 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysicsList.cc,v 1.40 2009/11/15 22:10:03 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "PhysListEmStandard.hh"
    3636#include "PhysListEmStandardSS.hh"
    37 #include "PhysListEmStandardIG.hh"
    38 #include "PhysListEmLivermore.hh"
    39 #include "PhysListEmPenelope.hh"
     37#include "PhysListEmStandardGS.hh"
    4038
    4139#include "G4EmStandardPhysics.hh"
    4240#include "G4EmStandardPhysics_option1.hh"
    4341#include "G4EmStandardPhysics_option2.hh"
    44 
    45 #include "G4HadronElasticPhysics.hh"
    46 #include "G4HadronDElasticPhysics.hh"
    47 #include "G4HadronHElasticPhysics.hh"
    48 #include "G4HadronQElasticPhysics.hh"
    49 #include "G4HadronInelasticQBBC.hh"
    50 #include "G4IonBinaryCascadePhysics.hh"
    51 
    52 #include "G4LossTableManager.hh"
     42#include "G4EmStandardPhysics_option3.hh"
     43#include "G4EmLivermorePhysics.hh"
     44#include "G4EmPenelopePhysics.hh"
     45
     46#include "G4Decay.hh"
     47#include "StepMax.hh"
     48
    5349#include "G4UnitsTable.hh"
    5450
    5551#include "G4ParticleDefinition.hh"
    5652#include "G4ProcessManager.hh"
    57 #include "G4Decay.hh"
    58 #include "StepMax.hh"
    5953
    6054// Bosons
     
    8478PhysicsList::PhysicsList() : G4VModularPhysicsList()
    8579{
    86   G4LossTableManager::Instance();
    8780  pMessenger = new PhysicsListMessenger(this);
    8881   
    8982  // EM physics
    90   emName = G4String("standard");
     83  emName = G4String("local");
    9184  emPhysicsList = new PhysListEmStandard(emName);
    92 
    93   helIsRegisted  = false;
    94   bicIsRegisted  = false;
    95   biciIsRegisted = false;
    96  
    97   stepMaxProcess  = 0;
    98    
     85     
    9986  defaultCutValue = 1.*mm;
     87
    10088  cutForGamma     = defaultCutValue;
    10189  cutForElectron  = defaultCutValue;
     
    11098{
    11199  delete emPhysicsList;
    112   for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
    113100  delete pMessenger; 
    114101}
     
    118105void PhysicsList::ConstructParticle()
    119106{
    120 // pseudo-particles
     107  // pseudo-particles
    121108  G4Geantino::GeantinoDefinition();
    122109  G4ChargedGeantino::ChargedGeantinoDefinition();
    123110 
    124 // gamma
     111  // gamma
    125112  G4Gamma::GammaDefinition();
    126113 
    127 // optical photon
    128   G4OpticalPhoton::OpticalPhotonDefinition();
    129 
    130 // leptons
     114  // leptons
    131115  G4Electron::ElectronDefinition();
    132116  G4Positron::PositronDefinition();
     
    139123  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
    140124
    141 // mesons
     125  // mesons
    142126  G4MesonConstructor mConstructor;
    143127  mConstructor.ConstructParticle();
    144128
    145 // barions
     129  // barions
    146130  G4BaryonConstructor bConstructor;
    147131  bConstructor.ConstructParticle();
    148132
    149 // ions
     133  // ions
    150134  G4IonConstructor iConstructor;
    151135  iConstructor.ConstructParticle();
     
    158142  AddTransportation();
    159143  emPhysicsList->ConstructProcess();
    160   for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
    161144  AddDecay(); 
    162145  AddStepMax();
     
    193176{
    194177  // Step limitation seen as a process
    195   stepMaxProcess = new StepMax();
     178  StepMax* stepMaxProcess = new StepMax();
    196179
    197180  theParticleIterator->reset();
     
    217200  if (name == emName) return;
    218201
    219   if (name == "standard") {
     202  if (name == "local") {
    220203
    221204    emName = name;
     
    223206    emPhysicsList = new PhysListEmStandard(name);
    224207
    225   } else if (name == "emstandard") {
     208  } else if (name == "emstandard_opt0") {
    226209
    227210    emName = name;
     
    240223    delete emPhysicsList;
    241224    emPhysicsList = new G4EmStandardPhysics_option2();
    242 
     225   
     226  } else if (name == "emstandard_opt3") {
     227
     228    emName = name;
     229    delete emPhysicsList;
     230    emPhysicsList = new G4EmStandardPhysics_option3();
     231   
    243232  } else if (name == "standardSS") {
    244233
     
    246235    delete emPhysicsList;
    247236    emPhysicsList = new PhysListEmStandardSS(name);
    248        
    249   } else if (name == "standardIG") {
    250 
    251     emName = name;
    252     delete emPhysicsList;
    253     emPhysicsList = new PhysListEmStandardIG(name);
    254        
    255   } else if (name == "livermore") {
    256 
    257     emName = name;
    258     delete emPhysicsList;
    259     emPhysicsList = new PhysListEmLivermore(name);
    260    
    261   } else if (name == "penelope") {
    262 
    263     emName = name;
    264     delete emPhysicsList;
    265     emPhysicsList = new PhysListEmPenelope(name);
    266 
    267   } else if (name == "elastic" && !helIsRegisted) {
    268     hadronPhys.push_back( new G4HadronElasticPhysics());
    269     helIsRegisted = true;
    270 
    271   } else if (name == "DElastic" && !helIsRegisted) {
    272     hadronPhys.push_back( new G4HadronDElasticPhysics());
    273     helIsRegisted = true;
    274 
    275   } else if (name == "HElastic" && !helIsRegisted) {
    276     hadronPhys.push_back( new G4HadronHElasticPhysics());
    277     helIsRegisted = true;
    278 
    279   } else if (name == "QElastic" && !helIsRegisted) {
    280     hadronPhys.push_back( new G4HadronQElasticPhysics());
    281     helIsRegisted = true;
    282 
    283   } else if (name == "binary" && !bicIsRegisted) {
    284     hadronPhys.push_back(new G4HadronInelasticQBBC());
    285     bicIsRegisted = true;
    286 
    287   } else if (name == "binary_ion" && !biciIsRegisted) {
    288     hadronPhys.push_back(new G4IonBinaryCascadePhysics());
    289     biciIsRegisted = true;
    290        
     237
     238  } else if (name == "standardGS") {
     239
     240    emName = name;
     241    delete emPhysicsList;
     242    emPhysicsList = new PhysListEmStandardGS(name);
     243
     244  } else if (name == "empenelope"){
     245    emName = name;
     246    delete emPhysicsList;
     247    emPhysicsList = new G4EmPenelopePhysics();
     248
     249  } else if (name == "emlivermore"){
     250    emName = name;
     251    delete emPhysicsList;
     252    emPhysicsList = new G4EmLivermorePhysics();
     253                       
    291254  } else {
    292255
     
    301264void PhysicsList::SetCuts()
    302265{
    303 
    304266  if (verboseLevel >0){
    305267    G4cout << "PhysicsList::SetCuts:";
     
    341303
    342304//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    343 
  • trunk/examples/extended/electromagnetic/TestEm5/src/PhysicsListMessenger.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsListMessenger.cc,v 1.6 2006/06/29 16:56:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsListMessenger.cc,v 1.8 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7777  allCutCmd->SetRange("cut>0.0");
    7878  allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
     79
    7980}
    8081
  • trunk/examples/extended/electromagnetic/TestEm5/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.4 2006/06/29 16:56:09 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.4 2006/06/29 16:56:12 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.25 2007/11/21 17:41:19 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.29 2009/06/18 19:08:18 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    122122  else            rmsStNe = 0.;
    123123
    124   G4double Gamma = (double)nbGamma/TotNbofEvents;
    125   G4double Elect = (double)nbElect/TotNbofEvents;
    126   G4double Posit = (double)nbPosit/TotNbofEvents;
     124  G4double Gamma = (G4double)nbGamma/TotNbofEvents;
     125  G4double Elect = (G4double)nbElect/TotNbofEvents;
     126  G4double Posit = (G4double)nbPosit/TotNbofEvents;
    127127
    128128  G4double transmit[2];
     
    252252  // compute width of the Gaussian central part of the MultipleScattering
    253253  //
    254   if (histoManager->HistoExist(13)) {
    255     G4cout << "\n MultipleScattering:"
    256            << "\n  rms proj angle of transmit primary particle = "
    257            << rmsMsc/mrad << " mrad (central part only)" << G4endl;
    258 
    259     G4cout << "  computed theta0 (Highland formula)          = "
    260            << ComputeMscHighland()/mrad << " mrad" << G4endl;
     254  G4cout << "\n MultipleScattering:"
     255         << "\n  rms proj angle of transmit primary particle = "
     256         << rmsMsc/mrad << " mrad (central part only)" << G4endl;
     257
     258  G4cout << "  computed theta0 (Highland formula)          = "
     259         << ComputeMscHighland()/mrad << " mrad" << G4endl;
    261260           
    262     G4cout << "  central part defined as +- "
    263            << MscThetaCentral/mrad << " mrad; "
    264            << "  Tail ratio = " << tailMsc << " %" << G4endl;     
    265   }
     261  G4cout << "  central part defined as +- "
     262         << MscThetaCentral/mrad << " mrad; "
     263         << "  Tail ratio = " << tailMsc << " %" << G4endl;       
    266264
    267265  G4cout.precision(prec);
    268 
     266 
     267  // normalize histograms
     268  //
     269  G4int ih = 1;
     270  G4double binWidth = histoManager->GetBinWidth(ih);
     271  G4double unit     = histoManager->GetHistoUnit(ih); 
     272  G4double fac = unit/(TotNbofEvents*binWidth);
     273  histoManager->Scale(ih,fac);
     274   
     275  ih = 10;
     276  binWidth = histoManager->GetBinWidth(ih);
     277  unit     = histoManager->GetHistoUnit(ih); 
     278  fac = unit/(TotNbofEvents*binWidth);
     279  histoManager->Scale(ih,fac);
     280   
     281  // save histograms
    269282  histoManager->save();
    270283
  • trunk/examples/extended/electromagnetic/TestEm5/src/StackingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: StackingAction.cc,v 1.7 2006/09/25 17:06:29 maire Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: StackingAction.cc,v 1.8 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7979  //stack or delete secondaries
    8080  G4ClassificationOfNewTrack status = fUrgent;
    81   if (killSecondary)
    82     {if (killSecondary == 1) eventaction->AddEnergy(energy); 
    83      status = fKill;}
     81  if (killSecondary) {
     82    if (killSecondary == 1) {
     83     eventaction->AddEnergy(energy);
     84    } 
     85     status = fKill;
     86  }
    8487   
    8588  return status;
  • trunk/examples/extended/electromagnetic/TestEm5/src/StackingMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StackingMessenger.cc,v 1.5 2006/09/25 17:06:29 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.2 2006/06/29 16:56:21 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:56:23 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/SteppingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.7 2006/06/29 16:56:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: SteppingAction.cc,v 1.8 2009/03/06 18:04:23 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5757 if (aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()
    5858     != detector->GetAbsorber()) return;
    59  
     59
    6060 eventaction->AddEnergy (aStep->GetTotalEnergyDeposit());
    6161   
     
    6767   eventaction->AddTrakLenNeutr(aStep->GetStepLength());
    6868   eventaction->CountStepsNeutr();   
    69  }     
     69 }
    7070}
    7171
  • trunk/examples/extended/electromagnetic/TestEm5/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.3 2006/06/29 16:56:27 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm5/src/TrackingAction.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: TrackingAction.cc,v 1.16 2007/11/28 12:37:57 maire Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: TrackingAction.cc,v 1.18 2008/08/28 15:28:04 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6565{
    6666  G4ThreeVector position = aTrack->GetPosition();
    67   G4double charge    = aTrack->GetDefinition()->GetPDGCharge();
     67  G4ThreeVector vertex   = aTrack->GetVertexPosition(); 
     68  G4double charge        = aTrack->GetDefinition()->GetPDGCharge();
    6869
    69   G4bool transmit = (position.x() >= xendAbs);
    70   G4bool reflect  = (position.x() <= xstartAbs);
     70  G4bool transmit = ((position.x() >= xendAbs) && (vertex.x() < xendAbs));
     71  G4bool reflect  =  (position.x() <= xstartAbs);
    7172  G4bool notabsor = (transmit || reflect);
    7273
     
    8283  //histograms
    8384  //
    84   G4int id = 0;
    8585  G4bool charged  = (charge != 0.);
    8686  G4bool neutral = !charged;
     
    8888  //energy spectrum at exit
    8989  //
     90  G4int id = 0; 
    9091       if (transmit && charged) id = 10;
    9192  else if (transmit && neutral) id = 20;
    9293  else if (reflect  && charged) id = 30;
    9394  else if (reflect  && neutral) id = 40;
    94  
     95
     96  if (id>0)   
    9597  histoManager->FillHisto(id, aTrack->GetKineticEnergy());
    9698   
     
    108110  //space angle distribution at exit : dN/dOmega
    109111  //
     112  G4ThreeVector direction = aTrack->GetMomentumDirection();   
     113  id = 0;   
    110114       if (transmit && charged) id = 12;
    111115  else if (transmit && neutral) id = 22;
     
    113117  else if (reflect  && neutral) id = 42;
    114118
    115   G4ThreeVector direction = aTrack->GetMomentumDirection(); 
    116   if (histoManager->HistoExist(id)) {
     119  if (id>0) {
    117120    G4double theta  = std::acos(direction.x());
    118121    G4double dteta  = histoManager->GetBinWidth(id);
     
    124127  //energy fluence at exit : dE(MeV)/dOmega
    125128  //
     129  id = 0; 
    126130       if (transmit && charged) id = 11;
    127131  else if (transmit && neutral) id = 21;
     
    129133  else if (reflect  && neutral) id = 41;
    130134
    131   if (histoManager->HistoExist(id)) {
     135  if (id>0) {
    132136    G4double theta  = std::acos(direction.x());
    133137    G4double dteta  = histoManager->GetBinWidth(id);
     
    140144  //projected angles distribution at exit
    141145  //
     146  id = 0;   
    142147       if (transmit && charged) id = 13;
    143148  else if (transmit && neutral) id = 23;
     
    157162  //projected position and radius at exit
    158163  //
     164  id = 0;   
    159165  if (transmit && charged) id = 14;
    160166 
  • trunk/examples/extended/electromagnetic/TestEm5/tramu.mac

    r807 r1230  
    1 # $Id: tramu.mac,v 1.7 2007/07/31 16:51:29 maire Exp $
     1# $Id: tramu.mac,v 1.13 2008/10/31 11:36:46 maire Exp $
    22#
    33# macro file for TestEm5.cc
     
    1414/testem/det/setAbsYZ    3 m
    1515#
    16 ##/testem/phys/addPhysics g4v52
    17 #
    1816/testem/phys/setCuts 1 mm
    1917#   
     
    2422/gun/energy 1 TeV
    2523#
    26 /testem/histo/setFileName tramu
    27 /testem/histo/setFileType hbook
    28 /testem/histo/setHisto 10  50  950 1000 GeV     #energy at exit 
     24/testem/histo/setFileName tramu/tramu
     25/testem/histo/setFileType root
     26/testem/histo/setHisto 10  100  950 1000 GeV    #energy at exit 
    2927#
    3028/testem/stack/killSecondaries
    3129#
    32 /testem/event/printModulo 1000
    33 /run/beamOn 10000
     30/testem/event/printModulo 10000
     31#
     32/run/beamOn 100000
  • trunk/examples/extended/electromagnetic/TestEm6/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.13 2006/10/20 16:47:47 maire Exp $
     1# $Id: GNUmakefile,v 1.14 2008/09/18 16:42:07 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm6/TestEm6.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm6.cc,v 1.15 2006/06/29 16:56:32 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.3 2006/06/29 16:56:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.4 2006/06/29 16:56:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.3 2006/06/29 16:56:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:56:43 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/PhysicsList.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsList.hh,v 1.7 2006/06/29 16:56:45 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.5 2006/06/29 16:56:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:56:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.3 2006/06/29 16:56:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/RunAction.hh

    r807 r1230  
    2525//
    2626// $Id: RunAction.hh,v 1.9 2006/06/29 16:56:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.4 2006/06/29 16:56:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.3 2006/06/29 16:56:58 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//   This class manages the verbose outputs in G4SteppingManager.
  • trunk/examples/extended/electromagnetic/TestEm6/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.cc,v 1.10 2006/06/29 16:57:00 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.5 2006/06/29 16:57:02 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.6 2006/06/29 16:57:04 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.6 2006/06/29 16:57:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.12 2006/06/29 16:57:09 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.cc,v 1.13 2009/05/13 17:25:33 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    190190      // to make the process of e+e- annihilation more visible,
    191191      // do not enable the other standard processes:
    192       // pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    193       // pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
    194       // pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
    195       // pmanager->AddProcess(new G4eplusAnnihilation,  0,-1,4);
     192      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
     193      pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
     194      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
     195      pmanager->AddProcess(new G4eplusAnnihilation,  0,-1,4);
    196196     
    197197      theAnnihiToMuPairProcess = new G4AnnihiToMuPair();
     
    230230  G4EmProcessOptions opt;
    231231  opt.SetVerbose(1);
     232  opt.SetMinEnergy(100*eV);       
     233  opt.SetMaxEnergy(1000*TeV);     
     234  opt.SetDEDXBinning(13*7);     
     235  opt.SetLambdaBinning(13*7);   
    232236}
    233237
  • trunk/examples/extended/electromagnetic/TestEm6/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.8 2006/06/29 16:57:11 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.3 2006/06/29 16:57:14 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.5 2006/06/29 16:57:17 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.12 2006/06/29 16:57:20 gunter Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: RunAction.cc,v 1.13 2008/09/18 16:42:07 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5959   G4bool readOnly  = false;
    6060   G4bool createNew = true;
    61    G4String options = "--noErrors uncompress";
    62    tree = tf->create("testem6.hbook","hbook",readOnly,createNew,options);
    63    //tree = tf->create("testem6.root", "root",readOnly,createNew,options);
     61   G4String options = "--noErrors export=root uncompress";
     62   //tree = tf->create("testem6.hbook","hbook",readOnly,createNew,options);
     63   tree = tf->create("testem6.root", "root",readOnly,createNew,options);
    6464   //tree = tf->create("testem6.XML" ,"XML"  ,readOnly,createNew,options);
    6565   delete tf;
  • trunk/examples/extended/electromagnetic/TestEm6/src/SteppingAction.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.cc,v 1.9 2006/06/29 16:57:23 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm6/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.5 2006/06/29 16:57:25 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.9 2007/06/22 12:44:42 maire Exp $
     1# $Id: GNUmakefile,v 1.11 2008/09/21 16:03:10 vnivanch Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1717#### G4ANALYSIS_USE := true
    1818
    19 ifdef G4ANALYSIS_USE
    20   CPPFLAGS += -DG4ANALYSIS_USE
    21 endif
    22 
    2319include $(G4INSTALL)/config/architecture.gmk
    24 
    25 ifdef G4ANALYSIS_USE
    26   # for the aida-config command see the README file
    27   CPPFLAGS += `aida-config --include`
    28   LOADLIBS += `aida-config --lib`
    29 endif
    3020
    3121include $(G4INSTALL)/config/binmake.gmk
     
    3626
    3727histclean:
    38         rm ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/RunAction.o
     28        rm ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/Histo.o
  • trunk/examples/extended/electromagnetic/TestEm7/TestEm7.cc

    r807 r1230  
    2525//
    2626// $Id: TestEm7.cc,v 1.8 2007/06/22 12:44:42 maire Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorConstruction.hh,v 1.2 2006/06/29 16:57:29 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/DetectorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.hh,v 1.3 2006/06/29 16:57:31 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/EventAction.hh

    r807 r1230  
    2525//
    2626// $Id: EventAction.hh,v 1.2 2006/06/29 16:57:34 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 16:57:36 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/G4ScreenedNuclearRecoil.hh

    r807 r1230  
    2525//
    2626//
    27 // $Id: G4ScreenedNuclearRecoil.hh,v 1.3 2007/12/07 17:51:10 vnivanch Exp $
    28 // GEANT4 tag $Name:  $
     27// G4ScreenedNuclearRecoil.hh,v 1.24 2008/05/01 19:58:59 marcus Exp
     28// GEANT4 tag
    2929//
    3030//
     
    4545//
    4646// First version, April 2004, Marcus H. Mendenhall, Vanderbilt University
     47// May 1, 2008 -- Added code to allow process to have zero cross section above max energy, to coordinate with G4MSC.  -- mhm
    4748//
    4849// Class Description - End
     
    5455#include "globals.hh"
    5556#include "G4VDiscreteProcess.hh"
     57#include "G4ParticleChange.hh"
    5658#include "c2_function.hh"
    5759
     
    5961#include <vector>
    6062
    61 class G4VParticleChange;
     63class G4VNIELPartition;
     64
     65typedef c2_const_ptr<G4double> G4_c2_const_ptr;
     66typedef c2_ptr<G4double> G4_c2_ptr;
     67typedef c2_function<G4double> G4_c2_function;
    6268
    6369typedef struct G4ScreeningTables {
    6470        G4double z1, z2, m1, m2, au, emin;
    65         c2_function<G4double> *EMphiData;
     71        G4_c2_const_ptr EMphiData;
    6672} G4ScreeningTables;
    6773
     
    7076{
    7177public:
    72         G4ScreenedCoulombCrossSectionInfo() { }
    73         ~G4ScreenedCoulombCrossSectionInfo() { }
    74 
    75         const char *CVSHeaderVers() { return
    76                 "";
    77         }
    78 
    79         const char *CVSFileVers() { return ""; }
     78        G4ScreenedCoulombCrossSectionInfo() { }
     79        ~G4ScreenedCoulombCrossSectionInfo() { }
     80       
     81        static const char* CVSHeaderVers() { return
     82                "G4ScreenedNuclearRecoil.hh,v 1.24 2008/05/01 19:58:59 marcus Exp GEANT4 tag ";
     83        }
     84        static const char* CVSFileVers();
    8085};
    8186
     
    114119       
    115120        // get the mean-free-path table for the indexed material
    116         c2_function<G4double> * operator [] (G4int materialIndex) {
    117                         return MFPTables.find(materialIndex)!=MFPTables.end() ? MFPTables[materialIndex] : (c2_function<G4double> *)0;
     121        const G4_c2_function * operator [] (G4int materialIndex) {
     122                        return MFPTables.find(materialIndex)!=MFPTables.end() ? &(MFPTables[materialIndex].get()) : (G4_c2_function *)0;
    118123                }
    119124       
     
    122127        ParticleCache targetMap;
    123128        G4int verbosity;
    124         std::map<G4int, c2_function<G4double> *> sigmaMap; // total cross section for each element
    125         std::map<G4int, c2_function<G4double> *> MFPTables; // MFP for each material
     129        std::map<G4int, G4_c2_const_ptr > sigmaMap; // total cross section for each element
     130        std::map<G4int, G4_c2_const_ptr > MFPTables; // MFP for each material
    126131       
    127132private:
     
    134139        G4ScreenedCoulombCrossSection *crossSection;
    135140        G4double a1, a2, sinTheta, cosTheta, sinZeta, cosZeta, eRecoil;
    136         G4ParticleDefinition *recoilIon;        } G4CoulombKinematicsInfo;
     141        G4ParticleDefinition *recoilIon;       
     142        const G4Material *targetMaterial;
     143} G4CoulombKinematicsInfo;
    137144
    138145class G4ScreenedCollisionStage {
     
    146153
    147154public:
    148         G4ScreenedCoulombClassicalKinematics() { }
     155        G4ScreenedCoulombClassicalKinematics();
    149156        virtual void DoCollisionStep(class G4ScreenedNuclearRecoil *master,
    150157                const class G4Track& aTrack, const class G4Step& aStep);
     
    153160                const G4ScreeningTables *screen,
    154161                G4double eps, G4double beta);
    155         virtual ~G4ScreenedCoulombClassicalKinematics() {}
     162        virtual ~G4ScreenedCoulombClassicalKinematics() { }
     163protected:
     164        // the c2_functions we need to do the work.
     165        c2_const_plugin_function_p<G4double> &phifunc;
     166        c2_linear_p<G4double> &xovereps;
     167        G4_c2_ptr diff;
     168       
    156169};
    157170
     
    165178};
    166179
     180/**
     181        \brief A process which handles screened Coulomb collisions between nuclei
     182 
     183*/
     184
    167185class G4ScreenedNuclearRecoil : public G4ScreenedCoulombCrossSectionInfo, public G4VDiscreteProcess
    168186{
     
    171189        friend class G4ScreenedCollisionStage;
    172190
     191        /// \brief Construct the process and set some physics parameters for it.
     192        /// \param processName the name to assign the process
     193        /// \param ScreeningKey the name of a screening function to use. 
     194        /// The default functions are "zbl" (recommended for soft scattering),
     195        /// "lj" (recommended for backscattering) and "mol" (Moliere potential)
     196        /// \param GenerateRecoils if frue, ions struck by primary are converted into new moving particles.
     197        /// If false, energy is deposited, but no new moving ions are created.
     198        /// \param RecoilCutoff energy below which no new moving particles will be created,
     199        /// even if \a GenerateRecoils is true.
     200        /// Also, a moving primary particle will be stopped if its energy falls below this limit.
     201        /// \param PhysicsCutoff the energy transfer to which screening tables are calucalted. 
     202        /// There is no really
     203        /// compelling reason to change it from the 10.0 eV default.  However, see the paper on running this
     204        /// in thin targets for further discussion, and its interaction with SetMFPScaling()
    173205        G4ScreenedNuclearRecoil(const G4String& processName = "ScreenedElastic",
    174206                        const G4String &ScreeningKey="zbl", G4bool GenerateRecoils=1,
    175207                        G4double RecoilCutoff=100.0*eV, G4double PhysicsCutoff=10.0*eV);
    176        
     208        /// \brief destructor
    177209        virtual ~G4ScreenedNuclearRecoil();
    178        
     210        /// \brief used internally by Geant4 machinery
    179211        virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition* );
    180        
     212        /// \brief used internally by Geant4 machinery
    181213        virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack, const G4Step& aStep);
    182        
     214        /// \brief test if a prticle of type \a aParticleType can use this process
     215        /// \param aParticleType the particle to test
    183216        virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
    184        
     217        /// \brief Build physics tables in advance.  Not Implemented.
     218        /// \param aParticleType the type of particle to build tables for
    185219        virtual void BuildPhysicsTable(const G4ParticleDefinition&) { }
    186        
     220        /// \brief Export physics tables for persistency.  Not Implemented.
     221        /// \param aParticleType the type of particle to build tables for
    187222        virtual void DumpPhysicsTable(const G4ParticleDefinition& aParticleType);
    188        
     223        /// \brief deterine if the moving particle is within  the strong force range of the selected nucleus
     224        /// \param A the nucleon number of the beam
     225        /// \param A1 the nucleon number of the target
     226        /// \param apsis the distance of closest approach
    189227        virtual G4bool CheckNuclearCollision(G4double A, G4double A1, G4double apsis); // return true if hard collision
    190228
    191229        virtual G4ScreenedCoulombCrossSection *GetNewCrossSectionHandler(void);
    192230       
    193         G4double GetNIEL() const { return NIEL; } // Get non-ionizing energy loss for last step
    194        
     231        /// \brief Get non-ionizing energy loss for last step
     232        G4double GetNIEL() const { return NIEL; }
     233       
     234        /// \brief clear precomputed screening tables
    195235        void ResetTables(); // clear all data tables to allow changing energy cutoff, materials, etc.
    196        
     236
     237        /// \brief set the upper energy beyond which this process has no cross section
     238        ///
     239        /// This funciton is used to coordinate this process with G4MSC.  Typically, G4MSC should
     240        ///  not be allowed to operate in a range which overlaps that of this process.  The criterion which is most reasonable
     241        /// is that the transition should be somewhere in the modestly relativistic regime (500 MeV/u for example).
     242        /// \param energy energy per nucleon for the cutoff
     243        void SetMaxEnergyForScattering(G4double energy) { processMaxEnergy=energy; }
     244        /// \brief find out what screening funciton we are using
    197245        std::string GetScreeningKey() const { return screeningKey; }
     246        /// \brief enable or disable all energy deposition by this process
     247        /// \param flag if true, enable deposition of energy (the default).  If false, disable deposition.
    198248        void AllowEnergyDeposition(G4bool flag) { registerDepositedEnergy=flag; }
     249        /// \brief get flag indicating whether deposition is enabled
    199250        G4bool GetAllowEnergyDeposition() const { return registerDepositedEnergy; }
     251        /// \brief enable or disable the generation of recoils. 
     252        /// If recoils are disabled, the energy they would have received is just deposited.
     253        /// \param flag if true, create recoil ions in cases in which the energy is above the recoilCutoff. 
     254        /// If false, just deposit the energy.
    200255        void EnableRecoils(G4bool flag) { generateRecoils=flag; }
     256        /// \brief find out if generation of recoils is enabled.
    201257        G4bool GetEnableRecoils() const { return generateRecoils; }
     258        /// \brief set the mean free path scaling as specified
     259        /// \param scale the factor by which the default MFP will be scaled. 
     260        /// Set to less than 1 for very thin films, typically, to sample multiple scattering,
     261        /// or to greater than 1 for quick simulaitons with a very long flight path.
    202262        void SetMFPScaling(G4double scale) { MFPScale=scale; }
     263        /// \brief get the MFPScaling parameter
    203264        G4double GetMFPScaling() const { return MFPScale; }
     265        /// \brief enable or disable whether this process will skip collisions
     266        /// which are close enough they need hadronic phsyics. Default is true (skip close collisions).
     267        /// Disabling this results in excess nuclear stopping power.
     268        /// \param flag true results in hard collisions being skipped.  false allows hard collisions.
    204269        void AvoidNuclearReactions(G4bool flag) { avoidReactions=flag; }
     270        /// \brief get the flag indicating whether hadronic collisions are ignored.
    205271        G4bool GetAvoidNuclearReactions() const { return avoidReactions; }
     272        /// \brief set the minimum energy (per nucleon) at which recoils can be generated,
     273        /// and the energy (per nucleon) below which all ions are stopped.
     274        /// \param energy energy per nucleon
    206275        void SetRecoilCutoff(G4double energy) { recoilCutoff=energy; }
     276        /// \brief get the recoil cutoff
    207277        G4double GetRecoilCutoff() const { return recoilCutoff; }
     278        /// \brief set the energy to which screening tables are computed.  Typically, this is 10 eV or so, and not often changed.
     279        /// \param energy the cutoff energy
    208280        void SetPhysicsCutoff(G4double energy) { physicsCutoff=energy; ResetTables(); }
     281        /// \brief get the physics cutoff energy.
    209282        G4double GetPhysicsCutoff() const { return physicsCutoff; }
    210         class G4ParticleChange &GetParticleChange() { return aParticleChange; }
    211         void AddToNIEL(G4double energy) { NIEL+=energy; }
     283        /// \brief set the pointer to a class for paritioning energy into NIEL
     284        /// \brief part the pointer to the class.
     285        void SetNIELPartitionFunction(const G4VNIELPartition *part);
     286        /// \brief set the cross section boost to provide faster computation of backscattering
     287        /// \param fraction the fraction of particles to have their cross section boosted.
     288        /// \param HardeningFactor the factor by which to boost the scattering cross section.
    212289        void SetCrossSectionHardening(G4double fraction, G4double HardeningFactor) {
    213290                hardeningFraction=fraction;
    214291                hardeningFactor=HardeningFactor;
    215292        }
     293        /// \brief get the fraction of particles which will have boosted scattering
    216294        G4double GetHardeningFraction() const { return hardeningFraction; }
     295        /// \brief get the boost factor in use.
    217296        G4double GetHardeningFactor() const { return hardeningFactor; }
     297        /// \brief the the interaciton length used in the last scattering.
    218298        G4double GetCurrentInteractionLength() const { return currentInteractionLength; }
     299        /// \brief set a function to compute screening tables, if the user needs non-standard behavior.
     300        /// \param cs a class which constructs the screening tables.
    219301        void SetExternalCrossSectionHandler(G4ScreenedCoulombCrossSection *cs) {
    220302                externalCrossSectionConstructor=cs;
    221303        }
     304        /// \brief get the verbosity.
    222305        G4int GetVerboseLevel() const { return verboseLevel; }
     306
    223307        std::map<G4int, G4ScreenedCoulombCrossSection*> &GetCrossSectionHandlers()
    224308                { return crossSectionHandlers; }
     
    228312        void SetValidCollision(G4bool flag) { validCollision=flag; }
    229313        G4bool GetValidCollision() const { return validCollision; }
     314
     315        /// \brief get the pointer to our ParticleChange object.  for internal use, primarily.
     316        class G4ParticleChange &GetParticleChange() { return static_cast<G4ParticleChange &>(*pParticleChange); }
     317        /// \brief take the given energy, and use the material information to partition it into NIEL and ionizing energy.
     318        void DepositEnergy(G4int z1, G4double a1, const G4Material *material, G4double energy);
    230319       
    231320protected:
    232         G4double highEnergyLimit, lowEnergyLimit;
     321        /// \brief the energy per nucleon above which the MFP is constant
     322        G4double highEnergyLimit;
     323        /// \brief the energy per nucleon below which the MFP is zero
     324        G4double lowEnergyLimit;
     325        /// \brief the energy per nucleon beyond which the cross section is zero, to cross over to G4MSC
     326        G4double processMaxEnergy;
    233327        G4String screeningKey;
    234328        G4bool generateRecoils, avoidReactions;
    235329        G4double recoilCutoff, physicsCutoff;
    236330        G4bool registerDepositedEnergy;
    237         G4double NIEL;
     331        G4double IonizingLoss, NIEL;
    238332        G4double MFPScale;
    239333        G4double hardeningFraction, hardeningFactor;
     
    243337       
    244338        std::map<G4int, G4ScreenedCoulombCrossSection*> crossSectionHandlers;           
    245         std::map<G4int, c2_function<G4double>*> meanFreePathTables;
    246339       
    247340        G4bool validCollision;
    248341        G4CoulombKinematicsInfo kinematics;
    249 
     342        const G4VNIELPartition *NIELPartitionFunction;
    250343};
    251344
     
    268361        std::vector<G4String> GetScreeningKeys() const;
    269362       
    270         typedef c2_function<G4double> &(*ScreeningFunc)(G4int z1, G4int z2, size_t nPoints, G4double rMax, G4double *au);
     363        typedef G4_c2_function &(*ScreeningFunc)(G4int z1, G4int z2, size_t nPoints, G4double rMax, G4double *au);
    271364       
    272365        void AddScreeningFunction(G4String name, ScreeningFunc fn) {
     
    279372};
    280373
    281 
     374G4_c2_function &ZBLScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval);
     375G4_c2_function &MoliereScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval);
     376G4_c2_function &LJScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval);
     377G4_c2_function &LJZBLScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval);
    282378
    283379#endif
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysListEmLivermore.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmLivermore.hh,v 1.1 2006/11/22 18:56:20 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysListEmPenelope.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmPenelope.hh,v 1.1 2006/11/22 18:56:21 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.3 2006/06/29 16:57:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysListEmStandardNR.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandardNR.hh,v 1.1 2008/01/14 12:11:38 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysListEmStandardSS.hh

    r807 r1230  
    2525//
    2626// $Id: PhysListEmStandardSS.hh,v 1.1 2006/10/24 11:37:56 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysicsList.hh

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.hh,v 1.6 2006/11/22 18:56:21 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.hh,v 1.8 2008/11/20 20:34:50 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939
    4040#include "G4VModularPhysicsList.hh"
     41#include "G4EmConfigurator.hh"
    4142#include "globals.hh"
    4243
     
    5051{
    5152public:
     53
    5254  PhysicsList();
    5355  virtual ~PhysicsList();
     
    6769
    6870private:
     71
     72  G4EmConfigurator em_config;
     73
    6974  G4double cutForGamma;
    7075  G4double cutForElectron;
     
    7782  G4String                             emName;
    7883  G4VPhysicsConstructor*               emPhysicsList;
     84  G4VPhysicsConstructor*               decPhysicsList;
    7985  std::vector<G4VPhysicsConstructor*>  hadronPhys;
    8086   
  • trunk/examples/extended/electromagnetic/TestEm7/include/PhysicsListMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.hh,v 1.3 2006/06/29 16:57:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 16:57:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/PrimaryGeneratorMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.hh,v 1.3 2006/06/29 16:57:56 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/RunAction.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.hh,v 1.12 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.hh,v 1.14 2008/08/22 18:30:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4040class PrimaryGeneratorAction;
    4141class G4Run;
    42 
    43 namespace AIDA {
    44  class IAnalysisFactory;
    45  class ITree;
    46  class IHistogram1D;
    47 }
     42class Histo;
    4843
    4944//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5247{
    5348public:
    54   RunAction(DetectorConstruction*, PhysicsList*,PrimaryGeneratorAction*);
     49  RunAction(DetectorConstruction*, PhysicsList*,
     50            PrimaryGeneratorAction*);
    5551  virtual ~RunAction();
    5652
     
    5854  void   EndOfRunAction(const G4Run*);
    5955   
    60   void FillTallyEdep(G4int n, G4double e) {tallyEdep[n] += e;};
     56  void FillTallyEdep(G4int n, G4double e)  {tallyEdep[n] += e;};
    6157  void FillEdep(G4double de, G4double eni) {edeptot += de; eniel += eni;};
    6258       
    6359  G4double GetBinLength() {return binLength;};
    6460  G4double GetLength()    {return length;};
    65   G4double GetOffsetX()   {return offsetX;}
    66   void     FillHisto(G4int id, G4double x, G4double weight = 1.0);
     61  G4double GetOffsetX()   {return offsetX;}
     62 
     63  void FillHisto(G4int id, G4double x, G4double weight = 1.0);
    6764   
    68   void AddProjRange (G4double x) {projRange += x; projRange2 += x*x;};
     65  void AddProjRange (G4double x)
     66  {projRange += x; projRange2 += x*x; nRange++;};
    6967  void AddPrimaryStep() {nPrimarySteps++;};
    7068                   
    7169private: 
    72   void bookHisto();
    73   void cleanHisto();
    7470   
    75 private:
    7671  DetectorConstruction*   detector;
    7772  PhysicsList*            physics;
     
    8479  G4double                edeptot, eniel;
    8580  G4int                   nPrimarySteps;
    86            
    87   AIDA::IAnalysisFactory* af; 
    88   AIDA::ITree*            tree;
    89   AIDA::IHistogram1D*     histo[1];       
     81  G4int                   nRange;
     82
     83  Histo*                  histo;
    9084};
    9185
  • trunk/examples/extended/electromagnetic/TestEm7/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.3 2006/06/29 16:58:01 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:58:03 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/SteppingAction.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingAction.hh,v 1.2 2006/06/29 16:58:05 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/SteppingVerbose.hh

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.hh,v 1.2 2006/06/29 16:58:07 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/TrackingAction.hh

    r807 r1230  
    2525//
    2626// $Id: TrackingAction.hh,v 1.2 2006/06/29 16:58:09 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/include/c2_function.hh

    r807 r1230  
     1//
     2// ********************************************************************
     3// * License and Disclaimer                                           *
     4// *                                                                  *
     5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
     6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
     7// * conditions of the Geant4 Software License,  included in the file *
     8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
     9// * include a list of copyright holders.                             *
     10// *                                                                  *
     11// * Neither the authors of this software system, nor their employing *
     12// * institutes,nor the agencies providing financial support for this *
     13// * work  make  any representation or  warranty, express or implied, *
     14// * regarding  this  software system or assume any liability for its *
     15// * use.  Please see the license in the file  LICENSE  and URL above *
     16// * for the full disclaimer and the limitation of liability.         *
     17// *                                                                  *
     18// * This  code  implementation is the result of  the  scientific and *
     19// * technical work of the GEANT4 collaboration.                      *
     20// * By using,  copying,  modifying or  distributing the software (or *
     21// * any work based  on the software)  you  agree  to acknowledge its *
     22// * use  in  resulting  scientific  publications,  and indicate your *
     23// * acceptance of all terms of the Geant4 Software license.          *
     24// ********************************************************************
     25//
     26//
    127/**
    228 *  \file
     
    733 *  \author Copyright 2005 __Vanderbilt University__. All rights reserved.
    834 *
    9  *      \version c2_function.hh,v 1.53 2007/11/12 13:58:57 marcus Exp
     35 *      \version c2_function.hh,v 1.238 2008/05/22 12:45:19 marcus Exp
     36 *  \see \ref c2_factory "Factory Functions" for information on constructing things in here 
    1037 */
    1138
    12 #ifndef __has_C2Functions_c2_h
    13 #define __has_C2Functions_c2_h 1
     39#ifndef __has_c2_function_hh
     40#define __has_c2_function_hh 1
     41
     42// MSVC does not automatically define numerical constants such as M_PI without this.
     43// this came from the msdn website, so it should be right...
     44#ifdef _MSC_VER
     45#define _USE_MATH_DEFINES
     46#define c2_isnan _isnan
     47#define c2_isfinite _finite
     48#else
     49#define c2_isnan std::isnan
     50#define c2_isfinite std::isfinite
     51#endif
    1452
    1553#include <cmath>
    1654#include <vector>
     55#include <utility>
    1756#include <string>
     57#include <stdexcept>
     58#include <typeinfo>
     59#include <sstream>
    1860
    1961/// \brief the exception class for c2_function operations.
     
    3274
    3375// put these forward references here, and with a bogus typename to make swig happy.
    34 template <typename float_type> class c2_composed_function;
    35 template <typename float_type> class c2_sum;
    36 template <typename float_type> class c2_diff;
    37 template <typename float_type> class c2_product;
    38 template <typename float_type> class c2_ratio;
     76template <typename float_type> class c2_composed_function_p;
     77template <typename float_type> class c2_sum_p;
     78template <typename float_type> class c2_diff_p;
     79template <typename float_type> class c2_product_p;
     80template <typename float_type> class c2_ratio_p;
     81template <typename float_type> class c2_piecewise_function_p;
     82template <typename float_type> class c2_quadratic_p;
     83template <typename float_type> class c2_ptr;
     84/**
     85        \defgroup abstract_classes Abstract Classes
     86        \defgroup arithmetic_functions Arithmetic Functions
     87        \defgroup math_functions Mathemetical Functions
     88        \defgroup parametric_functions Parametric Families of Functions
     89        \defgroup interpolators Interpolating Functions
     90        \defgroup containers Functions which are containers for, or functions of, other functions
     91        \defgroup factories Factory classes which reduce silly template typing
     92        \defgroup transforms Classes which provide coordinate system transformations, wih derivatives
     93*/
     94
     95/// \brief structure used to hold evaluated function data at a point. 
     96///
     97/// Contains all the information for the function at one point.
     98template <typename float_type> class c2_fblock
     99{       
     100public:
     101        /// \brief the abscissa
     102        float_type x;
     103        /// \brief the value of the function at \a x
     104        float_type y;
     105        /// \brief the derivative at \a x
     106        float_type yp;
     107        /// \brief the second derivative at \a x
     108        float_type ypp;
     109        /// flag, filled in by c2_function::fill_fblock(), indicating the derivative is NaN of Inf
     110        bool ypbad;
     111        /// flag, filled in by c2_function::fill_fblock(), indicating the second derivative is NaN of Inf
     112        bool yppbad;
     113};
    39114
    40115/**
    41116 \brief the parent class for all c2_functions.
    42 
     117 \ingroup abstract_classes
    43118  c2_functions know their value, first, and second derivative at almost every point.
    44119  They can be efficiently combined with binary operators, via c2_binary_function,
    45   composed via c2_composed_function,
     120  composed via c2_composed_function_,
    46121  have their roots found via find_root(),
    47122  and be adaptively integrated via partial_integrals() or integral().
     
    53128    log_log_interpolating_function, and arrhenius_interpolating_function,
    54129    as well as the template functions
    55     inverse_integrated_density().
     130    inverse_integrated_density_function().
    56131 
    57  \warning
    58  The composite flavors of c2_functions (c2_sum, c2_composed_function, c2_binary_function, e.g.) make no effort to manage
    59  deletion of their component functions.
    60  These are just container classes, and the user (along with normal automatic variable semantics)
    61  is responsible for the lifetime of components.
    62  Inappropriate attention to this can cause massive memory leaks. 
    63  However, in most cases these do exactly what is intended.
    64  The classes will be left this way since the only other option is to use copy constructors on everything,
    65  which would make this all very slow.
     132 For a discussion of memory management, see \ref memory_management
    66133 
    67134 */
     
    71138    /// \return the CVS Id string
    72139        const std::string cvs_header_vers() const { return
    73                 "c2_function.hh,v 1.53 2007/11/12 13:58:57 marcus Exp";
     140                "c2_function.hh,v 1.238 2008/05/22 12:45:19 marcus Exp";
    74141        }
    75142       
     
    80147public:
    81148    /// \brief destructor
    82         virtual ~c2_function() { if(sampling_grid && !no_overwrite_grid) delete sampling_grid; }
     149        virtual ~c2_function() {
     150                if(sampling_grid && !no_overwrite_grid) delete sampling_grid;   
     151                if(root_info) delete root_info;
     152                if(owner_count) {
     153                        std::ostringstream outstr;
     154                        outstr << "attempt to delete an object with non-zero ownership in class ";
     155                        outstr << typeid(*this).name() << std::endl;
     156                        throw c2_exception(outstr.str().c_str());
     157                }
     158        }
    83159       
    84160        /// \brief get the value and derivatives.
     
    97173        inline float_type operator () (float_type x) const throw(c2_exception)
    98174        { return value_with_derivatives(x, (float_type *)0, (float_type *)0); }
    99 
    100     /// \brief compose this function outside another.
    101     /// \param inner the inner function
    102     /// \return the composed function
    103         c2_composed_function<float_type> & operator ()(const c2_function<float_type> &inner) const
    104                 { return *new c2_composed_function<float_type>((*this), inner); }
    105175
    106176        /// \brief get the value and derivatives.
     
    130200    /// \param[out] final_yprime2 If pointer is not zero, return second derivative of function at root
    131201    /// \return the position of the root.
     202        /// \see \ref rootfinder_subsec "Root finding sample"
    132203        float_type find_root(float_type lower_bracket, float_type upper_bracket, float_type start,
    133204        float_type value, int *error=0,
     
    151222    /// with no error checking.
    152223    /// \param extrapolate if true, use simple Richardson extrapolation on the final 2 steps to reduce the error.
    153     /// \return sum of partial integrals, whcih is the definite integral from the first value in \a xgrid to the last.
     224    /// \return sum of partial integrals, which is the definite integral from the first value in \a xgrid to the last.
    154225        float_type partial_integrals(std::vector<float_type> xgrid, std::vector<float_type> *partials = 0,
    155           float_type abs_tol=1e-12, float_type rel_tol=1e-12, int derivs=2, bool adapt=true, bool extrapolate=true) const;
     226          float_type abs_tol=1e-12, float_type rel_tol=1e-12, int derivs=2, bool adapt=true, bool extrapolate=true)
     227                const throw(c2_exception);
    156228       
    157229    /// \brief a fully-automated integrator which uses the information provided by the get_sampling_grid() function
     
    164236        /// \param xmax upper bound of the domain for integration
    165237    /// \param partials if non-NULL, a vector in which to receive the partial integrals.
    166         /// It will automatically be sized apprpropriately, if provided, to contain \a n - 1 elements where \a n is the length of \a xgrid 
     238        /// It will automatically be sized appropriately, if provided, to contain \a n - 1 elements where \a n is the length of \a xgrid 
    167239    /// \param abs_tol the absolute error bound for each segment
    168240    /// \param rel_tol the fractional error bound for each segment. 
     
    173245    /// with no error checking.
    174246    /// \param extrapolate if true, use simple Richardson extrapolation on the final 2 steps to reduce the error.
    175     /// \return sum of partial integrals, whcih is the definite integral from the first value in \a xgrid to the last.
     247    /// \return sum of partial integrals, which is the definite integral from the first value in \a xgrid to the last.
    176248        float_type integral(float_type xmin, float_type xmax, std::vector<float_type> *partials = 0,
    177              float_type abs_tol=1e-12, float_type rel_tol=1e-12, int derivs=2, bool adapt=true, bool extrapolate=true) const;
    178 
     249             float_type abs_tol=1e-12, float_type rel_tol=1e-12, int derivs=2, bool adapt=true, bool extrapolate=true)
     250                const throw(c2_exception);
     251
     252        /// \brief create a c2_piecewise_function_p from c2_connector_function_p segments which
     253        /// is a representation of the parent function to the specified accuracy, but maybe much cheaper to evaluate
     254        ///
     255        /// This method has three modes, depending on the \a derivs flag.
     256        ///
     257        /// If \a derivs is 2,
     258        /// it computes a c2_piecewise_function_p representation of its parent function, which may be a much faster
     259        /// function to use in codes if the parent function is expensive.  If \a xvals and \a yvals are non-null,
     260        /// it will also fill them in with the function values at each grid point the adaptive algorithm chooses.
     261        ///
     262        /// If \a derivs is 1, this does not create the connectors,
     263        /// and returns an null pointer, but will fill in the \a xvals and \a yvals
     264        /// vectors with values of the function at points such that the linear interpolation error between the points
     265        /// is bounded by the tolerance values given.  Because it uses derivative information from the function to manage the
     266        /// error control, it is almost completely free of issues with missing periods of oscillatory functions,
     267        /// even with no information provided in the sampling grid.
     268        /// This is typically useful for sampling a function for plotting.
     269        ///
     270        /// If \a derivs is 0, this does something very like what it does if \a derivs = 1, but without derivatives. 
     271        /// Instead, to compute the intermediate value of the function for error control, it just uses
     272        /// 3-point parabolic interpolation.  This is useful amost exclusively for converting a non-c2_function,
     273        /// with no derivatives, but wrapped in a c2_classic_function wrapper, into a table of values to seed an interpolating_function_p.
     274        /// Note, however, that without derivatives, this is very susceptible to missing periods of oscillatory
     275        /// functions, so it is important to set a sampling grid which isn't too much coarser than the typical oscillations.
     276        ///
     277        /// \note the \a sampling_grid of the returned function matches the \a sampling_grid of its parent.
     278        /// \see \ref sample_function_for_plotting "Adaptive Sampling Examples"
     279    /// \param xmin lower bound of the domain for sampling
     280        /// \param xmax upper bound of the domain for sampling
     281    /// \param abs_tol the absolute error bound for each segment
     282    /// \param rel_tol the fractional error bound for each segment.
     283        /// \param derivs if 0 or 1, return a useless function, but fill in the \a xvals and \a yvals vectors (if non-null).
     284        /// Also, if 0 or 1, tolerances refer to linear interpolation, not high-order interpolation.
     285        /// If 2, return a full piecewise collection of c2_connector_function_p segments.  See discussion above.
     286        /// \param [in,out] xvals vector of abscissas at which the function was actually sampled (if non-null)
     287        /// \param [in,out] yvals vector of function values corresponding to \a xvals (if non-null)
     288        /// \return a new, sampled representation, if \a derivs is 2.  A null pointer if \a derivs is 0 or 1.
     289        c2_piecewise_function_p<float_type> *adaptively_sample(float_type xmin, float_type xmax,
     290                 float_type abs_tol=1e-12, float_type rel_tol=1e-12,
     291                 int derivs=2, std::vector<float_type> *xvals=0, std::vector<float_type> *yvals=0) const throw(c2_exception);
     292       
    179293        /// \brief return the lower bound of the domain for this function as set by set_domain()
    180294        inline float_type xmin() const { return fXMin; }
     
    186300        /// \brief this is a counter owned by the function but which can be used to monitor efficiency of algorithms.
    187301        ///
    188         /// It is not maintained automatically in general! 
    189         /// The adaptive integrator and root finder do clear it at the start and update it for performance checking.
     302        /// It is not maintained automatically in general!  The root finder, integrator, and sampler do increment it.
    190303        /// \return number of evaluations logged since last reset.
    191         volatile int get_evaluations() const { return evaluations; }
     304        volatile size_t get_evaluations() const { return evaluations; }
    192305        /// \brief reset the counter
    193306        void reset_evaluations()  const { evaluations=0; } // evaluations are 'invisible' to constant
     
    200313        /// \param message an informative string to include in an exception if this throws c2_exception
    201314        /// \return true if in decreasing order, false if increasing
    202         bool check_monotonicity(const std::vector<float_type> &data, const char message[]) throw(c2_exception);
     315        bool check_monotonicity(const std::vector<float_type> &data, const char message[]) const throw(c2_exception);
    203316       
    204317        /// \brief establish a grid of 'interesting' points on the function.
     
    212325        virtual void set_sampling_grid(const std::vector<float_type> &grid) throw(c2_exception);
    213326       
     327        /// \brief get the sampling grid, which may be a null pointer
     328        /// \return pointer to the sampling grid
     329        std::vector<float_type> *get_sampling_grid_pointer() const { return sampling_grid; }
     330       
    214331    /// \brief return the grid of 'interesting' points along this function which lie in the region requested
    215332        ///
     
    217334        /// \param xmin the lower bound for which the function is to be sampled
    218335        /// \param xmax the upper bound for which the function is to be sampled
    219         /// \return a new vector containing the samplng grid.
    220         virtual std::vector<float_type> &get_sampling_grid(float_type xmin, float_type xmax) const ;
     336        /// \param [in,out] grid filled vector containing the samplng grid.
     337        virtual void get_sampling_grid(float_type xmin, float_type xmax, std::vector<float_type> &grid) const ;
    221338       
    222339        /// \brief clean up endpoints on a grid of points
    223         ///
    224340        /// \param[in,out] result the sampling grid with excessively closely space endpoints removed.
    225341        /// The grid is modified in place.
    226342        void preen_sampling_grid(std::vector<float_type> *result) const;               
    227343        /// \brief refine a grid by splitting each interval into more intervals
    228         /// \param grid the grid to refine
     344        /// \param [in,out] grid the grid to refine in place
    229345        /// \param refinement the number of new steps for each old step
    230         /// \return a new sampling grid with more points.
    231         std::vector<float_type> & refine_sampling_grid(const std::vector<float_type> &grid, size_t refinement) const;           
     346        void refine_sampling_grid(std::vector<float_type> &grid, size_t refinement) const;             
    232347       
    233348        /// \brief create a new c2_function from this one which is normalized on the interval
     
    236351        /// \param norm the desired integral for the function over the region
    237352        /// \return a new c2_function with the desired \a norm.
    238         c2_function<float_type> &normalized_function(float_type xmin, float_type xmax, float_type norm=1.0);
     353        c2_function<float_type> &normalized_function(float_type xmin, float_type xmax, float_type norm=1.0) const throw(c2_exception);
    239354        /// \brief create a new c2_function from this one which is square-normalized on the interval
    240355    /// \param xmin lower bound of the domain for integration
     
    242357        /// \param norm the desired integral for the function over the region
    243358        /// \return a new c2_function with the desired \a norm.
    244         c2_function<float_type> &square_normalized_function(float_type xmin, float_type xmax, float_type norm=1.0);
     359        c2_function<float_type> &square_normalized_function(float_type xmin, float_type xmax, float_type norm=1.0) const throw(c2_exception);
    245360        /// \brief create a new c2_function from this one which is square-normalized with the provided \a weight on the interval
    246361    /// \param xmin lower bound of the domain for integration
     
    249364        /// \param norm the desired integral for the function over the region
    250365        /// \return a new c2_function with the desired \a norm.
    251         c2_function<float_type> &square_normalized_function(float_type xmin, float_type xmax, const c2_function<float_type> &weight, float_type norm=1.0);
    252 
    253         /// \brief factory function to create a c2_sum from an regular algebraic expression.
    254         /// \note
    255         /// be very wary of ownership issues if this is used in a complex expression.
    256         c2_sum<float_type> &operator + (const c2_function<float_type> &rhs)  { return *new c2_sum<float_type>(*this, rhs); }
    257         /// \brief factory function to create a c2_diff from an regular algebraic expression.
    258         /// \note
    259         /// be very wary of ownership issues if this is used in a complex expression.
    260         c2_diff<float_type> &operator - (const c2_function<float_type> &rhs)  { return *new c2_diff<float_type>(*this, rhs); }
    261         /// \brief factory function to create a c2_product from an regular algebraic expression.
    262         /// \note
    263         /// be very wary of ownership issues if this is used in a complex expression.
    264         c2_product<float_type> &operator * (const c2_function<float_type> &rhs)  { return *new c2_product<float_type>(*this, rhs); }
    265         /// \brief factory function to create a c2_ratio from an regular algebraic expression.
    266         /// \note
    267         /// be very wary of ownership issues if this is used in a complex expression.
    268         c2_ratio<float_type> &operator / (const c2_function<float_type> &rhs)  { return *new c2_ratio<float_type>(*this, rhs); }
    269        
    270 
    271        
    272         std::vector<float_type> *sampling_grid;
    273         bool no_overwrite_grid;
    274            
     366        c2_function<float_type> &square_normalized_function(
     367                float_type xmin, float_type xmax, const c2_function<float_type> &weight, float_type norm=1.0)
     368                const throw(c2_exception);
     369
     370        /// \brief factory function to create a c2_sum_p from a regular algebraic expression.
     371        /// \param rhs the right-hand term of the sum
     372        /// \return a new c2_function
     373        c2_sum_p<float_type> &operator + (const c2_function<float_type> &rhs)  const
     374                { return *new c2_sum_p<float_type>(*this, rhs); }
     375        /// \brief factory function to create a c2_diff_p from a regular algebraic expression.
     376        /// \param rhs the right-hand term of the difference
     377        /// \return a new c2_function
     378        c2_diff_p<float_type> &operator - (const c2_function<float_type> &rhs)  const
     379                { return *new c2_diff_p<float_type>(*this, rhs); }
     380        /// \brief factory function to create a c2_product_p from a regular algebraic expression.
     381        /// \param rhs the right-hand term of the product
     382        /// \return a new c2_function
     383        c2_product_p<float_type> &operator * (const c2_function<float_type> &rhs) const
     384                { return *new c2_product_p<float_type>(*this, rhs); }
     385        /// \brief factory function to create a c2_ratio_p from a regular algebraic expression.
     386        /// \param rhs the right-hand term of the ratio (the denominator)
     387        /// \return a new c2_function
     388        c2_ratio_p<float_type> &operator / (const c2_function<float_type> &rhs)  const
     389                { return *new c2_ratio_p<float_type>(*this, rhs); }
     390    /// \brief compose this function outside another.
     391    /// \param inner the inner function
     392    /// \return the composed function
     393        /// \anchor compose_operator
     394        c2_composed_function_p<float_type> & operator ()(const c2_function<float_type> &inner) const
     395                { return *new c2_composed_function_p<float_type>((*this), inner); }
     396
     397        /// \brief Find out where a calculation ran into trouble, if it got a nan.
     398        /// If the most recent computation did not return a nan, this is undefined.
     399        /// \return \a x value of point at which something went wrong, if integrator (or otherwise) returned a nan.
     400        float_type get_trouble_point() const { return bad_x_point; }
     401       
     402        /// \brief increment our reference count.  Destruction is only legal if the count is zero.
     403        void claim_ownership() const { owner_count++; }
     404        /// \brief decrement our reference count. Do not destroy at zero.
     405        /// \return final owner count, to check whether object should disappear.
     406        size_t release_ownership_for_return() const throw(c2_exception) {
     407                if(!owner_count) {
     408                        std::ostringstream outstr;
     409                        outstr << "attempt to release ownership of an unowned function in class ";
     410                        outstr << typeid(*this).name() << std::endl;
     411                        throw c2_exception(outstr.str().c_str());
     412                }
     413                owner_count--;
     414                return owner_count;
     415        }
     416        /// \brief decrement our reference count. If the count reaches zero, destroy ourself.
     417        void release_ownership() const throw(c2_exception) {
     418                if(!release_ownership_for_return()) delete this;
     419        }
     420        /// \brief get the reference count, mostly for debugging
     421        /// \return the count
     422        size_t count_owners() const { return owner_count; }
     423
    275424protected:
    276425        c2_function(const c2_function<float_type>  &src) : sampling_grid(0),
    277426                no_overwrite_grid(false),
    278         fXMin(src.fXMin), fXMax(src.fXMax), rootInitialized(false)
     427        fXMin(src.fXMin), fXMax(src.fXMax), root_info(0), owner_count(0)
    279428        {} // copy constructor only copies domain, and is only for internal use
    280429        c2_function() :
    281430                        sampling_grid(0), no_overwrite_grid(0),
    282431        fXMin(-std::numeric_limits<float_type>::max()),
    283         fXMax(std::numeric_limits<float_type>::max()),
    284         rootInitialized(false)
     432        fXMax(std::numeric_limits<float_type>::max()), root_info(0), owner_count(0)
    285433                {} // prevent accidental naked construction (impossible any since this has pure virtual methods)
    286434       
     
    293441                }
    294442       
     443        std::vector<float_type> * sampling_grid;
     444        bool no_overwrite_grid;
     445       
    295446        float_type fXMin, fXMax;
    296         mutable int evaluations;
    297        
     447        mutable size_t evaluations;
     448        /// \brief this point may be used to record where a calculation ran into trouble
     449        mutable float_type bad_x_point;
     450public:
     451        /// \brief fill in a c2_fblock<float_type>... a shortcut for the integrator & sampler
     452        /// \param [in,out] fb the block to fill in with information
     453        inline void fill_fblock(c2_fblock<float_type> &fb) const throw(c2_exception)
     454        {
     455                fb.y=value_with_derivatives(fb.x, &fb.yp, &fb.ypp);
     456                fb.ypbad=c2_isnan(fb.yp) || !c2_isfinite(fb.yp);
     457                fb.yppbad=c2_isnan(fb.ypp) || !c2_isfinite(fb.ypp);
     458                increment_evaluations();
     459        }
     460
    298461private:
    299         /// \brief structure used for recursion in adaptive integrator. 
    300         ///
    301         /// Contains all the information for the function at one point.
    302         struct c2_integrate_fblock {    float_type x, y, yp, ypp; };
    303         /// \brief structure used to pass information recursively.
     462        /// \brief the data element for the internal recursion stack for the sampler and integrator
     463        struct recur_item {
     464                c2_fblock<float_type> f1; size_t depth;
     465                float_type previous_estimate, abs_tol, step_sum;
     466                bool done;
     467                size_t f0index, f2index;
     468        };
     469       
     470
     471        /// \brief structure used to pass information recursively in integrator.
    304472        ///
    305473        /// the \a abs_tol is scaled by a factor of two at each division. 
    306474        /// Everything else is just passed down.
    307         struct c2_integrate_recur { struct c2_integrate_fblock *f0, *f1, *f2;
    308                 float_type abs_tol, rel_tol, *lr, eps_scale, extrap_coef, extrap2;
    309                 int depth, derivs;
    310                 bool adapt, extrapolate;
     475        struct c2_integrate_recur {
     476                c2_fblock<float_type> *f0, *f1;
     477                float_type abs_tol, rel_tol, eps_scale, extrap_coef, extrap2, dx_tolerance, abs_tol_min;
     478                std::vector< recur_item > *rb_stack;
     479                int  derivs;
     480                bool adapt, extrapolate, inited;
     481        };
     482
     483        /// \brief structure used to pass information recursively in sampler.
     484        ///
     485        struct c2_sample_recur {
     486                c2_fblock<float_type> *f0, *f1;
     487                float_type abs_tol, rel_tol, dx_tolerance, abs_tol_min;
     488                int derivs;
     489                c2_piecewise_function_p<float_type> *out;
     490                std::vector<float_type> *xvals, *yvals;
     491                std::vector< recur_item > *rb_stack;
     492                bool inited;
     493        };
     494
     495        /// \brief structure used to hold root bracketing information
     496        ///
     497        struct c2_root_info {
     498                c2_fblock<float_type> lower, upper;
     499                bool inited;
    311500        };
    312501       
     
    316505    /// to allow very efficient recursion.
    317506    /// \param rb a pointer to the recur struct.
    318         float_type integrate_step(struct c2_integrate_recur &rb) const;
     507        float_type integrate_step(struct c2_integrate_recur &rb) const throw(c2_exception);
    319508   
    320     /// these carry a memory of the last root bracketing,
     509    /// \brief Carry out the recursive subdivision for sampling.
     510    ///
     511    /// This passes information recursively through the \a recur block pointer
     512    /// to allow very efficient recursion.
     513    /// \param rb a pointer to the recur struct.
     514        void sample_step(struct c2_sample_recur &rb) const throw(c2_exception);
     515
     516    /// this carry a memory of the last root bracketing,
    321517    /// to avoid the necessity of evaluating the function on the brackets every time
    322518    /// if the brackets have not been changed.
    323     mutable float_type lastRootLowerX, lastRootUpperX, lastRootLowerY, lastRootUpperY;
    324     mutable int rootInitialized;
    325        
    326 };
    327 
     519        /// it is declared as a pointer, since many c2_functions may never need one allocated
     520    mutable struct  c2_root_info *root_info;
     521       
     522        mutable size_t owner_count;
     523};
     524
     525/// \brief a container into which any conventional c-style function can be dropped,
     526/// to create a degenerate c2_function without derivatives.
     527/// Mostly useful for sampling into interpolating functions.
     528/// construct a reference to this with c2_classic_function()
     529/// \ingroup containers
     530/// The factory function c2_factory::classic_function() creates *new c2_classic_function_p()
     531template <typename float_type=double> class c2_classic_function_p : public c2_function<float_type> {
     532public:
     533        /// \brief construct the container
     534        /// \param c_func a pointer to a conventional c-style function
     535        c2_classic_function_p(const float_type (*c_func)(float_type)) : c2_function<float_type>(), func(c_func)  {}
     536
     537        /// \copydoc c2_function::value_with_derivatives
     538        /// Uses the internal function pointer set by set_function().
     539        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     540        {
     541                if(!func) throw c2_exception("c2_classic_function called with null function");
     542                if(yprime) *yprime=0;
     543                if(yprime2) *yprime2=0;
     544                return func(x);
     545        }
     546        ~c2_classic_function_p() { }
     547       
     548protected:
     549        /// \brief pointer to our function
     550        const float_type (*func)(float_type);
     551};
     552
     553/// \brief create a container for a c2_function which handles the reference counting.
     554/// \ingroup containers
     555/// It is useful as a smart container to hold a c2_function and keep the reference count correct. 
     556/// The recommended way for a class to store a c2_function which is handed in from the outside
     557/// is for it to have a c2_ptr member into which the passed-in function is stored.
     558/// This way, when the class instance is deleted, it will automatically dereference any function
     559/// which it was handed.
     560///
     561/// This class contains a copy constructor and operator=, to make it fairly easy to make
     562/// a std::vector of these objects, and have it work as expected.
     563template <typename float_type> class c2_const_ptr {
     564public:
     565        /// \brief construct the container with no function
     566        c2_const_ptr() : func(0)  {}
     567        /// \brief construct the container with a pre-defined function
     568        /// \param f the function to store
     569        c2_const_ptr(const c2_function<float_type> &f) : func(0)
     570                { set_function(&f); }
     571        /// \brief copy constructor
     572        /// \param src the container to copy
     573        c2_const_ptr(const c2_const_ptr<float_type> &src) : func(0)
     574                { set_function(src.get_ptr()); }
     575        /// \brief fill the container with a new function, or clear it with a null pointer
     576        /// \param f the function to store, releasing any previously held function
     577        void set_function(const c2_function<float_type> *f)
     578        {
     579                if(func) func->release_ownership();
     580                func=f;
     581                if(func) func->claim_ownership();
     582        }
     583       
     584        /// \brief fill the container from another container
     585        /// \param f the container to copy
     586        void operator =(const c2_const_ptr<float_type> &f)
     587                { set_function(f.get_ptr()); }
     588        /// \brief fill the container with a function
     589        /// \param f the function
     590        void operator =(const c2_function<float_type> &f)
     591                { set_function(&f); }
     592        /// \brief release the function without destroying it, so it can be returned from a function
     593        ///
     594        /// This is usually the very last line of a function before the return statement, so that
     595        /// any exceptions that happen during execution of the function will cause proper cleanup.
     596        /// Once the function has been released from its container this way, it is an orhpaned object
     597        /// until the caller claims it, so it could get lost if an exception happens.
     598        void release_for_return() throw(c2_exception)
     599                {       
     600                        if(func) func->release_ownership_for_return();
     601                        func=0;
     602                }
     603        /// \brief clear the function
     604        ///
     605        /// Any attempt to use this c2_plugin_function_p throws an exception if the saved function is cleared.
     606        void unset_function(void) { set_function(0);  }
     607        /// \brief destructor
     608        ~c2_const_ptr() { set_function(0); }
     609       
     610        /// \brief get a reference to our owned function
     611        inline const c2_function<float_type> &get() const throw(c2_exception)
     612        {
     613                if(!func) throw c2_exception("c2_ptr accessed uninitialized");
     614                return *func;
     615        }
     616        /// \brief get an unchecked pointer to our owned function
     617        inline const c2_function<float_type> *get_ptr() const { return func; }
     618        /// \brief get a checked pointer to our owned function
     619        inline const c2_function<float_type> *operator -> () const
     620                { return &get(); }
     621        /// \brief check if we have a valid function
     622        bool valid() const { return func != 0; }
     623       
     624        /// \brief type coercion operator which lets us use a pointer as if it were a const c2_function
     625        operator const c2_function<float_type>& () const { return this->get(); }
     626       
     627        /// \brief convenience operator to make us look like a function
     628        /// \param x the value at which to evaluate the contained function
     629        /// \return the evaluated function
     630        /// \note If you using this repeatedly, do const c2_function<float_type> &func=ptr;
     631        /// and use func(x).  Calling this operator wastes some time, since it checks the validity of the
     632        /// pointer every time.
     633        float_type operator()(float_type x) const throw(c2_exception) { return get()(x); }
     634        /// \brief convenience operator to make us look like a function
     635        /// \param x the value at which to evaluate the contained function
     636        /// \param yprime the derivative
     637        /// \param yprime2 the second derivative
     638        /// \return the evaluated function
     639        /// \note If you using this repeatedly, do const c2_function<float_type> &func=ptr;
     640        /// and use func(x).  Calling this operator wastes some time, since it checks the validity of the
     641        /// pointer every time.
     642        float_type operator()(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     643                { return get().value_with_derivatives(x, yprime, yprime2); }
     644        /// \brief factory function to create a c2_sum_p from a regular algebraic expression.
     645        /// \param rhs the right-hand term of the sum
     646        /// \return a new c2_function
     647        c2_sum_p<float_type> &operator + (const c2_function<float_type> &rhs)  const throw(c2_exception)
     648                { return *new c2_sum_p<float_type>(get(), rhs); }
     649        /// \brief factory function to create a c2_diff_p from a regular algebraic expression.
     650        /// \param rhs the right-hand term of the difference
     651        /// \return a new c2_function
     652        c2_diff_p<float_type> &operator - (const c2_function<float_type> &rhs)  const throw(c2_exception)
     653                { return *new c2_diff_p<float_type>(get(), rhs); }
     654        /// \brief factory function to create a c2_product_p from a regular algebraic expression.
     655        /// \param rhs the right-hand term of the product
     656        /// \return a new c2_function
     657        c2_product_p<float_type> &operator * (const c2_function<float_type> &rhs) const throw(c2_exception)
     658                { return *new c2_product_p<float_type>(get(), rhs); }
     659        /// \brief factory function to create a c2_ratio_p from a regular algebraic expression.
     660        /// \param rhs the right-hand term of the ratio (the denominator)
     661        /// \return a new c2_function
     662        c2_ratio_p<float_type> &operator / (const c2_function<float_type> &rhs)  const throw(c2_exception)
     663                { return *new c2_ratio_p<float_type>(get(), rhs); }
     664    /// \brief compose this function outside another.
     665    /// \param inner the inner function
     666    /// \return the composed function
     667        c2_composed_function_p<float_type> & operator ()(const c2_function<float_type> &inner) const throw(c2_exception)
     668                { return *new c2_composed_function_p<float_type>(get(), inner); }
     669       
     670protected:
     671        const c2_function<float_type> * func;
     672};
     673
     674/// \brief create a container for a c2_function which handles the reference counting.
     675/// \ingroup containers
     676///
     677/// \see  c2_const_ptr and \ref memory_management "Use of c2_ptr for memory management"
     678
     679template <typename float_type> class c2_ptr : public c2_const_ptr<float_type >
     680{
     681public:
     682        /// \brief construct the container with no function
     683        c2_ptr() : c2_const_ptr<float_type>()  {}
     684        /// \brief construct the container with a pre-defined function
     685        /// \param f the function to store
     686        c2_ptr(c2_function<float_type> &f) :
     687                c2_const_ptr<float_type>() { set_function(&f); }
     688        /// \brief copy constructor
     689        /// \param src the container to copy
     690        c2_ptr(const c2_ptr<float_type> &src) :
     691                c2_const_ptr<float_type>() { set_function(src.get_ptr()); }
     692        /// \brief get a checked pointer to our owned function
     693        inline c2_function<float_type> &get() const throw(c2_exception)
     694                { return *const_cast<c2_function<float_type>*>(&c2_const_ptr<float_type>::get()); }
     695        /// \brief get an unchecked pointer to our owned function
     696        inline c2_function<float_type> *get_ptr() const
     697                { return const_cast<c2_function<float_type>*>(this->func); }
     698        /// \brief get a checked pointer to our owned function
     699        inline c2_function<float_type> *operator -> () const
     700                { return &get(); }
     701        /// \brief fill the container from another container
     702        /// \param f the container to copy
     703        void operator =(const c2_ptr<float_type> &f)
     704                { set_function(f.get_ptr()); }
     705        /// \brief fill the container with a function
     706        /// \param f the function
     707        void operator =(c2_function<float_type> &f)
     708                { set_function(&f); }
     709private:
     710        /// \brief hidden non-const-safe version of operator=
     711        void operator =(const c2_const_ptr<float_type> &f) { }
     712        /// \brief hidden non-const-safe version of operator=
     713        void operator =(const c2_function<float_type> &f) { }
     714};
     715
     716/// \brief create a non-generic container for a c2_function which handles the reference counting.
     717/// \ingroup containers
     718///
     719/// \see  c2_const_ptr and \ref memory_management "Use of c2_ptr for memory management"
     720///
     721/// \note Overuse of this class will generate massive bloat.  Use c2_ptr and c2_const_ptr if you don't _really_ need specific pointer types.
     722/// \see  \ref memory_management "Use of c2_ptr for memory management"
     723/*
     724template <typename float_type, template <typename> class c2_class > class c2_typed_ptr : public c2_const_ptr<float_type> {
     725public:
     726        /// \brief construct the container with no function
     727        c2_typed_ptr() : c2_ptr<float_type>()  {}
     728        /// \brief construct the container with a pre-defined function
     729        /// \param f the function to store
     730        c2_typed_ptr(c2_class<float_type> &f)
     731                : c2_const_ptr<float_type>() { this->set_function(&f); }
     732        /// \brief copy constructor
     733        /// \param src the container to copy
     734        c2_typed_ptr(const c2_typed_ptr<float_type, c2_class> &src)
     735                : c2_const_ptr<float_type>() { this->set_function(src.get_ptr()); }
     736       
     737        /// \brief get a reference to our owned function
     738        inline c2_class<float_type> &get() const throw(c2_exception)
     739                {
     740                        return *static_cast<c2_class<float_type> *>(const_cast<c2_function<float_type>*>(&c2_const_ptr<float_type>::get()));
     741                }
     742        /// \brief get a checked pointer to our owned function
     743        inline c2_class<float_type> *operator -> () const
     744                { return &get(); }
     745        /// \brief get an unchecked pointer to our owned function
     746        inline c2_class<float_type> *get_ptr() const
     747                { return static_cast<c2_class<float_type> *>(const_cast<c2_function<float_type>*>(this->func)); }
     748        /// \brief type coercion operator which lets us use a pointer as if it were a c2_function
     749        operator c2_class<float_type>&() const { return get(); }
     750        /// \brief fill the container from another container
     751        /// \param f the container to copy
     752        void operator =(const c2_typed_ptr<float_type, c2_class> &f)
     753                { set_function(f.get_ptr()); }
     754        /// \brief fill the container with a function
     755        /// \param f the function
     756        void operator =(c2_class<float_type> &f)
     757                { set_function(&f); }
     758private:
     759        /// \brief hidden downcasting version of operator=
     760        void operator =(const c2_const_ptr<float_type> &f) { }
     761        /// \brief hidden downcasting version of operator=. Use an explicit dynamic_cast<c2_class<float_type>&>(f) if you need to try this.
     762        void operator =(const c2_function<float_type> &f) { }
     763};
     764*/
    328765/// \brief a container into which any other c2_function can be dropped, to allow expressions
    329766/// with replacable components. 
    330 ///
     767/// \ingroup containers
    331768///It is useful for plugging different InterpolatingFunctions into a c2_function expression.
    332769///It saves a lot of effort in other places with casting away const declarations.
     
    334771/// It is also useful as a wrapper for a function if it is necessary to have a copy of a function
    335772/// which has a different domain or sampling grid than the parent function.  This can be
    336 /// be used, for example, to patch badly-behaved functions with c2_piecewise_function by
     773/// be used, for example, to patch badly-behaved functions with c2_piecewise_function_p by
    337774/// taking the parent function, creating two plugins of it with domains on each side of the
    338775/// nasty bit, and then inserting a nice function in the hole.
    339 template <typename float_type=double> class c2_plugin_function : public c2_function<float_type> {
     776///
     777/// This can also be used as a fancier c2_ptr which allows direct evaluation
     778/// instead of having to dereference the container first.
     779///
     780/// The factory function c2_factory::plugin_function() creates *new c2_plugin_function_p()
     781template <typename float_type=double> class c2_plugin_function_p :
     782        public c2_function<float_type> {
    340783public:
    341784        /// \brief construct the container with no function
    342         c2_plugin_function() : c2_function<float_type>(), func(0), owns(false)  {}
     785        c2_plugin_function_p() : c2_function<float_type>(), func()  {}
    343786        /// \brief construct the container with a pre-defined function
    344         c2_plugin_function(const c2_function<float_type> &f) : c2_function<float_type>(), func(0), owns(false) { set_function(f); }
    345         /// \brief fill the container with a new function
    346         void set_function(const c2_function<float_type> &f)
    347                 {
    348                         if(owns && func) delete func;
    349                         func=&f; set_domain(f.xmin(), f.xmax());
    350                         set_sampling_grid_pointer(*f.sampling_grid);
    351                         owns=false;
     787        c2_plugin_function_p(c2_function<float_type> &f) :
     788                c2_function<float_type>(),func(f)  { }
     789        /// \brief fill the container with a new function, or clear it with a null pointer
     790        /// and copy our domain
     791        void set_function(c2_function<float_type> *f)
     792                {
     793                        func.set_function(f);
     794                        if(f) set_domain(f->xmin(), f->xmax());
    352795                }
    353796        /// \copydoc c2_function::value_with_derivatives
     
    355798        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    356799                {
    357                         if(!func) throw c2_exception("c2_plugin_function<float_type> called uninitialized");
    358                         return this->func->value_with_derivatives(x, yprime, yprime2);
     800                        if(!func.valid()) throw c2_exception("c2_plugin_function_p called uninitialized");
     801                        return func->value_with_derivatives(x, yprime, yprime2);
    359802                }
    360         /// \brief clear the function
    361         ///
    362         /// Any attempt to use this c2_plugin_function throws an exception if the saved function is cleared.
    363         void unset_function(void) { if(owns && func) delete func; func=0; owns=false; }
    364803        /// \brief destructor
    365         ~c2_plugin_function() { if(owns && func) delete func; }
    366         /// \brief tell us we should delete the function at destruction.  NOT sticky when function is reset
    367         void set_ownership() { this->owns=true; }
    368        
     804        ~c2_plugin_function_p() { }
     805       
     806        /// \brief clear our function
     807        void unset_function() { func.unset_function(); }
     808       
     809        virtual void get_sampling_grid(float_type xmin, float_type xmax, std::vector<float_type> &grid) const
     810        {       
     811                if(!func.valid()) throw c2_exception("c2_plugin_function_p called uninitialized");
     812                if(this->sampling_grid) c2_function<float_type>::get_sampling_grid(xmin, xmax, grid);
     813                else  func->get_sampling_grid(xmin, xmax, grid);
     814        }
    369815protected:
    370         const c2_function<float_type> *func;
    371         bool owns;
    372        
     816        c2_ptr<float_type> func;
     817};
     818
     819/// \brief a c2_plugin_function_p which promises not to fiddle with the plugged function.
     820/// \ingroup containers
     821///
     822/// The factory function c2_factory::const_plugin_function() creates *new c2_const_plugin_function_p()
     823template <typename float_type=double> class c2_const_plugin_function_p : public c2_plugin_function_p<float_type> {
     824public:
     825        /// \brief construct the container with no function
     826        c2_const_plugin_function_p() : c2_plugin_function_p<float_type>()  {}
     827        /// \brief construct the container with a pre-defined function
     828        c2_const_plugin_function_p(const c2_function<float_type> &f) :
     829                c2_plugin_function_p<float_type>()  { set_function(&f); }
     830        /// \brief fill the container with a new function, or clear it with a null pointer
     831        void set_function(const c2_function<float_type> *f)
     832                { c2_plugin_function_p<float_type>::set_function(const_cast<c2_function<float_type>*>(f)); }
     833        /// \brief destructor
     834        ~c2_const_plugin_function_p() { }
     835       
     836        /// \brief get a const reference to our owned function, for direct access
     837        const c2_function<float_type> &get() const throw(c2_exception)
     838                { return this->func.get(); }
    373839};
    374840
    375841/// \brief Provides support for c2_function objects which are constructed from two other c2_function
    376842/// objects. 
    377 ///
    378 /// It provides a very primitive ownership concept, so that the creator can tag a function
    379 /// as being owned by this function, so that when this function is deleted, the owned function will be deleted, too.
    380 /// This allows a piece of code to create various c2_function objects, combine them with binary operators,
    381 /// appropriately mark wich ones have no other possible owners, and return the final function with
    382 /// reasonable faith that everything will get cleaned up when the final function is deleted.  Note that
    383 /// none of this marking is automatic, to keep this class very lightweight.
     843/// \ingroup abstract_classes
    384844template <typename float_type=double> class c2_binary_function : public c2_function<float_type> {
    385845public:
    386        
    387        
    388846        ///  \brief function to manage the binary operation, used by c2_binary_function::value_with_derivatives()
    389847    ///
    390     /// Normally not used alone, but can be used to combine functions in other contexts.
    391         /// See interpolating_function::binary_operator() for an example.
    392         /// \param left the function on the left of the binary operator or outside the composition
    393         /// \param right the function to the right of the operator or inside the composition
    394     /// \param[in] x the point at which to evaluate the function
    395     /// \param[out] yprime the first derivative (if pointer is non-null)
    396     /// \param[out] yprime2 the second derivative (if pointer is non-null)
    397     /// \return the value of the function
    398         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    399                                            float_type x, float_type *yprime, float_type *yprime2) const =0;
    400848       
    401849        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw (c2_exception)
    402850    {
    403                 return this->combine(this->Left, this->Right, x, yprime, yprime2);
     851                if(stub) throw c2_exception("attempt to evaluate a c2_binary_function stub");
     852                return this->combine(*Left.get_ptr(), *Right.get_ptr(), x, yprime, yprime2);
    404853    }
    405854
    406         /// \brief allow c2_binary_function to remember ownership of contained functions for automatic cleanup
     855        /// \brief destructor releases ownership of member functions
    407856        ///
    408         /// upon destruction, this will cause disposal of the left member function
    409         void set_left_ownership(void) { leftown=true; }
    410         /// \brief allow c2_binary_function to remember ownership of contained functions for automatic cleanup
    411         ///
    412         /// upon destruction, this will cause disposal of the right member function
    413         void set_right_ownership(void) { rightown=true; }
    414         /// \brief allow c2_binary_function to remember ownership of contained functions for automatic cleanup
    415         ///
    416         /// upon destruction, this will cause disposal of both member functions
    417         void set_ownership(void) { leftown=rightown=true; }
    418         /// \brief destructor executes disposal of member functions if flagged
    419         ///
    420         /// depends on judicious use of set_ownership(), set_right_ownership(), or set_left_ownership()
    421         virtual ~c2_binary_function() {
    422                 if(leftown) delete &Left;
    423                 if(rightown) delete &Right;
    424         }
    425                
     857        virtual ~c2_binary_function() { }
     858
    426859protected:
    427860        /// \brief construct the binary function
     861        /// \param combiner pointer to the function which actualy knows how to execute the binary
    428862        /// \param left the c2_function to be used in the left side of the binary relation
    429863        /// \param right the c2_function to be used in the right side of the binary relation
    430         c2_binary_function( const c2_function<float_type> &left,  const c2_function<float_type> &right) :
    431         c2_function<float_type>(),
    432         Left(left), Right(right), leftown(false), rightown(false)
     864        c2_binary_function(
     865                        float_type (*combiner)(const c2_function<float_type> &left, const c2_function<float_type> &right,
     866                                   float_type x, float_type *yprime, float_type *yprime2),                                             
     867                        const c2_function<float_type> &left,  const c2_function<float_type> &right) :
     868                        c2_function<float_type>(), combine(combiner), Left(left), Right(right), stub(false)
    433869        {
    434                         set_domain(
    435                                            (left.xmin() > right.xmin()) ? left.xmin() : right.xmin(),
    436                                            (left.xmax() < right.xmax()) ? left.xmax() : right.xmax()
    437                                            );
     870                set_domain(
     871                                   (left.xmin() > right.xmin()) ? left.xmin() : right.xmin(),
     872                                   (left.xmax() < right.xmax()) ? left.xmax() : right.xmax()
     873                                   );
    438874        }
    439875       
    440876        /// \brief construct a 'stub' c2_binary_function, which provides access to the combine() function
    441877        /// \note Do not evaluate a 'stub' ever.  It is only used so that combine() can be called
    442     c2_binary_function() : c2_function<float_type>(),
    443                 Left(*((c2_function<float_type> *)0)), Right(*((c2_function<float_type> *)0)) {}
    444        
    445         const c2_function<float_type> &Left,  &Right;
    446         bool leftown, rightown;
    447                
     878    c2_binary_function(
     879           float_type (*combiner)(const c2_function<float_type> &left, const c2_function<float_type> &right,
     880                                                          float_type x, float_type *yprime, float_type *yprime2)
     881                ) : c2_function<float_type>(), combine(combiner), Left(), Right(), stub(true) { }
     882       
     883public:
     884        float_type (* const combine)(const c2_function<float_type> &left, const c2_function<float_type> &right,
     885                                                                 float_type x, float_type *yprime, float_type *yprime2);
     886       
     887protected:     
     888        const c2_const_ptr<float_type> Left,  Right;
     889        /// \brief if true, we don't own any functions, we are just a source of a combining function.
     890        bool stub;
     891       
    448892};
    449893
    450894/// \brief Create a very lightweight method to return a scalar multiple of another function.
    451 ///
    452 template <typename float_type=double> class c2_scaled_function : public c2_plugin_function<float_type> {
     895/// \ingroup containers \ingroup arithmetic_functions \ingroup parametric_functions
     896///
     897/// The factory function c2_factory::scaled_function() creates *new c2_scaled_function_p
     898template <typename float_type=double> class c2_scaled_function_p : public c2_function<float_type> {
    453899public:
    454900        /// \brief construct the function with its scale factor.
     
    456902        /// \param outer the function to be scaled
    457903        /// \param scale the multiplicative scale factor
    458         c2_scaled_function(const c2_function<float_type> &outer, float_type scale) :
    459                 c2_plugin_function<float_type>(outer), yscale(scale) { }
     904        c2_scaled_function_p(const c2_function<float_type> &outer, float_type scale) :
     905                c2_function<float_type>(), func(outer), yscale(scale) { }
    460906       
    461907        /// \brief set a new scale factor
     
    475921
    476922protected:
    477     c2_scaled_function<float_type>() {} // hide default constructor, since its use is almost always an error.
     923    c2_scaled_function_p<float_type>() : func() {} // hide default constructor, since its use is almost always an error.
     924        /// \brief the scaling factor for the function
     925        const c2_const_ptr<float_type> func;
    478926        float_type yscale;
    479927};
    480928
    481929/// \brief A container into which any other c2_function can be dropped.
    482 ///
     930/// \ingroup containers
    483931/// It allows a function to be pre-evaluated at a point, and used at multiple places in an expression
    484932/// efficiently. If it is re-evaluated at the previous point, it returns the remembered values;
    485933/// otherwise, it re-evauates the function at the new point.
    486934///
    487 template <typename float_type=double> class c2_cached_function : public c2_plugin_function<float_type> {
     935/// The factory function c2_factory::cached_function() creates *new c2_cached_function_p
     936template <typename float_type=double> class c2_cached_function_p : public c2_function<float_type> {
    488937public:
    489938        /// \brief construct the container
    490939        ///
    491940        /// \param f the function to be cached
    492         c2_cached_function(const c2_function<float_type> &f) : c2_plugin_function<float_type>(f), init(false)  {}
     941        c2_cached_function_p(const c2_function<float_type> &f) : c2_function<float_type>(),
     942                func(f), init(false)  {}
    493943        /// \copydoc c2_function::value_with_derivatives
    494944        ///
     
    508958
    509959protected:
    510     c2_cached_function() {} // hide default constructor, since its use is almost always an error.
     960    c2_cached_function_p() : func() {} // hide default constructor, since its use is almost always an error.
     961        const c2_const_ptr<float_type> func;
    511962        mutable bool init;
    512963        mutable float_type x0, y, yp, ypp;
     
    515966
    516967/// \brief Provides function composition (nesting)
    517 ///
     968/// \ingroup arithmetic_functions
    518969/// This allows evaluation of \a f(g(x)) where \a f and \a g are c2_function objects.
    519970///
    520 /// \note See c2_binary_function for discussion of ownership.
    521 template <typename float_type=double> class  c2_composed_function : public c2_binary_function<float_type> {
     971/// This should always be constructed using \ref compose_operator "c2_function::operator()"
     972template <typename float_type=double> class  c2_composed_function_p : public c2_binary_function<float_type> {
    522973public:
    523974       
     
    526977        /// \param outer the outer function
    527978        /// \param inner the inner function
    528         c2_composed_function(const c2_function<float_type> &outer, const c2_function<float_type> &inner) : c2_binary_function<float_type>(outer, inner) {}
     979        c2_composed_function_p(const c2_function<float_type> &outer, const c2_function<float_type> &inner) :
     980                c2_binary_function<float_type>(combine, outer, inner) { this->set_domain(inner.xmin(), inner.xmax()); }
    529981        /// \brief Create a stub just for the combiner to avoid statics.
    530         c2_composed_function() : c2_binary_function<float_type>() {} ;
    531 
    532         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    533                                                   float_type x, float_type *yprime, float_type *yprime2) const
     982        c2_composed_function_p() : c2_binary_function<float_type>(combine) {}
     983
     984        /// \brief execute math necessary to do composition
     985        static float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
     986                                                  float_type x, float_type *yprime, float_type *yprime2) throw(c2_exception)
    534987    {
    535                 float_type y0, yp0, ypp0, y1, yp1, ypp1;
    536                 float_type *yp0p, *ypp0p, *yp1p, *ypp1p;
     988                float_type y0, y1;
    537989                if(yprime || yprime2) {
    538                         yp0p=&yp0; ypp0p=&ypp0; yp1p=&yp1; ypp1p=&ypp1;
     990                        float_type yp0, ypp0, yp1, ypp1;
     991                        y0=right.value_with_derivatives(x, &yp0, &ypp0);
     992                        y1=left.value_with_derivatives(y0, &yp1, &ypp1);
     993                        if(yprime) *yprime=yp1*yp0;
     994                        if(yprime2) *yprime2=ypp0*yp1+yp0*yp0*ypp1;
    539995                } else {
    540                         yp0p=ypp0p=yp1p=ypp1p=0;
     996                        y0=right(x);
     997                        y1=left(y0);
    541998                }
    542                
    543                 y0=right.value_with_derivatives(x, yp0p, ypp0p);
    544                 y1=left.value_with_derivatives(y0, yp1p, ypp1p);
    545                 if(yprime) *yprime=yp1*yp0;
    546                 if(yprime2) *yprime2=ypp0*yp1+yp0*yp0*ypp1;
    547999                return y1;
    5481000        }       
     
    5501002
    5511003/// \brief create a c2_function which is the sum of two other c2_function objects.
    552 ///
    553 /// \note See c2_binary_function for discussion of ownership.
    554 template <typename float_type=double> class c2_sum : public c2_binary_function<float_type> {
     1004/// \ingroup arithmetic_functions
     1005/// This should always be constructed using c2_function::operator+()
     1006template <typename float_type=double> class c2_sum_p : public c2_binary_function<float_type> {
    5551007public:
    5561008        /// \brief construct \a left + \a right
    557     /// \note See c2_binary_function for discussion of ownership.
     1009        /// \param left the left function
     1010        /// \param right the right function
     1011        c2_sum_p(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(combine, left, right) {}
     1012        /// \brief Create a stub just for the combiner to avoid statics.
     1013        c2_sum_p() : c2_binary_function<float_type>(combine) {} ; // create a stub just for the combiner to avoid statics
     1014
     1015        /// \brief execute math necessary to do addition
     1016        static float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
     1017                                                  float_type x, float_type *yprime, float_type *yprime2) throw(c2_exception)
     1018    {
     1019                float_type y0, y1;
     1020                if(yprime || yprime2) {
     1021                        float_type yp0, ypp0, yp1, ypp1;
     1022                        y0=left.value_with_derivatives(x, &yp0, &ypp0);
     1023                        y1=right.value_with_derivatives(x, &yp1, &ypp1);
     1024                        if(yprime) *yprime=yp0+yp1;
     1025                        if(yprime2) *yprime2=ypp0+ypp1;
     1026                } else {
     1027                        y0=left(x);
     1028                        y1=right(x);
     1029                }
     1030                return y0+y1;
     1031        }
     1032};
     1033
     1034
     1035/// \brief create a c2_function which is the difference of two other c2_functions.
     1036/// \ingroup arithmetic_functions
     1037/// This should always be constructed using c2_function::operator-()
     1038template <typename float_type=double> class c2_diff_p : public c2_binary_function<float_type> {
     1039public:
     1040        /// \brief construct \a left - \a right
    5581041        /// \param left the left function
    5591042        /// \param right the right function
    560         c2_sum(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(left, right) {}
     1043        c2_diff_p(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(combine, left, right) {}
    5611044        /// \brief Create a stub just for the combiner to avoid statics.
    562         c2_sum() : c2_binary_function<float_type>() {} ; // create a stub just for the combiner to avoid statics
    563 
    564         // function to do derivative arithmetic for sums
    565         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    566                                                   float_type x, float_type *yprime, float_type *yprime2) const
     1045        c2_diff_p() : c2_binary_function<float_type>(combine) {} ; // create a stub just for the combiner to avoid statics
     1046
     1047        /// \brief execute math necessary to do subtraction
     1048        static float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
     1049                                                          float_type x, float_type *yprime, float_type *yprime2) throw(c2_exception)
    5671050    {
    568                 float_type y0, yp0, ypp0, y1, yp1, ypp1;
    569                 float_type *yp0p, *ypp0p, *yp1p, *ypp1p;
     1051                float_type y0, y1;
    5701052                if(yprime || yprime2) {
    571                         yp0p=&yp0; ypp0p=& ypp0; yp1p=&yp1; ypp1p=&ypp1;
     1053                        float_type yp0, ypp0, yp1, ypp1;
     1054                        y0=left.value_with_derivatives(x, &yp0, &ypp0);
     1055                        y1=right.value_with_derivatives(x, &yp1, &ypp1);
     1056                        if(yprime) *yprime=yp0-yp1;
     1057                        if(yprime2) *yprime2=ypp0-ypp1;
    5721058                } else {
    573                         yp0p=ypp0p=yp1p=ypp1p=0;
     1059                        y0=left(x);
     1060                        y1=right(x);
    5741061                }
    575                 y0=left.value_with_derivatives(x, yp0p, ypp0p);
    576                 y1=right.value_with_derivatives(x, yp1p, ypp1p);
    577                 if(yprime) *yprime=yp0+yp1;
    578                 if(yprime2) *yprime2=ypp0+ypp1;
    579                 return y0+y1;
     1062                return y0-y1;
    5801063        }
    5811064};
    5821065
    5831066
    584 /// \brief create a c2_function which is the difference of two other c2_functions.
    585 ///
    586 /// \note See c2_binary_function for discussion of ownership.
    587 template <typename float_type=double> class c2_diff : public c2_binary_function<float_type> {
     1067/// \brief create a c2_function which is the product of two other c2_functions.
     1068/// \ingroup arithmetic_functions
     1069/// This should always be constructed using c2_function::operator*()
     1070template <typename float_type=double> class c2_product_p : public c2_binary_function<float_type> {
    5881071public:
    589         /// \brief construct \a left - \a right
    590     /// \note See c2_binary_function for discussion of ownership.
     1072        /// \brief construct \a left * \a right
    5911073        /// \param left the left function
    5921074        /// \param right the right function
    593         c2_diff(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(left, right) {}
     1075        c2_product_p(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(combine, left, right) {}
    5941076        /// \brief Create a stub just for the combiner to avoid statics.
    595         c2_diff() : c2_binary_function<float_type>() {} ; // create a stub just for the combiner to avoid statics
    596 
    597         // function to do derivative arithmetic for diffs
    598         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    599                                                           float_type x, float_type *yprime, float_type *yprime2) const
     1077        c2_product_p() : c2_binary_function<float_type>(combine) {} ; // create a stub just for the combiner to avoid statics
     1078
     1079        /// \brief execute math necessary to do multiplication
     1080        static float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
     1081                                                           float_type x, float_type *yprime, float_type *yprime2)  throw(c2_exception)
    6001082    {
    601                 float_type y0, yp0, ypp0, y1, yp1, ypp1;
    602                 float_type *yp0p, *ypp0p, *yp1p, *ypp1p;
     1083                float_type y0, y1;
    6031084                if(yprime || yprime2) {
    604                         yp0p=&yp0; ypp0p=&ypp0; yp1p=&yp1; ypp1p=&ypp1;
     1085                        float_type yp0, ypp0, yp1, ypp1;
     1086                        y0=left.value_with_derivatives(x, &yp0, &ypp0);
     1087                        y1=right.value_with_derivatives(x, &yp1, &ypp1);
     1088                        if(yprime) *yprime=y1*yp0+y0*yp1;
     1089                        if(yprime2) *yprime2=ypp0*y1+2.0*yp0*yp1+ypp1*y0;
    6051090                } else {
    606                         yp0p=ypp0p=yp1p=ypp1p=0;
     1091                        y0=left(x);
     1092                        y1=right(x);
    6071093                }
    608                 y0=left.value_with_derivatives(x, yp0p, ypp0p);
    609                 y1=right.value_with_derivatives(x, yp1p, ypp1p);
    610                 if(yprime) *yprime=yp0-yp1;
    611                 if(yprime2) *yprime2=ypp0-ypp1;
    612                 return y0-y1;
     1094                return y0*y1;
    6131095        }
    6141096};
    6151097
    6161098
    617 /// \brief create a c2_function which is the product of two other c2_functions.
    618 ///
    619 /// \note See c2_binary_function for discussion of ownership.
    620 template <typename float_type=double> class c2_product : public c2_binary_function<float_type> {
     1099/// \brief create a c2_function which is the ratio of two other c2_functions.
     1100/// \ingroup arithmetic_functions
     1101/// This should always be constructed using c2_function::operator/()
     1102template <typename float_type=double> class c2_ratio_p : public c2_binary_function<float_type> {
    6211103public:
    622         /// \brief construct \a left * \a right
    623     /// \note See c2_binary_function for discussion of ownership.
     1104        /// \brief construct \a left / \a right
    6241105        /// \param left the left function
    6251106        /// \param right the right function
    626         c2_product(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(left, right) {}
     1107        c2_ratio_p(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(combine, left, right) {}
    6271108        /// \brief Create a stub just for the combiner to avoid statics.
    628         c2_product() : c2_binary_function<float_type>() {} ; // create a stub just for the combiner to avoid statics
    629 
    630         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    631                                                            float_type x, float_type *yprime, float_type *yprime2) const
     1109        c2_ratio_p() : c2_binary_function<float_type>(combine) {} ; // create a stub just for the combiner to avoid statics
     1110       
     1111        /// \brief execute math necessary to do division
     1112        static float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
     1113                                                          float_type x, float_type *yprime, float_type *yprime2) throw(c2_exception)
    6321114    {
    633                 float_type y0, yp0, ypp0, y1, yp1, ypp1;
    634                 float_type *yp0p, *ypp0p, *yp1p, *ypp1p;
     1115                float_type y0, y1;
    6351116                if(yprime || yprime2) {
    636                         yp0p=&yp0; ypp0p=&ypp0; yp1p=&yp1; ypp1p=&ypp1;
     1117                        float_type yp0, ypp0, yp1, ypp1;
     1118                        y0=left.value_with_derivatives(x, &yp0, &ypp0);
     1119                        y1=right.value_with_derivatives(x, &yp1, &ypp1);
     1120                        if(yprime) *yprime=(yp0*y1-y0*yp1)/(y1*y1); // first deriv of ratio
     1121                        if(yprime2) *yprime2=(y1*y1*ypp0+y0*(2*yp1*yp1-y1*ypp1)-2*y1*yp0*yp1)/(y1*y1*y1);
    6371122                } else {
    638                         yp0p=ypp0p=yp1p=ypp1p=0;
     1123                        y0=left(x);
     1124                        y1=right(x);
    6391125                }
    640                 y0=left.value_with_derivatives(x, yp0p, ypp0p);
    641                 y1=right.value_with_derivatives(x, yp1p, ypp1p);
    642                 if(yprime) *yprime=y1*yp0+y0*yp1;
    643                 if(yprime2) *yprime2=ypp0*y1+2.0*yp0*yp1+ypp1*y0;
    644                 return y0*y1;
    645         }
    646 };
    647 
    648 
    649 /// \brief create a c2_function which is the ratio of two other c2_functions.
    650 ///
    651 /// \note See c2_binary_function for discussion of ownership.
    652 template <typename float_type=double> class c2_ratio : public c2_binary_function<float_type> {
    653 public:
    654         /// \brief construct \a left / \a right
    655     /// \note See c2_binary_function for discussion of ownership.
    656         /// \param left the left function
    657         /// \param right the right function
    658         c2_ratio(const c2_function<float_type> &left, const c2_function<float_type> &right) : c2_binary_function<float_type>(left, right) {}
    659         /// \brief Create a stub just for the combiner to avoid statics.
    660         c2_ratio() : c2_binary_function<float_type>() {} ; // create a stub just for the combiner to avoid statics
    661        
    662         virtual float_type combine(const c2_function<float_type> &left, const c2_function<float_type> &right,
    663                                                           float_type x, float_type *yprime, float_type *yprime2) const
    664     {
    665                 float_type y0, yp0, ypp0, y1, yp1, ypp1;
    666                 float_type *yp0p, *ypp0p, *yp1p, *ypp1p;
    667                 if(yprime || yprime2) {
    668                         yp0p=&yp0; ypp0p=&ypp0; yp1p=&yp1; ypp1p=&ypp1;
    669                 } else {
    670                         yp0p=ypp0p=yp1p=ypp1p=0;
    671                 }
    672                 y0=left.value_with_derivatives(x, yp0p, ypp0p);
    673                 y1=right.value_with_derivatives(x, yp1p, ypp1p);
    674                 if(yprime) *yprime=(yp0*y1-y0*yp1)/(y1*y1); // first deriv of ratio
    675                 if(yprime2) *yprime2=(y1*y1*ypp0+y0*(2*yp1*yp1-y1*ypp1)-2*y1*yp0*yp1)/(y1*y1*y1); // second deriv of ratio
    6761126                return y0/y1;
    6771127        }
     
    6791129};
    6801130
    681 /// \brief a c2_function which is constant : can do interpolating_function  f2=f1 + c2_constant(11.3)
    682 template <typename float_type> class c2_constant : public c2_function<float_type> {
    683 public:
    684         c2_constant(float_type x=0.0) : c2_function<float_type>(), value(x) {}
     1131/// \brief a c2_function which is constant
     1132/// \ingroup parametric_functions
     1133///
     1134/// The factory function c2_factory::constant() creates *new c2_constant_p()
     1135template <typename float_type> class c2_constant_p : public c2_function<float_type> {
     1136public:
     1137        c2_constant_p(float_type x) : c2_function<float_type>(), value(x) {}
    6851138        void reset(float_type val) { value=val; }
    6861139        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     
    6911144};
    6921145
     1146/// \brief a transformation of a coordinate, including an inverse
     1147/// \ingroup transforms
     1148template <typename float_type> class c2_transformation {
     1149public:
     1150        /// \brief initialize all our function pointers
     1151        /// \param transformed true if this function is not the identity
     1152        /// \param xin input X transform
     1153        /// \param xinp input X transform derivative
     1154        /// \param xinpp input X transform second derivative
     1155        /// \param xout output X transform, which MUST be the inverse of \a xin
     1156        c2_transformation(bool transformed,
     1157                   float_type (*xin)(float_type), float_type (*xinp)(float_type), float_type (*xinpp)(float_type), float_type (*xout)(float_type)
     1158           ) :
     1159                        fTransformed(transformed), fHasStaticTransforms(true),
     1160                        pIn(xin), pInPrime(xinp), pInDPrime(xinpp), pOut(xout) { }
     1161
     1162        /// \brief initialize all our function pointers so that only the (overridden) virtual functions can be called without an error
     1163        /// \param transformed true if this function is nonlinear
     1164        c2_transformation(bool transformed) :
     1165                        fTransformed(transformed), fHasStaticTransforms(false),
     1166                        pIn(report_error), pInPrime(report_error), pInDPrime(report_error), pOut(report_error) { }
     1167        /// \brief the destructor
     1168        virtual ~c2_transformation() { }
     1169        /// \brief flag to indicate if this transform is not the identity
     1170        const bool fTransformed;
     1171        /// \brief flag to indicate if the static function pointers can be used for efficiency
     1172        const bool fHasStaticTransforms;
     1173
     1174        /// \note the pointers to functions allow highly optimized access when static functions are available.
     1175        /// They are only used inside value_with_derivatives(), which is assumed to be the most critical routine.
     1176        /// \brief non-virtual pointer to input X transform
     1177        float_type (* const pIn)(float_type);
     1178        /// \brief non-virtual pointer to input X transform derivative
     1179        float_type (* const pInPrime)(float_type);
     1180        /// \brief non-virtual pointer to input X transform second derivative
     1181        float_type (* const pInDPrime)(float_type);
     1182        /// \brief non-virtual pointer to output X transform
     1183        float_type (* const pOut)(float_type);
     1184       
     1185        /// \brief virtual input X transform
     1186        virtual float_type fIn(float_type x) const { return pIn(x); }
     1187        /// \brief virtual input X transform derivative
     1188        virtual float_type fInPrime(float_type x) const { return pInPrime(x); }
     1189        /// \brief virtual input X transform second derivative
     1190        virtual float_type fInDPrime(float_type x) const { return pInDPrime(x); }
     1191        /// \brief virtual output X transform
     1192        virtual float_type fOut(float_type x) const { return pOut(x); }
     1193
     1194protected:
     1195        /// \brief utility function for unimplemented conversion
     1196        static float_type report_error(float_type x)  { throw c2_exception("use of improperly constructed axis transform"); return x; }
     1197        /// \brief utility function f(x)=x useful in axis transforms
     1198        static float_type ident(float_type x)  { return x; }
     1199        /// \brief utility function f(x)=1 useful in axis transforms
     1200        static float_type one(float_type)  { return 1; }
     1201        /// \brief utility function f(x)=0 useful in axis transforms
     1202        static float_type zero(float_type)  { return 0; }
     1203        /// \brief utility function f(x)=1/x useful in axis transforms
     1204        static float_type recip(float_type x)  { return 1.0/x; }
     1205        /// \brief utility function f(x)=-1/x**2 useful in axis transforms
     1206        static float_type recip_prime(float_type x)  { return -1/(x*x); }
     1207        /// \brief utility function f(x)=2/x**3 useful in axis transforms
     1208        static float_type recip_prime2(float_type x)  { return 2/(x*x*x); }
     1209
     1210};
     1211
     1212/// \brief the identity transform
     1213/// \ingroup transforms
     1214template <typename float_type> class c2_transformation_linear : public c2_transformation<float_type> {
     1215public:
     1216        /// \brief constructor
     1217        c2_transformation_linear() : c2_transformation<float_type>(false, this->ident, this->one, this->zero, this->ident) { }
     1218        /// \brief destructor
     1219        ~c2_transformation_linear() { }
     1220};
     1221/// \brief log axis transform
     1222/// \ingroup transforms
     1223template <typename float_type> class c2_transformation_log : public c2_transformation<float_type> {
     1224public:
     1225        /// \brief constructor
     1226        c2_transformation_log() : c2_transformation<float_type>(true, std::log, this->recip, this->recip_prime, std::exp) { }
     1227        /// \brief destructor
     1228        ~c2_transformation_log() { }
     1229};
     1230/// \brief reciprocal axis transform
     1231/// \ingroup transforms
     1232template <typename float_type> class c2_transformation_recip : public c2_transformation<float_type> {
     1233public:
     1234        /// \brief constructor
     1235        c2_transformation_recip() : c2_transformation<float_type>(true, this->recip, this->recip_prime, this->recip_prime2, this->recip) { }
     1236        /// \brief destructor
     1237        ~c2_transformation_recip() { }
     1238};
     1239
     1240/// \brief a transformation of a function in and out of a coordinate space, using 2 c2_transformations
     1241///
     1242/// This class is a container for two axis transforms, but also provides the critical evaluate()
     1243/// function which converts a result in internal coordinates (with derivatives) into the external representation
     1244/// \ingroup transforms
     1245template <typename float_type>
     1246        class c2_function_transformation {
     1247public:
     1248        /// \brief construct this from two c2_transformation instances
     1249        /// \param xx the X axis transform
     1250        /// \param yy the Y axis transform 
     1251        c2_function_transformation(
     1252                const c2_transformation<float_type> &xx, const c2_transformation<float_type> &yy) :
     1253                isIdentity(!(xx.fTransformed || yy.fTransformed)), X(xx), Y(yy) { }
     1254        /// \brief destructor
     1255        virtual ~c2_function_transformation() { delete &X; delete &Y; }
     1256        /// \brief evaluate the transformation from internal coordinates to external coordinates
     1257        /// \param xraw the value of \a x in external cordinates at which the transform is taking place
     1258        /// \param y the value of the function in internal coordinates
     1259        /// \param yp0 the derivative in internal coordinates
     1260        /// \param ypp0 the second derivative in internal coordinates
     1261        /// \param [out] yprime pointer to the derivative, or NULL, in external coordinates
     1262        /// \param [out] yprime2 pointer to the second derivative, or NULL, in external coordinates
     1263        /// \return the value of the function in external coordinates
     1264        virtual float_type evaluate(float_type xraw,
     1265                float_type y, float_type yp0, float_type ypp0,
     1266                float_type *yprime, float_type *yprime2) const;
     1267        /// \brief flag indicating of the transform is the identity, and can be skipped for efficiency
     1268        const bool isIdentity;
     1269        /// \brief the X axis transform
     1270        const c2_transformation<float_type> &X;
     1271        /// \brief the Y axis transform
     1272        const c2_transformation<float_type> &Y;
     1273};
     1274
     1275/// \brief a transformation of a function in and out of lin-lin space
     1276///
     1277/// \ingroup transforms
     1278template <typename float_type> class c2_lin_lin_function_transformation :
     1279        public c2_function_transformation<float_type> {
     1280public:
     1281        c2_lin_lin_function_transformation() :
     1282                c2_function_transformation<float_type>(
     1283                        *new c2_transformation_linear<float_type>,
     1284                        *new c2_transformation_linear<float_type>
     1285                ) { }
     1286        virtual ~c2_lin_lin_function_transformation() { }
     1287};
     1288
     1289/// \brief a transformation of a function in and out of log-log space
     1290///
     1291/// \ingroup transforms
     1292template <typename float_type> class c2_log_log_function_transformation :
     1293        public c2_function_transformation<float_type> {
     1294public:
     1295        c2_log_log_function_transformation() :
     1296                c2_function_transformation<float_type>(
     1297                        *new c2_transformation_log<float_type>,
     1298                        *new c2_transformation_log<float_type>
     1299                ) { }
     1300        virtual ~c2_log_log_function_transformation() { }
     1301};
     1302
     1303/// \brief a transformation of a function in and out of lin-log space
     1304///
     1305/// \ingroup transforms
     1306template <typename float_type> class c2_lin_log_function_transformation :
     1307        public c2_function_transformation<float_type> {
     1308public:
     1309        c2_lin_log_function_transformation() :
     1310                c2_function_transformation<float_type>(
     1311                        *new c2_transformation_linear<float_type>,
     1312                        *new c2_transformation_log<float_type>
     1313                ) { }
     1314        virtual ~c2_lin_log_function_transformation() { }
     1315};
     1316
     1317/// \brief a transformation of a function in and out of log-lin space
     1318///
     1319/// \ingroup transforms
     1320template <typename float_type> class c2_log_lin_function_transformation :
     1321        public c2_function_transformation<float_type> {
     1322public:
     1323        c2_log_lin_function_transformation() :
     1324                c2_function_transformation<float_type>(
     1325                        *new c2_transformation_log<float_type>,
     1326                        *new c2_transformation_linear<float_type>
     1327                ) { }
     1328        virtual ~c2_log_lin_function_transformation() { }
     1329};
     1330
     1331/// \brief a transformation of a function in and out of Arrhenuis (1/x vs. log(y)) space
     1332///
     1333/// \ingroup transforms
     1334template <typename float_type> class c2_arrhenius_function_transformation :
     1335        public c2_function_transformation<float_type> {
     1336public:
     1337        c2_arrhenius_function_transformation() :
     1338                c2_function_transformation<float_type>(
     1339                        *new c2_transformation_recip<float_type>,
     1340                        *new c2_transformation_log<float_type>
     1341                ) { }
     1342        virtual ~c2_arrhenius_function_transformation() { }
     1343};
     1344
    6931345/**
    6941346    \brief create a cubic spline interpolation of a set of (x,y) pairs
    695 
     1347        \ingroup interpolators
    6961348    This is one of the main reasons for c2_function objects to exist.
    6971349
     
    7071359    (vanishing second derivative), is created as: \n
    7081360    \code
     1361        c2_ptr<double> c2p;
     1362        c2_factory<double> c2;
    7091363    std::vector<double> xvals(10), yvals(10);
    7101364    // < fill in xvals and yvals >
    711     interpolating_function<double>  myfunc(xvals, yvals);
     1365    c2p myfunc=c2.interpolating_function().load(xvals, yvals,true,0,true,0);
    7121366    // and it can be evaluated at a point for its value only by:
    7131367    double y=myfunc(x);
     
    7161370    double y=myfunc(x,&yprime, &yprime2);
    7171371    \endcode
     1372       
     1373        The factory function c2_factory::interpolating_function() creates *new interpolating_function_p()
    7181374*/
    7191375
    720 template <typename float_type=double> class interpolating_function  : public c2_function<float_type> {
    721 public:
    722     /// \brief create the most general interpolating_function which defaults to linear-linear space
     1376template <typename float_type=double> class interpolating_function_p  : public c2_function<float_type> {
     1377public:
     1378    /// \brief an empty linear-linear cubic-spline interpolating_function_p
    7231379    ///
    7241380    /// lots to say here, but see Numerical Recipes for a discussion of cubic splines.
     1381        ///
     1382        interpolating_function_p() : c2_function<float_type>(),
     1383                fTransform(*new  c2_lin_lin_function_transformation<float_type>) { }
     1384
     1385    /// \brief an empty cubic-spline interpolating_function_p with a specific transform
     1386    ///
     1387        interpolating_function_p(const c2_function_transformation<float_type> &transform) : c2_function<float_type>(),
     1388                fTransform(transform) { }
     1389
     1390    /// \brief do the dirty work of constructing the spline from a function.
    7251391    /// \param x the list of abscissas.  Must be either strictly increasing or strictly decreasing.
    7261392        /// Strictly increasing is preferred, as less memory is used since a copy is not required for the sampling grid.
     
    7301396    /// \param upperSlopeNatural if true, set y''(last point)=0, otherwise compute it from \a upperSope
    7311397    /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
    732     /// \param inputXConversion a function (not a c2_function) which converts \a x into the internal space. \n
    733         /// If this is NULL, use linear space and ignore inputXConversionPrime, inputXConversionDPrime
    734     /// \param inputYConversion a function (not a c2_function) which converts \a y into the internal space. \n
    735         /// If this is NULL, use linear space and ignore inputYConversionPrime, inputYConversionDPrime, outputYConversion
    736     /// \param outputYConversion a function (not a c2_function) which converts \a y out of the internal space
    737     /// \param inputXConversionPrime the derivative of \a inputXConversion
    738     /// \param inputYConversionPrime the derivative of \a inputYConversion
    739     /// \param inputXConversionDPrime the second derivative of \a inputXConversion
    740     /// \param inputYConversionDPrime the second derivative of \a inputYConversion
    741     interpolating_function(const std::vector<float_type> &x, const std::vector<float_type> &f,
    742                                                   bool lowerSlopeNatural=true, float_type lowerSlope=0.0,
    743                                                   bool upperSlopeNatural=true, float_type upperSlope=0.0,
    744                                                   float_type (*inputXConversion)(float_type)=0,
    745                                                   float_type (*inputYConversion)(float_type)=0,
    746                                                   float_type (*outputYConversion)(float_type)=0,
    747                                                   float_type (*inputXConversionPrime)(float_type)=0,
    748                                                   float_type (*inputYConversionPrime)(float_type)=0,
    749                                                   float_type (*inputXConversionDPrime)(float_type)=0,
    750                                                   float_type (*inputYConversionDPrime)(float_type)=0
    751                                                    ) throw(c2_exception) : c2_function<float_type>()
    752         { init(x, f, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope,
    753                inputXConversion, inputYConversion, outputYConversion,
    754                inputXConversionPrime, inputYConversionPrime,
    755                inputXConversionDPrime, inputYConversionDPrime
    756                );
    757         }
    758        
    759     /// \brief copy constructor
    760     /// \param rhs interpolating_function  to copy from
    761         interpolating_function(const interpolating_function <float_type> &rhs) : c2_function<float_type>(rhs),
    762                 Xraw(rhs.Xraw), X(rhs.X), F(rhs.F), y2(rhs.y2),
    763                 fXin(rhs.fXin), fYin(rhs.fYin), fYout(rhs.fYout),
    764                 fXinPrime(rhs.fXinPrime), fYinPrime(rhs.fYinPrime),
    765                 fXinDPrime(rhs.fXinDPrime), fYinDPrime(rhs.fYinDPrime) ,
    766                 xInverted(rhs.xInverted), lastKLow(-1)
    767         {       set_sampling_grid_pointer(Xraw); }
    768        
    769         virtual ~interpolating_function() { } // just to suppress warnings about no virtual destructor
     1398        /// \param splined if true (default), use cubic spline, if false, use linear interpolation.
     1399        /// \return the same interpolating function, filled
     1400        interpolating_function_p<float_type> & load(const std::vector<float_type> &x, const std::vector<float_type> &f,
     1401                          bool lowerSlopeNatural, float_type lowerSlope,
     1402                          bool upperSlopeNatural, float_type upperSlope, bool splined=true
     1403        ) throw(c2_exception);
     1404
     1405    /// \brief do the dirty work of constructing the spline from a function.
     1406    /// \param data std::vector of std::pairs of x,y.  Will be sorted into x increasing order in place.
     1407    /// \param lowerSlopeNatural if true, set y''(first point)=0, otherwise compute it from \a lowerSope
     1408    /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
     1409    /// \param upperSlopeNatural if true, set y''(last point)=0, otherwise compute it from \a upperSope
     1410    /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
     1411        /// \param splined if true (default), use cubic spline, if false, use linear interpolation.
     1412        /// \return the same interpolating function, filled
     1413        interpolating_function_p<float_type> & load_pairs(
     1414                          std::vector<std::pair<float_type, float_type> > &data, 
     1415                          bool lowerSlopeNatural, float_type lowerSlope,
     1416                          bool upperSlopeNatural, float_type upperSlope, bool splined=true
     1417        ) throw(c2_exception);
     1418
     1419    /// \brief do the dirty work of constructing the spline from a function.
     1420    /// \param func a function without any requirement of valid derivatives to sample into an interpolating function.
     1421        /// Very probably a c2_classic_function.
     1422    /// \param xmin the lower bound of the region to sample
     1423    /// \param xmax the upper bound of the region to sample
     1424        /// \param abs_tol the maximum absolute error permitted when linearly interpolating the points.
     1425        /// the real error will be much smaller, since this uses cubic splines at the end.
     1426        /// \param rel_tol the maximum relative error permitted when linearly interpolating the points.
     1427        /// the real error will be much smaller, since this uses cubic splines at the end.
     1428    /// \param lowerSlopeNatural if true, set y'(first point) from 3-point parabola, otherwise compute it from \a lowerSope
     1429    /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
     1430    /// \param upperSlopeNatural if true, set y'(last point) from 3-point parabola, otherwise compute it from \a upperSope
     1431    /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
     1432        /// \return the same interpolating function, filled
     1433        /// \note If the interpolator being filled has a log vertical axis, put the desired relative error in
     1434        /// \a abs_tol, and 0 in \a rel_tol since the absolute error on the log of a function is the relative error
     1435        /// on the function itself.
     1436        interpolating_function_p<float_type> &  sample_function(const c2_function<float_type> &func,
     1437                          float_type xmin, float_type xmax, float_type abs_tol, float_type rel_tol,
     1438                          bool lowerSlopeNatural, float_type lowerSlope,
     1439                          bool upperSlopeNatural, float_type upperSlope
     1440                          ) throw(c2_exception);
     1441       
     1442
     1443        /// \brief initialize from a grid of points and a c2_function (un-normalized) to an
     1444        /// interpolator which, when evaluated with a uniform random variate on [0,1] returns random numbers
     1445        /// distributed as the input function.
     1446        /// \see  \ref random_subsec "Arbitrary random generation"
     1447        /// inverse_integrated_density starts with a probability density  std::vector, generates the integral,
     1448        /// and generates an interpolating_function_p  of the inverse function which, when evaluated using a uniform random on [0,1] returns values
     1449        /// with a density distribution equal to the input distribution
     1450        /// If the data are passed in reverse order (large X first), the integral is carried out from the big end.
     1451        /// \param bincenters the positions at which to sample the function \a binheights
     1452        /// \param binheights a function which describes the density of the random number distribution to be produced.
     1453        /// \return an initialized interpolator, which
     1454        /// if evaluated randomly with a uniform variate on [0,1] produces numbers
     1455        /// distributed according to \a binheights
     1456        interpolating_function_p<float_type> & load_random_generator_function(
     1457                const std::vector<float_type> &bincenters, const c2_function<float_type> &binheights)
     1458                throw(c2_exception);
     1459
     1460        /// \brief initialize from a grid of points and an std::vector of probability densities (un-normalized) to an
     1461        /// interpolator which, when evaluated with a uniform random variate on [0,1] returns random numbers
     1462        /// distributed as the input histogram.
     1463        /// \see  \ref random_subsec "Arbitrary random generation"
     1464        /// inverse_integrated_density starts with a probability density  std::vector, generates the integral,
     1465        /// and generates an interpolating_function_p  of the inverse function which, when evaluated using a uniform random on [0,1] returns values
     1466        /// with a density distribution equal to the input distribution
     1467        /// If the data are passed in reverse order (large X first), the integral is carried out from the big end.
     1468        /// \param bins if \a bins .size()==\a binheights .size(), the centers of the bins.  \n
     1469        /// if \a bins .size()==\a binheights .size()+1, the edges of the bins
     1470        /// \param binheights a vector which describes the density of the random number distribution to be produced.
     1471        /// Note density... the numbers in the bins are not counts, but counts/unit bin width.
     1472        /// \return an initialized interpolator, which
     1473        /// if evaluated randomly with a uniform variate on [0,1] produces numbers
     1474        /// distributed according to \a binheights
     1475        interpolating_function_p<float_type> & load_random_generator_bins(
     1476                const std::vector<float_type> &bins, const std::vector<float_type> &binheights)
     1477                throw(c2_exception);
     1478       
     1479        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception);
     1480       
     1481        /// \brief destructor
     1482        virtual ~interpolating_function_p() { delete &fTransform; }
     1483       
     1484        /// \brief create a new, empty interpolating function of this type (virtual constructor)
     1485        virtual interpolating_function_p<float_type> &clone() const throw(c2_exception)
     1486        {       return *new interpolating_function_p<float_type>(); }
    7701487       
    7711488    /// \brief retrieve copies of the x & y tables from which this was built
    7721489    ///
    7731490        /// This is often useful in the creation of new interpolating functions with transformed data.
    774         /// The vectorswill have their sizes set correctly on return.
     1491        /// The vectors will have their sizes set correctly on return.
    7751492        /// \param [in, out] xvals the abscissas
    7761493        /// \param [in, out] yvals the ordinates
     
    7931510        // preserving the X bounds and mapping functions of the host (left hand) function.
    7941511       
    795     /// \brief create a new interpolating_function  which is the \a source
     1512    /// \brief create a new interpolating_function_p  which is the \a source
    7961513    /// function applied to every point in the interpolating tables
    7971514    ///
    7981515    /// This carefully manages the derivative of the composed function at the two ends.
    7991516    /// \param source the function to apply
    800     /// \return a new interpolating_function  with the same mappings for x and y
    801         interpolating_function <float_type> & unary_operator(const c2_function<float_type> &source) const;
    802 
    803     /// \brief create a new interpolating_function  which is the parent interpolating_function 
     1517    /// \return a new interpolating_function_p  with the same mappings for x and y
     1518        interpolating_function_p <float_type> & unary_operator(const c2_function<float_type> &source) const;
     1519
     1520    /// \brief create a new interpolating_function_p  which is the parent interpolating_function_p 
    8041521    /// combined with \a rhs using \a combiner at every point in the interpolating tables
    8051522    ///
     
    8071524    /// \param rhs the function to apply
    8081525    /// \param combining_stub a function which defines which binary operation to use.
    809     /// \return a new interpolating_function  with the same mappings for x and y
    810         interpolating_function <float_type> & binary_operator(const c2_function<float_type> &rhs,
    811            c2_binary_function<float_type> *combining_stub
     1526    /// \return a new interpolating_function_p  with the same mappings for x and y
     1527        interpolating_function_p <float_type> & binary_operator(const c2_function<float_type> &rhs,
     1528           const c2_binary_function<float_type> *combining_stub
    8121529           ) const;
    813        
    814         // InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    815         // when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    816         // can be upcast back to a c2_function to produce unprocessed binaries.
    817 
    818         /// \brief produce a newly resampled interpolating_function  which is the specified sum.
     1530        /// \brief produce a newly resampled interpolating_function_p  which is the specified sum.
    8191531    /// \param rhs the function to add, pointwise
    820     /// \return a new interpolating_function
    821     /// \note
    822         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    823         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    824         /// can be upcast back to a c2_function to produce unprocessed binaries.
    825     interpolating_function <float_type> & operator + (const c2_function<float_type> &rhs) const {
    826                 return binary_operator(rhs, new c2_sum<float_type>()); }
    827         /// \brief produce a newly resampled interpolating_function  which is the specified difference.
     1532    /// \return a new interpolating_function_p
     1533    interpolating_function_p <float_type> & add_pointwise (const c2_function<float_type> &rhs) const {
     1534                return binary_operator(rhs, new c2_sum_p<float_type>()); }
     1535        /// \brief produce a newly resampled interpolating_function_p  which is the specified difference.
    8281536    /// \param rhs the function to subtract, pointwise
    829     /// \return a new interpolating_function
    830     /// \note
    831         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    832         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    833         /// can be upcast back to a c2_function to produce unprocessed binaries.
    834         interpolating_function <float_type> & operator - (const c2_function<float_type> &rhs) const {
    835                 return binary_operator(rhs, new c2_diff<float_type>()); }
    836         /// \brief produce a newly resampled interpolating_function  which is the specified product.
     1537    /// \return a new interpolating_function_p
     1538        interpolating_function_p <float_type> & subtract_pointwise (const c2_function<float_type> &rhs) const {
     1539                return binary_operator(rhs, new c2_diff_p<float_type>()); }
     1540        /// \brief produce a newly resampled interpolating_function_p  which is the specified product.
    8371541    /// \param rhs the function to multiply, pointwise
    838     /// \return a new interpolating_function
    839     /// \note
    840         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    841         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    842         /// can be upcast back to a c2_function to produce unprocessed binaries.
    843         interpolating_function <float_type> & operator * (const c2_function<float_type> &rhs) const {
    844                 return binary_operator(rhs, new c2_product<float_type>()); }
    845         /// \brief produce a newly resampled interpolating_function  which is the specified ratio.
     1542    /// \return a new interpolating_function_p
     1543        interpolating_function_p <float_type> & multiply_pointwise (const c2_function<float_type> &rhs) const {
     1544                return binary_operator(rhs, new c2_product_p<float_type>()); }
     1545        /// \brief produce a newly resampled interpolating_function_p  which is the specified ratio.
    8461546    /// \param rhs the function to divide, pointwise
    847     /// \return a new interpolating_function
    848     /// \note
    849         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    850         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    851         /// can be upcast back to a c2_function to produce unprocessed binaries.
    852         interpolating_function <float_type> & operator / (const c2_function<float_type> &rhs) const {
    853                 return binary_operator(rhs, new c2_ratio<float_type>()); }
    854         /// \brief produce a newly resampled interpolating_function  which is the specified sum.
    855     /// \param rhs a constant to add, pointwise
    856     /// \return a new interpolating_function
    857     /// \note
    858         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    859         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    860         /// can be upcast back to a c2_function to produce unprocessed binaries.
    861         interpolating_function <float_type> & operator + (float_type rhs) const { return (*this)+c2_constant<float_type>(rhs); }
    862         /// \brief produce a newly resampled interpolating_function  which is the specified difference.
    863     /// \param rhs a constant to subtract, pointwise
    864     /// \return a new interpolating_function
    865     /// \note
    866         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    867         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    868         /// can be upcast back to a c2_function to produce unprocessed binaries.
    869         interpolating_function <float_type> & operator - (float_type rhs) const { return (*this)-c2_constant<float_type>(rhs); }
    870         /// \brief produce a newly resampled interpolating_function  which is the specified product.
    871     /// \param rhs a constant to multiply, pointwise
    872     /// \return a new interpolating_function
    873     /// \note
    874         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    875         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    876         /// can be upcast back to a c2_function to produce unprocessed binaries.
    877         interpolating_function <float_type> & operator * (float_type rhs) const { return (*this)*c2_constant<float_type>(rhs); }
    878         /// \brief produce a newly resampled interpolating_function  which is the specified ratio.
    879     /// \param rhs a constant to divide, pointwise
    880     /// \return a new interpolating_function
    881     /// \note
    882         /// InterpolatingFunctions override the c2_function operators, since they explicitly re-generate the interpolation table
    883         /// when they are applied.  If this is not desired, these operators are not virtual, so the interpolating_function
    884         /// can be upcast back to a c2_function to produce unprocessed binaries.
    885         interpolating_function <float_type> & operator / (float_type rhs) const { return (*this)/c2_constant<float_type>(rhs); }
    886        
    887         virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception);
    888        
    889         /// \brief move value & derivatives into our internal coordinates (use splint to go the other way!)
    890     /// \note why?
    891         void localize_derivatives(float_type xraw, float_type y, float_type yprime, float_type yprime2, float_type *y0, float_type *yp0, float_type *ypp0) const;
    892        
    893 protected:
    894                
    895         interpolating_function() : c2_function<float_type>() { } // default constructor is never used, prevent accidents by protecting it.
    896    
    897     /// \brief do the dirty work of constructing the spline.  See interpolating_function  constructor for details.
    898         void init(const std::vector<float_type> &, const std::vector<float_type> &,
     1547    /// \return a new interpolating_function_p
     1548        interpolating_function_p <float_type> & divide_pointwise (const c2_function<float_type> &rhs) const {
     1549                return binary_operator(rhs, new c2_ratio_p<float_type>()); }
     1550    /// \brief copy data from another interpolating function.  This only makes sense if the source
     1551        /// function has the same transforms as the destination.
     1552    /// \param rhs interpolating_function_p  to copy from
     1553        void clone_data(const interpolating_function_p <float_type> &rhs) {
     1554                Xraw=rhs.Xraw; X=rhs.X; F=rhs.F; y2=rhs.y2;
     1555                set_sampling_grid_pointer(Xraw);
     1556        }
     1557
     1558        const c2_function_transformation<float_type> &fTransform;
     1559       
     1560protected:   
     1561    /// \brief create the spline coefficients
     1562        void spline(
    8991563                          bool lowerSlopeNatural, float_type lowerSlope,
    900                           bool upperSlopeNatural, float_type upperSlope,
    901                           float_type (*inputXConversion)(float_type)=0,
    902                           float_type (*inputXConversionPrime)(float_type)=0,
    903                           float_type (*inputXConversionDPrime)(float_type)=0,
    904                           float_type (*inputYConversion)(float_type)=0,
    905                           float_type (*inputYConversionPrime)(float_type)=0,
    906                           float_type (*inputYConversionDPrime)(float_type)=0,
    907                           float_type (*outputYConversion)(float_type)=0
    908                           ) throw(c2_exception) ;
     1564                          bool upperSlopeNatural, float_type upperSlope
     1565                          ) throw(c2_exception);
     1566
     1567        // This is for sorting the data. It must be static if it's going to be a class member.
     1568        static bool comp_pair(std::pair<float_type,float_type> const &i, std::pair<float_type,float_type> const &j) {return i.first<j.first;}
    9091569
    9101570    std::vector<float_type> Xraw, X, F, y2;
    911        
    912         float_type (*fXin)(float_type), (*fYin)(float_type), (*fYout)(float_type);
    913         float_type (*fXinPrime)(float_type), (*fYinPrime)(float_type);
    914         float_type (*fXinDPrime)(float_type), (*fYinDPrime)(float_type);
    915        
    916         int xInverted;
    917     mutable int lastKLow;
    918 };
    919 
    920 /// \brief An interpolatingFunction with X transformed into log space. 
    921 ///
     1571        c2_const_ptr<float_type> sampler_function;
     1572        bool xInverted;
     1573    mutable size_t lastKLow;
     1574};
     1575
     1576/// \brief A spline with X transformed into log space. 
     1577/// \ingroup interpolators
    9221578/// Most useful for functions looking like y=log(x) or any other function with a huge X dynamic range,
    9231579/// and a slowly varying Y.
    924 template <typename float_type=double> class log_lin_interpolating_function : public interpolating_function <float_type> {
    925 public:
    926     /// \brief Construct the function.
    927     /// \param x the list of abscissas.  Must be either strictly increasing or strictly decreasing.
    928         /// Strictly increasing is preferred, as less memory is used since a copy is not required for the sampling grid.
    929     /// \param f the list of function values.
    930     /// \param lowerSlopeNatural if true, set y''(first point)=0 in LogLin space, otherwise compute it from \a lowerSope
    931     /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
    932     /// \param upperSlopeNatural if true, set y''(last point)=0 in LogLin space, otherwise compute it from \a upperSope
    933     /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
    934     log_lin_interpolating_function(const std::vector<float_type> &x, const std::vector<float_type> &f,
    935                                                                 bool lowerSlopeNatural=true, float_type lowerSlope=0.0,
    936                                                                 bool upperSlopeNatural=true, float_type upperSlope=0.0);
    937 protected:
    938         log_lin_interpolating_function() {} // do not allow naked construction... it is usually an accident.
    939 };
    940 
    941 
    942 /// \brief An interpolatingFunction with Y transformed into log space. 
    943 ///
     1580///
     1581///     The factory function c2_factory::log_lin_interpolating_function() creates *new log_lin_interpolating_function_p()
     1582template <typename float_type=double> class log_lin_interpolating_function_p : public interpolating_function_p <float_type> {
     1583public:
     1584    /// \brief an empty log-linear cubic-spline interpolating_function_p
     1585    ///
     1586        log_lin_interpolating_function_p() : interpolating_function_p<float_type>(*new c2_log_lin_function_transformation<float_type>)
     1587                { }
     1588        /// \brief create a new, empty interpolating function of this type (virtual constructor)
     1589        virtual interpolating_function_p<float_type> &clone() const throw(c2_exception)
     1590                {       return *new log_lin_interpolating_function_p<float_type>(); }
     1591};
     1592
     1593
     1594/// \brief A spline with Y transformed into log space. 
     1595/// \ingroup interpolators
    9441596/// Most useful for functions looking like y=exp(x)
    945 template <typename float_type=double> class lin_log_interpolating_function : public interpolating_function <float_type> {
    946 public:
    947     /// \brief Construct the function.
    948     /// \param x the list of abscissas.  Must be either strictly increasing or strictly decreasing.
    949         /// Strictly increasing is preferred, as less memory is used since a copy is not required for the sampling grid.
    950     /// \param f the list of function values.
    951     /// \param lowerSlopeNatural if true, set y''(first point)=0 in LinLog space, otherwise compute it from \a lowerSope
    952     /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
    953     /// \param upperSlopeNatural if true, set y''(last point)=0 in LinLog space, otherwise compute it from \a upperSope
    954     /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
    955     lin_log_interpolating_function(const std::vector<float_type> &x, const std::vector<float_type> &f,
    956                                                                 bool lowerSlopeNatural=true, float_type lowerSlope=0.0,
    957                                                                 bool upperSlopeNatural=true, float_type upperSlope=0.0);
    958 protected:
    959         lin_log_interpolating_function() {} // do not allow naked construction... it is usually an accident.
    960 };
    961 
    962 
    963 /// \brief An interpolatingFunction with X and Y transformed into log space. 
    964 ///
     1597///
     1598///     The factory function c2_factory::lin_log_interpolating_function() creates *new lin_log_interpolating_function_p()
     1599template <typename float_type=double> class lin_log_interpolating_function_p : public interpolating_function_p <float_type> {
     1600public:
     1601    /// \brief an empty linear-log cubic-spline interpolating_function_p
     1602    ///
     1603        lin_log_interpolating_function_p() : interpolating_function_p<float_type>(*new c2_lin_log_function_transformation<float_type>)
     1604                { }
     1605        /// \brief create a new, empty interpolating function of this type (virtual constructor)
     1606        virtual interpolating_function_p<float_type> &clone() const throw(c2_exception)
     1607                {       return *new lin_log_interpolating_function_p<float_type>(); }
     1608};
     1609
     1610
     1611/// \brief A spline with X and Y transformed into log space. 
     1612/// \ingroup interpolators
    9651613/// Most useful for functions looking like y=x^n or any other function with a huge X and Y dynamic range.
    966 template <typename float_type=double> class log_log_interpolating_function : public interpolating_function <float_type> {
    967 public:
    968     /// \brief Construct the function.
    969     /// \param x the list of abscissas.  Must be either strictly increasing or strictly decreasing.
    970         /// Strictly increasing is preferred, as less memory is used since a copy is not required for the sampling grid.
    971     /// \param f the list of function values.
    972     /// \param lowerSlopeNatural if true, set y''(first point)=0 in LogLog space, otherwise compute it from \a lowerSope
    973     /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
    974     /// \param upperSlopeNatural if true, set y''(last point)=0 in LogLog space, otherwise compute it from \a upperSope
    975     /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
    976     log_log_interpolating_function(const std::vector<float_type> &x, const std::vector<float_type> &f,
    977                                                                 bool lowerSlopeNatural=true, float_type lowerSlope=0.0,
    978                                                                 bool upperSlopeNatural=true, float_type upperSlope=0.0);
    979 protected:
    980         log_log_interpolating_function() {} // do not allow naked construction... it is usually an accident.
    981 };
    982 
    983 
    984 /// \brief An interpolating_function  with X in reciprocal space and Y transformed in log space. 
    985 ///
     1614///
     1615///     The factory function c2_factory::log_log_interpolating_function() creates *new log_log_interpolating_function_p()
     1616template <typename float_type=double> class log_log_interpolating_function_p : public interpolating_function_p <float_type> {
     1617public:
     1618    /// \brief an empty log-log cubic-spline interpolating_function_p
     1619    ///
     1620        log_log_interpolating_function_p() : interpolating_function_p<float_type>(*new c2_log_log_function_transformation<float_type>)
     1621                { }
     1622        /// \brief create a new, empty interpolating function of this type (virtual constructor)
     1623        virtual interpolating_function_p<float_type> &clone() const throw(c2_exception)
     1624        {       return *new log_log_interpolating_function_p<float_type>(); }
     1625};
     1626
     1627
     1628/// \brief A spline with X in reciprocal space and Y transformed in log space. 
     1629/// \ingroup interpolators
    9861630/// Most useful for thermodynamic types of data where Y is roughly A*exp(-B/x).
    9871631/// Typical examples are reaction rate data, and thermistor calibration data.
    988 template <typename float_type=double> class arrhenius_interpolating_function : public interpolating_function <float_type> {
    989 public:
    990     /// \brief Construct the function.
    991     /// \param x the list of abscissas.  Must be either strictly increasing or strictly decreasing.
    992         /// Strictly increasing is preferred, as less memory is used since a copy is not required for the sampling grid.
    993     /// \param f the list of function values.
    994     /// \param lowerSlopeNatural if true, set y''(first point)=0 in Arrhenius space, otherwise compute it from \a lowerSope
    995     /// \param lowerSlope derivative of the function at the lower bound, used only if \a lowerSlopeNatural is false
    996     /// \param upperSlopeNatural if true, set y''(last point)=0 in Arrhenius space, otherwise compute it from \a upperSope
    997     /// \param upperSlope derivative of the function at the upper bound, used only if \a upperSlopeNatural is false
    998     arrhenius_interpolating_function(const std::vector<float_type> &x, const std::vector<float_type> &f,
    999                                                                 bool lowerSlopeNatural=true, float_type lowerSlope=0.0,
    1000                                                                 bool upperSlopeNatural=true, float_type upperSlope=0.0);
    1001 protected:
    1002         arrhenius_interpolating_function() {} // do not allow naked construction... it is usually an accident.
    1003 };
    1004 
    1005 /**
    1006  \brief create a linear-linear interpolating grid with both x & y set to
    1007  (xmin, xmin+dx, ... xmin + (count-1)*dx )
    1008 
    1009  very useful for transformaiton with other functions e.g.
    1010  \code
    1011  f=c2_sin<double>::sin(LinearInterpolatingGrid(-0.1,0.1, 65))
    1012  \endcode
    1013  creates a spline table of sin(x) slightly beyond the first period
    1014  \param xmin the starting point for the grid
    1015  \param dx the step size for the grid
    1016  \param count the number of points in the  grid
    1017  \return an identity interpolating_function  with the requested grid
    1018  */
    1019 template <typename float_type> interpolating_function <float_type> &linear_interpolating_grid(float_type xmin, float_type dx, int count) {
    1020         std::vector<float_type> x(count);
    1021         for(int i=0; i<count; i++) x[i]=xmin + i * dx;
    1022         return *new interpolating_function <float_type>(x,x);
    1023 }
    1024 
    1025 /**
    1026  \brief create a log-log interpolating grid with both x & y set to
    1027  (xmin, xmin*dx, ... xmin * dx^(count-1) )
    1028 
    1029  very useful for transformaiton with other functions e.g.
    1030  \code
    1031  f=c2_log<double>::log(LogLogInterpolatingGrid(2, 1.1, 65))
    1032  \endcode
    1033  creates a spline table of log(x)
    1034  \param xmin the starting point for the grid
    1035  \param dx the ratio between points
    1036  \param count the number of points in the  grid
    1037  \return an identity log_log_interpolating_function with the requested grid
    1038 */
    1039 template <typename float_type> log_log_interpolating_function <float_type> &log_log_interpolating_grid(float_type xmin, float_type dx, int count) {
    1040         std::vector<float_type> x(count);
    1041         x[0]=xmin;
    1042         for(int i=1; i<count; i++) x[i]=dx*x[i-1];
    1043         return *new log_log_interpolating_function<float_type>(x,x);
    1044 }
     1632///
     1633///     The factory function c2_factory::arrhenius_interpolating_function() creates *new arrhenius_interpolating_function_p()
     1634template <typename float_type=double> class arrhenius_interpolating_function_p : public interpolating_function_p <float_type> {
     1635public:
     1636    /// \brief an empty arrhenius cubic-spline interpolating_function_p
     1637    ///
     1638        arrhenius_interpolating_function_p() : interpolating_function_p<float_type>(*new c2_arrhenius_function_transformation<float_type>)
     1639                { }
     1640        /// \brief create a new, empty interpolating function of this type (virtual constructor)
     1641        virtual interpolating_function_p<float_type> &clone() const throw(c2_exception)
     1642        {       return *new arrhenius_interpolating_function_p<float_type>(); }
     1643};
    10451644
    10461645/// \brief compute sin(x) with its derivatives.
    1047 ///
    1048 /// Creates a singleton instance c2_sin::sin of itself for convenient access.
    1049 template <typename float_type=double> class c2_sin : public c2_function<float_type> {
    1050 public:
    1051         /// \brief constructor.  There is alread a singleton c2_sin::sin, which usually suffices.
    1052         c2_sin() {}
     1646/// \ingroup math_functions
     1647///
     1648/// The factory function c2_factory::sin() creates *new c2_sin_p
     1649template <typename float_type=double> class c2_sin_p : public c2_function<float_type> {
     1650public:
     1651        /// \brief constructor.
     1652        c2_sin_p() : c2_function<float_type>() {}
    10531653       
    10541654        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     
    10581658    /// \param xmin the lower bound for the grid
    10591659    /// \param xmax upper bound for the grid
    1060     /// \return a new sampling grid.
    1061         virtual std::vector<float_type> &get_sampling_grid(float_type xmin, float_type xmax);
    1062     /// \brief the static singleton
    1063         static const c2_sin sin;
    1064 };
     1660    /// \param [in, out] grid the sampling grid.
     1661        virtual void get_sampling_grid(float_type xmin, float_type xmax,  std::vector<float_type> &grid) const;
     1662};
     1663
    10651664/// \brief compute cos(x) with its derivatives.
    1066 ///
    1067 /// Creates a singleton instance c2_cos::cos of itself for convenient access.
    1068 template <typename float_type=double> class c2_cos : public c2_sin<float_type> {
    1069 public:
    1070         /// \brief constructor.  There is already a singleton c2_cos::cos, which usually suffices.
    1071         c2_cos() {}
     1665/// \ingroup math_functions
     1666///
     1667/// The factory function c2_factory::cos() creates *new c2_cos_p
     1668template <typename float_type=double> class c2_cos_p : public c2_sin_p<float_type> {
     1669public:
     1670        /// \brief constructor.
     1671        c2_cos_p() : c2_sin_p<float_type>() {}
    10721672       
    10731673        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    10741674        { float_type q=std::cos(x); if(yprime) *yprime=-std::sin(x); if(yprime2) *yprime2=-q; return q; }       
    1075     /// \brief the static singleton
    1076         static const c2_cos cos;
    1077 };
     1675};
     1676
    10781677/// \brief compute tan(x) with its derivatives.
    1079 ///
    1080 /// Creates a singleton instance c2_tan::tan of itself for convenient access.
    1081 template <typename float_type=double> class c2_tan : public c2_function<float_type> {
    1082 public:
    1083         /// \brief constructor.  There is already a singleton c2_tan::tan, which usually suffices.
    1084         c2_tan() {}
     1678/// \ingroup math_functions
     1679///
     1680/// The factory function c2_factory::tan() creates *new c2_tan_p
     1681template <typename float_type=double> class c2_tan_p : public c2_function<float_type> {
     1682public:
     1683        /// \brief constructor.
     1684        c2_tan_p() : c2_function<float_type>() {}
    10851685       
    10861686        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     
    10921692                return t;
    10931693        }       
    1094     /// \brief the static singleton
    1095         static const c2_tan tan;
    1096 };
     1694};
     1695
    10971696/// \brief compute log(x) with its derivatives.
    1098 ///
    1099 /// Creates a singleton instance c2_log::log of itself for convenient access.
    1100 template <typename float_type=double> class c2_log : public c2_function<float_type> {
    1101 public:
    1102         /// \brief constructor.  There is already a singleton c2_log::log, which usually suffices.
    1103         c2_log() {}
     1697/// \ingroup math_functions
     1698///
     1699/// The factory function c2_factory::log() creates *new c2_log_p
     1700template <typename float_type=double> class c2_log_p : public c2_function<float_type> {
     1701public:
     1702        /// \brief constructor.
     1703        c2_log_p() : c2_function<float_type>() {}
    11041704
    11051705        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    11061706        { if(yprime) *yprime=1.0/x; if(yprime2) *yprime2=-1.0/(x*x); return std::log(x); }     
    1107     /// \brief the static singleton
    1108         static const c2_log log;
    1109 };
     1707};
     1708
    11101709/// \brief compute exp(x) with its derivatives.
    1111 ///
    1112 /// Creates a singleton instance c2_exp::exp of itself for convenient access.
    1113 template <typename float_type=double>  class c2_exp : public c2_function<float_type> {
    1114 public:
    1115         /// \brief constructor.  There is already a singleton c2_exp::exp, which usually suffices.
    1116         c2_exp() {}
     1710/// \ingroup math_functions
     1711///
     1712/// The factory function c2_factory::exp() creates *new c2_exp_p
     1713template <typename float_type=double>  class c2_exp_p : public c2_function<float_type> {
     1714public:
     1715        /// \brief constructor.
     1716        c2_exp_p() : c2_function<float_type>() {}
    11171717
    11181718        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    11191719        { float_type q=std::exp(x); if(yprime) *yprime=q; if(yprime2) *yprime2=q; return q; }
    1120     /// \ brief the static singleton
    1121         static const c2_exp exp;
    1122 };
     1720};
     1721
    11231722/// \brief compute sqrt(x) with its derivatives.
    1124 ///
    1125 /// Creates a singleton instance c2_sqrt::sqrt of itself for convenient access.
    1126 template <typename float_type=double> class c2_sqrt : public c2_function<float_type> {
    1127 public:
    1128         /// \brief constructor.  There is already a singleton c2_sqrt::sqrt, which usually suffices.
    1129         c2_sqrt() {}
     1723/// \ingroup math_functions
     1724///
     1725/// The factory function c2_factory::sqrt() creates *new c2_sqrt_p()
     1726template <typename float_type=double> class c2_sqrt_p : public c2_function<float_type> {
     1727public:
     1728        /// \brief constructor.
     1729        c2_sqrt_p() : c2_function<float_type>() {}
    11301730       
    11311731        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    11321732        { float_type q=std::sqrt(x); if(yprime) *yprime=0.5/q; if(yprime2) *yprime2=-0.25/(x*q); return q; }
    1133     /// \brief the static singleton
    1134         static const c2_sqrt sqrt;
    1135 };
     1733};
     1734
    11361735/// \brief compute scale/x with its derivatives.
    1137 ///
    1138 /// Creates a singleton instance c2_recip:recip of itself for convenient access.
    1139 template <typename float_type=double> class c2_recip : public c2_function<float_type> {
    1140 public:
    1141         /// \brief constructor.  There is already a singleton c2_recip::recip, which usually suffices.
    1142         c2_recip(float_type scale) : rscale(scale) {}
     1736/// \ingroup parametric_functions
     1737///
     1738/// The factory function c2_factory::recip() creates *new c2_recip_p
     1739template <typename float_type=double> class c2_recip_p : public c2_function<float_type> {
     1740public:
     1741        /// \brief constructor.
     1742        c2_recip_p(float_type scale) : c2_function<float_type>(), rscale(scale) {}
    11431743       
    11441744        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
     
    11531753        /// \param scale the new numerator
    11541754        void reset(float_type scale) { rscale=scale; }
    1155     /// \brief the static singleton
    1156         static const c2_recip recip;
    11571755private:
    11581756        float_type rscale;
    11591757};
     1758
    11601759/// \brief compute x with its derivatives.
    1161 ///
    1162 /// Creates a singleton instance c2_identity::identity of itself for convenient access.
    1163 template <typename float_type=double> class c2_identity : public c2_function<float_type> {
    1164 public:
    1165         /// \brief constructor.  There is already a singleton c2_identity::identity, which usually suffices.
    1166         c2_identity() {}
     1760/// \ingroup math_functions
     1761///
     1762/// The factory function c2_factory::identity() creates *new c2_identity_p
     1763template <typename float_type=double> class c2_identity_p : public c2_function<float_type> {
     1764public:
     1765        /// \brief constructor.
     1766        c2_identity_p() : c2_function<float_type>() {}
    11671767       
    11681768        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    11691769        { if(yprime) *yprime=1.0; if(yprime2) *yprime2=0; return x; }
    1170     /// \brief the static singleton
    1171         static const c2_identity identity;
    11721770};
    11731771
    11741772/**
    11751773 \brief create a linear mapping of another function
    1176  
     1774 \ingroup parametric_functions
    11771775 for example, given a c2_function \a f
    11781776 \code
    1179  c2_linear<double> L(1.2, 2.0, 3.0);
    1180  c2_composed_function<double> &F=L(f);
     1777 c2_function<double> &F=c2_linear<double>(1.2, 2.0, 3.0)(f);
    11811778 \endcode
    11821779 produces a new c2_function F=2.0+3.0*(\a f - 1.2)
     1780 
     1781 The factory function c2_factory::linear() creates *new c2_linear_p
    11831782*/
    1184 template <typename float_type=double> class c2_linear : public c2_function<float_type> {
     1783template <typename float_type=double> class c2_linear_p : public c2_function<float_type> {
    11851784public:
    11861785    /// \brief Construct the operator f=y0 + slope * (x-x0)
     
    11881787    /// \param y0 the y-intercept i.e. f(x0)
    11891788    /// \param slope the slope of the mapping
    1190         c2_linear(float_type x0, float_type y0, float_type slope) : xint(x0), intercept(y0), m(slope) {}
     1789        c2_linear_p(float_type x0, float_type y0, float_type slope) :
     1790                c2_function<float_type>(), xint(x0), intercept(y0), m(slope) {}
    11911791    /// \brief Change the slope and intercepts after construction.
    11921792        /// \param x0 the x offset
     
    12001800                float_type xint, intercept, m;
    12011801protected:
    1202                 c2_linear() {} // do not allow naked construction... it is usually an accident.
     1802                c2_linear_p() {} // do not allow naked construction... it is usually an accident.
    12031803};
    12041804
    12051805/**
    12061806\brief create a quadratic mapping of another function
    1207  
     1807 \ingroup parametric_functions
    12081808 for example, given a c2_function \a f
    12091809 \code
    1210  c2_quadratic<double> Q(1.2, 2.0, 3.0, 4.0);
    1211  c2_composed_function<double> &F=Q(f);
     1810 c2_function<double> &F=c2_quadratic<double>(1.2, 2.0, 3.0, 4.0)(f);
    12121811 \endcode
    12131812 produces a new c2_function F=2.0 + 3.0*(f-1.2) + 4.0*(f-1.2)^2
     
    12151814 note that the parameters are overdetermined, but allows the flexibility of two different representations
    12161815
     1816 The factory function c2_factory::quadratic() creates *new c2_quadratic_p
    12171817 */
    1218 template <typename float_type=double> class c2_quadratic : public c2_function<float_type> {
     1818template <typename float_type=double> class c2_quadratic_p : public c2_function<float_type> {
    12191819public:
    12201820    /// \brief Construct the operator
     
    12231823    /// \param xcoef the scale on the (\a x - \a x0) term
    12241824    /// \param x2coef the scale on the (\a x - \a x0)^2 term
    1225         c2_quadratic(float_type x0, float_type y0, float_type xcoef, float_type x2coef) : intercept(y0), center(x0), a(x2coef), b(xcoef) {}
    1226     /// Modify the mapping after construction
     1825        c2_quadratic_p(float_type x0, float_type y0, float_type xcoef, float_type x2coef) :
     1826                c2_function<float_type>(), intercept(y0), center(x0), a(x2coef), b(xcoef) {}
     1827    /// \brief Modify the coefficients after construction
    12271828    /// \param x0 the new center around which the powers are computed
    12281829    /// \param y0 the new value of the function at \a x = \a x0
     
    12361837                float_type intercept, center, a, b;
    12371838protected:
    1238                 c2_quadratic() {} // do not allow naked construction... it is usually an accident.
     1839                c2_quadratic_p() {} // do not allow naked construction... it is usually an accident.
    12391840};
    12401841
    12411842/**
    12421843\brief create a power law mapping of another function
    1243  
     1844 \ingroup parametric_functions
    12441845 for example, given a c2_function \a f
    12451846 \code
    1246  c2_power_law<double> PLaw(1.2, 2.5);
    1247  c2_composed_function<double> &F=PLaw(f);
     1847 c2_power_law_p<double> PLaw(1.2, 2.5);
     1848 c2_composed_function_p<double> &F=PLaw(f);
    12481849 \endcode
    12491850 produces a new c2_function F=1.2 * f^2.5
    12501851 
     1852 The factory function c2_factory::power_law() creates *new c2_power_law_p
    12511853 */
    1252 template <typename float_type=double> class c2_power_law : public c2_function<float_type> {
     1854template <typename float_type=double> class c2_power_law_p : public c2_function<float_type> {
    12531855public:
    12541856    /// \brief Construct the operator
    12551857    /// \param scale the multipler
    12561858    /// \param power the exponent
    1257         c2_power_law(float_type scale, float_type power) : a(scale), b(power) {}
     1859        c2_power_law_p(float_type scale, float_type power) :
     1860                c2_function<float_type>(), a(scale), b(power) {}
    12581861    /// \brief Modify the mapping after construction
    12591862    /// \param scale the new multipler
     
    12661869                float_type a, b;
    12671870protected:
    1268                 c2_power_law() {} // do not allow naked construction... it is usually an accident.
     1871                c2_power_law_p() {} // do not allow naked construction... it is usually an accident.
    12691872};
    12701873
    12711874/**
    12721875\brief create the formal inverse function of another function
    1273  
     1876 \ingroup containers
    12741877 for example, given a c2_function \a f
    12751878 \code
     
    12821885 derivatives, too, unlike the case of a simple root-finding inverse.  This means
    12831886 it can be integrated (for example) quite efficiently.
    1284  
    1285  Note that it is a subclass of c2_scaled_function only to manage ownership of another c2_function.
    1286  */
    1287 template <typename float_type=double> class c2_inverse_function : public c2_plugin_function<float_type> {
     1887
     1888 \see \ref combined_inversion_hinting_sampling
     1889
     1890 The factory function c2_factory::inverse_function() creates *new c2_inverse_function_p
     1891*/
     1892template <typename float_type=double> class c2_inverse_function_p : public c2_function<float_type> {
    12881893public:
    12891894    /// \brief Construct the operator
    12901895    /// \param source the function to be inverted
    1291         c2_inverse_function(const c2_function<float_type> &source); 
     1896        c2_inverse_function_p(const c2_function<float_type> &source); 
    12921897    virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception);
    12931898   
     
    13011906    ///  It is used in value_with_derivatives() to guess where to start the root finder.
    13021907    /// \param x the abscissa for which an estimate is needed
    1303     virtual float_type get_start_hint(float_type x) const { return start_hint; }
    1304    
     1908    virtual float_type get_start_hint(float_type x) const
     1909                { return hinting_function.valid()? hinting_function(x) : start_hint; }
     1910
     1911        /// \brief set or unset the approximate function used to start the root finder
     1912        /// \anchor set_hinting_function_discussion
     1913        /// A hinting function is mostly useful if the evaluation of this inverse is
     1914        /// going to be carried out in very non-local order, so the root finder has to start over
     1915        /// for each step.  If most evaluations are going to be made in fairly localized clusters (scanning
     1916        /// through the function, for example), the default mechanism used (which just remembers the last point)
     1917        /// is almost certainly faster.
     1918        ///
     1919        /// Typically, the hinting function is likely to be set up by creating the inverse function,
     1920        /// and then adaptively sampling an interpolating function from it, and then using the result
     1921        /// to hint it.  Another way, if the parent function is already an interpolating function, is just to create
     1922        /// a version of the parent with the x & y coordinates reversed.
     1923        ///
     1924        /// \see \ref combined_inversion_hinting_sampling
     1925        ///
     1926        /// \param hint_func the function that is an approximate inverse of the parent of this inverse_function
     1927        void set_hinting_function(const c2_function<float_type> *hint_func)
     1928                { hinting_function.set_function(hint_func); }
     1929    /// \brief set the hinting function from a pointer.
     1930        ///
     1931        /// See \ref set_hinting_function_discussion "discussion"
     1932        /// \param hint_func the container holding the function
     1933        void set_hinting_function(const c2_const_ptr<float_type> hint_func)
     1934                { hinting_function=hint_func; }
     1935       
    13051936protected:
    1306     c2_inverse_function() {} // do not allow naked construction... it is usually an accident.
    1307     mutable float_type start_hint;
     1937        c2_inverse_function_p() {} // do not allow naked construction... it is usually an accident.
     1938        mutable float_type start_hint;
     1939        const c2_const_ptr<float_type> func;
     1940        c2_const_ptr<float_type> hinting_function;
    13081941};
    13091942
    13101943/**
    13111944  \brief
    1312     An interpolating_function  which is the cumulative integral of a histogram.
    1313 
     1945    An interpolating_function_p  which is the cumulative integral of a histogram.
     1946        \ingroup interpolators
    13141947    Note than binedges should be one element longer than binheights, since the lower & upper edges are specified.
    13151948    Note that this is a malformed spline, since the second derivatives are all zero, so it has less continuity.
     
    13181951*/
    13191952
    1320 template <typename float_type=double>  class accumulated_histogram : public interpolating_function <float_type> {
     1953template <typename float_type=double>  class accumulated_histogram : public interpolating_function_p <float_type> {
    13211954public:
    13221955    /// \brief Construct the integrated histogram
     
    13321965
    13331966/**
    1334   \brief Construct a function useful for generation of random numbers from the given distribution
    1335  
    1336   inverse_integrated_density<InterpolatingFunctionFlavor>() starts with a probability density c2_function, generates the integral,
    1337   and generates an interpolating_function  which, when evaluated using a uniform random on [0,1] returns values
    1338   with a density distribution equal to the input distribution
    1339   If the data are passed in reverse order (large X first), the integral is carried out from the big end.
     1967        \anchor inverse_integrated_density_bins
     1968        \brief construct from a grid of points and an std::vector of probability densities (un-normalized)
     1969        \see  \ref random_subsec "Arbitrary random generation"
     1970        \ingroup interpolators
     1971         inverse_integrated_density starts with a probability density  std::vector, generates the integral,
     1972         and generates an interpolating_function_p  of the inverse function which, when evaluated using a uniform random on [0,1] returns values
     1973         with a density distribution equal to the input distribution
     1974         If the data are passed in reverse order (large X first), the integral is carried out from the big end.
     1975         
     1976        \param bins if \a bins .size()==\a binheights .size(), the centers of the bins.  \n
     1977        if \a bins .size()==\a binheights .size()+1, the edges of the bins
     1978        \param binheights a vector which describes the density of the random number distribution to be produced.
     1979        Note density... the numbers in the bins are not counts, but counts/unit bin width.
     1980        \return an interpolating_function_p  of the type requested in the template which,
     1981        if evaluated randomly with a uniform variate on [0,1] produces numbers
     1982        distributed according to \a binheights
     1983*/
     1984
     1985template <typename float_type, typename Final>
     1986interpolating_function_p<float_type> & inverse_integrated_density_bins(
     1987                const std::vector<float_type> &bins, const std::vector<float_type> &binheights)
     1988                throw(c2_exception);
     1989
     1990/**
     1991\anchor inverse_integrated_density_function
     1992        \brief construct from a grid of points and a c2_function of probability densities (un-normalized)
     1993        \see  \ref random_subsec "Arbitrary random generation"
     1994        \ingroup interpolators
     1995 inverse_integrated_density starts with a probability density  std::vector, generates the integral,
     1996 and generates an interpolating_function_p  of the inverse function which, when evaluated using a uniform random on [0,1] returns values
     1997 with a density distribution equal to the input distribution
     1998 If the data are passed in reverse order (large X first), the integral is carried out from the big end.
    13401999 
    1341   \sa  template <typename Intermediate, typename Final> Final inverse_integrated_density(const std::vector, c2_function &)
    1342  
    1343   \param bincenters points at which to sample the c2_function \a binheights
    1344   \param binheights a c2_function which describes the random number distribution to be produced.
    1345   \return an interpolating_function  of the type requested in the template which,
    1346      if evaluated randomly with a uniform variate on [0,1) produces numbers
    1347      distributed according to \a binheights
    1348 */
    1349 
    1350 template <typename float_type, typename Final >
    1351         Final &inverse_integrated_density(const std::vector<float_type> &bincenters, c2_function<float_type> &binheights)
    1352 {       
    1353         std::vector<float_type> integral;
    1354        
    1355         // integrate from first to last bin in original order, leaving results in integral
    1356         // ask for relative error of 1e-6 on each bin, with absolute error set to 0 (since we don't know the data scale).
    1357         float_type sum=binheights.partial_integrals(bincenters, &integral, 0.0, 1e-6);
    1358         // the integral vector now has partial integrals... it must be accumulated by summing
    1359         integral.insert(integral.begin(), 0.0); // integral from start to start is 0
    1360         float_type scale=1.0/sum;
    1361         for(size_t i=1; i<integral.size(); i++) integral[i]=integral[i]*scale + integral[i-1];
    1362         integral.back()=1.0; // force exact value on boundary
    1363        
    1364         return  *new Final(integral, bincenters,
    1365                                            false, 1.0/(scale*binheights(bincenters.front() )),
    1366                                            false, 1.0/(scale*binheights(bincenters.back() ))
    1367                                            ); // use integral as x axis in inverse function
    1368 }
    1369 
    1370 /**
    1371  \brief Construct a function useful for generation of random numbers from the given distribution
    1372 
    1373  \code
    1374  template <typename Intermediate, typename Final>
    1375      Final & inverse_integrated_density(const std::vector &bincenters, const std::vector &binheights)
    1376  \endcode
    1377  is a variant of \code
    1378  template <typename Final>
    1379      Final & inverse_integrated_density(const std::vector &bincenters, c2_function &binheights)
    1380  \endcode
    1381  which takes two std::vectors and generates the intermediate interpolating_function  required for
    1382  inverse_integrated_density(), and then calls it.
    1383 
    1384  \param bincenters points at which \a binheights are defined
    1385  \param binheights an std::vector which describes the random number distribution to be produced.
    1386  \return an interpolating_function  of the type requested in the template which,
    1387  if evaluated randomly with a uniform variate on [0,1) produces numbers
    1388   distributed according to \a binheights
    1389 */
    1390 
    1391 template <typename float_type, typename Intermediate, typename Final> Final
    1392     &inverse_integrated_density(const std::vector<float_type> &bincenters, const std::vector<float_type> &binheights)
    1393 {       
    1394         std::vector<float_type> be(bincenters), bh(binheights);
    1395        
    1396         if(be[1] < be[0]) { // reverse data for interpolator if x axis passed in backwards
    1397                 std::reverse(be.begin(), be.end());
    1398                 std::reverse(bh.begin(), bh.end());
    1399         }
    1400        
    1401         Intermediate temp(be, bh); // create a temporary interpolating_function  to integrate
    1402         Final &result=inverse_integrated_density<Final>(bincenters, temp);
    1403        
    1404         return result;
    1405 }
     2000        \param bincenters the centers of the bins.
     2001        \param binheights a c2_function which describes the density of the random number distribution to be produced.
     2002        \return an interpolating_function_p  of the type requested in the template which,
     2003        if evaluated randomly with a uniform variate on [0,1] produces numbers
     2004        distributed according to \a binheights
     2005 */
     2006template <typename float_type, typename Final>
     2007interpolating_function_p<float_type>  & inverse_integrated_density_function(
     2008                const std::vector<float_type> &bincenters, const c2_function<float_type> &binheights)
     2009                throw(c2_exception);
    14062010
    14072011/// \brief create a c2_function which smoothly connects two other c2_functions.
    1408 ///
     2012/// \ingroup parametric_functions
    14092013/// This takes two points and generates a polynomial which matches two c2_function arguments
    14102014/// at those two points, with two derivatives at each point, and an arbitrary value at the center of the
     
    14142018/// of order 5.  If \a auto_center is false, the value \a y1 is used at the midpoint, resulting in a
    14152019/// polynomial of order 6.
    1416 template <typename float_type=double> class c2_connector_function : public c2_function<float_type> {
     2020///
     2021/// This is usually used in conjunction with c2_piecewise_function_p to assemble an apparently seamless
     2022/// function from a series of segments.
     2023/// \see \ref piecewise_applications_subsec "Sample Applications" and \ref c2_function::adaptively_sample() "Adaptive sampling"
     2024///
     2025/// The factory function c2_factory::connector_function() creates *new c2_connector_function_p
     2026template <typename float_type=double> class c2_connector_function_p : public c2_function<float_type> {
    14172027public:
    1418         /// \brief construct the container
    1419         /// \param f1 the function on the left side to be connected
     2028        /// \brief construct the container from two functions
     2029        /// \param x0 the point at which to match \a f1 and its derivatives
     2030        /// \param f0 the function on the left side to be connected
     2031        /// \param x2 the point at which to match \a f2 and its derivatives
    14202032        /// \param f2 the function on the right side to be connected
    1421         /// \param x0 the point at which to match \a f1 and its derivatives
    1422         /// \param x2 the point at which to match \a f2 and its derivatives
    14232033        /// \param auto_center if true, no midpoint value is specified.  If false, match the value \a y1 at the midpoint
    14242034        /// \param y1 the value to match at the midpoint, if \a auto_center is false
    1425         /// \return a c2_function with domain (\a x0,\a x2) which smoothly connects \a f1 and \a f2
    1426         c2_connector_function(const c2_function<float_type> &f1, const c2_function<float_type> &f2, float_type x0, float_type x2,
     2035        /// \return a c2_function with domain (\a x0,\a x2) which smoothly connects \a f0(x0) and \a f2(x2)
     2036        c2_connector_function_p(float_type x0, const c2_function<float_type> &f0, float_type x2, const c2_function<float_type> &f2,
    14272037                        bool auto_center, float_type y1);
     2038        /// \brief construct the container from numerical values
     2039        /// \param x0 the position of the left edge
     2040        /// \param y0 the function derivative on the left boundary
     2041        /// \param yp0 the function second derivative on the left boundary
     2042        /// \param ypp0 the function value on the left boundary
     2043        /// \param x2 the position of the right edge
     2044        /// \param y2 the function derivative on the right boundary
     2045        /// \param yp2 the function second derivative on the right boundary
     2046        /// \param ypp2 the function value on the right boundary
     2047        /// \param auto_center if true, no midpoint value is specified.  If false, match the value \a y1 at the midpoint
     2048        /// \param y1 the value to match at the midpoint, if \a auto_center is false
     2049        /// \return a c2_function with domain (\a x0,\a x2) which smoothly connects the points described
     2050        /// \anchor c2_connector_raw_init_docs
     2051        c2_connector_function_p(
     2052                float_type x0, float_type y0, float_type yp0, float_type ypp0,
     2053                float_type x2, float_type y2, float_type yp2, float_type ypp2,
     2054                bool auto_center, float_type y1);
     2055        /// \brief construct the container from c2_fblock<float_type> objects
     2056        /// \param fb0 the left edge
     2057        /// \param fb2 the right edge
     2058        /// \param auto_center if true, no midpoint value is specified.  If false, match the value \a y1 at the midpoint
     2059        /// \param y1 the value to match at the midpoint, if \a auto_center is false
     2060        /// \return a c2_function with domain (\a fb0.x,\a fb2.x) which smoothly connects \a fb0 and \a fb2
     2061        c2_connector_function_p(
     2062                const c2_fblock<float_type> &fb0,
     2063                const c2_fblock<float_type> &fb2,
     2064                bool auto_center, float_type y1);
     2065
    14282066        /// \brief destructor
    1429         virtual ~c2_connector_function();
     2067        virtual ~c2_connector_function_p();
    14302068        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw (c2_exception);
    14312069protected:
    1432         float_type fx1, fhinv, fdx, fy1, fa, fb, fc, fd, fe, ff;
    1433 };
    1434 
    1435 
     2070        /// \brief fill container numerically
     2071        void init(
     2072                const c2_fblock<float_type> &fb0,
     2073                const c2_fblock<float_type> &fb2,
     2074                bool auto_center, float_type y1);
     2075
     2076        float_type fhinv, fy1, fa, fb, fc, fd, fe, ff;
     2077};
    14362078
    14372079/// \brief create a c2_function which is a piecewise assembly of other c2_functions.
    1438 ///
     2080/// \ingroup containers
    14392081/// The functions must have increasing, non-overlapping domains.  Any empty space
    14402082/// between functions will be filled with a linear interpolation.
     2083///
     2084/// \note If you want a smooth connection, instead of the default linear interpolation,
     2085/// create a c2_connector_function_p to bridge the gap.  The linear interpolation is intended
     2086/// to be a barely intelligent bridge, and may never get used by anyone.
     2087///
    14412088/// \note The creation of the container results in the creation of an explicit sampling grid. 
    14422089/// If this is used with functions with a large domain, or which generate very dense sampling grids,
    14432090/// it could eat a lot of memory.  Do not abuse this by using functions which can generate gigantic grids.
    14442091///
    1445 /// See c2_plugin_function for a discussion of how this might be used.
    1446 template <typename float_type=double> class c2_piecewise_function : public c2_function<float_type> {
     2092/// \see \ref piecewise_applications_subsec "Sample Applications" \n
     2093/// c2_plugin_function_p page \n
     2094/// c2_connector_function_p page \n
     2095/// \ref c2_function::adaptively_sample() "Adaptive sampling"
     2096///
     2097/// The factory function c2_factory::piecewise_function() creates *new c2_piecewise_function_p
     2098template <typename float_type=double> class c2_piecewise_function_p : public c2_function<float_type> {
    14472099public:
    14482100        /// \brief construct the container
    1449         c2_piecewise_function();
     2101        c2_piecewise_function_p();
    14502102        /// \brief destructor
    1451         virtual ~c2_piecewise_function();
     2103        virtual ~c2_piecewise_function_p();
    14522104        virtual float_type value_with_derivatives(float_type x, float_type *yprime, float_type *yprime2) const throw (c2_exception);
    14532105        /// \brief append a new function to the sequence
     
    14572109        /// the final function.  If the domain exactly abuts the domain of the previous function, it
    14582110        /// will be directly attached.  If there is a gap, the gap will be filled in by linear interpolation.
    1459         /// If the function being appended is to be deleted automatically when this container is deleted, set the pass_ownership flag.
    14602111        /// \param func a c2_function with a defined domain to be appended to the collection
    1461         /// \param pass_ownership if set, \a func will be deleted when the container is destroyed
    1462         void append_function(c2_function<float_type> &func, bool pass_ownership) throw (c2_exception);
     2112        void append_function(const c2_function<float_type> &func) throw (c2_exception);
    14632113protected:
    1464         std::vector<c2_function<float_type> *> functions;
    1465         std::vector<bool> owns;
     2114        std::vector<c2_const_ptr<float_type> > functions;
    14662115        mutable int lastKLow;
    14672116};
  • trunk/examples/extended/electromagnetic/TestEm7/include/c2_function.icc

    r807 r1230  
     1//
     2// ********************************************************************
     3// * License and Disclaimer                                           *
     4// *                                                                  *
     5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
     6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
     7// * conditions of the Geant4 Software License,  included in the file *
     8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
     9// * include a list of copyright holders.                             *
     10// *                                                                  *
     11// * Neither the authors of this software system, nor their employing *
     12// * institutes,nor the agencies providing financial support for this *
     13// * work  make  any representation or  warranty, express or implied, *
     14// * regarding  this  software system or assume any liability for its *
     15// * use.  Please see the license in the file  LICENSE  and URL above *
     16// * for the full disclaimer and the limitation of liability.         *
     17// *                                                                  *
     18// * This  code  implementation is the result of  the  scientific and *
     19// * technical work of the GEANT4 collaboration.                      *
     20// * By using,  copying,  modifying or  distributing the software (or *
     21// * any work based  on the software)  you  agree  to acknowledge its *
     22// * use  in  resulting  scientific  publications,  and indicate your *
     23// * acceptance of all terms of the Geant4 Software license.          *
     24// ********************************************************************
     25//
     26//
    127/**
    228 *  \file
     
    733 *  \author Copyright 2005 __Vanderbilt University__. All rights reserved.
    834 *
    9  *      \version c2_function.cc,v 1.43 2007/11/12 20:22:54 marcus Exp
     35 *      \version c2_function.cc,v 1.169 2008/05/22 12:45:19 marcus Exp
    1036 */
    1137
     
    2248
    2349template <typename float_type> const std::string c2_function<float_type>::cvs_file_vers() const
    24 { return "c2_function.cc,v 1.43 2007/11/12 20:22:54 marcus Exp"; }
     50{ return "c2_function.cc,v 1.169 2008/05/22 12:45:19 marcus Exp"; }
    2551
    2652// find a pre-bracketed root of a c2_function, which is a MUCH easier job than general root finding
     
    3359        // find f(x)=value within the brackets, using the guarantees of smoothness associated with a c2_function
    3460        // can use local f(x)=a*x**2 + b*x + c and solve quadratic to find root, then iterate
    35         reset_evaluations();
    3661       
    3762        float_type yp, yp2; // we will make unused pointers point here, to save null checks later
     
    4772        float_type c, b;
    4873       
     74        if(!root_info) {
     75                root_info=new struct c2_root_info;
     76                root_info->inited=false;
     77        }
    4978        // this new logic is to keep track of where we were before, and lower the number of
    5079        // function evaluations if we are searching inside the same bracket as before.
    5180        // Since this root finder has, very often, the bracket of the entire domain of the function,
    5281        // this makes a big difference, especially to c2_inverse_function
    53         if(!rootInitialized || upper_bracket != lastRootUpperX || lower_bracket != lastRootLowerX) {
    54                 lastRootUpperY=value_with_derivatives(upper_bracket, final_yprime, final_yprime2);
    55                 increment_evaluations();
    56                 lastRootUpperX=upper_bracket;
    57        
    58                 lastRootLowerY=value_with_derivatives(lower_bracket, final_yprime, final_yprime2);
    59                 increment_evaluations();
    60                 lastRootLowerX=lower_bracket;
    61                 rootInitialized=true;
    62         }
    63        
    64         float_type clower=lastRootLowerY-value;
    65         float_type cupper=lastRootUpperY-value;
    66         if(clower*cupper >0) {
     82        if(!root_info->inited || upper_bracket != root_info->upper.x || lower_bracket != root_info->lower.x) {
     83                root_info->upper.x=upper_bracket;
     84                fill_fblock(root_info->upper);         
     85                root_info->lower.x=lower_bracket;
     86                fill_fblock(root_info->lower);
     87                root_info->inited=true;
     88        }
     89       
     90        float_type clower=root_info->lower.y-value;
     91        if(!clower) {
     92                *final_yprime=root_info->lower.yp;
     93                *final_yprime2=root_info->lower.ypp;
     94                return lower_bracket;
     95        }
     96       
     97        float_type cupper=root_info->upper.y-value;
     98        if(!cupper) {
     99                *final_yprime=root_info->upper.yp;
     100                *final_yprime2=root_info->upper.ypp;
     101                return upper_bracket;
     102        }
     103        const float_type lower_sign = (clower < 0) ? -1 : 1;
     104       
     105        if(lower_sign*cupper >0) {
    67106                // argh, no sign change in here!
    68107                if(error) { *error=1; return 0.0; }
     
    104143           }
    105144           c=value_with_derivatives(root, final_yprime, final_yprime2)-value; // compute initial values
     145           if(c2_isnan(c)) {
     146                   bad_x_point=root;
     147                   return c; // return the nan if a computation failed
     148           }
    106149           b=*final_yprime; // make a local copy for readability
    107150           increment_evaluations();
    108151
    109152           // now, close in bracket on whichever side this still brackets
    110            if(c*clower < 0.0) {
     153           if(c*lower_sign < 0.0) {
    111154                   cupper=c;
    112155                   upper_bracket=root;
     
    131174
    132175// the recursive part of the integrator is agressively designed to minimize copying of data... lots of pointers
    133 template <typename float_type> float_type c2_function<float_type>::integrate_step(c2_integrate_recur &rb) const
    134 {
    135         struct c2_integrate_fblock *fbl[3]={rb.f0, rb.f1, rb.f2};
    136         struct c2_integrate_fblock f1; // will hold new middle values
    137         float_type retvals[2]={0.0,0.0};
    138         float_type lr[2];
    139 
    140         // std::cout << "entering with " << rb.f0->x << " " << rb.f1->x << " " << rb.f2->x << std::endl;
    141        
    142         int depth=rb.depth; // save this from the recursion block
    143         float_type abs_tol=rb.abs_tol;  // this is the value we will pass down
    144         float_type *rblr=rb.lr; // save pointer to our parent's lr[2] array since it will get trampled in recursion
    145        
    146         if(!depth) {
     176template <typename float_type> float_type c2_function<float_type>::integrate_step(c2_integrate_recur &rb) const throw(c2_exception)
     177{
     178        std::vector< recur_item > &rb_stack=*rb.rb_stack; // heap-based stack of data for recursion
     179        rb_stack.clear();
     180
     181        recur_item top;
     182        top.depth=0; top.done=false; top.f0index=0; top.f2index=0; top.step_sum=0;
     183       
     184        // push storage for our initial elements
     185        rb_stack.push_back(top);
     186        rb_stack.back().f1=*rb.f0;
     187        rb_stack.back().done=true; // this element will never be evaluated further
     188       
     189        rb_stack.push_back(top);
     190        rb_stack.back().f1=*rb.f1;
     191        rb_stack.back().done=true; // this element will never be evaluated further
     192               
     193        if(!rb.inited) {
    147194                switch(rb.derivs) {
    148195                        case 0:
     
    157204               
    158205                rb.extrap2=1.0/(rb.extrap_coef-1.0);
    159         }
    160        
    161         for (int i=0; i<(depth==0?1:2); i++) { // handle left and right intervals, but only left one for depth=0
    162                 struct c2_integrate_fblock *f0=fbl[i], *f2=fbl[i+1];
    163                 f1.x=0.5*(f0->x + f2->x); // center of interval
    164                 float_type dx=f2->x - f0->x;
    165                 float_type dx2 = 0.5*dx;
    166                 float_type total;
    167                
    168                 f1.y=value_with_derivatives(f1.x, &(f1.yp), &(f1.ypp));
    169                 increment_evaluations();
    170                
     206                rb.dx_tolerance=10.0*std::numeric_limits<float_type>::epsilon();
     207                rb.abs_tol_min=10.0*std::numeric_limits<float_type>::min();
     208                rb.inited=true;
     209        }
     210       
     211        // now, push our first real element
     212        top.f0index=0; // left element is stack[0]
     213        top.f2index=1; // right element is stack[1]
     214        top.abs_tol=rb.abs_tol;
     215        rb_stack.push_back(top);
     216               
     217        while(rb_stack.size() > 2) {
     218                recur_item &back=rb_stack.back();
     219                if(back.done) {
     220                        float_type sum=back.step_sum;
     221                        rb_stack.pop_back();
     222                        rb_stack.back().step_sum+=sum; // bump our sum up to the parent
     223                        continue;
     224                }
     225                back.done=true;
     226               
     227                c2_fblock<float_type> &f0=rb_stack[back.f0index].f1, &f2=rb_stack[back.f2index].f1;
     228                c2_fblock<float_type> &f1=back.f1; // will hold new middle values
     229                size_t f1index=rb_stack.size()-1; // our current offset
     230                float_type abs_tol=back.abs_tol;
     231               
     232                f1.x=0.5*(f0.x + f2.x); // center of interval
     233                float_type dx2=0.5*(f2.x - f0.x);
     234
    171235                // check for underflow on step size, which prevents us from achieving specified accuracy.
    172                 if(std::abs(dx) < std::abs(f1.x)*rb.rel_tol) {
     236                if(std::abs(dx2) < std::abs(f1.x)*rb.dx_tolerance || std::abs(dx2) < rb.abs_tol_min) {
    173237                        std::ostringstream outstr;
    174                         outstr << "Step size underflow in adaptive_partial_integrals at depth=" << depth << ", x= " << f1.x;
     238                        outstr << "Step size underflow in adaptive_partial_integrals at depth=" << back.depth << ", x= " << f1.x;
    175239                        throw c2_exception(outstr.str().c_str());
    176240                }
    177241               
    178                 if(!depth) { // top level, total has not been initialized yet
    179                         switch(rb.derivs) { // create estimate of next lower order for first try
     242                fill_fblock(f1);
     243                if(c2_isnan(f1.y)) {
     244                        bad_x_point=f1.x;
     245                        return f1.y; // can't go any further if a nan has appeared
     246                }
     247               
     248                bool yptrouble=f0.ypbad || f2.ypbad || f1.ypbad;
     249                bool ypptrouble=f0.yppbad || f2.yppbad || f1.yppbad;
     250               
     251                // select the real derivative count based on whether we are at a point where derivatives exist
     252                int derivs = std::min(rb.derivs, (yptrouble||ypptrouble)?(yptrouble?0:1):2);
     253                               
     254                if(!back.depth) { // top level, total has not been initialized yet
     255                        switch(derivs) { // create estimate of next lower order for first try
    180256                                case 0:
    181                                         total=0.5*(f0->y+f2->y)*dx; break;
     257                                        back.previous_estimate=(f0.y+f2.y)*dx2; break;
    182258                                case 1:
    183                                         total=(f0->y+4.0*f1.y+f2->y)*dx/6.0; break;
     259                                        back.previous_estimate=(f0.y+4.0*f1.y+f2.y)*dx2/3.0; break;
    184260                                case 2:
    185                                         total=( (14*f0->y + 32*f1.y + 14*f2->y) +  dx * (f0->yp - f2->yp) ) * dx /60.; break;
     261                                        back.previous_estimate=( (14*f0.y + 32*f1.y + 14*f2.y) +  2*dx2 * (f0.yp - f2.yp) ) * dx2 /30.; break;
    186262                                default:
    187                                         total=0.0; // just to suppress missing default warnings
     263                                        back.previous_estimate=0.0; // just to suppress missing default warnings
    188264                        }
    189                 } else total=rblr[i]; // otherwise, get it from previous level
     265                }
    190266               
    191267                float_type left, right;
    192268               
    193                 switch(rb.derivs) {
     269                // pre-compute constants so all multiplies use a small dynamic range
     270                // constants for 0 derivative integrator
     271                static const float_type c0c1=5./12., c0c2=8./12., c0c3=-1./12.;
     272                // constants for 1 derivative integrator
     273                static const float_type c1c1=101./240., c1c2=128./240., c1c3=11./240.,
     274                        c1c4=13./240., c1c5=-40./240., c1c6=-3./240.;
     275                // constants for 2 derivative integrator
     276                static const float_type c2c1=169./40320., c2c2=1024./ 40320., c2c3=-41./40320.,
     277                        c2c4=2727./40320., c2c5=-5040./40320., c2c6=423./40320.,
     278                        c2c7=17007./40320., c2c8=24576./40320., c2c9=-1263./40320.;
     279               
     280                switch(derivs) {
    194281                        case 2:
    195282                                // use ninth-order estimates for each side, from full set of all values (!) (Thanks, Mathematica!)
    196                                 left=   ( ( (169*f0->ypp + 1024*f1.ypp -  41*f2->ypp)*dx2 +
    197                                                         (2727*f0->yp - 5040*f1.yp +  423*f2->yp) )*dx2 +
    198                                                   (17007*f0->y + 24576*f1.y -  1263*f2->y) )* (dx2/40320.0);
    199                                 right=  ( ( (169*f2->ypp + 1024*f1.ypp -  41*f0->ypp)*dx2 -
    200                                                         (2727*f2->yp - 5040*f1.yp +  423*f0->yp) )*dx2 +
    201                                                   (17007*f2->y + 24576*f1.y -  1263*f0->y) )* (dx2/40320.0);
    202                                 // std::cout << f0->x << " " << f1.x << " " << f2->x <<  std::endl ;
    203                                 // std::cout << f0->y << " " << f1.y << " " << f2->y << " " << left << " " << right << " " << total << std::endl ;
     283                                left=   ( ( (c2c1*f0.ypp + c2c2*f1.ypp +  c2c3*f2.ypp)*dx2 +
     284                                                        (c2c4*f0.yp + c2c5*f1.yp +  c2c6*f2.yp) )*dx2 +
     285                                                  (c2c7*f0.y + c2c8*f1.y +  c2c9*f2.y) )* dx2;
     286                                right=  ( ( (c2c1*f2.ypp + c2c2*f1.ypp +  c2c3*f0.ypp)*dx2 -
     287                                                        (c2c4*f2.yp + c2c5*f1.yp +  c2c6*f0.yp) )*dx2 +
     288                                                  (c2c7*f2.y + c2c8*f1.y +  c2c9*f0.y) )* dx2;
     289                                // std::cout << f0.x << " " << f1.x << " " << f2.x <<  std::endl ;
     290                                // std::cout << f0.y << " " << f1.y << " " << f2.y << " " << left << " " << right << " " << total << std::endl ;
    204291                                break;
    205292                        case 1:
    206                                 left=   ( (202*f0->y + 256*f1.y + 22*f2->y) + dx*(13*f0->yp - 40*f1.yp - 3*f2->yp) ) * dx /960.;
    207                                 right=  ( (202*f2->y + 256*f1.y + 22*f0->y) - dx*(13*f2->yp - 40*f1.yp - 3*f0->yp) ) * dx /960.;
     293                                left=   ( (c1c1*f0.y + c1c2*f1.y + c1c3*f2.y) + dx2*(c1c4*f0.yp + c1c5*f1.yp + c1c6*f2.yp) ) * dx2 ;
     294                                right=  ( (c1c1*f2.y + c1c2*f1.y + c1c3*f0.y) - dx2*(c1c4*f2.yp + c1c5*f1.yp + c1c6*f0.yp) ) * dx2 ;
    208295                                break;
    209296                        case 0:
    210                                 left=   (5*f0->y + 8*f1.y - f2->y)*dx/24.;
    211                                 right=  (5*f2->y + 8*f1.y - f0->y)*dx/24.;
     297                                left=   (c0c1*f0.y + c0c2*f1.y + c0c3*f2.y)*dx2;
     298                                right=  (c0c1*f2.y + c0c2*f1.y + c0c3*f0.y)*dx2;
    212299                                break;
    213300                        default:
     
    216303                }
    217304               
    218                 lr[0]= left; // left interval
    219                 lr[1]= right; // right interval
    220305                float_type lrsum=left+right;
    221306
    222                 float_type eps=std::abs(total-lrsum)*rb.eps_scale;
    223                 if(rb.extrapolate) eps*=rb.eps_scale;
    224                
    225                 if(!rb.adapt || eps < abs_tol ||  eps < std::abs(total)*rb.rel_tol) {
    226                         if(depth==0 || !rb.extrapolate) retvals[i]=lrsum;
    227                         else {
    228                                 retvals[i]=(rb.extrap_coef*lrsum - total)*rb.extrap2;   
    229                                 // std::cout << "extrapolating " << lrsum << " " << total << " " << retvals[i] << std::endl;
    230                                
    231                         }
     307                bool extrapolate=back.depth && rb.extrapolate && (derivs==rb.derivs); // only extrapolate if no trouble with derivs
     308                float_type eps=std::abs(back.previous_estimate-lrsum)*rb.eps_scale;
     309                if(extrapolate) eps*=rb.eps_scale;
     310               
     311                if(rb.adapt && eps > abs_tol &&  eps > std::abs(lrsum)*rb.rel_tol) {
     312                        // tolerance not met, subdivide & recur
     313                        if(abs_tol > rb.abs_tol_min) abs_tol=abs_tol*0.5; // each half has half the error budget
     314                        top.abs_tol=abs_tol;
     315                        top.depth=back.depth+1;
     316                       
     317                        // save the last things we need from back before a push happens, in case
     318                        // the push causes a reallocation and moves the whole stack.
     319                        size_t f0index=back.f0index, f2index=back.f2index;
     320                       
     321                        top.f0index=f1index; top.f2index=f2index; // insert pointers to right side data into our recursion block
     322                        top.previous_estimate=right;
     323                        rb_stack.push_back(top);
     324
     325                        top.f0index=f0index; top.f2index=f1index; // insert pointers to left side data into our recursion block
     326                        top.previous_estimate=left;
     327                        rb_stack.push_back(top);
     328
     329                } else if(extrapolate) {
     330                        // extrapolation only happens on leaf nodes, where the tolerance was met.
     331                        back.step_sum+=(rb.extrap_coef*lrsum - back.previous_estimate)*rb.extrap2;
    232332                } else {
    233                         rb.depth=depth+1; // increment depth counter
    234                         rb.lr=lr;  // point to our left-right values array for recursion
    235                         rb.abs_tol=abs_tol*0.5; // each half has half the error budget
    236                         rb.f0=f0; rb.f1=&f1; rb.f2=f2; // insert pointers to data into our recursion block
    237                         // std::cout << "recurring with " << f0->x << " " << f1.x << " " << f2->x <<  std::endl ;
    238                         retvals[i]=integrate_step(rb); // and recur
    239                 }
    240         }       
    241         return retvals[0]+retvals[1];
     333                        back.step_sum+=lrsum;
     334                }
     335        }
     336        return rb_stack.back().step_sum; // last element on the stack holds the sum
    242337}
    243338
    244339template <typename float_type> bool c2_function<float_type>::check_monotonicity(
    245         const std::vector<float_type> &data, const char message[]) throw(c2_exception)
     340        const std::vector<float_type> &data, const char message[]) const throw(c2_exception)
    246341{
    247342        size_t np=data.size();
     
    269364}
    270365
    271 template <typename float_type> std::vector<float_type> &c2_function<float_type>::get_sampling_grid(float_type xmin, float_type xmax) const
    272 {
    273         std::vector<float_type> *result=new std::vector<float_type>;
     366template <typename float_type> void c2_function<float_type>::
     367        get_sampling_grid(float_type xmin, float_type xmax, std::vector<float_type> &grid) const
     368{
     369        std::vector<float_type> *result=&grid;
     370        result->clear();
    274371       
    275372        if( !(sampling_grid) || !(sampling_grid->size()) || (xmax <= sampling_grid->front()) || (xmin >= sampling_grid->back()) ) {
     
    313410                std::copy(sg.begin()+firstindex, sg.begin()+lastindex+1, result->begin()+initsize);
    314411                result->back()=xmax;
    315                
     412
    316413                //  this is the unrefined sampling grid... now check for very close points on front & back and fix if needed.
    317414                preen_sampling_grid(result);
    318415        }
    319         return *result;
    320416}
    321417
     
    351447}
    352448
    353 template <typename float_type> std::vector<float_type> &c2_function<float_type>::
    354         refine_sampling_grid(const std::vector<float_type> &grid, size_t refinement) const
     449template <typename float_type> void c2_function<float_type>::
     450        refine_sampling_grid(std::vector<float_type> &grid, size_t refinement) const
    355451{
    356452        size_t np=grid.size();
     
    358454        float_type dxscale=1.0/refinement;
    359455       
    360         std::vector<float_type> *result=new std::vector<float_type>(count);
     456        std::vector<float_type> result(count);
    361457       
    362458        for(size_t i=0; i<(np-1); i++) {
    363459                float_type x=grid[i];
    364460                float_type dx=(grid[i+1]-x)*dxscale;
    365                 for(size_t j=0; j<refinement; j++, x+=dx) (*result)[i*refinement+j]=x;
    366         }
    367         (*result)[count-1]=grid.back();
    368         return *result;
     461                for(size_t j=0; j<refinement; j++, x+=dx) result[i*refinement+j]=x;
     462        }
     463        result.back()=grid.back();
     464        grid=result; // copy the expanded grid back to the input
    369465}
    370466
    371467template <typename float_type> float_type c2_function<float_type>::integral(float_type xmin, float_type xmax, std::vector<float_type> *partials,
    372          float_type abs_tol, float_type rel_tol, int derivs, bool adapt, bool extrapolate) const
    373 {
    374         std::vector<float_type> &grid=get_sampling_grid(xmin, xmax);
    375         float_type intg=partial_integrals(grid, partials, abs_tol, rel_tol, adapt, extrapolate);
    376         delete &grid;
     468         float_type abs_tol, float_type rel_tol, int derivs, bool adapt, bool extrapolate) const throw(c2_exception)
     469{
     470        if(xmin==xmax) {
     471                if(partials) partials->clear();
     472                return 0.0;
     473        }
     474        std::vector<float_type> grid;
     475        get_sampling_grid(xmin, xmax, grid);
     476        float_type intg=partial_integrals(grid, partials, abs_tol, rel_tol, derivs, adapt, extrapolate);
    377477        return intg;
    378478}
    379479
    380480template <typename float_type> c2_function<float_type> &c2_function<float_type>::normalized_function(float_type xmin, float_type xmax, float_type norm)
     481        const throw(c2_exception)
    381482{
    382483        float_type intg=integral(xmin, xmax);
    383         return *new c2_scaled_function<float_type>(*this, norm/intg);
    384 }
    385 
    386 template <typename float_type> c2_function<float_type> &c2_function<float_type>::square_normalized_function(float_type xmin, float_type xmax, float_type norm)
    387 {
    388         c2_quadratic<float_type> q(0., 0., 0., 1.);
    389         c2_composed_function<float_type> mesquared(q,*this);
    390        
    391         std::vector<float_type> grid(get_sampling_grid(xmin, xmax));           
    392         float_type intg=mesquared.partial_integrals(grid);
    393        
    394         return *new c2_scaled_function<float_type>(*this, std::sqrt(norm/intg));
     484        return *new c2_scaled_function_p<float_type>(*this, norm/intg);
     485}
     486
     487template <typename float_type> c2_function<float_type> &c2_function<float_type>::square_normalized_function(float_type xmin, float_type xmax, float_type norm)
     488        const throw(c2_exception)
     489{
     490        c2_ptr<float_type> mesquared((*new c2_quadratic_p<float_type>(0., 0., 0., 1.))(*this));
     491       
     492        std::vector<float_type> grid;
     493        get_sampling_grid(xmin, xmax, grid);           
     494        float_type intg=mesquared->partial_integrals(grid);
     495       
     496        return *new c2_scaled_function_p<float_type>(*this, std::sqrt(norm/intg));
    395497}
    396498
    397499template <typename float_type> c2_function<float_type> &c2_function<float_type>::square_normalized_function(
    398500                float_type xmin, float_type xmax, const c2_function<float_type> &weight, float_type norm)
    399 {
    400         c2_quadratic<float_type> q(0., 0., 0., 1.);
    401         c2_composed_function<float_type> mesquared(q,*this);
    402         c2_product<float_type> weighted(mesquared, weight);
    403 
    404         std::vector<float_type> grid(get_sampling_grid(xmin, xmax));   
    405         float_type intg=weighted.partial_integrals(grid);
    406 
    407         return *new c2_scaled_function<float_type>(*this, std::sqrt(norm/intg));
     501        const throw(c2_exception)
     502{
     503        c2_ptr<float_type> weighted((*new c2_quadratic_p<float_type>(0., 0., 0., 1.))(*this) * weight);
     504
     505        std::vector<float_type> grid;
     506        get_sampling_grid(xmin, xmax, grid);   
     507        float_type intg=weighted->partial_integrals(grid);
     508
     509        return *new c2_scaled_function_p<float_type>(*this, std::sqrt(norm/intg));
    408510}
    409511
    410512template <typename float_type> float_type c2_function<float_type>::partial_integrals(
    411513        std::vector<float_type> xgrid, std::vector<float_type> *partials,
    412         float_type abs_tol, float_type rel_tol, int derivs, bool adapt, bool extrapolate) const
     514        float_type abs_tol, float_type rel_tol, int derivs, bool adapt, bool extrapolate)
     515        const throw(c2_exception)
    413516{
    414517        int np=xgrid.size();
    415518       
    416         struct c2_integrate_fblock f0, f2;
     519        c2_fblock<float_type> f0, f2;
    417520        struct c2_integrate_recur rb;
    418521        rb.rel_tol=rel_tol;
     
    420523        rb.adapt=adapt;
    421524        rb.derivs=derivs;
    422        
    423         reset_evaluations(); // counter returns with total evaluations needed for this integral
     525        std::vector< recur_item > rb_stack;
     526        rb_stack.reserve(20); // enough for most operations
     527        rb.rb_stack=&rb_stack;
     528        rb.inited=false;
     529        float_type dx_inv=1.0/std::abs(xgrid.back()-xgrid.front());
    424530       
    425531        if(partials) partials->resize(np-1);
     
    428534       
    429535        f2.x=xgrid[0];
    430         f2.y=value_with_derivatives(f2.x, &f2.yp, &f2.ypp);
    431         increment_evaluations();
     536        fill_fblock(f2);
     537        if(c2_isnan(f2.y)) {
     538                bad_x_point=f2.x;
     539                return f2.y; // can't go any further if a nan has appeared
     540        }
    432541       
    433542        for(int i=0; i<np-1; i++) {
     
    435544               
    436545                f2.x=xgrid[i+1];
    437                 f2.y=value_with_derivatives(f2.x, &f2.yp, &f2.ypp);
    438                 increment_evaluations();
    439                
    440                 rb.depth=0;
    441                 rb.abs_tol=abs_tol;
    442                 rb.f0=&f0; rb.f1=&f2; rb.f2=&f2; // we are really only using the left half for the top level
    443                 rb.lr=0; // pointer is meaningless; will be filled in in recursion
     546                fill_fblock(f2);
     547                if(c2_isnan(f2.y)) {
     548                        bad_x_point=f2.x;
     549                        return f2.y; // can't go any further if a nan has appeared
     550                }
     551               
     552                rb.abs_tol=abs_tol*std::abs(f2.x-f0.x)*dx_inv; // distribute error tolerance over whole domain
     553                rb.f0=&f0; rb.f1=&f2;
    444554                float_type ps=integrate_step(rb);
    445555                sum+=ps;
    446556                if(partials) (*partials)[i]=ps;
     557                if(c2_isnan(ps)) break; // NaN stops integration
    447558        }
    448559        return sum;
    449560}
    450 
    451 // declare singleton functions for most common c2_function instances
    452 #define c2_singleton(X) template <typename float_type> const c2_##X<float_type> c2_##X<float_type>::X=c2_##X();
    453 c2_singleton(sin)
    454 c2_singleton(cos)
    455 c2_singleton(tan)
    456 c2_singleton(log)
    457 c2_singleton(exp)
    458 c2_singleton(sqrt)
    459 c2_singleton(identity)
    460 
    461 // reciprocal is actually parametric (a/x), but make singleton 1/x
    462 template <typename float_type> const c2_recip<float_type> c2_recip<float_type>::recip=c2_recip(1.0);
    463 
    464 #undef c2_singleton
    465561
    466562// generate a sampling grid at points separated by dx=5, which is intentionally
    467563// incommensurate with pi and 2*pi so grid errors are somewhat randomized
    468 template <typename float_type> std::vector<float_type> &c2_sin<float_type>::get_sampling_grid(float_type xmin, float_type xmax)
    469 {
    470         std::vector<float_type> *result=new std::vector<float_type>;
    471        
    472         for(; xmin < xmax; xmin+=5.0) result->push_back(xmin);
    473         result->push_back(xmax);
    474         this->preen_sampling_grid(result);
    475         return *result;
    476 }
    477 
    478 template <typename float_type> float_type Identity(float_type x) { return x; } // a useful function
    479 template <typename float_type> float_type f_one(float_type) { return 1.0; } // the first derivative of identity
    480 template <typename float_type> float_type f_zero(float_type) { return 0.0; } // the second derivative of identity
     564template <typename float_type> void c2_sin_p<float_type>::
     565        get_sampling_grid(float_type xmin, float_type xmax,  std::vector<float_type> &grid) const
     566{
     567        grid.clear();   
     568        for(; xmin < xmax; xmin+=5.0) grid.push_back(xmin);
     569        grid.push_back(xmax);
     570        this->preen_sampling_grid(&grid);
     571}
     572
     573template <typename float_type> float_type c2_function_transformation<float_type>::evaluate(
     574                float_type xraw,
     575                float_type y, float_type yp0, float_type ypp0,
     576                float_type *yprime, float_type *yprime2) const
     577{
     578        y=Y.fHasStaticTransforms ? Y.pOut(y) : Y.fOut(y);
     579               
     580        if(yprime || yprime2) {
     581
     582                float_type yp, yp2;
     583                if(X.fHasStaticTransforms && Y.fHasStaticTransforms) {
     584                        float_type fpi=1.0/Y.pInPrime(y);
     585                        float_type gp=X.pInPrime(xraw);
     586                        // from Mathematica Dt[InverseFunction[f][y[g[x]]], x]
     587                        yp=gp*yp0*fpi; // transformed derivative
     588                        yp2=(gp*gp*ypp0 + X.pInDPrime(xraw)*yp0  - Y.pInDPrime(y)*yp*yp )*fpi;
     589                } else {
     590                        float_type fpi=1.0/Y.fInPrime(y);
     591                        float_type gp=X.fInPrime(xraw);
     592                        // from Mathematica Dt[InverseFunction[f][y[g[x]]], x]
     593                        yp=gp*yp0*fpi; // transformed derivative
     594                        yp2=(gp*gp*ypp0 + X.fInDPrime(xraw)*yp0  - Y.fInDPrime(y)*yp*yp )*fpi;
     595                }
     596                if(yprime) *yprime=yp;
     597                if(yprime2) *yprime2=yp2;
     598        }       
     599        return y;
     600}
    481601
    482602//  The constructor
    483 template <typename float_type> void interpolating_function<float_type>::init(
     603template <typename float_type> interpolating_function_p<float_type> & interpolating_function_p<float_type>::load(
    484604                                                                const std::vector<float_type> &x, const std::vector<float_type> &f,
    485605                                                                bool lowerSlopeNatural, float_type lowerSlope,
    486606                                                                bool upperSlopeNatural, float_type upperSlope,
    487                                                                 float_type (*inputXConversion)(float_type),
    488                                                                 float_type (*inputXConversionPrime)(float_type),
    489                                                                 float_type (*inputXConversionDPrime)(float_type),
    490                                                                 float_type (*inputYConversion)(float_type),
    491                                                                 float_type (*inputYConversionPrime)(float_type),
    492                                                                 float_type (*inputYConversionDPrime)(float_type),
    493                                                                 float_type (*outputYConversion)(float_type)
    494                                         ) throw(c2_exception)
    495 {
     607                                                                bool splined
     608                ) throw(c2_exception)
     609{
     610        c2_ptr<float_type> keepme(*this);
    496611        X= x;
    497612        F= f;
     
    501616
    502617        set_domain(std::min(Xraw.front(), Xraw.back()),std::max(Xraw.front(), Xraw.back()));
    503        
    504         fXin=inputXConversion;
    505         fXinPrime=inputXConversionPrime;
    506         fXinDPrime=inputXConversionDPrime;
    507         fYin=inputYConversion;
    508         fYinPrime=inputYConversionPrime;
    509         fYinDPrime=inputYConversionDPrime;
    510         fYout=outputYConversion;
    511        
     618               
    512619        if(x.size() != f.size()) {
    513620                throw c2_exception("interpolating_function::init() -- x & y inputs are of different size");
     
    529636        }
    530637       
    531         if(fXin) { // check if X scale is nonlinear, and if so, do transform
    532                 if(!lowerSlopeNatural) lowerSlope /= fXinPrime(X[0]);
    533                 if(!upperSlopeNatural) upperSlope /= fXinPrime(X[np-1]);
    534                 for(size_t i=0; i<np; i++) X[i]=fXin(X[i]);
    535         } else {
    536                 fXin=Identity<float_type>;
    537                 fXinPrime=f_one<float_type>;
    538                 fXinDPrime=f_zero<float_type>;
    539         }
    540        
    541         if(inputYConversion) {  // check if Y scale is nonlinear, and if so, do transform
    542                 if(!lowerSlopeNatural) lowerSlope *= fYinPrime(F[0]);
    543                 if(!upperSlopeNatural) upperSlope *= fYinPrime(F[np-1]);
    544                 for(size_t i=0; i<np; i++) F[i]=inputYConversion(F[i]);
    545         } else {
    546                 fYin=Identity<float_type>;
    547                 fYinPrime=f_one<float_type>;
    548                 fYinDPrime=f_zero<float_type>;
    549                 fYout=Identity<float_type>;
     638        if(fTransform.X.fTransformed) { // check if X scale is nonlinear, and if so, do transform
     639                if(!lowerSlopeNatural) lowerSlope /= fTransform.X.fInPrime(X[0]);
     640                if(!upperSlopeNatural) upperSlope /= fTransform.X.fInPrime(X[np-1]);
     641                for(size_t i=0; i<np; i++) X[i]=fTransform.X.fIn(X[i]);
     642        }       
     643        if(fTransform.Y.fTransformed) {  // check if Y scale is nonlinear, and if so, do transform
     644                if(!lowerSlopeNatural) lowerSlope *= fTransform.Y.fInPrime(F[0]);
     645                if(!upperSlopeNatural) upperSlope *= fTransform.Y.fInPrime(F[np-1]);
     646                for(size_t i=0; i<np; i++) F[i]=fTransform.Y.fIn(F[i]);
    550647        }
    551648                 
     
    553650                "interpolating_function::init() non-monotonic transformed x input");
    554651       
    555         // construct spline tables here. 
     652        if(splined) spline(lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope);
     653        else y2.assign(np,0.0);
     654       
     655        lastKLow=0;
     656        keepme.release_for_return();
     657        return *this;
     658}
     659
     660/*
     661//  The constructor
     662template <typename float_type> interpolating_function_p<float_type> & interpolating_function_p<float_type>::load_pairs(
     663                                                                std::vector<std::pair<float_type, float_type> > &data,
     664                                                                bool lowerSlopeNatural, float_type lowerSlope,
     665                                                                bool upperSlopeNatural, float_type upperSlope,
     666                                                                bool splined
     667                ) throw(c2_exception)
     668{
     669        c2_ptr<float_type> keepme(*this);
     670       
     671        size_t np=data.size();
     672        if(np < 2) {
     673                throw c2_exception("interpolating_function::init() -- input < 2 elements ");
     674        }
     675       
     676        // sort into ascending order
     677        std::sort(data.begin(), data.end(), comp_pair);
     678       
     679        std::vector<float_type> xtmp, ytmp;
     680        xtmp.reserve(np);
     681        ytmp.reserve(np);
     682        for (size_t i=0; i<np; i++) {
     683                xtmp.push_back(data[i].first);
     684                ytmp.push_back(data[i].second);
     685        }
     686        this->load(xtmp, ytmp, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope, splined);
     687       
     688        keepme.release_for_return();
     689        return *this;
     690}
     691
     692template <typename float_type> interpolating_function_p<float_type> &
     693        interpolating_function_p<float_type>::load_random_generator_function(
     694        const std::vector<float_type> &bincenters, const c2_function<float_type> &binheights)
     695        throw(c2_exception)
     696{       
     697        c2_ptr<float_type> keepme(*this);
     698
     699        std::vector<float_type> integral;
     700        c2_const_ptr<float_type> keepit(binheights); // manage function... not really needed here, but always safe.
     701        // integrate from first to last bin in original order, leaving results in integral
     702        // ask for relative error of 1e-6 on each bin, with absolute error set to 0 (since we don't know the data scale).
     703        float_type sum=binheights.partial_integrals(bincenters, &integral, 0.0, 1e-6);
     704        // the integral vector now has partial integrals... it must be accumulated by summing
     705        integral.insert(integral.begin(), 0.0); // integral from start to start is 0
     706        float_type scale=1.0/sum;
     707        for(size_t i=1; i<integral.size(); i++) integral[i]=integral[i]*scale + integral[i-1];
     708        integral.back()=1.0; // force exact value on boundary
     709       
     710        this->load(integral, bincenters,
     711                                           false, 1.0/(scale*binheights(bincenters.front() )),
     712                                           false, 1.0/(scale*binheights(bincenters.back() ))
     713                                           ); // use integral as x axis in inverse function
     714        keepme.release_for_return();
     715        return *this;
     716}
     717
     718template <typename float_type> interpolating_function_p<float_type> &
     719        interpolating_function_p<float_type>::load_random_generator_bins(
     720        const std::vector<float_type> &bins, const std::vector<float_type> &binheights)
     721        throw(c2_exception)
     722{       
     723        c2_ptr<float_type> keepme(*this);
     724
     725        size_t np=binheights.size();
     726        std::vector<float_type> integral(np+1), bin_edges(np+1);
     727       
     728        // compute the integral based on estimates of the bin edges from the given bin centers...
     729        // except for bin 0 & final bin, the edge of a bin is halfway between then center of the
     730        // bin and the center of the previous/next bin.
     731        // This gives width[n] = (center[n+1]+center[n])/2 - (center[n]+center[n-1])/2 = (center[n+1]-center[n-1])/2
     732        // for the edges, assume a bin of width (center[1]-center[0]) or (center[np-1]-center[np-2])
     733        // be careful that absolute values are used in case data are reversed.
     734
     735        if(bins.size() == binheights.size()+1) {
     736                bin_edges=bins; // edges array was passed in
     737        } else if (bins.size() == binheights.size()) {
     738                bin_edges.front()=bins[0] - (bins[1]-bins[0])*0.5; // edge bin
     739                for(size_t i=1; i<np; i++) {
     740                        bin_edges[i]=(bins[i]+bins[i-1])*0.5;
     741                }
     742                bin_edges.back()=bins[np-1] + (bins[np-1]-bins[np-2])*0.5; // edge bin
     743        } else {
     744                throw c2_exception("inconsistent bin vectors passed to load_random_generator_bins");
     745        }
     746       
     747        float_type running_sum=0.0;
     748        for(size_t i=0; i<np; i++) {
     749                integral[i]=running_sum;
     750                if(!binheights[i]) throw c2_exception("empty bin passed to load_random_generator_bins");
     751                running_sum+=binheights[i]*std::abs(bin_edges[i+1]-bin_edges[i]);
     752        }
     753        float_type scale=1.0/running_sum;
     754        for(size_t i=0; i<np; i++) integral[i]*=scale;
     755        integral.back()=1.0; // force exactly correct value on boundary
     756        this->load(integral, bin_edges,
     757                  false, 1.0/(scale*binheights.front()),
     758                  false, 1.0/(scale*binheights.back())
     759                  ); // use integral as x axis in inverse function
     760        keepme.release_for_return();
     761        return *this;
     762}
     763*/
     764
     765//  The spline table generator
     766template <typename float_type> void interpolating_function_p<float_type>::spline(
     767         bool lowerSlopeNatural, float_type lowerSlope,
     768         bool upperSlopeNatural, float_type upperSlope
     769         ) throw(c2_exception)
     770{
     771// construct spline tables here. 
    556772        // this code is a re-translation of the pythonlabtools spline algorithm from pythonlabtools.sourceforge.net
    557        
     773        size_t np=X.size();
    558774        std::vector<float_type> u(np),  dy(np-1), dx(np-1), dxi(np-1), dx2i(np-2), siga(np-2), dydx(np-1);
    559775       
     
    596812        y2[np-1]=(un-qn*u[np-2])/(qn*y2[np-2]+1.0);
    597813        for (size_t k=np-1; k != 0; k--) y2[k-1]=y2[k-1]*y2[k]+u[k-1];
    598        
    599         lastKLow=-1; // flag  new X search required for next evaluation
     814}
     815
     816template <typename float_type> interpolating_function_p<float_type> &interpolating_function_p<float_type>::sample_function(
     817                        const c2_function<float_type> &func,
     818                        float_type xmin, float_type xmax, float_type abs_tol, float_type rel_tol,
     819                        bool lowerSlopeNatural, float_type lowerSlope,
     820                        bool upperSlopeNatural, float_type upperSlope
     821 ) throw(c2_exception)
     822{
     823        c2_ptr<float_type> keepme(*this);
     824       
     825        const c2_transformation<float_type> &XX=fTransform.X, &YY=fTransform.Y; // shortcuts
     826       
     827         // set up our params to look like the samplng function for now
     828         sampler_function=func;
     829         std::vector<float_type> grid;
     830         func.get_sampling_grid(xmin, xmax, grid);
     831         size_t gsize=grid.size();
     832         if(XX.fTransformed) for(size_t i=0; i<gsize; i++) grid[i]=XX.fIn(grid[i]);
     833         set_sampling_grid_pointer(grid);
     834         
     835        // float_type xmin1=fXin(xmin), xmax1=fXin(xmax); // bounds in transformed space
     836         // get a list of points needed in transformed space, directly into our tables
     837         this->adaptively_sample(grid.front(), grid.back(), 8*abs_tol, 8*rel_tol, 0, &X, &F);
     838         // clear the sampler function now, since otherwise our value_with_derivatives is broken
     839         sampler_function.unset_function();
     840         
     841         xInverted=check_monotonicity(X,
     842                  "interpolating_function::init() non-monotonic transformed x input");
     843         
     844         size_t np=X.size();
     845         
     846         // Xraw is useful in some of the arithmetic operations between interpolating functions
     847         if(!XX.fTransformed) Xraw=X;
     848         else {
     849                 Xraw.resize(np);
     850                 for (size_t i=1; i<np-1; i++) Xraw[i]=XX.fOut(X[i]);
     851                 Xraw.front()=xmin;
     852                 Xraw.back()=xmax;
     853         }
     854                 
     855         bool xraw_rev=check_monotonicity(Xraw,
     856                  "interpolating_function::init() non-monotonic raw x input");
     857                  // which way does raw X point?  sampling grid MUST be increasing
     858         
     859         if(!xraw_rev) { // we can use pointer to raw X values if they are in the right order
     860                 set_sampling_grid_pointer(Xraw);
     861                 // our intial grid of x values is certainly a good guess for 'interesting' points
     862         } else {
     863                 set_sampling_grid(Xraw); // make a copy of it, and assure it is in right order
     864         }
     865         
     866         if(XX.fTransformed) { // check if X scale is nonlinear, and if so, do transform
     867                 if(!lowerSlopeNatural) lowerSlope /= XX.fInPrime(xmin);
     868                 if(!upperSlopeNatural) upperSlope /= XX.fInPrime(xmax);
     869         }     
     870         if(YY.fTransformed) {  // check if Y scale is nonlinear, and if so, do transform
     871                 if(!lowerSlopeNatural) lowerSlope *= YY.fInPrime(func(xmin));
     872                 if(!upperSlopeNatural) upperSlope *= YY.fInPrime(func(xmax));
     873         }
     874         // note that each of ends has 3 points with two equal gaps, since they were obtained by bisection
     875         // so the step sizes are easy to get
     876         // the 'natural slope' option for sampled functions has a different meaning than
     877         // for normal splines.  In this case, the derivative is adjusted to make the
     878         // second derivative constant on the last two points at each end
     879         // which is consistent with the error sampling technique we used to get here
     880         if(lowerSlopeNatural) {
     881                 float_type hlower=X[1]-X[0];
     882                 lowerSlope=0.5*(-F[2]-3*F[0]+4*F[1])/hlower;
     883                 lowerSlopeNatural=false; // it's not the usual meaning of natural any more
     884         }
     885         if(upperSlopeNatural) {
     886                 float_type hupper=X[np-1]-X[np-2];
     887                 upperSlope=0.5*(F[np-3]+3*F[np-1]-4*F[np-2])/hupper;
     888                 upperSlopeNatural=false; // it's not the usual meaning of natural any more
     889         }
     890         this->set_domain(xmin, xmax);
     891         
     892         spline(lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope);
     893         lastKLow=0;
     894         keepme.release_for_return();
     895         return *this;
    600896}
    601897
    602898//  This function is the reason for this class to exist
    603899// it computes the interpolated function, and (if requested) its proper first and second derivatives including all coordinate transforms
    604 template <typename float_type> float_type interpolating_function<float_type>::value_with_derivatives(
     900template <typename float_type> float_type interpolating_function_p<float_type>::value_with_derivatives(
    605901                                float_type x, float_type *yprime, float_type *yprime2) const throw(c2_exception)
    606902{
     903        if(sampler_function.valid()) {
     904                // if this is non-null, we are sampling data for later, so just return raw function
     905                // however, transform it into our sampling space, first.
     906                if(yprime) *yprime=0;
     907                if(yprime2) *yprime2=0;
     908                sampler_function->increment_evaluations();
     909                return fTransform.Y.fIn(sampler_function(fTransform.X.fOut(x))); // derivatives are completely undefined
     910        }
     911                                       
    607912        if(x < this->xmin() || x > this->xmax()) {
    608913                std::ostringstream outstr;
     
    613918        float_type xraw=x;
    614919       
    615         // template here is impossible! if(fXin && fXin != (Identity<float_type>) )
    616         x=fXin(x); // save time by explicitly testing for identity function here
     920        if(fTransform.X.fTransformed) x=fTransform.X.fHasStaticTransforms?
     921                fTransform.X.pIn(x) : fTransform.X.fIn(x); // save time by explicitly testing for identity function here
    617922       
    618923        int klo=0, khi=X.size()-1;
     924
     925        if(khi < 0) throw c2_exception("Uninitialized interpolating function being evaluated");
     926       
     927        const float_type *XX=&X[lastKLow]; // make all fast checks short offsets from here
    619928       
    620929        if(!xInverted) { // select search depending on whether transformed X is increasing or decreasing
    621                 if(lastKLow >=0 && (X[lastKLow] <= x) && (X[lastKLow+1] >= x) ) { // already bracketed
     930                if((XX[0] <= x) && (XX[1] >= x) ) { // already bracketed
    622931                        klo=lastKLow;
    623                 } else if(lastKLow >=0 && (X[lastKLow+1] <= x) && (X[lastKLow+2] > x)) { // in next bracket to the right
     932                } else if((XX[1] <= x) && (XX[2] >= x)) { // in next bracket to the right
    624933                        klo=lastKLow+1;         
    625                 } else if(lastKLow > 0 && (X[lastKLow-1] <= x) && (X[lastKLow] > x)) { // in next bracket to the left
     934                } else if(lastKLow > 0 && (XX[-1] <= x) && (XX[0] >= x)) { // in next bracket to the left
    626935                        klo=lastKLow-1;         
    627936                } else { // not bracketed, not close, start over
     
    634943                }
    635944        } else {
    636                 if(lastKLow >=0 && (X[lastKLow] >= x) && (X[lastKLow+1] <= x) ) { // already bracketed
     945                if((XX[0] >= x) && (XX[1] <= x) ) { // already bracketed
    637946                        klo=lastKLow;
    638                 } else if(lastKLow >=0 && (X[lastKLow+1] >= x) && (X[lastKLow+2] < x)) { // in next bracket to the right
     947                } else if((XX[1] >= x) && (XX[2] <= x)) { // in next bracket to the right
    639948                        klo=lastKLow+1;         
    640                 } else if(lastKLow > 0 && (X[lastKLow-1] >= x) && (X[lastKLow] < x)) { // in next bracket to the left
     949                } else if(lastKLow > 0 && (XX[-1] >= x) && (XX[0] <= x)) { // in next bracket to the left
    641950                        klo=lastKLow-1;         
    642951                } else { // not bracketed, not close, start over
     
    659968        float_type ylo=F[klo], yhi=F[khi], y2lo=y2[klo], y2hi=y2[khi];
    660969        float_type y=a*ylo+b*yhi+((a*a*a-a)*y2lo+(b*b*b-b)*y2hi)*(h*h)/6.0;
    661        
    662         // template here is impossible! if(fYin && fYin != Identity)
    663         y=fYout(y); // save time by explicitly testing for identity function here
     970
     971        float_type yp0=0; // the derivative in interpolating table coordinates
     972        float_type ypp0=0; // second derivative
    664973       
    665974        if(yprime || yprime2) {
    666                 float_type fpi=1.0/fYinPrime(y);
    667                 float_type gp=fXinPrime(xraw);
    668                 float_type yp0=(yhi-ylo)/h+((3*b*b-1)*y2hi-(3*a*a-1)*y2lo)*h/6.0; // the derivative in interpolating table coordinates
    669                
    670                 // from Mathematica Dt[InverseFunction[f][y[g[x]]], x]
    671                 if(yprime) *yprime=gp*yp0*fpi; // the real derivative of the inverse transformed output
    672                 if(yprime2) {
    673                         float_type ypp0=b*y2hi+a*y2lo;
    674                         float_type fpp=fYinDPrime(y);
    675                         float_type gpp=fXinDPrime(xraw);
    676                         // also from Mathematica Dt[InverseFunction[f][y[g[x]]], {x,2}]
    677                         if(yprime2) *yprime2=(gp*gp*ypp0 + yp0*gpp - gp*gp*yp0*yp0*fpp*fpi*fpi)*fpi;
    678                 }
    679         }
    680        
    681         return y;
    682 }
    683 
    684 template <typename float_type> void interpolating_function<float_type>::set_lower_extrapolation(float_type bound)
     975                yp0=(yhi-ylo)/h+((3*b*b-1)*y2hi-(3*a*a-1)*y2lo)*h/6.0; // the derivative in interpolating table coordinates
     976                ypp0=b*y2hi+a*y2lo; // second derivative
     977        }
     978       
     979        if(fTransform.isIdentity) {
     980                if(yprime) *yprime=yp0;
     981                if(yprime2) *yprime2=ypp0;
     982                return y;       
     983        } else return fTransform.evaluate(xraw, y, yp0, ypp0, yprime, yprime2);
     984}
     985
     986template <typename float_type> void interpolating_function_p<float_type>::set_lower_extrapolation(float_type bound)
    685987{
    686988        int kl = 0 ;
    687989        int kh=kl+1;
    688         float_type xx=fXin(bound);
     990        float_type xx=fTransform.X.fIn(bound);
    689991        float_type h0=X[kh]-X[kl];
    690992        float_type h1=xx-X[kl];
     
    7021004}
    7031005
    704 template <typename float_type> void interpolating_function<float_type>::set_upper_extrapolation(float_type bound)
     1006template <typename float_type> void interpolating_function_p<float_type>::set_upper_extrapolation(float_type bound)
    7051007{
    7061008        int kl = X.size()-2 ;
    7071009        int kh=kl+1;
    708         float_type xx=fXin(bound);
     1010        float_type xx=fTransform.X.fIn(bound);
    7091011        float_type h0=X[kh]-X[kl];
    7101012        float_type h1=xx-X[kl];
     
    7211023}
    7221024
    723 // move derivatives into our internal coordinates (use splint to go the other way!)
    724 template <typename float_type> void interpolating_function<float_type>::localize_derivatives(
    725    float_type xraw, float_type y, float_type yp, float_type ypp, float_type *y0, float_type *yprime, float_type *yprime2) const
    726 {
    727         float_type fp=fYinPrime(y);
    728         float_type gp=fXinPrime(xraw);
    729         float_type fpp=fYinDPrime(y);
    730         float_type gpp=fXinDPrime(xraw);
    731        
    732         if(y0) *y0=fYin(y);
    733         if(yprime) *yprime=yp*fp/gp; // Mathematica Dt[f[y[InverseFunction[g][x]]], x]
    734         if(yprime2) *yprime2=( yp*yp*fpp - fp*yp*gpp/gp + fp*ypp )/(gp*gp) ; // Mathematica Dt[f[y[InverseFunction[g][x]]], {x,2}]
    735 }
    736 
    7371025// return a new interpolating_function which is the unary function of an existing interpolating_function
    7381026// can also be used to generate a resampling of another c2_function on a different grid
     
    7401028// and doing b=a.unary_operator(c) where c is a c2_function (probably another interpolating_function)
    7411029
    742 template <typename float_type> interpolating_function<float_type>&
    743         interpolating_function<float_type>::unary_operator(const c2_function<float_type> &source) const
     1030template <typename float_type> interpolating_function_p<float_type>&
     1031        interpolating_function_p<float_type>::unary_operator(const c2_function<float_type> &source) const
    7441032{
    7451033        size_t np=X.size();
    7461034        std::vector<float_type>yv(np);
    747         c2_composed_function<float_type> comp(source, *this);
     1035        c2_ptr<float_type> comp(source(*this));
    7481036        float_type yp0, yp1, ypp;
    7491037       
    750         for(size_t i=0; i<np; i++) {
    751                 yv[i]=source(fYout(F[i])); // copy pointwise the function of our data values
    752         }
    753                
    754         comp(Xraw.front(), &yp0, &ypp); // get derivative at front
    755         comp(Xraw.back(), &yp1, &ypp); // get derivative at back
    756        
    757         return  *new interpolating_function(Xraw, yv, false, yp0, false, yp1,
    758                                                                            fXin, fXinPrime, fXinDPrime,
    759                                                                            fYin, fYinPrime, fYinDPrime, fYout);
     1038        for(size_t i=1; i<np-1; i++) {
     1039                yv[i]=source(fTransform.Y.fOut(F[i])); // copy pointwise the function of our data values
     1040        }
     1041               
     1042        yv.front()=comp(Xraw.front(), &yp0, &ypp); // get derivative at front
     1043        yv.back()= comp(Xraw.back(), &yp1, &ypp); // get derivative at back
     1044       
     1045        interpolating_function_p &copy=clone();
     1046        copy.load(this->Xraw, yv, false, yp0, false, yp1);
     1047       
     1048        return copy;
    7601049}
    7611050
    7621051template <typename float_type> void
    763 interpolating_function<float_type>::get_data(std::vector<float_type> &xvals, std::vector<float_type> &yvals) const throw()
     1052interpolating_function_p<float_type>::get_data(std::vector<float_type> &xvals, std::vector<float_type> &yvals) const throw()
    7641053{
    7651054       
     
    7671056        yvals.resize(F.size());
    7681057       
    769         for(size_t i=0; i<F.size(); i++) yvals[i]=fYout(F[i]);
    770 }
    771 
    772 template <typename float_type> interpolating_function<float_type> &
    773         interpolating_function<float_type>::binary_operator(const c2_function<float_type> &rhs,
    774                 c2_binary_function<float_type> *combining_stub) const
     1058        for(size_t i=0; i<F.size(); i++) yvals[i]=fTransform.Y.fOut(F[i]);
     1059}
     1060
     1061template <typename float_type> interpolating_function_p<float_type> &
     1062        interpolating_function_p<float_type>::binary_operator(const c2_function<float_type> &rhs,
     1063                const c2_binary_function<float_type> *combining_stub) const
    7751064{       
    7761065        size_t np=X.size();     
    7771066        std::vector<float_type> yv(np);
    778         c2_constant<float_type> fval;
    779         c2_constant<float_type> yval;
     1067        c2_constant_p<float_type> fval(0);
    7801068        float_type yp0, yp1, ypp;
    7811069       
    782         for(size_t i=0; i<np; i++) {
    783                 fval.reset(fYout(F[i])); // update the constant function pointwise
    784                 yval.reset(rhs(Xraw[i]));
    785                 yv[i]=(*combining_stub).combine(fval, yval, Xraw[i], (float_type *)0, (float_type *)0); // compute rhs & combine without derivatives
    786         }
    787        
    788         (*combining_stub).combine(*this, rhs, Xraw.front(), &yp0, &ypp); // get derivative at front
    789         (*combining_stub).combine(*this, rhs, Xraw.back(),  &yp1, &ypp); // get derivative at back
    790 
    791         delete combining_stub;
    792        
    793         return  *new interpolating_function(Xraw, yv, false, yp0, false, yp1,
    794                                                                            fXin, fXinPrime, fXinDPrime,
    795                                                                            fYin, fYinPrime, fYinDPrime, fYout);
    796 }
    797 
    798 template <typename float_type>  float_type c2_f_logprime(float_type x) { return 1.0/x; } // the derivative of log(x)
    799 template <typename float_type>  float_type c2_f_logprime2(float_type x) { return -1.0/(x*x); } // the second derivative of log(x)
    800 
    801 template <typename float_type> log_lin_interpolating_function<float_type>::log_lin_interpolating_function(
    802                                                                                 const std::vector<float_type> &x, const std::vector<float_type> &f,
    803                                                                                 bool lowerSlopeNatural, float_type lowerSlope,
    804                                                                                 bool upperSlopeNatural, float_type upperSlope)
    805                                                                                 : interpolating_function<float_type>()
    806 {
    807         init(x, f, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope,
    808                  (float_type (*)(float_type)) (std::log), c2_f_logprime, c2_f_logprime2, 0, 0, 0, 0);
    809 }
    810 
    811 template <typename float_type> lin_log_interpolating_function<float_type>::lin_log_interpolating_function(
    812                                                                                 const std::vector<float_type> &x, const std::vector<float_type> &f,
    813                                                                                 bool lowerSlopeNatural, float_type lowerSlope,
    814                                                                                 bool upperSlopeNatural, float_type upperSlope)
    815                                                                                 : interpolating_function<float_type>()
    816 {
    817         init(x, f, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope,
    818                  0, 0, 0,
    819                  (float_type (*)(float_type)) (std::log), c2_f_logprime, c2_f_logprime2,
    820                  (float_type (*)(float_type)) (std::exp) );
    821 }
    822 
    823 template <typename float_type> log_log_interpolating_function<float_type>::log_log_interpolating_function(
    824                                                                                 const std::vector<float_type> &x, const std::vector<float_type> &f,
    825                                                                                 bool lowerSlopeNatural, float_type lowerSlope,
    826                                                                                 bool upperSlopeNatural, float_type upperSlope)
    827                                                                                 : interpolating_function<float_type>()
    828 {
    829         init(x, f, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope,
    830                  (float_type (*)(float_type)) (std::log), c2_f_logprime, c2_f_logprime2,
    831                  (float_type (*)(float_type)) (std::log), c2_f_logprime, c2_f_logprime2,
    832                  (float_type (*)(float_type)) (std::exp) );
    833 }
    834 
    835 template <typename float_type> float_type c2_f_recip(float_type x) { return 1.0/x; }
    836 template <typename float_type> float_type c2_f_recipprime(float_type x) { return -1.0/(x*x); } // the derivative of 1/x
    837 template <typename float_type> float_type c2_f_recipprime2(float_type x) { return 2.0/(x*x*x); } // the second derivative of 1/x
    838 
    839 template <typename float_type> arrhenius_interpolating_function<float_type>::arrhenius_interpolating_function(
    840                                                                                 const std::vector<float_type> &x, const std::vector<float_type> &f,
    841                                                                                 bool lowerSlopeNatural, float_type lowerSlope,
    842                                                                                 bool upperSlopeNatural, float_type upperSlope)
    843                                                                                 : interpolating_function<float_type>()
    844 {
    845         init(x, f, lowerSlopeNatural, lowerSlope, upperSlopeNatural, upperSlope,
    846                 c2_f_recip, c2_f_recipprime, c2_f_recipprime2,
    847                 (float_type (*)(float_type)) (std::log), c2_f_logprime, c2_f_logprime2,
    848                 (float_type (*)(float_type)) (std::exp) );
    849 }
    850 
    851 template <typename float_type> c2_inverse_function<float_type>::c2_inverse_function(const c2_function<float_type> &source)
    852         : c2_plugin_function<float_type>(source)
     1070        c2_const_ptr<float_type> stub(*combining_stub);  // manage ownership
     1071       
     1072        for(size_t i=1; i<np-1; i++) {
     1073                fval.reset(fTransform.Y.fOut(F[i])); // update the constant function pointwise
     1074                yv[i]=combining_stub->combine(fval, rhs, Xraw[i], (float_type *)0, (float_type *)0); // compute rhs & combine without derivatives
     1075        }
     1076       
     1077        yv.front()=combining_stub->combine(*this, rhs, Xraw.front(), &yp0, &ypp); // get derivative at front
     1078        yv.back()= combining_stub->combine(*this, rhs, Xraw.back(),  &yp1, &ypp); // get derivative at back
     1079       
     1080        interpolating_function_p &copy=clone();
     1081        copy.load(this->Xraw, yv, false, yp0, false, yp1);
     1082       
     1083        return copy;
     1084}
     1085
     1086template <typename float_type> c2_inverse_function_p<float_type>::c2_inverse_function_p(const c2_function<float_type> &source)
     1087        : c2_function<float_type>(), func(source)
    8531088{
    8541089        float_type l=source.xmin();
     
    8641099}
    8651100
    866 template <typename float_type> float_type c2_inverse_function<float_type>::value_with_derivatives(
     1101template <typename float_type> float_type c2_inverse_function_p<float_type>::value_with_derivatives(
    8671102                                        float_type x, float_type *yprime, float_type *yprime2
    8681103                        ) const throw(c2_exception)
     
    9271162                for(int i=0; i<=np; i++) cum[i]*=m;
    9281163        }
    929         if(inverse_function) interpolating_function<float_type>(cum, be); // use cum as x axis in inverse function
    930         else interpolating_function<float_type>(be, cum); // else use lower bin edge as x axis
     1164        if(inverse_function) interpolating_function_p<float_type>(cum, be); // use cum as x axis in inverse function
     1165        else interpolating_function_p<float_type>(be, cum); // else use lower bin edge as x axis
    9311166        std::fill(this->y2.begin(), this->y2.end(), 0.0); // clear second derivatives, to we are piecewise linear
    9321167}
    9331168
    934 template <typename float_type> c2_piecewise_function<float_type>::c2_piecewise_function()
     1169template <typename float_type> c2_piecewise_function_p<float_type>::c2_piecewise_function_p()
    9351170: c2_function<float_type>(), lastKLow(-1)
    9361171{
     
    9381173}
    9391174
    940 template <typename float_type> c2_piecewise_function<float_type>::~c2_piecewise_function()
    941 {
    942         size_t np=functions.size();
    943         for(size_t i=0; i<np; i++) if(owns[i]) delete functions[i];
    944 }
    945 
    946 template <typename float_type> float_type c2_piecewise_function<float_type>::value_with_derivatives(
     1175template <typename float_type> c2_piecewise_function_p<float_type>::~c2_piecewise_function_p()
     1176{
     1177}
     1178
     1179template <typename float_type> float_type c2_piecewise_function_p<float_type>::value_with_derivatives(
    9471180                  float_type x, float_type *yprime, float_type *yprime2
    9481181                  ) const throw(c2_exception)
     
    9741207}
    9751208
    976 template <typename float_type> void c2_piecewise_function<float_type>::append_function(
    977         c2_function<float_type> &func, bool pass_ownership) throw(c2_exception)
    978 {
     1209template <typename float_type> void c2_piecewise_function_p<float_type>::append_function(
     1210        const c2_function<float_type> &func) throw(c2_exception)
     1211{
     1212        c2_const_ptr<float_type> keepfunc(func);  //  manage function before we can throw any exceptions
    9791213        if(functions.size()) { // check whether there are any gaps to fill, etc.
    980                 c2_function<float_type> &tail=*(functions.back());
     1214                const c2_function<float_type> &tail=functions.back();
    9811215                float_type x0=tail.xmax();
    9821216                float_type x1=func.xmin();
     
    9851219                        float_type y0=tail(x0);
    9861220                        float_type y1=func(x1);
    987                         c2_function<float_type> *connector=new c2_linear<float_type>(x0, y0, (y1-y0)/(x1-x0));
    988                         connector->set_domain(x0,x1);
    989                         functions.push_back(connector);
    990                         owns.push_back(true);
     1221                        c2_function<float_type> &connector=*new c2_linear_p<float_type>(x0, y0, (y1-y0)/(x1-x0));
     1222                        connector.set_domain(x0,x1);
     1223                        functions.push_back(c2_const_ptr<float_type>(connector));
    9911224                        this->sampling_grid->push_back(x1);
    9921225                } else if(x0>x1) throw c2_exception("function domains not increasing in c2_piecewise_function");
    9931226        }
    994         functions.push_back(&func);
    995         owns.push_back(pass_ownership);
     1227        functions.push_back(keepfunc);
    9961228        // extend our domain to include all known functions
    9971229        this->set_domain(functions.front()->xmin(), functions.back()->xmax());
    9981230        // extend our sampling grid with the new function's grid, with the first point dropped to avoid duplicates
    999         std::vector<float_type> &newgrid=func.get_sampling_grid(func.xmin(), func.xmax());
     1231        std::vector<float_type> newgrid;
     1232        func.get_sampling_grid(func.xmin(), func.xmax(), newgrid);
    10001233        this->sampling_grid->insert(this->sampling_grid->end(), newgrid.begin()+1, newgrid.end());
    1001         delete &newgrid;
    1002 }
    1003 
    1004 template <typename float_type> c2_connector_function<float_type>::c2_connector_function(
    1005         const c2_function<float_type> &f1, const c2_function<float_type> &f2, float_type x0, float_type x2,
     1234}
     1235
     1236template <typename float_type> c2_connector_function_p<float_type>::c2_connector_function_p(
     1237        float_type x0, const c2_function<float_type> &f0, float_type x2, const c2_function<float_type> &f2,
    10061238        bool auto_center, float_type y1)
    1007 
    1008 : c2_function<float_type>()
    1009 {
    1010         float_type y0, yp0, ypp0, y2, yp2, ypp2;
    1011         fdx=(x2-x0)/2.0;
    1012         fhinv=1.0/fdx;
    1013         fx1=(x0+x2)/2.0;
    1014        
    1015         y0=f1.value_with_derivatives(x0, &yp0, &ypp0); // get left wall values from conventional computation
    1016         y2=f2.value_with_derivatives(x2, &yp2, &ypp2); // get right wall values from conventional computation
     1239        : c2_function<float_type>()
     1240{
     1241        c2_const_ptr<float_type> left(f0), right(f2); // make sure if these are unowned, they get deleted
     1242        c2_fblock<float_type> fb0, fb2;
     1243        fb0.x=x0;
     1244        f0.fill_fblock(fb0);
     1245        fb2.x=x2;
     1246        f2.fill_fblock(fb2);
     1247        init(fb0, fb2, auto_center, y1);
     1248}
     1249
     1250template <typename float_type> c2_connector_function_p<float_type>::c2_connector_function_p(
     1251        float_type x0, float_type y0, float_type yp0, float_type ypp0,
     1252        float_type x2, float_type y2, float_type yp2, float_type ypp2,
     1253        bool auto_center, float_type y1)
     1254        : c2_function<float_type>()
     1255{
     1256        c2_fblock<float_type> fb0, fb2;
     1257        fb0.x=x0; fb0.y=y0; fb0.yp=yp0; fb0.ypp=ypp0;
     1258        fb2.x=x2; fb2.y=y2; fb2.yp=yp2; fb2.ypp=ypp2;   
     1259        init(fb0, fb2, auto_center, y1);
     1260}
     1261
     1262template <typename float_type> c2_connector_function_p<float_type>::c2_connector_function_p(
     1263        const c2_fblock<float_type> &fb0,
     1264        const c2_fblock<float_type> &fb2,
     1265        bool auto_center, float_type y1)
     1266        : c2_function<float_type>()
     1267{
     1268        init(fb0, fb2, auto_center, y1);
     1269}
     1270
     1271template <typename float_type> void c2_connector_function_p<float_type>::init(
     1272        const c2_fblock<float_type> &fb0,
     1273        const c2_fblock<float_type> &fb2,
     1274        bool auto_center, float_type y1)
     1275{
     1276        float_type dx=(fb2.x-fb0.x)/2.0;
     1277        fhinv=1.0/dx;
    10171278
    10181279        // scale derivs to put function on [-1,1] since mma  solution is done this way
    1019         yp0*=fdx;
    1020         yp2*=fdx;
    1021         ypp0*=fdx*fdx;
    1022         ypp2*=fdx*fdx;
    1023        
    1024         float_type ff0=(8*(y0 + y2) + 5*(yp0 - yp2) + ypp0 + ypp2)/16.0;
     1280        float_type yp0=fb0.yp*dx;
     1281        float_type yp2=fb2.yp*dx;
     1282        float_type ypp0=fb0.ypp*dx*dx;
     1283        float_type ypp2=fb2.ypp*dx*dx;
     1284       
     1285        float_type ff0=(8*(fb0.y + fb2.y) + 5*(yp0 - yp2) + ypp0 + ypp2)*0.0625;
    10251286        if(auto_center) y1=ff0; // forces ff to be 0 if we are auto-centering
    10261287       
    1027         // y[x_] = y1 + x (a + b x) + (x-1) x (x+1) (c + d x + e x^2 + f x^3)
     1288        // y[x_] = y1 + x (a + b x) + x [(x-1) (x+1)] (c + d x) + x (x-1)^2 (x+1)^2 (e + f x)
     1289        // y' = a + 2 b x + d x [(x+1)(x-1)] + (c + d x)(3x^2-1) + f x [(x+1)(x-1)]^2 + (e + f x)[(x+1)(x-1)](5x^2-1) 
     1290        // y'' = 2 b + 6x(c + d x) + 2d(3x^2-1) + 4x(e + f x)(5x^2-3) + 2f(x^2-1)(5x^2-1)
    10281291        fy1=y1;
    1029         fa=-(y0 - y2)/2.;
    1030         fb=(y0 - 2*y1 + y2)/2.;
    1031         fc=(7*(y0 - y2 + yp0 + yp2) + ypp0 - ypp2)/16.;
    1032         fd=(32*y1 - 16*(y2 + y0) + 9*(yp2 - yp0) - ypp0 - ypp2)/16.;
    1033         fe=(3*(y2 - y0 - yp0 - yp2) - ypp0 + ypp2)/16.;
     1292        fa=(fb2.y - fb0.y)*0.5;
     1293        fb=(fb0.y + fb2.y)*0.5 - y1;
     1294        fc=(yp2+yp0-2.*fa)*0.25;
     1295        fd=(yp2-yp0-4.*fb)*0.25;
     1296        fe=(ypp2-ypp0-12.*fc)*0.0625;
    10341297        ff=(ff0 - y1);
    1035         // y'[x] = a + 2 b x + (3x^2 - 1)   (c + d x + e x^2 + f x^3) + (x-1) x (x+1) (d + 2 e x + 3 f x^2 )
    1036         // y''[x] = 2b + (x-1) x (x+1) (2 e + 6 f x) + 2 (3 x^2 -1) (d + 2 e x + 3 f x^2 ) + 6 x (c + d x + e x^2 + f x^3)
    1037         this->set_domain(x0,x2); // this is where the function is valid
    1038 }
    1039 
    1040 template <typename float_type> c2_connector_function<float_type>::~c2_connector_function()
    1041 {
    1042 }
    1043 
    1044 template <typename float_type> float_type c2_connector_function<float_type>::value_with_derivatives(
     1298        this->set_domain(fb0.x, fb2.x); // this is where the function is valid
     1299}
     1300
     1301template <typename float_type> c2_connector_function_p<float_type>::~c2_connector_function_p()
     1302{
     1303}
     1304
     1305template <typename float_type> float_type c2_connector_function_p<float_type>::value_with_derivatives(
    10451306        float_type x, float_type *yprime, float_type *yprime2
    10461307        ) const throw(c2_exception)
    10471308{
    1048                                                                                                                                                                                                        
    1049         float_type dx=(x-fx1)*fhinv;
    1050         float_type q1=fc + dx*(fd + dx*(fe + dx*ff));
    1051         float_type xp1=(dx-1)*(dx+1)*dx;
    1052        
    1053         float_type y= fy1 + dx*(fa+fb*dx) + xp1*q1;
     1309        float_type x0=this->xmin(), x2=this->xmax();
     1310        float_type dx=(x-(x0+x2)*0.5)*fhinv;
     1311        float_type q1=(x-x0)*(x-x2)*fhinv*fhinv; // exactly vanish all bits at both ends
     1312        float_type q2=dx*q1;
     1313       
     1314        float_type r1=fa+fb*dx;
     1315        float_type r2=fc+fd*dx;
     1316        float_type r3=fe+ff*dx;
     1317       
     1318        float_type y=fy1+dx*r1+q2*r2+q1*q2*r3;
     1319       
    10541320        if(yprime || yprime2) {
    1055                 float_type q2 =fd + dx*(2*fe + dx*3*ff);       
    1056                 float_type q3=2*fe+6*ff*dx;
    1057                 float_type xp2=(3*dx*dx-1);
    1058                 if(yprime) *yprime=(fa + 2*fb*dx + xp2*q1 + xp1*q2)*fhinv;
    1059                 if(yprime2) *yprime2=(2*fb+xp1*q3+2*xp2*q2+6*dx*q1)*fhinv*fhinv;
     1321                float_type q3=3*q1+2;
     1322                float_type q4=5*q1+4;
     1323                if(yprime) *yprime=(fa+2*fb*dx+fd*q2+r2*q3+ff*q1*q2+q1*q4*r3)*fhinv;
     1324                if(yprime2) *yprime2=2*(fb+fd*q3+3*dx*r2+ff*q1*q4+r3*(2*dx*(5*q1+2)))*fhinv*fhinv;
    10601325        }
    10611326        return y;
    10621327}
     1328
     1329// the recursive part of the sampler is agressively designed to minimize copying of data... lots of pointers
     1330template <typename float_type> void c2_function<float_type>::sample_step(c2_sample_recur &rb) const throw(c2_exception)
     1331{
     1332        std::vector< recur_item > &rb_stack=*rb.rb_stack; // heap-based stack of data for recursion
     1333        rb_stack.clear();
     1334       
     1335        recur_item top;
     1336        top.depth=0; top.done=false; top.f0index=0; top.f2index=0;
     1337       
     1338        // push storage for our initial elements
     1339        rb_stack.push_back(top);
     1340        rb_stack.back().f1=*rb.f0;
     1341        rb_stack.back().done=true;
     1342
     1343        rb_stack.push_back(top);
     1344        rb_stack.back().f1=*rb.f1;
     1345        rb_stack.back().done=true;
     1346       
     1347        if(!rb.inited) {
     1348                rb.dx_tolerance=10.0*std::numeric_limits<float_type>::epsilon();
     1349                rb.abs_tol_min=10.0*std::numeric_limits<float_type>::min();
     1350                rb.inited=true;
     1351        }
     1352
     1353        // now, push our first real element
     1354        top.f0index=0; // left element is stack[0]
     1355        top.f2index=1; // right element is stack[1]
     1356        rb_stack.push_back(top);
     1357
     1358        while(rb_stack.size() > 2) {
     1359                recur_item &back=rb_stack.back();
     1360                if(back.done) {
     1361                        rb_stack.pop_back();
     1362                        continue;
     1363                }
     1364                back.done=true;
     1365
     1366                c2_fblock<float_type> &f0=rb_stack[back.f0index].f1, &f2=rb_stack[back.f2index].f1;
     1367                c2_fblock<float_type> &f1=back.f1; // will hold new middle values
     1368                size_t f1index=rb_stack.size()-1; // our current offset
     1369
     1370                // std::cout << "processing: " << rb_stack.size() << " " <<
     1371                // (&back-&rb_stack.front())  << " " << back.depth << " " << f0.x << " " << f2.x << std::endl;
     1372
     1373                f1.x=0.5*(f0.x + f2.x); // center of interval
     1374                float_type dx2=0.5*(f2.x - f0.x);
     1375                       
     1376                // check for underflow on step size, which prevents us from achieving specified accuracy.
     1377                if(std::abs(dx2) < std::abs(f1.x)*rb.dx_tolerance || std::abs(dx2) < rb.abs_tol_min) {
     1378                        std::ostringstream outstr;
     1379                        outstr << "Step size underflow in adaptive_sampling at depth=" << back.depth << ", x= " << f1.x;
     1380                        throw c2_exception(outstr.str().c_str());
     1381                }
     1382               
     1383                fill_fblock(f1);
     1384               
     1385                if(c2_isnan(f1.y) || f1.ypbad || f1.yppbad) {
     1386                        // can't go any further if a nan has appeared
     1387                        bad_x_point=f1.x;
     1388                        throw c2_exception("NaN encountered while sampling function");
     1389                }
     1390
     1391                float_type eps;
     1392                if(rb.derivs==2) {
     1393                        // this is code from connector_function to compute the value at the midpoint
     1394                        // it is re-included here to avoid constructing a complete c2connector
     1395                        // just to find out if we are close enough
     1396                        float_type ff0=(8*(f0.y + f2.y) + 5*(f0.yp - f2.yp)*dx2 + (f0.ypp+f2.ypp)*dx2*dx2)*0.0625;
     1397                        // we are converging as at least x**5 and bisecting, so real error on final step is smaller
     1398                        eps=std::abs(ff0-f1.y)/32.0;   
     1399                } else {
     1400                        // there are two tolerances to meet... the shift in the estimate of the actual point,
     1401                        // and the difference between the current points and the extremum
     1402                        // build all the coefficients needed to construct the local parabola
     1403                        float_type ypcenter, ypp;
     1404                        if (rb.derivs==1) {
     1405                                // linear extrapolation error using exact derivs
     1406                                eps = (std::abs(f0.y+f0.yp*dx2-f1.y)+std::abs(f2.y-f2.yp*dx2-f1.y))*0.125;
     1407                                ypcenter=2*f1.yp*dx2; // first deriv scaled so this interval is on [-1,1]
     1408                                ypp=2*(f2.yp-f0.yp)*dx2*dx2; // second deriv estimate scaled so this interval is on [-1,1]
     1409                        } else {
     1410                                // linear interpolation error without derivs if we are at top level
     1411                                //  or 3-point parabolic interpolation estimates from previous level, if available
     1412                                ypcenter=(f2.y-f0.y)*0.5; // derivative estimate at center
     1413                                ypp=(f2.y+f0.y-2*f1.y); // second deriv estimate
     1414                                if(back.depth==0) eps=std::abs((f0.y+f2.y)*0.5 - f1.y)*2; // penalize first step
     1415                                else eps=std::abs(f1.y-back.previous_estimate)*0.25;
     1416                        }
     1417                        float_type ypleft=ypcenter-ypp; // derivative at left edge
     1418                        float_type ypright=ypcenter+ypp; // derivative at right edge
     1419                        float_type extremum_eps=0;
     1420                        if((ypleft*ypright) <=0) // y' changes sign if we have an extremum
     1421                        {
     1422                                // compute position and value of the extremum this way
     1423                                float_type xext=-ypcenter/ypp;
     1424                                float_type yext=f1.y + xext*ypcenter + 0.5*xext*xext*ypp;
     1425                                // and then find the the smallest offset of it from a point, looking in the left or right side
     1426                                if(xext <=0) extremum_eps=std::min(std::abs(f0.y-yext), std::abs(f1.y-yext));
     1427                                else extremum_eps=std::min(std::abs(f2.y-yext), std::abs(f1.y-yext));
     1428                        }
     1429                        eps=std::max(eps, extremum_eps); // if previous shot was really bad, keep trying
     1430                }
     1431               
     1432                if(eps < rb.abs_tol ||  eps < std::abs(f1.y)*rb.rel_tol) {
     1433                        if(rb.out) {
     1434                                // we've met the tolerance, and are building a function, append two connectors
     1435                                rb.out->append_function(
     1436                                        *new c2_connector_function_p<float_type>(f0, f1, true, 0.0)
     1437                                );
     1438                                rb.out->append_function(
     1439                                        *new c2_connector_function_p<float_type>(f1, f2, true, 0.0)
     1440                                );
     1441                        }
     1442                        if(rb.xvals && rb.yvals) {
     1443                                rb.xvals->push_back(f0.x);
     1444                                rb.xvals->push_back(f1.x);
     1445                                rb.yvals->push_back(f0.y);
     1446                                rb.yvals->push_back(f1.y);
     1447                                // the value at f2 will get pushed in the next segment... it is not forgotten
     1448                        }
     1449                } else {
     1450                        top.depth=back.depth+1; // increment depth counter
     1451
     1452                        // save the last things we need from back before a push happens, in case
     1453                        // the push causes a reallocation and moves the whole stack.
     1454                        size_t f0index=back.f0index, f2index=back.f2index;
     1455                        float_type left=0, right=0;
     1456                        if(rb.derivs==0) {
     1457                                // compute three-point parabolic interpolation estimate of right-hand and left-hand midpoint
     1458                                left=(6*f1.y + 3*f0.y - f2.y) * 0.125;
     1459                                right=(6*f1.y + 3*f2.y - f0.y) * 0.125;
     1460                        }
     1461                       
     1462                        top.f0index=f1index; top.f2index=f2index; // insert pointers to right side data into our recursion block                       
     1463                        top.previous_estimate=right;
     1464                        rb_stack.push_back(top);
     1465
     1466                        top.f0index=f0index; top.f2index=f1index; // insert pointers to left side data into our recursion block
     1467                        top.previous_estimate=left;
     1468                        rb_stack.push_back(top);
     1469                }
     1470        }
     1471}
     1472
     1473template <typename float_type>  c2_piecewise_function_p<float_type> *
     1474        c2_function<float_type>::adaptively_sample(
     1475                float_type xmin, float_type xmax,
     1476                float_type abs_tol, float_type rel_tol,
     1477                int derivs, std::vector<float_type> *xvals, std::vector<float_type> *yvals) const throw(c2_exception)
     1478{
     1479        c2_fblock<float_type> f0, f2;
     1480        c2_sample_recur rb;
     1481        std::vector< recur_item > rb_stack;
     1482        rb_stack.reserve(20); // enough for most operations
     1483        rb.rb_stack=&rb_stack;
     1484        rb.out=0;
     1485        if(derivs==2) rb.out=new c2_piecewise_function_p<float_type>();
     1486        c2_ptr<float_type> pieces(*rb.out); // manage this function, if any, so it deletes on an exception
     1487        rb.rel_tol=rel_tol;
     1488        rb.abs_tol=abs_tol;
     1489        rb.xvals=xvals;
     1490        rb.yvals=yvals;
     1491        rb.derivs=derivs;
     1492        rb.inited=false;
     1493       
     1494        if(xvals && yvals) {
     1495                xvals->clear();
     1496                yvals->clear();
     1497        }
     1498         
     1499        // create xgrid as a automatic-variable copy of the sampling grid so the exception handler correctly
     1500        // disposes of it.
     1501        std::vector<float_type> xgrid;
     1502        get_sampling_grid(xmin, xmax, xgrid);
     1503        int np=xgrid.size();     
     1504
     1505        f2.x=xgrid[0];
     1506        fill_fblock(f2);
     1507        if(c2_isnan(f2.y) || f2.ypbad || f2.yppbad) {
     1508                // can't go any further if a nan has appeared
     1509                bad_x_point=f2.x;
     1510                throw c2_exception("NaN encountered while sampling function");
     1511        }
     1512
     1513        for(int i=0; i<np-1; i++) {
     1514                f0=f2; // copy upper bound to lower before computing new upper bound
     1515
     1516                f2.x=xgrid[i+1];
     1517                fill_fblock(f2);
     1518                if(c2_isnan(f2.y) || f2.ypbad || f2.yppbad) {
     1519                        // can't go any further if a nan has appeared
     1520                        bad_x_point=f2.x;
     1521                        throw c2_exception("NaN encountered while sampling function");
     1522                }
     1523
     1524                rb.f0=&f0; rb.f1=&f2;
     1525                sample_step(rb);
     1526        }
     1527        if(xvals && yvals) { // push final point in vector
     1528                xvals->push_back(f2.x);
     1529                yvals->push_back(f2.y);
     1530        }
     1531       
     1532        if(rb.out) rb.out->set_sampling_grid(xgrid); // reflect old sampling grid, which still should be right
     1533        pieces.release_for_return(); // unmanage the piecewise_function so we can return it
     1534        return rb.out;
     1535}
     1536
     1537template <typename float_type, typename Final>
     1538 interpolating_function_p<float_type> & inverse_integrated_density_function(
     1539        const std::vector<float_type> &bincenters, const c2_function<float_type> &binheights)
     1540        throw(c2_exception)
     1541{       
     1542        return (new Final())->load_random_generator_function(bincenters, binheights);
     1543}
     1544
     1545template <typename float_type, typename Final>
     1546        interpolating_function_p<float_type> & inverse_integrated_density_bins(
     1547        const std::vector<float_type> &bins, const std::vector<float_type> &binheights)
     1548        throw(c2_exception)
     1549{       
     1550        return (new Final())->load_random_generator_bins(bins, binheights);
     1551}
  • trunk/examples/extended/electromagnetic/TestEm7/ionC12.mac

    r807 r1230  
    1 # $Id: ionC12.mac,v 1.19 2007/11/07 19:41:32 vnivanch Exp $
     1# $Id: ionC12.mac,v 1.22 2008/10/24 15:36:24 maire Exp $
    22#
    33# Macro file for "TestEm7.cc"
     
    77/control/verbose 2
    88/run/verbose 2
    9 /tracking/verbose 1
     9/tracking/verbose 0
    1010#
    11 /testem/det/setMat Water
     11/testem/det/setMat G4_WATER
    1212/testem/det/setSizeX  20 cm
    1313/testem/det/setSizeYZ 20 cm
    1414#
    15 /testem/det/tallyMat Water
     15/testem/det/tallyMat G4_WATER
    1616/testem/det/tallySize 2. 2. 2. mm
    1717/testem/det/tallyPosition -9.9 0. 0. cm
     
    2020/testem/det/tallyPosition  5.  0. 0. cm
    2121#
    22 /testem/phys/addPhysics  standardNR     
    23 #/testem/phys/addPhysics  emstandard
    24 #/testem/phys/addPhysics  standard_opt2
     22#/testem/phys/addPhysics  standardNR   
     23/testem/phys/addPhysics  emstandard
     24#/testem/phys/addPhysics  emstandard_opt2
    2525#
    2626/run/initialize
     
    2929/gun/ion 6 12 6
    3030#/gun/ion 6 12 1
    31 /gun/energy 3.5 GeV
     31/gun/energy 2.4 GeV
    3232#
    3333# beam size
    34 /testem/gun/rndm 2 mm
     34#/testem/gun/rndm 2 mm
    3535#
    3636# step limit
    37 /testem/stepMax 1 mm
     37/testem/phys/setCuts 0.5 mm
     38#/testem/stepMax 0.1 mm
    3839#
    3940/testem/event/printModulo 1000
    4041#
     42/testem/histo/fileName c12
     43/testem/histo/fileType root
     44/testem/histo/setHisto 1 100 80 90
     45/testem/histo/setHisto 2 100 80 90
     46#
    4147/run/beamOn 1000
  • trunk/examples/extended/electromagnetic/TestEm7/proton.mac

    r807 r1230  
    1 # $Id: proton.mac,v 1.10 2007/07/28 16:39:31 vnivanch Exp $
     1# $Id: proton.mac,v 1.17 2008/10/24 15:36:24 maire Exp $
    22#
    33# Macro file for "TestEm7.cc"
     
    88/run/verbose 2
    99#
    10 /testem/det/setMat Water
     10/testem/det/setMat G4_WATER
    1111/testem/det/setSizeX  10 cm
    1212/testem/det/setSizeYZ 10 cm
     13/testem/det/tallyMat G4_WATER
    1314#
    14 /testem/phys/addPhysics  standard       #em physics
     15#/testem/phys/addPhysics  standard
     16/testem/phys/addPhysics  emstandard_opt3
    1517#
    1618/run/initialize
     
    2022#
    2123# step limit
    22 /testem/stepMax 0.5 mm
     24#/testem/phys/setCuts 0.5 mm
     25/testem/phys/setCuts 1 mm
     26#/testem/stepMax 0.5 mm
    2327#
    2428/testem/event/printModulo 1000
    2529#
     30/testem/histo/fileName p100opt3cut1
     31/testem/histo/fileType root
     32/testem/histo/setHisto 1 100 70 80
     33/testem/histo/setHisto 2 100 70 80
     34#
    2635/run/beamOn 10000
     36#
  • trunk/examples/extended/electromagnetic/TestEm7/snr.mac

    r807 r1230  
    1 # $Id: snr.mac,v 1.1 2007/12/19 19:21:41 vnivanch Exp $
     1# $Id: snr.mac,v 1.3 2008/05/08 11:20:50 vnivanch Exp $
    22#
    33# Macro file for "TestEm7.cc"
     
    1919/testem/det/tallyPosition  5.  0. 0. cm
    2020#
    21 /testem/phys/addPhysics  standardNR     # use screened nuclear recoil 
    22 ###/testem/phys/addPhysics  binary      # hadronic physics
     21#/testem/phys/addPhysics  emstandard
     22#/testem/phys/addPhysics  emstandard_opt2
     23#/testem/phys/addPhysics  emstandard_opt3 
     24/testem/phys/addPhysics  standardNR       
     25#/testem/phys/addPhysics  standardIG 
     26###/testem/phys/addPhysics  binary
    2327#
    2428/run/initialize
     
    4044/run/beamOn 1000
    4145#
    42 /testem/det/setMat G4_Cu
    43 /testem/det/update
    44 /gun/particle kaon+
    45 /gun/energy 100 MeV
    46 /run/beamOn 1000
  • trunk/examples/extended/electromagnetic/TestEm7/src/DetectorConstruction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: DetectorConstruction.cc,v 1.8 2007/01/11 15:41:46 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: DetectorConstruction.cc,v 1.10 2008/04/21 13:13:30 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4545
    4646#include "G4NistManager.hh"
    47 
    4847#include "G4UnitsTable.hh"
     48
     49#include "G4FieldManager.hh"
     50#include "G4TransportationManager.hh"
     51#include "G4RunManager.hh"
    4952
    5053//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    117120  Air->AddElement(N, fractionmass=0.7);
    118121  Air->AddElement(O, fractionmass=0.3);
     122
     123  density     = 1.e-5*g/cm3;
     124  pressure    = 2.e-2*bar;
     125  temperature = STP_Temperature;  // From PhysicalConstants.h .
     126  G4Material* vac = new G4Material( "TechVacuum", density, 1,
     127                           kStateGas, temperature, pressure );
     128  vac->AddMaterial( Air, 1. );
    119129
    120130  density     = universe_mean_density;    //from PhysicalConstants.h
     
    235245{
    236246  absorSizeX = value; worldSizeX = 1.2*absorSizeX;
     247  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    237248}
    238249 
     
    243254  absorSizeYZ = value;
    244255  worldSizeYZ = 1.2*absorSizeYZ;
     256  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    245257
    246258
     
    252264  G4Material* pttoMaterial =
    253265    G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
    254   if (pttoMaterial) absorMaterial = pttoMaterial;
    255 }
    256 
    257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    258 
    259 #include "G4FieldManager.hh"
    260 #include "G4TransportationManager.hh"
     266  if (pttoMaterial) {
     267    absorMaterial = pttoMaterial;
     268    if(lAbsor) {
     269      lAbsor->SetMaterial(absorMaterial);
     270      G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     271    }
     272  }
     273}
     274
     275//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    261276
    262277void DetectorConstruction::SetMagField(G4double fieldValue)
     
    285300{
    286301  tallySize = value;
     302  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    287303
    288304
     
    294310  G4Material* pttoMaterial =
    295311    G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
    296   if (pttoMaterial) tallyMaterial = pttoMaterial;
     312  if (pttoMaterial) {
     313    tallyMaterial = pttoMaterial;
     314    if(lTally) {
     315      lTally->SetMaterial(tallyMaterial);
     316      G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     317    }
     318  }
    297319}
    298320
     
    305327    tallyNumber++;
    306328  }
     329  G4RunManager::GetRunManager()->GeometryHasBeenModified();
    307330
    308331
    309332//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    310 
    311 #include "G4RunManager.hh"
    312333 
    313334void DetectorConstruction::UpdateGeometry()
    314335{
    315 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
    316 }
    317 
    318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     336  G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     337  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
     338}
     339
     340//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/DetectorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: DetectorMessenger.cc,v 1.3 2006/06/29 16:58:13 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.4 2006/06/29 16:58:15 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.4 2006/06/29 16:58:17 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/G4ScreenedNuclearRecoil.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: G4ScreenedNuclearRecoil.cc,v 1.5 2008/01/14 12:11:39 vnivanch Exp $
    28 // GEANT4 tag $Name:  $
     27// G4ScreenedNuclearRecoil.cc,v 1.57 2008/05/07 11:51:26 marcus Exp
     28// GEANT4 tag
    2929//
    3030//
     
    8484#include "G4ScreenedNuclearRecoil.hh"
    8585
     86const char* G4ScreenedCoulombCrossSectionInfo::CVSFileVers() { return
     87        "G4ScreenedNuclearRecoil.cc,v 1.57 2008/05/07 11:51:26 marcus Exp GEANT4 tag ";
     88}
     89
    8690#include "G4ParticleTypes.hh"
    8791#include "G4ParticleTable.hh"
    8892#include "G4VParticleChange.hh"
    89 #include "G4ParticleChange.hh"
     93#include "G4ParticleChangeForLoss.hh"
    9094#include "G4DataVector.hh"
    9195#include "G4Track.hh"
     
    99103#include "G4IsotopeVector.hh"
    100104
     105#include "G4EmProcessSubType.hh"
     106
    101107#include "G4RangeTest.hh"
    102108#include "G4ParticleDefinition.hh"
     
    104110#include "G4ProcessManager.hh"
    105111#include "G4StableIsotopes.hh"
     112#include "G4LindhardPartition.hh"
    106113
    107114#include "Randomize.hh"
     
    112119#include <iomanip>
    113120
     121#include "c2_factory.hh"
     122static c2_factory<G4double> c2; // this makes a lot of notation shorter
     123typedef c2_ptr<G4double> c2p;
     124
    114125G4ScreenedCoulombCrossSection::~G4ScreenedCoulombCrossSection()
    115126{
    116         ScreeningMap::iterator tables=screeningData.begin();
    117         for (;tables != screeningData.end(); tables++) {
    118                 delete (*tables).second.EMphiData;
    119         }
    120127        screeningData.clear();
    121        
    122         std::map<G4int, c2_function<G4double> *>::iterator mfpit=MFPTables.begin();
    123         for (;mfpit != MFPTables.end(); mfpit++) {
    124                 delete (*mfpit).second;
    125         }
    126         MFPTables.clear();
    127        
     128        MFPTables.clear();     
    128129}
    129130
     
    248249                        element=elementVector[kel];
    249250                        G4int Z=(G4int)std::floor(element->GetZ()+0.5);
    250                         c2_function<G4double> &ifunc=*sigmaMap[Z];
     251                        const G4_c2_function &ifunc=sigmaMap[Z];
    251252                        if(!kel || ifunc.xmin() > emin) emin=ifunc.xmin();
    252253                        if(!kel || ifunc.xmax() < emax) emax=ifunc.xmax();                     
     
    268269                        element=elementVector[kel];
    269270                        G4int Z=(G4int)std::floor(element->GetZ()+0.5);
    270                         c2_function<G4double> &sigma=*sigmaMap[Z];
     271                        const G4_c2_function &sigma=sigmaMap[Z];
    271272                        G4double ndens = atomDensities[kel]; // compute atom fraction for this element in this material
    272273                                               
     
    281282                }
    282283                // and make a new interpolating function out of the sum
    283                 MFPTables[matidx] = static_cast<c2_function<G4double> *>(new log_log_interpolating_function<G4double>(
    284                                 evals, mfpvals));
     284                MFPTables[matidx] = c2.log_log_interpolating_function().load(evals, mfpvals,true,0,true,0);
    285285    }
    286        
    287 #ifdef DEBUG   
    288         for (G4int matidx=0; matidx < nMaterials; matidx++) {
    289                 const G4Material* material= (*materialTable)[matidx];
    290                 G4cout << "***** MFP (1MeV) ***** " << material->GetName() << "  " << (*MFPTables[matidx])(1.0) << G4endl;
    291         }
    292 #endif
    293        
    294286}
    295287
     
    304296        recoilCutoff(RecoilCutoff), physicsCutoff(PhysicsCutoff),
    305297        hardeningFraction(0.0), hardeningFactor(1.0),
    306         externalCrossSectionConstructor(0)
    307 {
     298        externalCrossSectionConstructor(0),
     299        NIELPartitionFunction(new G4LindhardRobinsonPartition)
     300{
     301                // for now, point to class instance of this. Doing it by creating a new one fails
     302                // to correctly update NIEL
     303                // not even this is needed... done in G4VProcess().
     304                // pParticleChange=&aParticleChange;
     305                processMaxEnergy=50000.0*MeV;
    308306                highEnergyLimit=100.0*MeV;
    309307                lowEnergyLimit=physicsCutoff;
     
    313311                AddStage(new G4ScreenedCoulombClassicalKinematics);
    314312                AddStage(new G4SingleScatter);
     313                SetProcessSubType(fCoulombScattering);
    315314}
    316315
    317316void G4ScreenedNuclearRecoil::ResetTables()
    318317{
    319         std::map<G4int, c2_function<G4double>*>::iterator xh=meanFreePathTables.begin();
    320         for(;xh != meanFreePathTables.end(); xh++) {
    321                 delete (*xh).second;
    322         }
    323         meanFreePathTables.clear();
    324318       
    325319        std::map<G4int, G4ScreenedCoulombCrossSection*>::iterator xt=crossSectionHandlers.begin();
     
    338332
    339333        collisionStages.clear();
     334}
     335
     336void G4ScreenedNuclearRecoil::SetNIELPartitionFunction(const G4VNIELPartition *part)
     337{
     338        if(NIELPartitionFunction) delete NIELPartitionFunction;
     339        NIELPartitionFunction=part;
     340}
     341
     342void G4ScreenedNuclearRecoil::DepositEnergy(G4int z1, G4double a1, const G4Material *material, G4double energy)
     343{
     344        if(!NIELPartitionFunction) {
     345                IonizingLoss+=energy;
     346        } else {
     347                G4double part=NIELPartitionFunction->PartitionNIEL(z1, a1, material, energy);
     348                IonizingLoss+=energy*(1-part);
     349                NIEL += energy*part;
     350        }
    340351}
    341352
     
    363374G4double G4ScreenedNuclearRecoil::GetMeanFreePath(const G4Track& track,
    364375                                                  G4double,
    365                                                   G4ForceCondition*)
     376                                                  G4ForceCondition* cond)
    366377{
    367378        const G4DynamicParticle* incoming = track.GetDynamicParticle();
     
    370381       
    371382        G4double meanFreePath;
    372        
    373         if (energy < lowEnergyLimit || energy < recoilCutoff) return 1.0*nanometer; /* stop slow particles! */
    374         else if (energy > highEnergyLimit*a1) energy=highEnergyLimit*a1; /* constant MFP at high energy */
     383        *cond=NotForced;
     384       
     385        if (energy < lowEnergyLimit || energy < recoilCutoff*a1) {
     386                *cond=Forced;
     387                return 1.0*nm; /* catch and stop slow particles to collect their NIEL! */
     388        } else if (energy > processMaxEnergy*a1) {
     389                return DBL_MAX; // infinite mean free path
     390        } else if (energy > highEnergyLimit*a1) energy=highEnergyLimit*a1; /* constant MFP at high energy */
    375391
    376392        G4double fz1=incoming->GetDefinition()->GetPDGCharge();
     
    390406        size_t materialIndex = materialCouple->GetMaterial()->GetIndex();
    391407
    392         c2_function<G4double> &mfp=*(*xs)[materialIndex];
     408        const G4_c2_function &mfp=*(*xs)[materialIndex];
    393409       
    394410        // make absolutely certain we don't get an out-of-range energy
     
    403419{
    404420        validCollision=1;
    405         aParticleChange.Initialize(aTrack);
     421        pParticleChange->Initialize(aTrack);
    406422        NIEL=0.0; // default is no NIEL deposited
     423        IonizingLoss=0.0;
    407424       
    408425        // do universal setup
     
    413430        G4double fz1=baseParticle->GetPDGCharge()/eplus;
    414431        G4int z1=(G4int)(fz1+0.5);
     432        G4double a1=baseParticle->GetPDGMass()/amu_c2;
    415433        G4double incidentEnergy = incidentParticle->GetKineticEnergy();
    416434               
     
    418436        const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
    419437       
    420         if(incidentEnergy < GetRecoilCutoff()) { // check energy sanity on entry
    421                 if(!baseParticle->GetProcessManager()->
    422                    GetAtRestProcessVector()->size())
    423                         aParticleChange.ProposeTrackStatus(fStopAndKill);
    424                 else
    425                         aParticleChange.ProposeTrackStatus(fStopButAlive);
    426 
    427                 AddToNIEL(incidentEnergy);
    428                 aParticleChange.ProposeEnergy(0.0);
     438        const G4Material* mat = couple->GetMaterial();
     439
     440        G4double P=0.0; // the impact parameter of this collision
     441
     442        if(incidentEnergy < GetRecoilCutoff()*a1) { // check energy sanity on entry
     443                DepositEnergy(z1, baseParticle->GetPDGMass()/amu_c2, mat, incidentEnergy);
     444                GetParticleChange().ProposeEnergy(0.0);
    429445                // stop the particle and bail out
    430446                validCollision=0;
    431         }       
    432        
    433         const G4Material* mat = couple->GetMaterial();
    434         G4double numberDensity=mat->GetTotNbOfAtomsPerVolume();
    435         G4double lattice=0.5/std::pow(numberDensity,1.0/3.0); // typical lattice half-spacing
    436         G4double length=GetCurrentInteractionLength();
    437         G4double sigopi=1.0/(CLHEP::pi*numberDensity*length);  // this is sigma0/pi
    438        
    439         // compute the impact parameter very early, so if is rejected as too far away, little effort is wasted
    440         // this is the TRIM method for determining an impact parameter based on the flight path
    441         // this gives a cumulative distribution of N(P)= 1-exp(-pi P^2 n l)
    442         // which says the probability of NOT hitting a disk of area sigma= pi P^2 =exp(-sigma N l)
    443         // which may be reasonable
    444         G4double P;
    445         if(sigopi < lattice*lattice) {
    446                 // normal long-flight approximation
    447                 P = std::sqrt(-std::log(G4UniformRand()) *sigopi);
    448447        } else {
    449                 // short-flight limit
    450                 P = std::sqrt(G4UniformRand())*lattice;
    451         }
    452                
    453         G4double fraction=GetHardeningFraction();
    454         if(fraction && G4UniformRand() < fraction) {
    455                 // pick out some events, and increase the central cross section
    456                 // by reducing the impact parameter
    457                 P /= std::sqrt(GetHardeningFactor());
    458         }
    459        
    460        
    461         // check if we are far enough away that the energy transfer must be below cutoff,
    462         // and leave everything alone if so, saving a lot of time.
    463         if(P*P > sigopi) {
    464                 if(GetVerboseLevel() > 1)
    465                         printf("ScreenedNuclear impact reject: length=%.3f P=%.4f limit=%.4f\n",
    466                                    length/angstrom, P/angstrom,std::sqrt(sigopi)/angstrom);
    467                 // no collision, don't follow up with anything
    468                 validCollision=0;
     448               
     449                G4double numberDensity=mat->GetTotNbOfAtomsPerVolume();
     450                G4double lattice=0.5/std::pow(numberDensity,1.0/3.0); // typical lattice half-spacing
     451                G4double length=GetCurrentInteractionLength();
     452                G4double sigopi=1.0/(CLHEP::pi*numberDensity*length);  // this is sigma0/pi
     453               
     454                // compute the impact parameter very early, so if is rejected as too far away, little effort is wasted
     455                // this is the TRIM method for determining an impact parameter based on the flight path
     456                // this gives a cumulative distribution of N(P)= 1-exp(-pi P^2 n l)
     457                // which says the probability of NOT hitting a disk of area sigma= pi P^2 =exp(-sigma N l)
     458                // which may be reasonable
     459                if(sigopi < lattice*lattice) {
     460                        // normal long-flight approximation
     461                        P = std::sqrt(-std::log(G4UniformRand()) *sigopi);
     462                } else {
     463                        // short-flight limit
     464                        P = std::sqrt(G4UniformRand())*lattice;
     465                }
     466                       
     467                G4double fraction=GetHardeningFraction();
     468                if(fraction && G4UniformRand() < fraction) {
     469                        // pick out some events, and increase the central cross section
     470                        // by reducing the impact parameter
     471                        P /= std::sqrt(GetHardeningFactor());
     472                }
     473               
     474               
     475                // check if we are far enough away that the energy transfer must be below cutoff,
     476                // and leave everything alone if so, saving a lot of time.
     477                if(P*P > sigopi) {
     478                        if(GetVerboseLevel() > 1)
     479                                printf("ScreenedNuclear impact reject: length=%.3f P=%.4f limit=%.4f\n",
     480                                           length/angstrom, P/angstrom,std::sqrt(sigopi)/angstrom);
     481                        // no collision, don't follow up with anything
     482                        validCollision=0;
     483                }
    469484        }
    470485       
    471486        // find out what we hit, and record it in our kinematics block.
     487        kinematics.targetMaterial=mat;
     488        kinematics.a1=a1;
     489       
    472490        if(validCollision) {
    473491                G4ScreenedCoulombCrossSection   *xsect=GetCrossSectionHandlers()[z1];
     
    477495                kinematics.recoilIon=recoilIon;
    478496                kinematics.impactParameter=P;
    479                 kinematics.a1=baseParticle->GetPDGMass()/amu_c2;
    480497                kinematics.a2=recoilIon->GetPDGMass()/amu_c2;
    481498        } else {
    482499                kinematics.recoilIon=0;
    483500                kinematics.impactParameter=0;
    484                 kinematics.a1=baseParticle->GetPDGMass()/amu_c2;
    485501                kinematics.a2=0;
    486502        }
     
    492508       
    493509        if(registerDepositedEnergy) {
    494           aParticleChange.ProposeLocalEnergyDeposit(NIEL);
    495           aParticleChange.ProposeNonIonizingEnergyDeposit(NIEL);
    496         }
     510                pParticleChange->ProposeLocalEnergyDeposit(IonizingLoss+NIEL);
     511                pParticleChange->ProposeNonIonizingEnergyDeposit(NIEL);
     512                //MHM G4cout << "depositing energy, total = " << IonizingLoss+NIEL << " NIEL = " << NIEL << G4endl;
     513        }
     514
    497515        return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep );
     516}
     517
     518G4ScreenedCoulombClassicalKinematics::G4ScreenedCoulombClassicalKinematics() :
     519// instantiate all the needed functions statically, so no allocation is done at run time
     520// we will be solving x^2 - x phi(x*au)/eps - beta^2 == 0.0
     521// or, for easier scaling, x'^2 - x' au phi(x')/eps - beta^2 au^2
     522// note that only the last of these gets deleted, since it owns the rest
     523phifunc(c2.const_plugin_function()),
     524xovereps(c2.linear(0., 0., 0.)), // will fill this in with the right slope at run time
     525diff(c2.quadratic(0., 0., 0., 1.)-xovereps*phifunc)
     526{
    498527}
    499528
     
    520549        }
    521550       
    522         c2_function<G4double> &phiData=*(screen->EMphiData);
    523         // instantiate all the needed functions statically, so no allocation is done at run time
    524551        // we will be solving x^2 - x phi(x*au)/eps - beta^2 == 0.0
    525552        // or, for easier scaling, x'^2 - x' au phi(x')/eps - beta^2 au^2
    526         static c2_plugin_function<G4double> phifunc;
    527         static c2_quadratic<G4double> xsq(0., 0., 0., 1.); //  x^2
    528         static c2_linear<G4double> xovereps(0., 0., 0.); // will fill this in with the right slope at run time
    529         static c2_function<G4double> &xphi=xovereps*phifunc;
    530         static c2_function<G4double> &diff=xsq-xphi;
    531        
    532553        xovereps.reset(0., 0.0, au/eps); // slope of x*au/eps term
    533         phifunc.set_function(phiData); // install interpolating table
    534        
     554        phifunc.set_function(&(screen->EMphiData.get())); // install interpolating table
    535555        G4double xx1, phip, phip2;
    536         G4int root_error;
    537        
    538         xx1=diff.find_root(phiData.xmin(), std::min(10*xx0*au,phiData.xmax()),
    539                                            std::min(xx0*au, phiData.xmax()), beta*beta*au*au, &root_error, &phip, &phip2)/au;
     556        G4int root_error;       
     557        xx1=diff->find_root(phifunc.xmin(), std::min(10*xx0*au,phifunc.xmax()),
     558                                           std::min(xx0*au, phifunc.xmax()), beta*beta*au*au, &root_error, &phip, &phip2)/au;
    540559       
    541560        if(root_error) {
    542561                G4cout << "Screened Coulomb Root Finder Error" << G4endl;
    543562                G4cout << "au " << au << " A " << A << " a1 " << a1 << " xx1 " << xx1 << " eps " << eps << " beta " << beta << G4endl;
    544                 G4cout << " xmin " << phiData.xmin() << " xmax " << std::min(10*xx0*au,phiData.xmax()) ;
    545                 G4cout << " f(xmin) " << phifunc(phiData.xmin()) <<  " f(xmax) " << phifunc(std::min(10*xx0*au,phiData.xmax())) ;
    546                 G4cout << " xstart " << std::min(xx0*au, phiData.xmax()) <<  " target " <<  beta*beta*au*au ;
     563                G4cout << " xmin " << phifunc.xmin() << " xmax " << std::min(10*xx0*au,phifunc.xmax()) ;
     564                G4cout << " f(xmin) " << phifunc(phifunc.xmin()) <<  " f(xmax) " << phifunc(std::min(10*xx0*au,phifunc.xmax())) ;
     565                G4cout << " xstart " << std::min(xx0*au, phifunc.xmax()) <<  " target " <<  beta*beta*au*au ;
    547566                G4cout << G4endl;
    548567                throw c2_exception("Failed root find");
    549568        }
    550569       
    551         phifunc.unset_function(); // throws an exception if used without setting again
    552                                                           // phiprime is scaled by one factor of au because phi is evaluated at (xx0*au),
     570        // phiprime is scaled by one factor of au because phi is evaluated at (xx0*au),
    553571        G4double phiprime=phip*au;
    554572       
     
    564582                G4double x, ff;
    565583                x=xx1/xvals[k];
    566                 ff=1.0/std::sqrt(1.0-phiData(x*au)/(x*eps)-beta*beta/(x*x));
     584                ff=1.0/std::sqrt(1.0-phifunc(x*au)/(x*eps)-beta*beta/(x*x));
    567585                alpha+=weights[k]*ff;
    568586        }
    569587       
     588        phifunc.unset_function(); // throws an exception if used without setting again
     589
    570590        G4double thetac1=CLHEP::pi*beta*alpha/xx1; // complement of CM scattering angle
    571591        G4double sintheta=std::sin(thetac1); //note sin(pi-theta)=sin(theta)
     
    626646        kin.eRecoil=eRecoil;
    627647       
    628         if(incidentEnergy-eRecoil < master->GetRecoilCutoff()) {
    629                 if(!baseParticle->GetProcessManager()->
    630                    GetAtRestProcessVector()->size())
    631                         aParticleChange.ProposeTrackStatus(fStopAndKill);
    632                 else
    633                         aParticleChange.ProposeTrackStatus(fStopButAlive);
     648        if(incidentEnergy-eRecoil < master->GetRecoilCutoff()*a1) {
    634649                aParticleChange.ProposeEnergy(0.0);
    635                 master->AddToNIEL(incidentEnergy-eRecoil);
     650                master->DepositEnergy(int(screen->z1), a1, kin.targetMaterial, incidentEnergy-eRecoil);
    636651        }
    637652       
    638         if(master->GetEnableRecoils() && eRecoil > master->GetRecoilCutoff()) {
     653        if(master->GetEnableRecoils() && eRecoil > master->GetRecoilCutoff() * kin.a2) {
    639654                kin.recoilIon=recoilIon;               
    640655        } else {
    641656                kin.recoilIon=0; // this flags no recoil to be generated
    642                 master->AddToNIEL(eRecoil) ;
     657                master->DepositEnergy(Z, A, kin.targetMaterial, eRecoil) ;
    643658        }       
    644659}
     
    706721#include <vector>
    707722
    708 static c2_function<G4double> &ZBLScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
     723G4_c2_function &ZBLScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
    709724{
    710725        static const size_t ncoef=4;
     
    729744       
    730745        *auval=au;
    731         return *static_cast<c2_function<G4double> *>(new lin_log_interpolating_function<G4double>(r, phi, false, phiprime0));
    732 }
    733 
    734 static c2_function<G4double> &MoliereScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
     746        return c2.lin_log_interpolating_function().load(r, phi, false, phiprime0,true,0);
     747}
     748
     749G4_c2_function &MoliereScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
    735750{       
    736751        static const size_t ncoef=3;
     
    755770       
    756771        *auval=au;
    757         return *static_cast<c2_function<G4double> *>(new lin_log_interpolating_function<G4double>(r, phi, false, phiprime0));
    758 }
    759 
    760 static c2_function<G4double> &LJScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
     772        return c2.lin_log_interpolating_function().load(r, phi, false, phiprime0,true,0);
     773}
     774
     775G4_c2_function &LJScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
    761776{       
    762777//from Loftager, Besenbacher, Jensen & Sorensen
     
    781796       
    782797        *auval=au;
    783         return *static_cast<c2_function<G4double> *>(new lin_log_interpolating_function<G4double>(r, phi, false, logphiprime0*phi[0]));
     798        return c2.lin_log_interpolating_function().load(r, phi, false, logphiprime0*phi[0],true,0);
     799}
     800
     801G4_c2_function &LJZBLScreening(G4int z1, G4int z2, size_t npoints, G4double rMax, G4double *auval)
     802{       
     803// hybrid of LJ and ZBL, uses LJ if x < 0.25*auniv, ZBL if x > 1.5*auniv, and
     804/// connector in between.  These numbers are selected so the switchover
     805// is very near the point where the functions naturally cross.
     806        G4double auzbl, aulj;
     807       
     808        c2p zbl=ZBLScreening(z1, z2, npoints, rMax, &auzbl);
     809        c2p lj=LJScreening(z1, z2, npoints, rMax, &aulj);
     810
     811        G4double au=(auzbl+aulj)*0.5;
     812        lj->set_domain(lj->xmin(), 0.25*au);
     813        zbl->set_domain(1.5*au,zbl->xmax());
     814       
     815        c2p conn=c2.connector_function(lj->xmax(), lj, zbl->xmin(), zbl, true,0);
     816        c2_piecewise_function_p<G4double> &pw=c2.piecewise_function();
     817        c2p keepit(pw);
     818        pw.append_function(lj);
     819        pw.append_function(conn);
     820        pw.append_function(zbl);
     821       
     822        *auval=au;
     823        keepit.release_for_return();
     824        return pw;
    784825}
    785826
     
    791832        AddScreeningFunction("lj", LJScreening);       
    792833        AddScreeningFunction("mol", MoliereScreening); 
     834        AddScreeningFunction("ljzbl", LJZBLScreening); 
    793835}
    794836
     
    855897                       
    856898                        G4double au;
    857                         c2_function<G4double> &screen=sfunc(z1, Z, 200, 50.0*angstrom, &au); // generate the screening data
    858 
     899                        G4_c2_ptr screen=sfunc(z1, Z, 200, 50.0*angstrom, &au); // generate the screening data
    859900                        G4ScreeningTables st;
    860                         st.EMphiData=&screen; // this is our phi table
     901       
     902                        st.EMphiData=screen; //save our phi table
    861903                        st.z1=z1; st.m1=a1; st.z2=Z; st.m2=a2; st.emin=recoilCutoff;
    862904                        st.au=au;
     
    869911                        //this rearranges to phi(x0)/(x0*eps) = 2*theta/pi - theta^2/pi^2
    870912                       
    871                         c2_linear<G4double> c2au(0.0, 0.0, au);
    872                         c2_composed_function<G4double> phiau(screen, c2au); // build phi(x*au) for dimensionless phi
    873                         c2_linear<G4double> c2eps(0.0, 0.0, 0.0); // will store an appropriate eps inside this in loop
    874                         c2_ratio<G4double> x0func(phiau, c2eps); // this will be phi(x)/(x*eps) when c2eps is correctly set
     913                        c2_linear_p<G4double> &c2eps=c2.linear(0.0, 0.0, 0.0); // will store an appropriate eps inside this in loop
     914                        G4_c2_ptr phiau=screen(c2.linear(0.0, 0.0, au));
     915                        G4_c2_ptr x0func(phiau/c2eps); // this will be phi(x)/(x*eps) when c2eps is correctly set
     916                        x0func->set_domain(1e-6*angstrom/au, 0.9999*screen->xmax()/au); // needed for inverse function
     917                        // use the c2_inverse_function interface for the root finder... it is more efficient for an ordered
     918                        // computation of values.
     919                        G4_c2_ptr x0_solution(c2.inverse_function(x0func));
    875920                       
    876921                        G4double m1c2=a1*amu_c2;
     
    897942                                G4double q=theta/pi;
    898943                                // G4cout << ee << " " << m1c2 << " " << gamma << " " << eps << " " << theta << " " << q << G4endl;
    899                                 G4double x0= x0func.find_root(1e-6*angstrom/au, 0.9999*screen.xmax()/au, 1.0, 2*q-q*q);
     944                                // old way using root finder
     945                                // G4double x0= x0func->find_root(1e-6*angstrom/au, 0.9999*screen.xmax()/au, 1.0, 2*q-q*q);
     946                                // new way using c2_inverse_function which caches useful information so should be a bit faster
     947                                // since we are scanning this in strict order.
     948                                G4double x0=0;
     949                                try {
     950                                        x0=x0_solution(2*q-q*q);
     951                                } catch(c2_exception e) {
     952                                        G4Exception(
     953                                                G4String("G4ScreenedNuclearRecoil: failure in inverse solution to generate MFP Tables: ")+e.what()
     954                                        );
     955                                }
    900956                                G4double betasquared=x0*x0 - x0*phiau(x0)/eps; 
    901957                                G4double sigma=pi*betasquared*au*au;
     
    903959                                data[idx]=sigma;
    904960                        }
    905                        
    906961                        screeningData[Z]=st;
    907                         sigmaMap[Z] = static_cast<c2_function<G4double> *>(new log_log_interpolating_function<G4double>(
    908                                 energies, data));
     962                        sigmaMap[Z] = c2.log_log_interpolating_function().load(energies, data, true,0,true,0);
    909963                }
    910964        }
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmLivermore.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmLivermore.cc,v 1.2 2006/12/11 20:13:53 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmPenelope.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmPenelope.cc,v 1.1 2006/11/22 18:56:21 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmStandard.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: PhysListEmStandard.cc,v 1.11 2008/01/14 12:11:39 vnivanch Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: PhysListEmStandard.cc,v 1.19 2008/11/20 20:34:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2928//
    3029//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3938#include "G4PhotoElectricEffect.hh"
    4039
    41 #include "G4MultipleScattering.hh"
     40#include "G4eMultipleScattering.hh"
    4241#include "G4hMultipleScattering.hh"
    4342
     
    5150
    5251#include "G4hIonisation.hh"
     52#include "G4hBremsstrahlung.hh"
     53#include "G4hPairProduction.hh"
     54
    5355#include "G4ionIonisation.hh"
    5456
    5557#include "G4EmProcessOptions.hh"
     58#include "G4MscStepLimitType.hh"
    5659
    5760//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8689    } else if (particleName == "e-") {
    8790      //electron
    88       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    89       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    90       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     91      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
     92      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     93      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    9194           
    9295    } else if (particleName == "e+") {
    9396      //positron
    94       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    95       pmanager->AddProcess(new G4eIonisation,        -1, 2,2);
    96       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    97       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     97      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
     98      pmanager->AddProcess(new G4eIonisation,         -1, 2, 2);
     99      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     100      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    98101     
    99102    } else if( particleName == "mu+" ||
    100103               particleName == "mu-"    ) {
    101104      //muon 
    102       pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
    103       pmanager->AddProcess(new G4MuIonisation,       -1, 2,2);
    104       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 3,3);
    105       pmanager->AddProcess(new G4MuPairProduction,   -1, 4,4);       
     105      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     106      pmanager->AddProcess(new G4MuIonisation,        -1, 2, 2);
     107      pmanager->AddProcess(new G4MuBremsstrahlung,    -1, 3, 3);
     108      pmanager->AddProcess(new G4MuPairProduction,    -1, 4, 4);       
     109             
     110    } else if( particleName == "proton" ||
     111               particleName == "pi-" ||
     112               particleName == "pi+"    ) {
     113      //proton 
     114      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     115      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     116      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     117      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    106118     
    107     } else if( particleName == "alpha" || particleName == "GenericIon" ) {
    108       pmanager->AddProcess(new G4hMultipleScattering,-1, 1,1);
    109       pmanager->AddProcess(new G4ionIonisation,      -1, 2,2);
     119    } else if( particleName == "alpha" ||
     120               particleName == "He3" ||
     121               particleName == "GenericIon" ) {
     122      //Ions
     123      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     124      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);   
    110125
    111126    } else if ((!particle->IsShortLived()) &&
     
    113128               (particle->GetParticleName() != "chargedgeantino")) {
    114129      //all others charged particles except geantino
    115       pmanager->AddProcess(new G4hMultipleScattering,-1,1,1);
    116       pmanager->AddProcess(new G4hIonisation,        -1,2,2);
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    117132    }
    118133  }
    119   G4EmProcessOptions opt;
    120   opt.SetStepFunction(0.2, 10*um);
    121   //  opt.SetSkin(1.);
    122   opt.SetMinEnergy(0.1*keV);
    123   opt.SetMaxEnergy(100.*GeV);
    124   opt.SetDEDXBinning(360);
    125   opt.SetLambdaBinning(360);
    126   opt.SetLinearLossLimit(1.e-6);
    127134}
    128135
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmStandardNR.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandardNR.cc,v 1.1 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysListEmStandardNR.cc,v 1.3 2008/05/09 08:30:59 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5656#include "G4CoulombScattering.hh"
    5757
     58#include "G4DummyModel.hh"
     59
    5860//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5961
     
    7476
    7577  G4ScreenedNuclearRecoil* nucr = new G4ScreenedNuclearRecoil();
     78  G4double energyLimit = 100.*MeV;
     79  nucr->SetMaxEnergyForScattering(energyLimit);
    7680
    7781  theParticleIterator->reset();
     
    109113             
    110114    } else if (particleName == "alpha" || particleName == "He3") {
     115      G4hMultipleScattering* msc = new G4hMultipleScattering();
     116      G4DummyModel* dm = new G4DummyModel();
     117      dm->SetLowEnergyLimit(0.0);
     118      dm->SetHighEnergyLimit(energyLimit);
     119      msc->AddEmModel(0, dm);
     120      pmanager->AddProcess(msc, -1, 1,1);
     121
    111122      G4ionIonisation* ion = new G4ionIonisation();
    112123      ion->ActivateNuclearStopping(false);
    113       pmanager->AddProcess(ion, -1, 1, 1);
     124      pmanager->AddProcess(ion, -1, 2, 2);
     125
    114126      pmanager->AddDiscreteProcess(nucr);     
    115127
    116128    } else if (particleName == "GenericIon" ) {
     129      G4hMultipleScattering* msc = new G4hMultipleScattering();
     130      G4DummyModel* dm = new G4DummyModel();
     131      dm->SetLowEnergyLimit(0.0);
     132      dm->SetHighEnergyLimit(energyLimit);
     133      msc->AddEmModel(0, dm);
     134      pmanager->AddProcess(msc, -1, 1,1);
     135
    117136      G4ionIonisation* ion = new G4ionIonisation();
    118137      ion->ActivateNuclearStopping(false);
    119138      ion->SetStepFunction(0.1, um);
    120       pmanager->AddProcess(ion, -1, 1, 1);
     139      pmanager->AddProcess(ion, -1, 2, 2);
     140
    121141      pmanager->AddDiscreteProcess(nucr);     
    122142
     
    124144               particleName == "deuteron" ||
    125145               particleName == "triton") {
     146      G4hMultipleScattering* msc = new G4hMultipleScattering();
     147      G4DummyModel* dm = new G4DummyModel();
     148      dm->SetLowEnergyLimit(0.0);
     149      dm->SetHighEnergyLimit(energyLimit);
     150      msc->AddEmModel(0, dm);
     151      pmanager->AddProcess(msc, -1, 1,1);
     152
    126153      G4hIonisation* hion = new G4hIonisation();
    127154      hion->SetFluctModel(new G4IonFluctuations());
    128155      hion->SetStepFunction(0.1, 10.*um);
    129156      hion->ActivateNuclearStopping(false);
    130       pmanager->AddProcess(hion, -1, 1,1);
     157      pmanager->AddProcess(hion, -1, 2, 2);
     158
    131159      pmanager->AddDiscreteProcess(nucr);     
    132160     
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmStandardSS.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandardSS.cc,v 1.5 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysListEmStandardSS.cc,v 1.8 2008/11/16 19:17:39 maire Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3838#include "G4PhotoElectricEffect.hh"
    3939
    40 #include "G4MultipleScattering.hh"
     40#include "G4CoulombScattering.hh"
    4141
    4242#include "G4eIonisation.hh"
     
    5050#include "G4hIonisation.hh"
    5151#include "G4ionIonisation.hh"
    52 #include "G4ionGasIonisation.hh"
    53 #include "G4IonFluctuations.hh"
    54 #include "G4CoulombScattering.hh"
     52
     53#include "G4EmProcessOptions.hh"
    5554
    5655//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8584    } else if (particleName == "e-") {
    8685      //electron
    87       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    88       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
    8986      pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     87      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     88      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
    9089           
    9190    } else if (particleName == "e+") {
    9291      //positron
    93       pmanager->AddProcess(new G4eIonisation,        -1, 1,1);
    94       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2,2);
    95       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,3);
    9692      pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     93      pmanager->AddProcess(new G4eIonisation,        -1, 1, 1);
     94      pmanager->AddProcess(new G4eBremsstrahlung,    -1, 2, 2);
     95      pmanager->AddProcess(new G4eplusAnnihilation,   0,-1, 3);
    9796           
    9897    } else if (particleName == "mu+" ||
    9998               particleName == "mu-"    ) {
    100       //muon 
    101       pmanager->AddProcess(new G4MuIonisation,       -1, 1,1);
    102       pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2,2);
    103       pmanager->AddProcess(new G4MuPairProduction,   -1, 3,3);
    104       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     99      //muon
     100      pmanager->AddDiscreteProcess(new G4CoulombScattering);       
     101      pmanager->AddProcess(new G4MuIonisation,       -1, 1, 1);
     102      pmanager->AddProcess(new G4MuBremsstrahlung,   -1, 2, 2);
     103      pmanager->AddProcess(new G4MuPairProduction,   -1, 3, 3);
    105104             
    106     } else if (particleName == "alpha" || particleName == "He3") {
    107       G4ionIonisation* ion = new G4ionIonisation();
    108       ion->SetStepFunction(0.1, um);
    109       ion->ActivateNuclearStopping(false);
    110       pmanager->AddProcess(ion,  -1, 1,1);
    111       pmanager->AddDiscreteProcess(new G4CoulombScattering);     
    112 
    113     } else if (particleName == "GenericIon" ) {
    114       G4ionGasIonisation* ion = new G4ionGasIonisation();
    115       ion->ActivateNuclearStopping(false);
    116       ion->SetStepFunction(0.1, um);
    117       pmanager->AddProcess(ion,  -1, 1,1);
    118       G4CoulombScattering* cs = new G4CoulombScattering();
    119       cs->SetBuildTableFlag(false);
    120       pmanager->AddDiscreteProcess(cs);
    121      
     105    } else if (particleName == "alpha" ||
     106               particleName == "He3" ||
     107               particleName == "GenericIon") {
     108      pmanager->AddDiscreteProcess(new G4CoulombScattering);           
     109      pmanager->AddProcess(new G4ionIonisation,      -1, 1, 1);
     110     
    122111    } else if ((!particle->IsShortLived()) &&
    123112               (particle->GetPDGCharge() != 0.0) &&
    124113               (particle->GetParticleName() != "chargedgeantino")) {
    125114      //all others charged particles except geantino
    126       G4hIonisation* hion = new G4hIonisation();
    127       hion->SetStepFunction(0.1, 10.*um);
    128       hion->ActivateNuclearStopping(false);
    129       pmanager->AddProcess(hion,  -1,1,1);
    130115      pmanager->AddDiscreteProcess(new G4CoulombScattering);     
     116      pmanager->AddProcess(new G4hIonisation,        -1, 1, 1);
    131117    }
    132118  }
     119 
     120  // Em options
     121  //
     122  // Main options and setting parameters are shown here.
     123  // Several of them have default values.
     124  //
     125  G4EmProcessOptions emOptions;
     126 
     127  //physics tables
     128  //
     129  emOptions.SetMinEnergy(100*eV);       //default   
     130  emOptions.SetMaxEnergy(100*TeV);      //default 
     131  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     132  emOptions.SetLambdaBinning(12*20);    //default=12*7
     133  emOptions.SetSplineFlag(true);        //default
     134     
     135  //energy loss
     136  //
     137  emOptions.SetStepFunction(0.2,50*um); //default=(0.2, 1*mm)   
     138  emOptions.SetLinearLossLimit(1.e-2);  //default
     139   
     140  //ionization
     141  //
     142  emOptions.SetSubCutoff(false);        //default   
    133143}
    134144
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.28 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysicsList.cc,v 1.36 2008/11/21 12:53:13 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3535#include "PhysListEmStandard.hh"
    3636#include "PhysListEmStandardSS.hh"
    37 #include "PhysListEmStandardIG.hh"
    3837#include "PhysListEmStandardNR.hh"
    3938#include "PhysListEmLivermore.hh"
     
    4241#include "G4EmStandardPhysics_option1.hh"
    4342#include "G4EmStandardPhysics_option2.hh"
     43#include "G4EmStandardPhysics_option3.hh"
     44
     45#include "G4DecayPhysics.hh"
    4446
    4547#include "G4HadronElasticPhysics.hh"
     
    5052#include "G4IonBinaryCascadePhysics.hh"
    5153
    52 #include "G4EmProcessOptions.hh"
    53 
    5454#include "G4LossTableManager.hh"
    5555#include "G4UnitsTable.hh"
     
    5757#include "G4ProcessManager.hh"
    5858#include "G4Decay.hh"
     59
     60#include "StepMax.hh"
     61
     62#include "G4IonFluctuations.hh"
     63#include "G4IonParametrisedLossModel.hh"
    5964
    6065//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    7984
    8085  // EM physics
    81   emPhysicsList = new PhysListEmStandard(emName = "standard");
    82 
     86  emPhysicsList = new G4EmStandardPhysics(1);
     87  emName = G4String("emstandard");
     88
     89  // Deacy physics and all particles
     90  decPhysicsList = new G4DecayPhysics();
    8391}
    8492
     
    8997  delete pMessenger;
    9098  delete emPhysicsList;
    91   for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
    92 }
    93 
    94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    95 
    96 // Bosons
    97 #include "G4ChargedGeantino.hh"
    98 #include "G4Geantino.hh"
    99 #include "G4Gamma.hh"
    100 
    101 // leptons
    102 #include "G4MuonPlus.hh"
    103 #include "G4MuonMinus.hh"
    104 #include "G4NeutrinoMu.hh"
    105 #include "G4AntiNeutrinoMu.hh"
    106 
    107 #include "G4Electron.hh"
    108 #include "G4Positron.hh"
    109 #include "G4NeutrinoE.hh"
    110 #include "G4AntiNeutrinoE.hh"
    111 
    112 // Hadrons
    113 #include "G4MesonConstructor.hh"
    114 #include "G4BaryonConstructor.hh"
    115 #include "G4IonConstructor.hh"
     99  delete decPhysicsList;
     100  for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
     101}
    116102
    117103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    119105void PhysicsList::ConstructParticle()
    120106{
    121 // pseudo-particles
    122   G4Geantino::GeantinoDefinition();
    123   G4ChargedGeantino::ChargedGeantinoDefinition();
    124  
    125 // gamma
    126   G4Gamma::GammaDefinition();
    127  
    128 // leptons
    129   G4Electron::ElectronDefinition();
    130   G4Positron::PositronDefinition();
    131   G4MuonPlus::MuonPlusDefinition();
    132   G4MuonMinus::MuonMinusDefinition();
    133 
    134   G4NeutrinoE::NeutrinoEDefinition();
    135   G4AntiNeutrinoE::AntiNeutrinoEDefinition();
    136   G4NeutrinoMu::NeutrinoMuDefinition();
    137   G4AntiNeutrinoMu::AntiNeutrinoMuDefinition(); 
    138 
    139 // mesons
    140   G4MesonConstructor mConstructor;
    141   mConstructor.ConstructParticle();
    142 
    143 // barions
    144   G4BaryonConstructor bConstructor;
    145   bConstructor.ConstructParticle();
    146 
    147 // ions
    148   G4IonConstructor iConstructor;
    149   iConstructor.ConstructParticle();
    150 }
    151 
    152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     107  decPhysicsList->ConstructParticle();
     108}
     109
     110//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     111
    153112void PhysicsList::ConstructProcess()
    154113{
     
    160119  //
    161120  emPhysicsList->ConstructProcess();
     121  em_config.AddModels();
     122
     123  // decay physics list
     124  //
     125  decPhysicsList->ConstructProcess();
    162126 
    163127  // hadronic physics lists
    164   for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
    165  
    166   // decay process
    167   //
    168   G4Decay* fDecayProcess = new G4Decay();
    169 
    170   theParticleIterator->reset();
    171   while( (*theParticleIterator)() ){
    172     G4ParticleDefinition* particle = theParticleIterator->value();
    173     G4ProcessManager* pmanager = particle->GetProcessManager();
    174 
    175     if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
    176 
    177       pmanager ->AddProcess(fDecayProcess);
    178 
    179       // set ordering for PostStepDoIt and AtRestDoIt
    180       pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
    181       pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
    182 
    183     }
     128  for(size_t i=0; i<hadronPhys.size(); i++) {
     129    hadronPhys[i]->ConstructProcess();
    184130  }
    185131 
    186132  // step limitation (as a full process)
    187133  // 
    188   AddStepMax();
    189  
    190   G4EmProcessOptions opt;
    191   opt.SetDEDXBinning(480);
     134  AddStepMax(); 
    192135}
    193136
     
    196139void PhysicsList::AddPhysicsList(const G4String& name)
    197140{
    198   if (verboseLevel>-1) {
     141  if (verboseLevel>1) {
    199142    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
    200143  }
     
    202145  if (name == emName) return;
    203146
    204   if (name == "standard") {
     147  if (name == "standard_local") {
    205148
    206149    emName = name;
     
    212155    emName = name;
    213156    delete emPhysicsList;
    214     emPhysicsList = new G4EmStandardPhysics();
     157    emPhysicsList = new G4EmStandardPhysics(1);
    215158
    216159  } else if (name == "emstandard_opt1") {
     
    225168    delete emPhysicsList;
    226169    emPhysicsList = new G4EmStandardPhysics_option2();
     170   
     171  } else if (name == "emstandard_opt3") {
     172
     173    emName = name;
     174    delete emPhysicsList;
     175    emPhysicsList = new G4EmStandardPhysics_option3();   
    227176
    228177  } else if (name == "standardSS") {
     
    238187    emPhysicsList = new PhysListEmStandardNR(name);
    239188
    240   } else if (name == "standardIG") {
    241 
    242     emName = name;
    243     delete emPhysicsList;
    244     emPhysicsList = new PhysListEmStandardIG(name);
     189  } else if (name == "standardICRU73") {
     190
     191    emName = name;
     192    delete emPhysicsList;
     193    emPhysicsList = new PhysListEmStandard(name);
     194    em_config.SetExtraEmModel("GenericIon","ionIoni",
     195                              new G4IonParametrisedLossModel(),
     196                              "",0.0, 100.0*TeV,
     197                              new G4IonFluctuations());
     198    G4cout << "standardICRU73" << G4endl;
    245199
    246200  } else if (name == "livermore") {
     
    288242//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    289243
    290 #include "StepMax.hh"
    291 
    292244void PhysicsList::AddStepMax()
    293245{
     
    297249  theParticleIterator->reset();
    298250  while ((*theParticleIterator)()){
    299       G4ParticleDefinition* particle = theParticleIterator->value();
    300       G4ProcessManager* pmanager = particle->GetProcessManager();
    301 
    302       if (stepMaxProcess->IsApplicable(*particle) && pmanager)
    303         {
    304           pmanager ->AddDiscreteProcess(stepMaxProcess);
    305         }
     251    G4ParticleDefinition* particle = theParticleIterator->value();
     252    G4ProcessManager* pmanager = particle->GetProcessManager();
     253
     254    if (stepMaxProcess->IsApplicable(*particle) && pmanager)
     255      {
     256        pmanager ->AddDiscreteProcess(stepMaxProcess);
     257      }
    306258  }
    307259}
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 16:58:37 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:58:39 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/PrimaryGeneratorMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: PrimaryGeneratorMessenger.cc,v 1.3 2006/06/29 16:58:41 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/RunAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.21 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: RunAction.cc,v 1.24 2008/08/22 18:30:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4242
    4343#include "Randomize.hh"
    44 
    45 #ifdef G4ANALYSIS_USE
    46 #include "AIDA/AIDA.h"
    47 #endif
     44#include "Histo.hh"
    4845
    4946//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5148RunAction::RunAction(DetectorConstruction* det, PhysicsList* phys,
    5249                     PrimaryGeneratorAction* kin)
    53 :detector(det), physics(phys), kinematic(kin), af(0), tree(0)
     50:detector(det), physics(phys), kinematic(kin)
    5451{
    5552  tallyEdep = new G4double[MaxTally];
    5653  binLength = offsetX = 0.;
    57   histo[0] = 0;
    58  
    59 #ifdef G4ANALYSIS_USE
    60   // Creating the analysis factory
    61   af = AIDA_createAnalysisFactory();
    62   if(!af) {
    63     G4cout << "RunAction::RunAction() :"
    64            << " problem creating the AIDA analysis factory."
    65            << G4endl;
    66   }       
    67 #endif 
     54  histo = new Histo();
     55  histo->setFileName("testem7");
     56  histo->add1D("1","Edep (MeV/mm) along absorber (mm)", 100, 0, 100);
     57  histo->add1D("2","Edep (MeV/mm) along absorber zoomed (mm)", 100, 0, 100);
     58  histo->add1D("3","Projectile range (mm)", 100, 0, 100);
    6859}
    6960
     
    7364{
    7465  delete [] tallyEdep;
    75  
    76 #ifdef G4ANALYSIS_USE
    77   delete af; 
    78 #endif     
    79 }
    80 
    81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    82 
    83 void RunAction::bookHisto()
    84 {
    85   length  = detector->GetAbsorSizeX();
    86   G4double stepMax = physics->GetStepMaxProcess()->GetMaxStep();
    87   const G4int nbmin = 100;
    88   G4int nbBins = (int)(0.5 + length/stepMax);
    89   if (nbBins < nbmin) nbBins = nbmin;
    90   binLength = length/nbBins;
    91   offsetX   = 0.5*length;
    92  
    93 #ifdef G4ANALYSIS_USE
    94   if (!af) return;
    95 
    96   // Create a tree mapped to an hbook file.
    97   G4bool readOnly  = false;
    98   G4bool createNew = true;
    99   G4String options = "--noErrors uncompress";
    100   AIDA::ITreeFactory* tf  = af->createTreeFactory(); 
    101   tree = tf->create("testem7.hbook","hbook", readOnly, createNew, options);
    102   //tree = tf->create("testem7.root", "root",readOnly, createNew, options);
    103   //tree = tf->create("testem7.XML" , "XML" ,readOnly, createNew, options);
    104   delete tf;
    105   if (!tree) {
    106     G4cout << "RunAction::bookHisto()" << G4endl;
    107     return;
    108   }
    109 
    110   // Create a histogram factory, whose histograms will be handled by the tree
    111   AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
    112  
    113   // Create histogram
    114   histo[0] = hf->createHistogram1D("1","Edep (MeV/mm) along absorber (mm)",
    115              nbBins, 0, length/mm);
    116              
    117   delete hf;         
    118   G4cout << "\n----> Histogram Tree opened" << G4endl;
    119 #endif
    120 }
    121 
    122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    123 
    124 void RunAction::cleanHisto()
    125 {
    126 #ifdef G4ANALYSIS_USE
    127   tree->commit();       // Writing the histograms to the file
    128   tree->close();        // and closing the tree (and the file)
    129   delete tree;
    130   tree = 0;
    131  
    132   G4cout << "\n----> Histogram Tree saved" << G4endl; 
    133 #endif
     66  delete histo; 
    13467}
    13568
     
    13871void RunAction::FillHisto(G4int ih, G4double x, G4double weight)
    13972{
    140 #ifdef G4ANALYSIS_USE
    141   if(histo[ih]) histo[ih]->fill(x, weight);
    142 #endif
     73  histo->fill(ih, x, weight);
    14374}
    14475
     
    15687  //
    15788  nPrimarySteps = 0;
     89  nRange = 0;
    15890  projRange = projRange2 = 0.;
    15991  edeptot = eniel = 0.;
    16092  for (G4int j=0; j<MaxTally; j++) tallyEdep[j] = 0.;
    16193  kinematic->ResetEbeamCumul();
    162   bookHisto();     
     94
     95  // define "1" histogram binning
     96  length  = detector->GetAbsorSizeX();
     97  G4double stepMax = physics->GetStepMaxProcess()->GetMaxStep();
     98  const G4int nbmin = 100;
     99  G4int nbBins = (G4int)(0.5 + length/stepMax);
     100  if (nbBins < nbmin) nbBins = nbmin;
     101  binLength = length/nbBins;
     102  offsetX   = 0.5*length;
     103   
     104  // histogram "1" is defined by the length of the target
     105  // zoomed histograms are defined by UI command
     106  histo->setHisto1D(0, nbBins, 0, length, mm);
     107 
     108  histo->book();
    163109}
    164110
     
    186132  //compute projected range and straggling
    187133  //
    188   projRange /= NbofEvents; projRange2 /= NbofEvents;
     134  if(nRange > 0) {
     135    projRange /= nRange;
     136    projRange2 /= nRange;
     137  }
    189138  G4double rms = projRange2 - projRange*projRange;       
    190139  if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
     
    227176  }
    228177
    229 #ifdef G4ANALYSIS_USE
    230178  // normalize histogram
    231179  G4double fac = (mm/MeV)/(NbofEvents *  binLength);
    232   histo[0]->scale(fac);
    233 #endif
    234  
     180  for (G4int j=0; j<3; j++) {histo->scale(j, fac);}
    235181 
    236182  // save and clean histo
    237   cleanHisto();
     183  histo->save();
    238184 
    239185  // show Rndm status
  • trunk/examples/extended/electromagnetic/TestEm7/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.5 2006/06/29 16:58:45 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:58:47 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/SteppingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.12 2008/01/14 12:11:39 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: SteppingAction.cc,v 1.14 2008/08/22 18:30:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5151void SteppingAction::UserSteppingAction(const G4Step* aStep)
    5252{
    53  G4double edep = aStep->GetTotalEnergyDeposit();
    54  if (edep <= 0.) return;
     53  G4double edep = aStep->GetTotalEnergyDeposit();
     54  if (edep <= 0.) return;
    5555
    56  // G4cout << "edep= " << edep << "NIEL= " << aStep->GetNonIonizingEnergyDeposit()<<G4endl;
     56  // G4cout << "edep= " << edep << "NIEL= " << aStep->GetNonIonizingEnergyDeposit()<<G4endl;
    5757
    58  runAction->FillEdep(edep,aStep->GetNonIonizingEnergyDeposit());
     58  runAction->FillEdep(edep,aStep->GetNonIonizingEnergyDeposit());
    5959
    60  if(aStep->GetTrack()->GetTrackID() == 1) runAction->AddPrimaryStep(); 
     60  if(aStep->GetTrack()->GetTrackID() == 1) runAction->AddPrimaryStep(); 
    6161 
    62  //Bragg curve
    63  //     
    64  G4StepPoint* prePoint  = aStep->GetPreStepPoint();
    65  G4StepPoint* postPoint = aStep->GetPostStepPoint();
     62  //Bragg curve
     63  //   
     64  G4StepPoint* prePoint  = aStep->GetPreStepPoint();
     65  G4StepPoint* postPoint = aStep->GetPostStepPoint();
    6666   
    67  G4double x1 = prePoint->GetPosition().x(), x2 = postPoint->GetPosition().x(); 
    68  G4double x = runAction->GetOffsetX() + x1 + G4UniformRand()*(x2-x1);
    69  runAction->FillHisto(0, x/mm , edep);
     67  G4double x1 = prePoint->GetPosition().x(), x2 = postPoint->GetPosition().x(); 
     68  G4double x = runAction->GetOffsetX() + x1 + G4UniformRand()*(x2-x1);
     69  runAction->FillHisto(0, x/mm , edep);
     70  runAction->FillHisto(1, x/mm , edep);
    7071
    71  //fill tallies
    72  //
    73  G4TouchableHandle touchable = prePoint->GetTouchableHandle();
    74  G4LogicalVolume* lVolume = touchable->GetVolume()->GetLogicalVolume();
    75  if (lVolume == detector->GetLogicalTally())
    76      runAction->FillTallyEdep(touchable->GetCopyNumber(), edep);
     72  //fill tallies
     73  //
     74  G4TouchableHandle touchable = prePoint->GetTouchableHandle();
     75  G4LogicalVolume* lVolume = touchable->GetVolume()->GetLogicalVolume();
     76  if (lVolume == detector->GetLogicalTally())
     77    runAction->FillTallyEdep(touchable->GetCopyNumber(), edep);
    7778}
    7879
  • trunk/examples/extended/electromagnetic/TestEm7/src/SteppingVerbose.cc

    r807 r1230  
    2525//
    2626// $Id: SteppingVerbose.cc,v 1.3 2006/06/29 16:58:51 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm7/src/TrackingAction.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: TrackingAction.cc,v 1.3 2006/11/22 17:58:11 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: TrackingAction.cc,v 1.5 2008/08/22 18:30:27 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5050    G4double x = aTrack->GetPosition().x() + runAction->GetOffsetX();
    5151    if(x > runAction->GetLength()) x = runAction->GetLength();
    52     runAction->AddProjRange(x);
     52    //G4cout << " range= " << x << " x= " << aTrack->GetPosition().x()
     53    //     << " ofset= " << runAction->GetOffsetX() << G4endl;
     54    if(x > 0.0) runAction->AddProjRange(x);
     55    runAction->FillHisto(2, x/mm, 1.0);
    5356  } 
    5457}
  • trunk/examples/extended/electromagnetic/TestEm8/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.7 2006/10/26 16:20:33 maire Exp $
     1# $Id: GNUmakefile,v 1.8 2008/06/11 22:27:45 maire Exp $
    22# --------------------------------------------------------------
    33# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
     
    1515all: lib bin
    1616
    17 ifdef G4ANALYSIS_USE
    18   CPPFLAGS += -DG4ANALYSIS_USE
    19 endif
     17#### G4ANALYSIS_USE := true
    2018
    2119include $(G4INSTALL)/config/architecture.gmk
    2220
    23 ifdef G4ANALYSIS_USE
    24   # for the aida-config command see the README file
    25   CPPFLAGS += `aida-config --include`
    26   LOADLIBS += `aida-config --lib`
    27 endif
    28 
    2921include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm8/TestEm8.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm8.cc,v 1.8 2007/07/27 15:29:38 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8CalorHit.hh

    r807 r1230  
    2626//
    2727// $Id: Em8CalorHit.hh,v 1.4 2006/06/29 16:58:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8CalorimeterSD.hh

    r807 r1230  
    2626//
    2727// $Id: Em8CalorimeterSD.hh,v 1.4 2006/06/29 16:59:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8DetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: Em8DetectorConstruction.hh,v 1.9 2007/10/02 10:12:47 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8DetectorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em8DetectorMessenger.hh,v 1.6 2007/10/02 10:12:47 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8EventAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em8EventAction.hh,v 1.4 2006/06/29 16:59:08 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8EventActionMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em8EventActionMessenger.hh,v 1.4 2006/06/29 16:59:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8PrimaryGeneratorAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em8PrimaryGeneratorAction.hh,v 1.4 2006/06/29 16:59:12 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8PrimaryGeneratorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: Em8PrimaryGeneratorMessenger.hh,v 1.4 2006/06/29 16:59:14 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8RunAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em8RunAction.hh,v 1.8 2006/06/29 16:59:16 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8RunMessenger.hh

    r807 r1230  
    2727//
    2828// $Id: Em8RunMessenger.hh,v 1.4 2006/06/29 16:59:18 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8SteppingAction.hh

    r807 r1230  
    2626//
    2727// $Id: Em8SteppingAction.hh,v 1.5 2006/06/29 16:59:20 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/Em8SteppingVerbose.hh

    r807 r1230  
    2626//
    2727// $Id: Em8SteppingVerbose.hh,v 1.4 2006/06/29 16:59:22 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// 
  • trunk/examples/extended/electromagnetic/TestEm8/include/PhysicsList.hh

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.hh,v 1.2 2006/06/29 16:59:46 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.hh,v 1.3 2008/11/21 12:39:24 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    4040#include "G4VModularPhysicsList.hh"
    4141#include "globals.hh"
     42#include "G4EmConfigurator.hh"
    4243
    4344class G4VPhysicsConstructor;
     
    4950class PhysicsList: public G4VModularPhysicsList
    5051{
    51   public:
    52     PhysicsList();
    53   ~PhysicsList();
     52public:
     53  PhysicsList();
     54  virtual ~PhysicsList();
    5455
    55     void ConstructParticle();
     56  void ConstructParticle();
    5657   
    57     void SetCuts();
    58     void SetCutForGamma(G4double);
    59     void SetCutForElectron(G4double);
    60     void SetCutForPositron(G4double);
     58  void SetCuts();
     59  void SetCutForGamma(G4double);
     60  void SetCutForElectron(G4double);
     61  void SetCutForPositron(G4double);
    6162       
    62     void AddPhysicsList(const G4String& name);
    63     void ConstructProcess();
     63  void AddPhysicsList(const G4String& name);
     64  void ConstructProcess();
    6465   
    65     void AddStepMax();       
    66     StepMax* GetStepMaxProcess() {return stepMaxProcess;};
     66  void AddStepMax();       
     67  //StepMax* GetStepMaxProcess() {return stepMaxProcess;};
    6768
    68   private:
    69     G4double cutForGamma;
    70     G4double cutForElectron;
    71     G4double cutForPositron;
     69private:
    7270
    73     G4VPhysicsConstructor*  emPhysicsList;
    74     G4VPhysicsConstructor*  generalPhysicsList;
    75     G4VPhysicsConstructor*  particleList;
    76     std::vector<G4VPhysicsConstructor*>  hadronPhys;
    77     G4String emName;
     71  void  AddPAIModel(const G4String&);
     72  void  NewPAIModel(const G4ParticleDefinition*, const G4String& modname,
     73                    const G4String& procname);
     74
     75  G4EmConfigurator em_config;
     76
     77  G4double cutForGamma;
     78  G4double cutForElectron;
     79  G4double cutForPositron;
     80
     81  G4VPhysicsConstructor*  emPhysicsList;
     82  G4VPhysicsConstructor*  generalPhysicsList;
     83  G4VPhysicsConstructor*  particleList;
     84  std::vector<G4VPhysicsConstructor*>  hadronPhys;
     85  G4String emName;
    7886   
    79     StepMax* stepMaxProcess;
     87  StepMax* stepMaxProcess;
    8088   
    81     PhysicsListMessenger* pMessenger;
     89  PhysicsListMessenger* pMessenger;
     90
     91  G4VEmModel* em_model;
     92  G4VEmFluctuationModel* fm_model;
     93
    8294};
    8395
  • trunk/examples/extended/electromagnetic/TestEm8/include/PhysicsListMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsListMessenger.hh,v 1.2 2006/06/29 16:59:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.2 2006/06/29 16:59:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm8/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.2 2006/06/29 16:59:55 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm8/include/TRTDetectorConstruction.hh

    r807 r1230  
    2626//
    2727// $Id: TRTDetectorConstruction.hh,v 1.4 2006/06/29 16:59:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/include/TRTMaterials.hh

    r807 r1230  
    2626//
    2727// $Id: TRTMaterials.hh,v 1.4 2006/06/29 17:00:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8CalorHit.cc

    r807 r1230  
    2626//
    2727// $Id: Em8CalorHit.cc,v 1.5 2006/06/29 17:00:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8CalorimeterSD.cc

    r807 r1230  
    2626//
    2727// $Id: Em8CalorimeterSD.cc,v 1.7 2006/06/29 17:00:05 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8DetectorConstruction.cc

    r807 r1230  
    2626//
    2727// $Id: Em8DetectorConstruction.cc,v 1.21 2007/10/02 10:12:47 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8DetectorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em8DetectorMessenger.cc,v 1.8 2007/10/02 10:12:47 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8EventAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em8EventAction.cc,v 1.10 2007/11/12 10:54:49 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8EventActionMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em8EventActionMessenger.cc,v 1.5 2006/06/29 17:00:15 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em8PrimaryGeneratorAction.cc,v 1.7 2006/06/29 17:00:18 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8PrimaryGeneratorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em8PrimaryGeneratorMessenger.cc,v 1.5 2006/06/29 17:00:21 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8RunAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em8RunAction.cc,v 1.15 2007/11/12 10:54:49 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8RunMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: Em8RunMessenger.cc,v 1.7 2006/06/29 17:00:25 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8SteppingAction.cc

    r807 r1230  
    2626//
    2727// $Id: Em8SteppingAction.cc,v 1.10 2007/11/12 10:54:49 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/Em8SteppingVerbose.cc

    r807 r1230  
    2626//
    2727// $Id: Em8SteppingVerbose.cc,v 1.8 2006/06/29 17:00:29 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/PhysicsList.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsList.cc,v 1.14 2007/09/26 10:23:17 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsList.cc,v 1.16 2008/12/05 17:46:12 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
     
    3636
    3737#include "G4EmStandardPhysics.hh"
     38#include "G4EmStandardPhysics_option1.hh"
     39#include "G4EmStandardPhysics_option2.hh"
     40#include "G4EmStandardPhysics_option3.hh"
    3841#include "G4DecayPhysics.hh"
    3942
    40 #include "PhysListEmModelPai.hh"
    41 #include "PhysListEmPaiPhoton.hh"
    42 #include "PhysListEmPAI.hh"
     43#include "G4PAIModel.hh"
     44#include "G4PAIPhotonModel.hh"
    4345
    4446#include "G4Gamma.hh"
     
    6971  pMessenger = new PhysicsListMessenger(this);
    7072
    71   SetVerboseLevel(1);
    72 
    7373  // Decay Physics is always defined
    7474  generalPhysicsList = new G4DecayPhysics();
     
    7676  // EM physics
    7777  emName = G4String("emstandard");
    78   emPhysicsList = new G4EmStandardPhysics();
    79 
     78  emPhysicsList = new G4EmStandardPhysics(1);
     79
     80  SetVerboseLevel(1);
    8081}
    8182
     
    104105  AddTransportation();
    105106  emPhysicsList->ConstructProcess();
     107  em_config.AddModels();
    106108  generalPhysicsList->ConstructProcess();
    107109  for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
     
    113115void PhysicsList::AddPhysicsList(const G4String& name)
    114116{
    115   if (verboseLevel>-1) {
     117  if (verboseLevel>1) {
    116118    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
    117119  }
    118120
    119   if (name == emName) return;
    120 
    121   if (name == "pai")
    122   {
     121  if (name == emName) {
     122    return;
     123
     124  } else if (name == "emstandard_opt1") {
     125
    123126    emName = name;
    124127    delete emPhysicsList;
    125     emPhysicsList = new PhysListEmModelPai(name);
    126     G4cout<<"PhysListEmModelPai is called"<<G4endl;
    127   }
    128   else if (name == "pai_photon")
    129   {
     128    emPhysicsList = new G4EmStandardPhysics_option1();
     129
     130  } else if (name == "emstandard_opt2") {
     131
    130132    emName = name;
    131133    delete emPhysicsList;
    132     emPhysicsList = new PhysListEmPaiPhoton(name);
    133     G4cout<<"PhysListEmModelPaiPhoton is called"<<G4endl;
    134   }
    135   else if (name == "pai_brem")
    136   {
     134    emPhysicsList = new G4EmStandardPhysics_option2();
     135
     136  } else if (name == "emstandard_opt3") {
     137
    137138    emName = name;
    138139    delete emPhysicsList;
    139     emPhysicsList = new PhysListEmPAI(name);
    140     G4cout<<"PhysListEmPAI is called (bremsstrahlung dedx added)"<<G4endl;
    141   }
    142   else
    143   {
     140    emPhysicsList = new G4EmStandardPhysics_option3();
     141
     142  } else if (name == "pai") {
     143
     144    emName = name;
     145    AddPAIModel(name);
     146
     147  } else if (name == "pai_photon") {
     148
     149    emName = name;
     150    AddPAIModel(name);
     151
     152  } else {
     153
    144154    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
    145155           << " is not defined"
     
    156166
    157167  theParticleIterator->reset();
    158 
    159168  while ((*theParticleIterator)())
    160169  {
     
    216225//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    217226
     227void PhysicsList::AddPAIModel(const G4String& modname)
     228{
     229  theParticleIterator->reset();
     230  while ((*theParticleIterator)())
     231  {
     232    G4ParticleDefinition* particle = theParticleIterator->value();
     233    G4String partname = particle->GetParticleName();
     234    if(partname == "e-" || partname == "e+") {
     235      NewPAIModel(particle, modname, "eIoni");
     236
     237    } else if(partname == "mu-" || partname == "mu+") {
     238      NewPAIModel(particle, modname, "muIoni");
     239
     240    } else if(partname == "proton" ||
     241              partname == "pi+" ||
     242              partname == "pi-"   
     243              ) {
     244      NewPAIModel(particle, modname, "hIoni");
     245    }
     246  }
     247}
     248
     249//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     250
     251void PhysicsList::NewPAIModel(const G4ParticleDefinition* part,
     252                              const G4String& modname,
     253                              const G4String& procname)
     254{
     255  G4String partname = part->GetParticleName();
     256  if(modname == "pai") {
     257    G4PAIModel* pai = new G4PAIModel(part,"PAIModel");
     258    em_config.SetExtraEmModel(partname,procname,pai,"VertexDetector",
     259                              0.0,100.*TeV,pai);
     260  } else if(modname == "pai_photon") {
     261    G4PAIPhotonModel* pai = new G4PAIPhotonModel(part,"PAIPhotModel");
     262    em_config.SetExtraEmModel(partname,procname,pai,"VertexDetector",
     263                              0.0,100.*TeV,pai);
     264  }
     265}
     266
     267//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     268
  • trunk/examples/extended/electromagnetic/TestEm8/src/PhysicsListMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 17:00:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm8/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.3 2006/06/29 17:00:49 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm8/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.2 2006/06/29 17:00:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/GNUmakefile

    r807 r1230  
    1 # $Id: GNUmakefile,v 1.8 2006/10/26 15:50:35 maire Exp $
    2 # GEANT4 tag $Name: $
     1# $Id: GNUmakefile,v 1.9 2008/06/11 22:31:05 maire Exp $
     2# GEANT4 tag $Name: geant4-09-03-cand-01 $
    33# --------------------------------------------------------------
    44# GNUmakefile for examples module with AIDA interface
     
    1616all: lib bin
    1717
    18 ifdef G4ANALYSIS_USE
    19   CPPFLAGS += -DG4ANALYSIS_USE
    20 endif
     18#### G4ANALYSIS_USE := true
    2119
    2220include $(G4INSTALL)/config/architecture.gmk
    23 
    24 # for the aida-config command see the README file
    25 ifdef G4ANALYSIS_USE
    26   CPPFLAGS += `aida-config --include`
    27   LOADLIBS += `aida-config --lib`
    28 endif
    2921
    3022include $(G4INSTALL)/config/binmake.gmk
  • trunk/examples/extended/electromagnetic/TestEm9/TestEm9.cc

    r807 r1230  
    2626//
    2727// $Id: TestEm9.cc,v 1.8 2006/11/17 17:45:05 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/cms10gev.mac

    r807 r1230  
    1 # $Id: cms10gev.mac,v 1.2 2006/10/26 15:50:35 maire Exp $
     1# $Id: cms10gev.mac,v 1.5 2008/09/24 10:38:46 vnivanch Exp $
    22#
    33# Macro file for "TestEm9.cc"
     
    1010#
    1111/testem/det/CalMat     G4_PbWO4
    12 /testem/del/EcalLength 230 mm
     12/testem/det/EcalLength 230 mm
    1313/testem/det/EcalWidth   22 mm
    1414#
    15 /testem/phys/addPhysics  standard
     15#/testem/phys/addPhysics  emstandard_opt2
     16/testem/phys/addPhysics  standardLPM
    1617#
     18/testem/phys/setCuts 1 mm
    1719/testem/phys/VertexCuts 0.01 mm
    1820/testem/phys/MuonCuts  10.0 mm
    19 /testem/stepMax          10 mm
     21#/testem/stepMax          10 mm
    2022#
    2123#
     
    3133#/random/resetEngineFrom first.rndm
    3234/testem/event/printModulo 1000
    33 /testem/histo/fileName  cms.paw
    34 /testem/histo/setHisto  0 75  7000  8500 MeV
    35 /testem/histo/setHisto  1 100 9000 10000 MeV
    36 /testem/histo/setHisto  2 100 9500 10000 MeV
    37 #/testem/histo/fileType  hbook
    38 /testem/
     35/testem/histo/fileName cms10gev1mm
     36/testem/histo/fileType root
     37/testem/histo/setHisto 0  250 0.60 0.85
     38/testem/histo/setHisto 1  200 0.80 1.00
     39/testem/histo/setHisto 2  100 0.90 1.00
     40/testem/histo/setHisto 10  80 0.80 0.88
     41/testem/histo/setHisto 11 100 0.75 0.85
     42/testem/histo/setHisto 12  40 0.94 0.98
     43/run/initialize
     44/run/beamOn 10000
    3945#
    40 /testem/phys/setCuts 1 mm
    41 /run/initialize
    42 /run/beamOn 1000
     46/testem/phys/setCuts 3 mm
     47/testem/histo/fileName cms10gev3mm
     48/run/beamOn 10000
    4349#
    44 #
  • trunk/examples/extended/electromagnetic/TestEm9/csi.mac

    r807 r1230  
    11# $Id: csi.mac,v 1.4 2006/10/26 15:50:35 maire Exp $
    2 # GEANT4 tag $Name: $
     2# GEANT4 tag $Name: geant4-09-03-cand-01 $
    33#
    44# Macro file for TestEm9 - Crystal Calorimeter
  • trunk/examples/extended/electromagnetic/TestEm9/include/DetectorConstruction.hh

    r807 r1230  
    2525//
    2626//
    27 // $Id: DetectorConstruction.hh,v 1.5 2006/06/29 17:00:56 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: DetectorConstruction.hh,v 1.7 2008/04/07 18:09:05 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
     
    5757class DetectorMessenger;
    5858class G4Region;
     59class G4ProductionCuts;
    5960
    6061//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6566
    6667  DetectorConstruction();
    67   ~DetectorConstruction();
     68  virtual ~DetectorConstruction();
    6869
    6970public:
     
    7172  void SetEcalMaterial(const G4String&);
    7273  void SetAbsMaterial(const G4String&);
    73   void SetEcalLength (G4double val)   {ecalLength = val;};
    74   void SetEcalWidth  (G4double val)   {ecalWidth = val;};
    75   void SetVertexLength (G4double val) {vertexLength = val;};
    76   void SetPadLength  (G4double val)   {padLength = val;};
    77   void SetPadWidth  (G4double val)    {padWidth = val;};
    78   void SetAbsLength(G4double val)     {absLength = val;};
     74  void SetEcalLength(G4double val);
     75  void SetEcalWidth(G4double val);
     76  void SetVertexLength(G4double val);
     77  void SetPadLength(G4double val);
     78  void SetPadWidth(G4double val);
     79  void SetAbsLength(G4double val);
    7980
    8081  G4VPhysicalVolume* Construct();
     
    8283  void UpdateGeometry();
    8384
    84   G4double GetWorldSizeZ()            {return worldZ;}
     85  G4double GetWorldSizeZ()  {return worldZ;}
    8586
    8687private:
     
    106107  G4Material* yorkMaterial;
    107108
    108   G4LogicalVolume* logicC;
     109  G4LogicalVolume* logicWorld;
     110  G4LogicalVolume* logicECal;
     111  G4LogicalVolume* logicCal;
    109112  G4LogicalVolume* logicA1;
    110113  G4LogicalVolume* logicA2;
    111114  G4LogicalVolume* logicA3;
    112115  G4LogicalVolume* logicA4;
     116  G4LogicalVolume* logicYV;
     117  G4LogicalVolume* logicY;
     118  G4LogicalVolume* logicVV;
     119  G4LogicalVolume* logicVD;
     120  G4LogicalVolume* logicV;
    113121 
    114122  G4Region*   vertexRegion;
    115123  G4Region*   muonRegion;
     124  G4ProductionCuts* vertexDetectorCuts;
     125  G4ProductionCuts* muonDetectorCuts;
    116126
    117127  DetectorMessenger* detectorMessenger;  //pointer to the Messenger
  • trunk/examples/extended/electromagnetic/TestEm9/include/DetectorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: DetectorMessenger.hh,v 1.4 2006/06/29 17:00:58 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/include/EmAcceptance.hh

    r807 r1230  
    2626//
    2727// $Id: EmAcceptance.hh,v 1.2 2006/06/29 17:01:00 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/include/EventAction.hh

    r807 r1230  
    2828
    2929// $Id: EventAction.hh,v 1.3 2006/06/29 17:01:02 gunter Exp $
    30 // GEANT4 tag $Name: $
     30// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3131
    3232//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/examples/extended/electromagnetic/TestEm9/include/EventActionMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.hh,v 1.3 2006/06/29 17:01:04 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/Histo.hh

    r807 r1230  
    2525//
    2626// $Id: Histo.hh,v 1.5 2007/05/24 13:17:41 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828
    2929#ifndef Histo_h
  • trunk/examples/extended/electromagnetic/TestEm9/include/HistoManager.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: HistoManager.hh,v 1.8 2007/04/24 14:20:04 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: HistoManager.hh,v 1.11 2008/09/24 10:38:46 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828
    2929#ifndef HistoManager_h
     
    110110  void SetThresholdEnergy(G4double val) {thKinE = val;};
    111111  void SetThresholdZ(G4double val) {thPosZ = val;};
    112   void AddStep() {n_step++;};
     112  void AddStep() {n_step += 1.0;};
    113113
    114114  // Acceptance parameters
     
    133133
    134134  G4double trackLength;
     135  G4double n_step;
     136  G4double n_step_target;
    135137  G4bool trackAbs;        // Track is in absorber
    136138  G4int n_evt;
     
    138140  G4int n_posit;
    139141  G4int n_gam;
    140   G4int n_step;
    141142  G4int n_gamph;
    142143  G4int n_gam_tar;
    143   G4int n_step_target;
     144  G4int n_lowe;
    144145  G4int nBinsE, nBinsEA, nBinsED;
    145146  G4bool nTuple;
     
    153154  G4double  rmstrue[3];
    154155  G4double  limittrue[3];
    155   G4double  edep[3];
    156   G4double  erms[3];
    157   G4double  edeptr[3];
    158   G4double  ermstr[3];
    159   G4int     stat[3];
     156  G4double  edep[6];
     157  G4double  erms[6];
     158  G4double  edeptr[6];
     159  G4double  ermstr[6];
     160  G4int     stat[6];
    160161  G4int     nmax;
    161162
  • trunk/examples/extended/electromagnetic/TestEm9/include/HistoMessenger.hh

    r807 r1230  
    2727//
    2828// $Id: HistoMessenger.hh,v 1.3 2006/06/29 17:01:11 gunter Exp $
    29 // GEANT4 tag $Name: $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131//
  • trunk/examples/extended/electromagnetic/TestEm9/include/PhysListEmLivermore.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmLivermore.hh,v 1.1 2006/11/17 17:45:57 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/PhysListEmPenelope.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmPenelope.hh,v 1.1 2006/11/17 17:45:57 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/PhysListEmStandard.hh

    r807 r1230  
    2626//
    2727// $Id: PhysListEmStandard.hh,v 1.3 2006/06/29 17:02:17 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/PhysicsList.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.hh,v 1.5 2006/11/17 17:03:26 vnivanch Exp $
    27 // GEANT4 tag $Name: $
     26// $Id: PhysicsList.hh,v 1.7 2008/04/07 18:09:05 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6161public:
    6262  PhysicsList();
    63   ~PhysicsList();
     63  virtual ~PhysicsList();
    6464
    6565  void ConstructParticle();
     
    6969  void SetCutForElectron(G4double);
    7070  void SetCutForPositron(G4double);
    71   void SetMscStepLimit(G4bool val);
    7271
    7372  void AddPhysicsList(const G4String& name);
     
    8988  G4double cutForElectron;
    9089  G4double cutForPositron;
     90  G4double cutForVertexDetector;
     91  G4double cutForMuonDetector;
    9192
    9293  G4VPhysicsConstructor*  emPhysicsList;
     
    102103  G4ProductionCuts* muonDetectorCuts;
    103104
    104   G4bool mscStepLimit;
    105105  G4bool helIsRegisted;
    106106  G4bool bicIsRegisted;
  • trunk/examples/extended/electromagnetic/TestEm9/include/PhysicsListMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: PhysicsListMessenger.hh,v 1.4 2006/06/29 17:02:32 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/include/PrimaryGeneratorAction.hh

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.hh,v 1.3 2006/06/29 17:02:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/include/StepMax.hh

    r807 r1230  
    2525//
    2626// $Id: StepMax.hh,v 1.3 2006/06/29 17:02:40 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/StepMaxMessenger.hh

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.hh,v 1.3 2006/06/29 17:02:42 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/include/SteppingAction.hh

    r807 r1230  
    2626//
    2727// $Id: SteppingAction.hh,v 1.3 2006/06/29 17:02:44 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/src/DetectorConstruction.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: DetectorConstruction.cc,v 1.9 2006/06/29 17:02:59 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: DetectorConstruction.cc,v 1.11 2008/04/07 18:09:05 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
     
    5858#include "G4Region.hh"
    5959#include "G4RegionStore.hh"
     60#include "G4ProductionCuts.hh"
    6061#include "G4PhysicalVolumeStore.hh"
    6162#include "G4LogicalVolumeStore.hh"
     
    7273
    7374DetectorConstruction::DetectorConstruction()
    74   :logicC(0),logicA1(0),logicA2(0)
     75  : G4VUserDetectorConstruction()
    7576{
    7677  detectorMessenger = new DetectorMessenger(this);
     
    8485  vertexRegion = 0;
    8586  muonRegion   = 0;
     87  logicWorld   = 0;
     88  logicCal     = 0;
     89  logicA1      = 0;
    8690  DefineMaterials();
     91  vertexDetectorCuts = new G4ProductionCuts();
     92  muonDetectorCuts   = new G4ProductionCuts();
    8793}
    8894
     
    9096
    9197DetectorConstruction::~DetectorConstruction()
    92 { delete detectorMessenger;}
     98{
     99  delete detectorMessenger;
     100  delete vertexDetectorCuts;
     101  delete muonDetectorCuts;
     102}
    93103
    94104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    106116
    107117  G4NistManager* man = G4NistManager::Instance();
    108   man->SetVerbose(1);
     118  //  man->SetVerbose(1);
    109119  worldMaterial = man->FindOrBuildMaterial("G4_AIR");
    110120  absMaterial   = man->FindOrBuildMaterial("G4_Al");
     
    118128G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
    119129{
    120   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
    121 
    122130  // Cleanup old geometry
    123131
    124132  G4GeometryManager::GetInstance()->OpenGeometry();
     133
     134  if(G4NistManager::Instance()->GetVerbose() > 0)
     135    G4cout << *(G4Material::GetMaterialTable()) << G4endl;
     136
     137  if(vertexRegion) {
     138    delete vertexRegion;
     139    delete muonRegion;
     140  }
     141  vertexRegion = new G4Region("VertexDetector");
     142  vertexRegion->SetProductionCuts(vertexDetectorCuts);
     143
     144  muonRegion   = new G4Region("MuonDetector");
     145  muonRegion->SetProductionCuts(muonDetectorCuts);
     146
     147  G4SolidStore::GetInstance()->Clean();
     148  G4LogicalVolumeStore::GetInstance()->Clean();
    125149  G4PhysicalVolumeStore::GetInstance()->Clean();
    126   G4LogicalVolumeStore::GetInstance()->Clean();
    127   G4SolidStore::GetInstance()->Clean();
    128 
    129   if(vertexRegion) delete vertexRegion;
    130   if(muonRegion) delete muonRegion;
    131   vertexRegion = new G4Region("VertexDetector");
    132   muonRegion   = new G4Region("MuonDetector");
    133150
    134151  if(vertexLength < padLength*5.0) vertexLength = padLength*5.0;
     
    137154  G4double york   = 10.*cm;
    138155
    139            worldZ = 2.*vertexLength + 3.*absLength + 0.5*(ecalLength + york) + biggap*2.;
     156  worldZ = 2.*vertexLength + 3.*absLength + 0.5*(ecalLength + york) + biggap*2.;
     157
    140158  G4double worldX = ecalWidth*3.0;
    141159  G4double vertexZ= -worldZ + vertexLength*2.0 + absLength     + biggap;
    142160  G4double absZ2  = -worldZ + vertexLength*4.0 + absLength*3.5 + biggap;
    143   G4double ecalZ  = -worldZ + vertexLength*4.0 + absLength*4.0 + ecalLength*0.5 + 2.*biggap;
     161  G4double ecalZ  = -worldZ + vertexLength*4.0 + absLength*4.0 + ecalLength*0.5
     162    + 2.*biggap;
    144163  G4double yorkZ  = -worldZ + vertexLength*4.0 + absLength*5.0 + ecalLength
    145                             + york*0.5 + 3.*biggap;
     164    + york*0.5 + 3.*biggap;
    146165
    147166  //
     
    149168  //
    150169  G4Box* solidW = new G4Box("World",worldX,worldX,worldZ);
    151   G4LogicalVolume* logicW = new G4LogicalVolume( solidW,worldMaterial,
    152                                                 "World");
     170  logicWorld = new G4LogicalVolume( solidW,worldMaterial,"World");
    153171  G4VPhysicalVolume* world = new G4PVPlacement(0,G4ThreeVector(),
    154                                        "World",logicW,0,false,0);
     172                                               "World",logicWorld,0,false,0);
    155173
    156174  //
     
    158176  //
    159177  G4Box* solidE = new G4Box("VolE",worldX,worldX,ecalLength*0.5 + gap);
    160   G4LogicalVolume* logicE = new G4LogicalVolume( solidE,worldMaterial,
    161                                                 "VolE");
     178  logicECal = new G4LogicalVolume( solidE,worldMaterial,"VolE");
    162179  G4VPhysicalVolume* physE = new G4PVPlacement(0,G4ThreeVector(0.,0.,ecalZ),
    163                                        "VolE",logicE,world,false,0);
     180                                               "VolE",logicECal,world,false,0);
    164181
    165182  G4Box* solidC = new G4Box("Ecal",ecalWidth*0.5,ecalWidth*0.5,ecalLength*0.5);
    166   logicC = new G4LogicalVolume( solidC,calMaterial,"Ecal");
     183  logicCal = new G4LogicalVolume( solidC,calMaterial,"Ecal");
    167184
    168185  G4cout << "Ecal is " << G4BestUnit(ecalLength,"Length")
    169       << " of " << calMaterial->GetName() << G4endl;
     186        << " of " << calMaterial->GetName() << G4endl;
    170187
    171188  // Crystals
     
    182199    for (j=0; j<5; j++) {
    183200
    184       pv = new G4PVPlacement(0,G4ThreeVector(x,y,0.),"Ecal",logicC,
     201      pv = new G4PVPlacement(0,G4ThreeVector(x,y,0.),"Ecal",logicCal,
    185202                                    physE,false,k);
    186203      k++;
     
    195212  logicA2 = new G4LogicalVolume( solidA,absMaterial,"Abs2");
    196213  pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,absZ2),
    197                                       "Abs2",logicA2,world,false,0);
     214                        "Abs2",logicA2,world,false,0);
    198215
    199216  G4cout << "Absorber is " << G4BestUnit(absLength,"Length")
    200       << " of " << absMaterial->GetName() << G4endl;
     217        << " of " << absMaterial->GetName() << G4endl;
    201218
    202219  //York
    203220
    204221  G4Box* solidYV = new G4Box("VolY",worldX,worldX,york*0.5+absLength);
    205   G4LogicalVolume* logicYV = new G4LogicalVolume( solidYV,yorkMaterial,"VolY");
     222  logicYV = new G4LogicalVolume( solidYV,yorkMaterial,"VolY");
    206223  G4VPhysicalVolume* physYV = new G4PVPlacement(0,G4ThreeVector(0.,0.,yorkZ),
    207                                        "VolY",logicYV,world,false,0);
     224                                                "VolY",logicYV,world,false,0);
    208225
    209226  G4Box* solidY = new G4Box("York",worldX,worldX,york*0.5);
    210   G4LogicalVolume* logicY = new G4LogicalVolume( solidY,yorkMaterial,"York");
     227  logicY = new G4LogicalVolume( solidY,yorkMaterial,"York");
    211228  pv = new G4PVPlacement(0,G4ThreeVector(),
    212                                       "York",logicY,physYV,false,0);
     229                        "York",logicY,physYV,false,0);
    213230
    214231  logicA3 = new G4LogicalVolume( solidA,absMaterial,"Abs3");
    215232  logicA4 = new G4LogicalVolume( solidA,absMaterial,"Abs4");
     233
    216234  pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,-(york+absLength)*0.5),
    217                                       "Abs3",logicA3,physYV,false,0);
     235                        "Abs3",logicA3,physYV,false,0);
    218236  pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,(york+absLength)*0.5),
    219                                       "Abs4",logicA4,physYV,false,0);
     237                        "Abs4",logicA4,physYV,false,0);
    220238
    221239  //Vertex volume
    222 
    223240  G4Box* solidVV = new G4Box("VolV",worldX,worldX,vertexLength*2.+absLength+gap);
    224   G4LogicalVolume* logicVV = new G4LogicalVolume( solidVV,worldMaterial,"VolV");
     241  logicVV = new G4LogicalVolume( solidVV,worldMaterial,"VolV");
    225242  G4VPhysicalVolume* physVV = new G4PVPlacement(0,G4ThreeVector(0.,0.,vertexZ),
    226                                        "VolV",logicVV,world,false,0);
     243                                                "VolV",logicVV,world,false,0);
    227244
    228245  //Absorber
    229 
    230246  logicA1 = new G4LogicalVolume( solidA,absMaterial,"Abs1");
    231247  pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,vertexLength*2.-absLength*0.5),
    232                                       "Abs1",logicA1,physVV,false,0);
     248                        "Abs1",logicA1,physVV,false,0);
    233249
    234250  //Vertex
    235 
    236251  G4double vertWidth = ecalWidth/5.;
    237252  G4int npads = (G4int)(vertWidth/padWidth);
     
    242257
    243258  G4Box* solidVD = new G4Box("VertDet",x1,ecalWidth*0.5+gap,padLength*0.5);
    244   G4LogicalVolume* logicVD = new G4LogicalVolume( solidVD,vertMaterial,"VertDet");
     259  logicVD = new G4LogicalVolume( solidVD,vertMaterial,"VertDet");
     260  logicVD->SetSolid(solidVD);
    245261
    246262  G4Box* solidV = new G4Box("Vert",padWidth*0.5,ecalWidth*0.5,padLength*0.5);
    247   G4LogicalVolume* logicV = new G4LogicalVolume( solidV,vertMaterial,"Vert");
     263  logicV = new G4LogicalVolume( solidV,vertMaterial,"Vert");
    248264
    249265  for (i=0; i<3; i++) {
     
    267283
    268284  // Define region for the vertex detector
    269 
    270285  vertexRegion->AddRootLogicalVolume(logicVV);
    271286  vertexRegion->AddRootLogicalVolume(logicA3);
    272287
    273288  // Define region for the muon detector
    274 
    275289  muonRegion->AddRootLogicalVolume(logicYV);
    276290
    277291  // color regions
    278 
    279292  logicVV-> SetVisAttributes(G4VisAttributes::Invisible);
    280293  logicV-> SetVisAttributes(G4VisAttributes::Invisible);
    281   logicE-> SetVisAttributes(G4VisAttributes::Invisible);
     294  logicECal-> SetVisAttributes(G4VisAttributes::Invisible);
    282295  logicYV-> SetVisAttributes(G4VisAttributes::Invisible);
    283296
    284297  G4VisAttributes* regWcolor = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3));
    285   logicW->SetVisAttributes(regWcolor);
     298  logicWorld->SetVisAttributes(regWcolor);
    286299
    287300  G4VisAttributes* regVcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
     
    289302
    290303  G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.7, 0.3));
    291   logicC->SetVisAttributes(regCcolor);
     304  logicCal->SetVisAttributes(regCcolor);
    292305
    293306  G4VisAttributes* regAcolor = new G4VisAttributes(G4Colour(1., 0.5, 0.5));
     
    302315  // always return world
    303316  G4cout << "### New geometry is constructed" << G4endl;
    304 
     317 
    305318  return world;
    306319}
     
    313326  G4Material* pttoMaterial =
    314327    G4NistManager::Instance()->FindOrBuildMaterial(mat, false);
    315   if (pttoMaterial) calMaterial = pttoMaterial;
     328  if (pttoMaterial) {
     329    calMaterial = pttoMaterial;
     330    if(logicCal) {
     331      logicCal->SetMaterial(calMaterial);
     332      G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     333    }
     334  }
    316335}
    317336
     
    323342  G4Material* pttoMaterial =
    324343    G4NistManager::Instance()->FindOrBuildMaterial(mat, false);
    325   if (pttoMaterial) absMaterial = pttoMaterial;
     344  if (pttoMaterial) {
     345    absMaterial = pttoMaterial;
     346    if(logicA1) {
     347      logicA1->SetMaterial(absMaterial);
     348      logicA2->SetMaterial(absMaterial);
     349      logicA3->SetMaterial(absMaterial);
     350      logicA4->SetMaterial(absMaterial);
     351      G4RunManager::GetRunManager()->PhysicsHasBeenModified();
     352    }
     353  }
    326354}
    327355
     
    330358void DetectorConstruction::UpdateGeometry()
    331359{
     360  G4RunManager::GetRunManager()->PhysicsHasBeenModified();
    332361  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
    333362}
    334363
    335364//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     365
     366void DetectorConstruction::SetEcalLength (G4double val)   
     367{
     368  if(val > 0.0) {
     369    ecalLength = val;
     370    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     371  }
     372}
     373
     374//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     375
     376void DetectorConstruction::SetEcalWidth  (G4double val)   
     377{
     378  if(val > 0.0) {
     379    ecalWidth = val;
     380    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     381  }
     382}
     383
     384//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     385
     386void DetectorConstruction::SetVertexLength (G4double val)
     387{
     388  if(val > 0.0) {
     389    vertexLength = val;
     390    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     391  }
     392}
     393
     394//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     395
     396void DetectorConstruction::SetPadLength  (G4double val)   
     397{
     398  if(val > 0.0) {
     399    padLength = val;
     400    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     401  }
     402}
     403
     404//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     405
     406void DetectorConstruction::SetPadWidth  (G4double val)   
     407{
     408  if(val > 0.0) {
     409    padWidth = val;
     410    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     411  }
     412}
     413
     414//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     415
     416void DetectorConstruction::SetAbsLength(G4double val)     
     417{
     418  if(val > 0.0) {
     419    absLength = val;
     420    G4RunManager::GetRunManager()->GeometryHasBeenModified();
     421  }
     422}
     423
     424//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/DetectorMessenger.cc

    r807 r1230  
    2626//
    2727// $Id: DetectorMessenger.cc,v 1.3 2006/06/29 17:03:01 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/src/EmAcceptance.cc

    r807 r1230  
    2626//
    2727// $Id: EmAcceptance.cc,v 1.4 2006/06/29 17:03:03 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/src/EventAction.cc

    r807 r1230  
    2525//
    2626// $Id: EventAction.cc,v 1.4 2006/06/29 17:03:06 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
  • trunk/examples/extended/electromagnetic/TestEm9/src/EventActionMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: EventActionMessenger.cc,v 1.3 2006/06/29 17:03:08 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/Histo.cc

    r807 r1230  
    5353  verbose    = 0;
    5454  histName   = "testem9";
    55   histType   = "hbook";
     55  histType   = "root";
    5656  nHisto     = 0;
    5757  defaultAct = 1;
     
    9393
    9494  G4String nam = histName + "." + histType;
    95 
    96   tree = tf->create(nam,histType,false,true,"uncompress");
     95  G4String options  = "--noErrors export=root uncompress";
     96 
     97  tree = tf->create(nam,histType,false,true,options);
    9798  delete tf;
    9899  if(tree) {
     
    107108  // Creating an 1-dimensional histograms in the root directory of the tree
    108109  for(G4int i=0; i<nHisto; i++) {
    109     if(active[i])
    110       histo[i] = hf->createHistogram1D(ids[i], titles[i], bins[i], xmin[i], xmax[i]);
     110    if(active[i]) {
     111      G4String ss = ids[i];
     112      if(histType == "root") ss = "h" + ids[i];
     113      histo[i] = hf->createHistogram1D(ss, titles[i], bins[i], xmin[i], xmax[i]);
     114    }
    111115  }
    112116  delete hf;
  • trunk/examples/extended/electromagnetic/TestEm9/src/HistoManager.cc

    r807 r1230  
    8787  nBinsED= 100;
    8888  nTuple = false;
    89   nHisto = 10;
     89  nHisto = 13;
    9090
    9191  // initialise acceptance
     
    9797
    9898  histo->add1D("10",
    99     "Energy deposit (MeV) in central crystal",nBinsED,0.0,beamEnergy,MeV);
     99    "Evis/E0 in central crystal",nBinsED,0.0,1,1.0);
    100100
    101101  histo->add1D("11",
    102     "Energy deposit (MeV) in 3x3",nBinsED,0.0,beamEnergy,MeV);
     102    "Evis/E0 in 3x3",nBinsED,0.0,1.0,1.0);
    103103
    104104  histo->add1D("12",
    105     "Energy deposit (MeV) in 5x5",nBinsED,0.0,beamEnergy,MeV);
     105    "Evis/E0 in 5x5",nBinsED,0.0,1.0,1.0);
    106106
    107107  histo->add1D("13",
     
    125125  histo->add1D("19",
    126126    "Number of vertex hits",20,-0.5,19.5,1.0);
     127
     128  histo->add1D("20",
     129    "E1/E9 Ratio",nBinsED,0.0,1,1.0);
     130
     131  histo->add1D("21",
     132    "E1/25 Ratio",nBinsED,0.0,1.0,1.0);
     133
     134  histo->add1D("22",
     135    "E9/E25 Ratio",nBinsED,0.0,1.0,1.0);
    127136
    128137  if(nTuple) {
     
    141150  n_gam  = 0;
    142151  n_step = 0;
    143 
    144   for(G4int i=0; i<nmax; i++) {
     152  n_lowe = 0;
     153
     154  for(G4int i=0; i<6; i++) {
    145155    stat[i] = 0;
    146156    edep[i] = 0.0;
    147157    erms[i] = 0.0;
    148     edeptr[i] = 0.0;
    149     ermstr[i] = 0.0;
     158    if(i < 3) {
     159      edeptr[i] = 0.0;
     160      ermstr[i] = 0.0;
     161    }
    150162  }
    151163
     
    164176
    165177  G4cout << "HistoManager: End of run actions are started" << G4endl;
    166   G4String nam[3] = {"1x1", "3x3", "5x5"};
     178  G4String nam[6] = {"1x1", "3x3", "5x5", "E1/E9 ", "E1/E25", "E9/E25"};
    167179
    168180  // average
     
    175187
    176188    // total mean
    177     edep[j] *= x/beamEnergy;
    178     G4double y = erms[j]*x/(beamEnergy*beamEnergy) - edep[j]*edep[j];
     189    edep[j] *= x;
     190    G4double y = erms[j]*x - edep[j]*edep[j];
    179191    if(y < 0.0) y = 0.0;
    180192    erms[j] = std::sqrt(y);
     
    183195    G4double xx = G4double(stat[j]);
    184196    if(xx > 0.0) xx = 1.0/xx;
    185     edeptr[j] *= xx/beamEnergy;
    186     y = ermstr[j]*xx/(beamEnergy*beamEnergy) - edeptr[j]*edeptr[j];
     197    edeptr[j] *= xx;
     198    y = ermstr[j]*xx - edeptr[j]*edeptr[j];
    187199    if(y < 0.0) y = 0.0;
    188200    ermstr[j] = std::sqrt(y);
     
    191203  G4double xg = x*(G4double)n_gam;
    192204  G4double xp = x*(G4double)n_posit;
    193   G4double xs = x*(G4double)n_step;
     205  G4double xs = x*n_step;
    194206
    195207  G4double f = 100.*std::sqrt(beamEnergy/GeV);
     
    201213  G4cout << std::setprecision(4) << "Average number of steps      " << xs << G4endl;
    202214 
    203   for(j=0; j<nmax; j++) {
     215  for(j=0; j<3; j++) {
    204216    G4double e = edeptr[j];
    205217    G4double s = ermstr[j];
    206     G4double r = s*std::sqrt(x);
     218    G4double xx= G4double(stat[j]);
     219    if(xx > 0.0) xx = 1.0/xx;
     220    G4double r = s*std::sqrt(xx);
    207221    G4cout << std::setprecision(4) << "Edep " << nam[j] << " =                   " << e
    208222           << " +- " << r;
     
    222236    }
    223237  }
     238  G4cout<<"===========  Ratios without trancating ==========================="<<G4endl;
     239  for(j=3; j<6; j++) {
     240    G4double e = edep[j];
     241    G4double xx= G4double(stat[j]);
     242    if(xx > 0.0) xx = 1.0/xx;
     243    e *= xx;
     244    G4double y = erms[j]*xx - e*e;
     245    G4double r = 0.0;
     246    if(y > 0.0) r = std::sqrt(y*xx);
     247    G4cout << "  " << nam[j] << " =                   " << e
     248           << " +- " << r;
     249    G4cout << G4endl;
     250  }
     251  G4cout << std::setprecision(4) << "Beam Energy                  " << beamEnergy/GeV
     252         << " GeV" << G4endl;
     253  if(n_lowe > 0)          G4cout << "Number of events E/E0<0.8    " << n_lowe << G4endl;
    224254  G4cout<<"=================================================================="<<G4endl;
    225255  G4cout<<G4endl;
     
    264294  Evertex.clear();
    265295  Nvertex.clear();
    266   for (int i=0; i<25; i++) {
     296  for (G4int i=0; i<25; i++) {
    267297    E[i] = 0.0;
    268298  }
     
    275305  G4double e9 = 0.0;
    276306  G4double e25= 0.0;
    277   for (int i=0; i<25; i++) {
     307  for (G4int i=0; i<25; i++) {
     308    E[i] /= beamEnergy;
    278309    e25 += E[i];
    279310    if( ( 6<=i &&  8>=i) || (11<=i && 13>=i) || (16<=i && 18>=i)) e9 += E[i];
    280311  }
    281   histo->fill(0,E[12],1.0);
     312
     313  if(e25 < 0.8) {
     314    n_lowe++;
     315    G4cout << "### in the event# " << n_evt << "  E25= " << e25 << G4endl;
     316  }
     317
     318  // compute ratios
     319  G4double e0 = E[12];
     320  G4double e19  = 0.0;
     321  G4double e125 = 0.0;
     322  G4double e925 = 0.0;
     323  if(e9 > 0.0) {
     324    e19 = e0/e9;
     325    e125 = e0/e25;
     326    e925 = e9/e25;
     327    edep[3] += e19;
     328    erms[3] += e19*e19;
     329    edep[4] += e125;
     330    erms[4] += e125*e125;
     331    edep[5] += e925;
     332    erms[5] += e925*e925;
     333    stat[3] += 1;
     334    stat[4] += 1;
     335    stat[5] += 1;
     336  }
     337
     338  // fill histo
     339  histo->fill(0,e0,1.0);
    282340  histo->fill(1,e9,1.0);
    283341  histo->fill(2,e25,1.0);
     
    286344  histo->fill(7,Eabs3,1.0);
    287345  histo->fill(8,Eabs4,1.0);
    288   float nn = (double)(Nvertex.size());
    289   histo->fill(9,nn,1.0);
    290 
    291   G4double e0 = E[12];
    292 
     346  histo->fill(9,G4double(Nvertex.size()),1.0);
     347  histo->fill(10,e19,1.0);
     348  histo->fill(11,e125,1.0);
     349  histo->fill(12,e925,1.0);
     350
     351  // compute sums
    293352  edep[0] += e0;
    294353  erms[0] += e0*e0;
     
    299358
    300359  // trancated mean
    301   if(limittrue[0] == DBL_MAX || std::abs(e0/beamEnergy-edeptrue[0])<rmstrue[0]*limittrue[0]) {
     360  if(limittrue[0] == DBL_MAX || std::abs(e0-edeptrue[0])<rmstrue[0]*limittrue[0]) {
    302361    stat[0] += 1;
    303362    edeptr[0] += e0;
    304363    ermstr[0] += e0*e0;
    305364  }
    306   if(limittrue[1] == DBL_MAX || std::abs(e9/beamEnergy-edeptrue[1])<rmstrue[1]*limittrue[1]) {
     365  if(limittrue[1] == DBL_MAX || std::abs(e9-edeptrue[1])<rmstrue[1]*limittrue[1]) {
    307366    stat[1] += 1;
    308367    edeptr[1] += e9;
    309368    ermstr[1] += e9*e9;
    310369  }
    311   if(limittrue[2] == DBL_MAX || std::abs(e25/beamEnergy-edeptrue[2])<rmstrue[2]*limittrue[2]) {
     370  if(limittrue[2] == DBL_MAX || std::abs(e25-edeptrue[2])<rmstrue[2]*limittrue[2]) {
    312371    stat[2] += 1;
    313372    edeptr[2] += e25;
     
    333392  if(0 == pid) {
    334393
     394    beamEnergy = kinE;
    335395    histo->fillTuple("TKIN", kinE/MeV);
    336396
  • trunk/examples/extended/electromagnetic/TestEm9/src/HistoMessenger.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: HistoMessenger.cc,v 1.6 2006/06/29 17:03:16 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: HistoMessenger.cc,v 1.7 2008/08/22 14:11:53 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    6060  //
    6161  G4UIparameter* ih = new G4UIparameter("ih",'i',false);
    62   ih->SetGuidance("histo number : from 1 to MaxHisto");
     62  ih->SetGuidance("histo number : from 0 to MaxHisto-1");
    6363  histoCmd->SetParameter(ih);
    6464  //
     
    110110     G4String unit = unts;
    111111     G4double vUnit = 1. ;
    112      if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
     112     if(unit != "none") vUnit = G4UIcommand::ValueOf(unit);
     113     if(vUnit <= 0.0)  vUnit = 1.;
    113114     histo->setHisto1D(ih,nbBins,vmin,vmax,vUnit);
    114115   }
  • trunk/examples/extended/electromagnetic/TestEm9/src/PhysListEmLivermore.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmLivermore.cc,v 1.2 2007/01/08 16:29:42 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/PhysListEmPenelope.cc

    r807 r1230  
    2626//
    2727// $Id: PhysListEmPenelope.cc,v 1.1 2006/11/17 17:45:57 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/PhysListEmStandard.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysListEmStandard.cc,v 1.8 2006/11/22 19:09:12 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysListEmStandard.cc,v 1.13 2008/11/16 21:01:10 maire Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3939#include "G4PhotoElectricEffect.hh"
    4040
    41 #include "G4MultipleScattering.hh"
     41#include "G4eMultipleScattering.hh"
     42#include "G4hMultipleScattering.hh"
    4243
    4344#include "G4eIonisation.hh"
     
    4849#include "G4MuBremsstrahlung.hh"
    4950#include "G4MuPairProduction.hh"
     51#include "G4hBremsstrahlung.hh"
     52#include "G4hPairProduction.hh"
    5053
    5154#include "G4hIonisation.hh"
    5255#include "G4ionIonisation.hh"
     56
     57#include "G4EmProcessOptions.hh"
     58#include "G4MscStepLimitType.hh"
    5359
    5460//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    8389    } else if (particleName == "e-") {
    8490 
    85       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    86       pmanager->AddProcess(new G4eIonisation(),      -1, 2,2);
    87       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
     91      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
     92      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
     93      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
    8894           
    8995    } else if (particleName == "e+") {
    9096
    91       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    92       pmanager->AddProcess(new G4eIonisation(),      -1, 2,2);
    93       pmanager->AddProcess(new G4eBremsstrahlung,    -1, 3,3);
    94       pmanager->AddProcess(new G4eplusAnnihilation,   0,-1,4);
     97      pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
     98      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
     99      pmanager->AddProcess(new G4eBremsstrahlung,     -1, 3, 3);
     100      pmanager->AddProcess(new G4eplusAnnihilation,    0,-1, 4);
    95101     
    96102    } else if (particleName == "mu+" ||
    97103               particleName == "mu-"    ) {
    98104
    99       pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
    100       pmanager->AddProcess(new G4MuIonisation,      -1, 2,2);
    101       pmanager->AddProcess(new G4MuBremsstrahlung,  -1, 3,3);
    102       pmanager->AddProcess(new G4MuPairProduction,  -1, 4,4);       
     105      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     106      pmanager->AddProcess(new G4MuIonisation,        -1, 2, 2);
     107      pmanager->AddProcess(new G4MuBremsstrahlung,    -1, 3, 3);
     108      pmanager->AddProcess(new G4MuPairProduction,    -1, 4, 4);       
     109
     110    } else if (particleName == "proton" ||
     111               particleName == "pi-" || 
     112               particleName == "pi+") {
     113
     114      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     115      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
     116      pmanager->AddProcess(new G4hBremsstrahlung,     -1, 3, 3);
     117      pmanager->AddProcess(new G4hPairProduction,     -1, 4, 4);       
    103118
    104119    } else if (particleName == "alpha" ||
     
    106121               particleName == "GenericIon") {
    107122
    108       pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
    109       pmanager->AddProcess(new G4ionIonisation,      -1, 2,2);
     123      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     124      pmanager->AddProcess(new G4ionIonisation,       -1, 2, 2);
    110125     
    111126    } else if ((!particle->IsShortLived()) &&
     
    113128               (particle->GetParticleName() != "chargedgeantino")) {
    114129
    115       pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
    116       pmanager->AddProcess(new G4hIonisation,       -1,2,2);
     130      pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
     131      pmanager->AddProcess(new G4hIonisation,         -1, 2, 2);
    117132    }
    118133  }
     134 
     135  // Em options
     136  //
     137  // Main options and setting parameters are shown here.
     138  // Several of them have default values.
     139  // 
     140  G4EmProcessOptions emOptions;
     141 
     142  //physics tables
     143  //
     144  emOptions.SetMinEnergy(100*eV);       //default   
     145  emOptions.SetMaxEnergy(100*TeV);      //default 
     146  emOptions.SetDEDXBinning(12*20);      //default=12*7 
     147  emOptions.SetLambdaBinning(12*20);    //default=12*7
     148  emOptions.SetSplineFlag(true);        //default 
     149   
     150  //coulomb scattering
     151  //
     152  emOptions.SetMscStepLimitation(fUseDistanceToBoundary);  //default=fUseSafety
     153  emOptions.SetMscRangeFactor(0.04);    //default
     154  emOptions.SetMscGeomFactor (2.5);     //default       
     155  emOptions.SetSkin(3.);                //default
     156         
     157  //energy loss
     158  //
     159  emOptions.SetStepFunction(0.2, 100*um);       //default=(0.2, 1*mm)   
     160  emOptions.SetLinearLossLimit(1.e-2);          //default
     161   
     162  //ionization
     163  //
     164  emOptions.SetSubCutoff(true);         //default=false 
    119165}
    120166
  • trunk/examples/extended/electromagnetic/TestEm9/src/PhysicsList.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysicsList.cc,v 1.19 2007/11/13 14:44:26 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     26// $Id: PhysicsList.cc,v 1.24 2008/10/16 11:48:58 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//---------------------------------------------------------------------------
     
    4646
    4747#include "PhysListEmStandard.hh"
    48 #include "PhysListEmStandardIG.hh"
    4948#include "G4EmStandardPhysics.hh"
    5049#include "G4EmStandardPhysics_option1.hh"
    5150#include "G4EmStandardPhysics_option2.hh"
     51#include "G4EmStandardPhysics_option3.hh"
    5252#include "PhysListEmLivermore.hh"
    5353#include "PhysListEmPenelope.hh"
     
    8585  cutForElectron  = defaultCutValue;
    8686  cutForPositron  = defaultCutValue;
     87  cutForVertexDetector = defaultCutValue;
     88  cutForMuonDetector   = defaultCutValue;
    8789
    8890  vertexDetectorCuts = 0;
     
    9698  SetVerboseLevel(1);
    9799
    98   mscStepLimit   = true;
    99100  helIsRegisted  = false;
    100101  bicIsRegisted  = false;
     
    106107
    107108  // EM physics
    108   emName = G4String("standard");
    109   emPhysicsList = new PhysListEmStandard(emName);
     109  emName = G4String("emstandard");
     110  emPhysicsList = new G4EmStandardPhysics();
    110111}
    111112
     
    173174      G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
    174175
    175   } else if (name == "standard") {
     176  } else if (name == "emstandard_opt3") {
     177    emName = name;
     178    delete emPhysicsList;
     179    emPhysicsList = new G4EmStandardPhysics_option3();
     180    if (verboseLevel > 0)
     181      G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
     182
     183  } else if (name == "emstandard_local") {
    176184    emName = name;
    177185    delete emPhysicsList;
     
    179187    if (verboseLevel > 0)
    180188      G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
    181 
    182   } else if (name == "standardIG") {
    183     emName = name;
    184     delete emPhysicsList;
    185     emPhysicsList = new PhysListEmStandardIG();
    186     if (verboseLevel > 0)
    187       G4cout << "PhysicsList::Set StandardIG EM physics" << G4endl;
    188189
    189190  } else if (name == "livermore") {
     
    255256void PhysicsList::SetCuts()
    256257{
    257 
    258258  SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld");
    259259  SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld");
    260260  SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld");
    261   G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm
    262          << " mm    cutE= " << cutForElectron/mm << " mm " << G4endl;
    263 
    264   if( !vertexDetectorCuts ) SetVertexCut(cutForElectron);
     261  //  G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm
     262  //     << " mm    cutE= " << cutForElectron/mm << " mm " << G4endl;
     263
     264  //G4cout << " cutV= " << cutForVertexDetector
     265  //     << " cutM= " << cutForMuonDetector<<G4endl;
     266
    265267  G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector");
    266   region->SetProductionCuts(vertexDetectorCuts);
    267   G4cout << "Vertex cuts are set" << G4endl;
    268 
    269   if( !muonDetectorCuts ) SetMuonCut(cutForElectron);
     268  vertexDetectorCuts = region->GetProductionCuts();
     269  SetVertexCut(cutForVertexDetector);
     270  //  G4cout << "Vertex cuts are set" << G4endl;
     271 
    270272  region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector");
    271   region->SetProductionCuts(muonDetectorCuts);
    272   G4cout << "Muon cuts are set" << G4endl;
    273 
     273  muonDetectorCuts = region->GetProductionCuts();
     274  SetMuonCut(cutForMuonDetector);
     275  //G4cout << "Muon cuts are set " <<muonRegion << " " << muonDetectorCuts << G4endl;
     276 
    274277  if (verboseLevel>0) DumpCutValuesTable();
    275278}
     
    303306void PhysicsList::SetVertexCut(G4double cut)
    304307{
    305   if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts();
    306 
    307   vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
    308   vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
    309   vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
    310 
     308  cutForVertexDetector = cut;
     309 
     310  if( vertexDetectorCuts ) {
     311    vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
     312    vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
     313    vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
     314  }
    311315}
    312316
     
    315319void PhysicsList::SetMuonCut(G4double cut)
    316320{
    317   if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts();
    318 
    319   muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
    320   muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
    321   muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
    322 }
    323 
    324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    325 
    326 void PhysicsList::SetMscStepLimit(G4bool val)
    327 {
    328   mscStepLimit = val;
    329 }
    330 
    331 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    332 
     321  cutForMuonDetector   = cut;
     322
     323  if( muonDetectorCuts ) {
     324    muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut);
     325    muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
     326    muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut);
     327  }
     328}
     329
     330//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     331
  • trunk/examples/extended/electromagnetic/TestEm9/src/PhysicsListMessenger.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: PhysicsListMessenger.cc,v 1.3 2006/06/29 17:03:43 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: PhysicsListMessenger.cc,v 1.4 2008/04/03 15:07:55 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
     
    143143   { pPhysicsList->AddPhysicsList(newValue);}
    144144
    145   if( command == mscCmd )
    146   { pPhysicsList->SetMscStepLimit(mscCmd->GetNewBoolValue(newValue));}
     145  //  if( command == mscCmd )
     146  // { pPhysicsList->SetMscStepLimit(mscCmd->GetNewBoolValue(newValue));}
    147147}
    148148
  • trunk/examples/extended/electromagnetic/TestEm9/src/PrimaryGeneratorAction.cc

    r807 r1230  
    2626//
    2727// $Id: PrimaryGeneratorAction.cc,v 1.3 2006/06/29 17:03:46 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/electromagnetic/TestEm9/src/StepMax.cc

    r807 r1230  
    2525//
    2626// $Id: StepMax.cc,v 1.3 2006/06/29 17:03:52 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/StepMaxMessenger.cc

    r807 r1230  
    2525//
    2626// $Id: StepMaxMessenger.cc,v 1.2 2006/06/29 17:03:54 gunter Exp $
    27 // GEANT4 tag $Name: $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
  • trunk/examples/extended/electromagnetic/TestEm9/src/SteppingAction.cc

    r807 r1230  
    2626//
    2727// $Id: SteppingAction.cc,v 1.2 2006/06/29 17:03:57 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
Note: See TracChangeset for help on using the changeset viewer.