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

update to geant4.9.3

Location:
trunk/examples/extended/electromagnetic/TestEm5/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.