Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RE06ActionInitialization.cc 66522 2012-12-19 12:26:04Z ihrivnac $
//
/// \file src/RE06ActionInitialization.cc
/// \brief Implementation of the RE06ActionInitialization class
//
#include "RE06ActionInitialization.hh"
#include "RE06PrimaryGeneratorAction.hh"
#include "RE06RunAction.hh"
RE06ActionInitialization::RE06ActionInitialization()
{;}
RE06ActionInitialization::~RE06ActionInitialization()
{;}
void RE06ActionInitialization::Build() const
{
//
SetUserAction(new RE06PrimaryGeneratorAction);
//
SetUserAction(new RE06RunAction);
}
void RE06ActionInitialization::BuildForMaster() const
{
//
G4UserRunAction* run_action = new RE06RunAction;
SetUserAction(run_action);
}
@@ -0,0 +1,547 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06DetectorConstruction.cc
/// \brief Implementation of the RE06DetectorConstruction class
//
// $Id: RE06DetectorConstruction.cc 75123 2013-10-28 09:53:28Z gcosmo $
//
#include "RE06DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4PSEnergyDeposit.hh"
#include "G4PSNofSecondary.hh"
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4PSMinKinEAtGeneration.hh"
#include "G4VSDFilter.hh"
#include "G4SDParticleFilter.hh"
#include "G4ios.hh"
#include "RE06DetectorMessenger.hh"
#include "RE06PrimaryGeneratorAction.hh"
#include "RE06ParallelWorld.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06DetectorConstruction::RE06DetectorConstruction()
: G4VUserDetectorConstruction(),
fNumberOfLayers(40),
fTotalThickness (2.0*m),
fLayerThickness(0.),
fConstructed(false),
fConstructedSDandField(false),
fWorldMaterial(0),
fAbsorberMaterial(0),
fGapMaterial(0),
fLayerSolid(0),
fGapSolid(0),
fWorldLogical(0),
fWorldPhysical(0),
fSerial(false),
fDetectorMessenger(0),
fVerboseLevel(1)
{
fLayerThickness = fTotalThickness / fNumberOfLayers;
for(size_t i=0;i<3;i++)
{
fCalorLogical[i] = 0;
fLayerLogical[i] = 0;
fGapLogical[i] = 0;
fCalorPhysical[i] = 0;
fLayerPhysical[i] = 0;
fGapPhysical[i] = 0;
}
fCalName[0] = "Calor-A";
fCalName[1] = "Calor-B";
fCalName[2] = "Calor-C";
fDetectorMessenger = new RE06DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06DetectorConstruction::~RE06DetectorConstruction()
{ delete fDetectorMessenger;}
G4VPhysicalVolume* RE06DetectorConstruction::Construct()
{
// if(!fConstructed)
{
fConstructed = true;
DefineMaterials();
SetupGeometry();
SetupDetectors();
}
if (GetVerboseLevel()>0) {
PrintCalorParameters();
}
return fWorldPhysical;
}
void RE06DetectorConstruction::ConstructSDandField() {
// if(!fConstructedSDandField)
{
fConstructedSDandField = true;
SetupDetectors();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::DefineMaterials()
{
G4String name, symbol; //a=mass of a mole;
G4double a, z, density; //z=mean number of protons;
G4int iz; //iz=number of protons in an isotope;
G4int n; // n=number of nucleons in an isotope;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
G4double temperature, pressure;
//
// define Elements
//
a = 1.01*g/mole;
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 12.01*g/mole;
G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
a = 14.01*g/mole;
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
a = 16.00*g/mole;
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
//
// define an Element from isotopes, by relative abundance
//
G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole);
G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole);
G4Element* U = new G4Element(name="enriched Uranium",symbol="U",ncomponents=2);
U->AddIsotope(U5, abundance= 90.*perCent);
U->AddIsotope(U8, abundance= 10.*perCent);
//
// define simple materials
//
new G4Material(name="Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
new G4Material(name="Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
new G4Material(name="Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3);
new G4Material(name="ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
new G4Material(name="He", z=2., a=4.0*g/mole, density=0.1786e-03*g/cm3);
density = 1.390*g/cm3;
a = 39.95*g/mole;
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
density = 11.35*g/cm3;
a = 207.19*g/mole;
G4Material* Pb = new G4Material(name="Lead" , z=82., a, density);
//
// define a material from elements. case 1: chemical molecule
//
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
density = 1.032*g/cm3;
G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
Sci->AddElement(C, natoms=9);
Sci->AddElement(H, natoms=10);
//
// define a material from elements. case 2: mixture by fractional mass
//
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//
// examples of vacuum
//
density = universe_mean_density;
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material* Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole,
density,kStateGas,temperature,pressure);
if (GetVerboseLevel()>1) {
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//default materials of the calorimeter
fWorldMaterial = Vacuum;
fAbsorberMaterial = Pb;
fGapMaterial = lAr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetupGeometry()
{
//
// World
//
G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,fTotalThickness*2.);
fWorldLogical = new G4LogicalVolume(worldSolid,fWorldMaterial,"World");
fWorldPhysical = new G4PVPlacement(0,G4ThreeVector(),fWorldLogical,"World",
0,false,0);
//
// Calorimeter
//
G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,fTotalThickness/2.);
G4int i;
for(i=0;i<3;i++)
{
fCalorLogical[i]
= new G4LogicalVolume(calorSolid,fAbsorberMaterial,fCalName[i]);
if(fSerial)
{
fCalorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,0.,G4double(i-1)*fTotalThickness),
fCalorLogical[i],fCalName[i],fWorldLogical,false,i);
}
else
{
fCalorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,G4double(i-1)*m,0.),
fCalorLogical[i],fCalName[i],fWorldLogical,false,i);
}
}
//
// Layers --- as absorbers
//
fLayerSolid = new G4Box("Layer",0.5*m,0.5*m,fLayerThickness/2.);
for(i=0;i<3;i++)
{
fLayerLogical[i]
= new G4LogicalVolume(fLayerSolid,fAbsorberMaterial,fCalName[i]+"_LayerLog");
fLayerPhysical[i]
= new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
kZAxis,fNumberOfLayers,fLayerThickness);
}
//
// Gap
//
fGapSolid = new G4Box("Gap",0.5*m,0.5*m,fLayerThickness/4.);
for(i=0;i<3;i++)
{
fGapLogical[i] = new G4LogicalVolume(fGapSolid,fGapMaterial,fCalName[i]+"_Gap");
fGapPhysical[i] = new G4PVPlacement(0,G4ThreeVector(0.,0.,fLayerThickness/4.),
fGapLogical[i],fCalName[i]+"_gap",fLayerLogical[i],false,0);
}
//
// Regions
//
for(i=0;i<3;i++)
{
G4Region* aRegion = new G4Region(fCalName[i]);
fCalorLogical[i]->SetRegion(aRegion);
aRegion->AddRootLogicalVolume(fCalorLogical[i]);
}
//
// Visualization attributes
//
fWorldLogical->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
for(i=0;i<3;i++)
{
fCalorLogical[i]->SetVisAttributes(simpleBoxVisAtt);
fLayerLogical[i]->SetVisAttributes(simpleBoxVisAtt);
fGapLogical[i]->SetVisAttributes(simpleBoxVisAtt);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetupDetectors()
{
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
G4String filterName, particleName;
G4SDParticleFilter* gammaFilter
= new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma");
G4SDParticleFilter* electronFilter
= new G4SDParticleFilter(filterName="electronFilter",particleName="e-");
G4SDParticleFilter* positronFilter
= new G4SDParticleFilter(filterName="positronFilter",particleName="e+");
G4SDParticleFilter* epFilter
= new G4SDParticleFilter(filterName="epFilter");
epFilter->add(particleName="e-");
epFilter->add(particleName="e+");
for(G4int i=0;i<3;i++)
{
for(G4int j=0;j<2;j++)
{
// Loop counter j = 0 : absorber
// = 1 : gap
G4String detName = fCalName[i];
if(j==0)
{ detName += "_abs"; }
else
{ detName += "_gap"; }
G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName);
// The second argument in each primitive means the "level" of geometrical
// hierarchy, the copy number of that level is used as the key of the
// G4THitsMap.
// For absorber (j = 0), the copy number of its own physical volume is used.
// For gap (j = 1), the copy number of its mother physical volume is used,
// since there is only one physical volume of gap is placed with respect
// to its mother.
G4VPrimitiveScorer* primitive;
primitive = new G4PSEnergyDeposit("eDep",j);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nGamma",j);
primitive->SetFilter(gammaFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nElectron",j);
primitive->SetFilter(electronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nPositron",j);
primitive->SetFilter(positronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSMinKinEAtGeneration("minEkinGamma",j);
primitive->SetFilter(gammaFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSMinKinEAtGeneration("minEkinElectron",j);
primitive->SetFilter(electronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSMinKinEAtGeneration("minEkinPositron",j);
primitive->SetFilter(positronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSTrackLength("trackLength",j);
primitive->SetFilter(epFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofStep("nStep",j);
primitive->SetFilter(epFilter);
det->RegisterPrimitive(primitive);
if(j==0)
{ SetSensitiveDetector(fLayerLogical[i], det); }
else
{ SetSensitiveDetector(fGapLogical[i], det);}
}
}
G4SDManager::GetSDMpointer()->SetVerboseLevel(0);
}
void RE06DetectorConstruction::PrintCalorParameters() const
{
G4cout
<< "--------------------------------------------------------" << G4endl;
if(fSerial)
{ G4cout << " Calorimeters are placed in serial." << G4endl; }
else
{ G4cout << " Calorimeters are placed in parallel." << G4endl; }
G4cout
<< " Absorber is made of " << fAbsorberMaterial->GetName() << G4endl
<< " Gap is made of " << fGapMaterial->GetName() << G4endl
<< "--------------------------------------------------------" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if(pttoMaterial)
{
fAbsorberMaterial = pttoMaterial;
if(fConstructed) for(size_t i=0;i<3;i++)
{
fCalorLogical[i]->SetMaterial(fAbsorberMaterial);
fLayerLogical[i]->SetMaterial(fAbsorberMaterial);
}
G4RunManager::GetRunManager()->GeometryHasBeenModified();
if (GetVerboseLevel()>1) {
PrintCalorParameters();
}
}
else
{
G4cerr
<< materialChoice << " is not defined. - Command is ignored." << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE06DetectorConstruction::GetAbsorberMaterial() const
{ return fAbsorberMaterial->GetName(); }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetGapMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if(pttoMaterial)
{
fGapMaterial = pttoMaterial;
if(fConstructed) for(size_t i=0;i<3;i++)
{ fGapLogical[i]->SetMaterial(fGapMaterial); }
G4RunManager::GetRunManager()->GeometryHasBeenModified();
if (GetVerboseLevel()>1) {
PrintCalorParameters();
}
}
else
{
G4cerr
<< materialChoice << " is not defined. - Command is ignored." << G4endl;
}
}
G4String RE06DetectorConstruction::GetGapMaterial() const
{ return fGapMaterial->GetName(); }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetSerialGeometry(G4bool serial)
{
if(fSerial==serial) return;
fSerial=serial;
RE06PrimaryGeneratorAction* gen = (RE06PrimaryGeneratorAction*)
(G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
if(gen) gen->SetSerial(fSerial);
if(!fConstructed) return;
for(G4int i=0;i<3;i++)
{
if(fSerial)
{
fCalorPhysical[i]
->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m));
}
else
{
fCalorPhysical[i]
->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.));
}
}
((RE06ParallelWorld*)GetParallelWorld(0))->SetSerialGeometry(serial);
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::SetNumberOfLayers(G4int nl)
{
fNumberOfLayers = nl;
fLayerThickness = fTotalThickness/fNumberOfLayers;
if(!fConstructed) return;
fLayerSolid->SetZHalfLength(fLayerThickness/2.);
fGapSolid->SetZHalfLength(fLayerThickness/4.);
for(size_t i=0;i<3;i++)
{
fCalorLogical[i]->RemoveDaughter(fLayerPhysical[i]);
delete fLayerPhysical[i];
fLayerPhysical[i]
= new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
kZAxis,fNumberOfLayers,fLayerThickness);
fGapPhysical[i]->SetTranslation(G4ThreeVector(0.,0.,fLayerThickness/4.));
}
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorConstruction::AddMaterial()
{
static G4bool isAdded = false;
if( isAdded ) return;
G4String name, symbol; //a=mass of a mole;
G4double a, z, density; //z=mean number of protons;
G4int ncomponents, natoms;
//
// define simple materials
//
new G4Material(name="Copper", z=29., a=63.546*g/mole, density=8.96*g/cm3);
new G4Material(name="Tungsten", z=74., a=183.84*g/mole, density=19.3*g/cm3);
G4Element* C = G4Element::GetElement("Carbon");
G4Element* O = G4Element::GetElement("Oxygen");
G4Material* CO2 =
new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
kStateGas, 325.*kelvin, 50.*atmosphere);
CO2->AddElement(C, natoms=1);
CO2->AddElement(O, natoms=2);
isAdded = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,182 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06DetectorMessenger.cc
/// \brief Implementation of the RE06DetectorMessenger class
//
// $Id: RE06DetectorMessenger.cc 68026 2013-03-13 13:45:22Z gcosmo $
//
#include "RE06DetectorMessenger.hh"
#include "RE06DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4Material.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06DetectorMessenger::RE06DetectorMessenger(RE06DetectorConstruction* det)
: G4UImessenger(),
fDetector(det),
fDirectory(0),
fAbsMaterialCmd(0),
fGapMaterialCmd(0),
fNumLayerCmd(0),
fSerialCmd(0),
fVerboseCmd(0),
fAddMaterialCmd(0)
{
fDirectory = new G4UIdirectory("/RE06/");
fDirectory->SetGuidance("UI commands of this example");
G4String matList;
const G4MaterialTable* matTbl = G4Material::GetMaterialTable();
for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
{
matList += (*matTbl)[i]->GetName();
matList += " ";
}
fAbsMaterialCmd = new G4UIcmdWithAString("/RE06/setAbsMat",this);
fAbsMaterialCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterialCmd->SetParameterName("choice",false);
fAbsMaterialCmd->AvailableForStates(G4State_Idle);
fAbsMaterialCmd->SetCandidates(matList);
fGapMaterialCmd = new G4UIcmdWithAString("/RE06/setGapMat",this);
fGapMaterialCmd->SetGuidance("Select Material of the Gap.");
fGapMaterialCmd->SetParameterName("choice",false);
fGapMaterialCmd->AvailableForStates(G4State_Idle);
fGapMaterialCmd->SetCandidates(matList);
fNumLayerCmd = new G4UIcmdWithAnInteger("/RE06/numberOfLayers",this);
fNumLayerCmd->SetGuidance("Set number of layers.");
fNumLayerCmd->SetParameterName("nl",false);
fNumLayerCmd->AvailableForStates(G4State_Idle);
fNumLayerCmd->SetRange("nl>0");
fSerialCmd = new G4UIcmdWithABool("/RE06/serialGeometry",this);
fSerialCmd
->SetGuidance("Select calorimeters to be placed in serial or parallel.");
fSerialCmd->SetParameterName("serialize",false);
fSerialCmd->AvailableForStates(G4State_Idle);
fVerboseCmd = new G4UIcmdWithAnInteger("/RE06/verbose",this);
fVerboseCmd->SetGuidance("Set verbosity level");
fVerboseCmd->SetParameterName("verbose",false);
fVerboseCmd->AvailableForStates(G4State_Idle);
fVerboseCmd->SetRange("verbose>=0");
fAddMaterialCmd = new G4UIcmdWithABool("/RE06/AddMaterial",this);
fAddMaterialCmd->SetGuidance("Add materials ");
fAddMaterialCmd->SetParameterName("dummy",true);
fAddMaterialCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06DetectorMessenger::~RE06DetectorMessenger()
{
delete fAbsMaterialCmd;
delete fGapMaterialCmd;
delete fNumLayerCmd;
delete fSerialCmd;
delete fDirectory;
}
void RE06DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fAbsMaterialCmd ) {
fDetector->SetAbsorberMaterial(newValue);
} else if( command == fGapMaterialCmd ){
fDetector->SetGapMaterial(newValue);
} else if( command == fNumLayerCmd ) {
fDetector->SetNumberOfLayers(fNumLayerCmd->GetNewIntValue(newValue));
} else if( command == fSerialCmd ) {
fDetector->SetSerialGeometry(fSerialCmd->GetNewBoolValue(newValue));
} else if( command == fVerboseCmd ) {
fDetector->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
} else if( command == fAddMaterialCmd ) {
fDetector->AddMaterial();
UpdateMaterialList();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String RE06DetectorMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String ans;
if( command == fAbsMaterialCmd ){
ans=fDetector->GetAbsorberMaterial();
} else if( command == fGapMaterialCmd ){
ans=fDetector->GetGapMaterial();
} else if( command == fNumLayerCmd ) {
ans=fNumLayerCmd->ConvertToString(fDetector->GetNumberOfLayers());
} else if( command == fSerialCmd ){
ans=fSerialCmd->ConvertToString(fDetector->IsSerial());
} else if( command == fSerialCmd ) {
ans=fSerialCmd->ConvertToString(fDetector->IsSerial());
} else if( command == fVerboseCmd ) {
ans=fVerboseCmd->ConvertToString(fDetector->GetVerboseLevel());
}
return ans;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06DetectorMessenger::UpdateMaterialList()
{
G4String matList;
const G4MaterialTable* matTbl = G4Material::GetMaterialTable();
for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
{
matList += (*matTbl)[i]->GetName();
matList += " ";
}
if(fAbsMaterialCmd !=0) {
fAbsMaterialCmd->SetCandidates(matList);
}
if (fGapMaterialCmd !=0) {
fGapMaterialCmd->SetCandidates(matList);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,216 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06ParallelWorld.cc
/// \brief Implementation of the RE06ParallelWorld class
//
// $Id: RE06ParallelWorld.cc 75123 2013-10-28 09:53:28Z gcosmo $
//
#include "RE06ParallelWorld.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4PSEnergyDeposit.hh"
#include "G4PSNofSecondary.hh"
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4PSMinKinEAtGeneration.hh"
#include "G4VSDFilter.hh"
#include "G4SDParticleFilter.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06ParallelWorld::RE06ParallelWorld(G4String worldName)
:G4VUserParallelWorld(worldName),
fConstructed(false),
fSerial(false),
fTotalThickness(2.0*m),
fNumberOfLayers(20)
{
for(size_t i=0;i<3;i++)
{
fCalorLogical[i] = 0;
fLayerLogical[i] = 0;
fCalorPhysical[i] = 0;
fLayerPhysical[i] = 0;
}
fCalName[0] = "Calor-AP";
fCalName[1] = "Calor-BP";
fCalName[2] = "Calor-CP";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06ParallelWorld::~RE06ParallelWorld()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06ParallelWorld::Construct()
{
if(!fConstructed)
{
fConstructed = true;
SetupGeometry();
//SetupDetectors();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06ParallelWorld::ConstructSD()
{
SetupDetectors();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06ParallelWorld::SetupGeometry()
{
//
// World
//
G4VPhysicalVolume* ghostWorld = GetWorld();
G4LogicalVolume* worldLogical = ghostWorld->GetLogicalVolume();
//
// Calorimeter
//
G4VSolid* calorSolid
= new G4Tubs("Calor",0.0,0.5*m,fTotalThickness/2.,0.0,360.*deg);
G4int i;
for(i=0;i<3;i++)
{
fCalorLogical[i] = new G4LogicalVolume(calorSolid,0,fCalName[i]);
if(fSerial)
{
fCalorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,0.,G4double(i-1)*fTotalThickness),
fCalorLogical[i],fCalName[i],worldLogical,false,i);
}
else
{
fCalorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,G4double(i-1)*m,0.),
fCalorLogical[i],fCalName[i],worldLogical,false,i);
}
}
//
// Layers --- as absorbers
//
G4VSolid* layerSolid
= new G4Tubs("Layer",0.0,0.5*m,fTotalThickness/2.,0.0,360.*deg);
for(i=0;i<3;i++)
{
fLayerLogical[i]
= new G4LogicalVolume(layerSolid,0,fCalName[i]+"_LayerLog");
fLayerPhysical[i]
= new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
kRho,fNumberOfLayers,0.5*m/fNumberOfLayers);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06ParallelWorld::SetupDetectors()
{
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
G4String filterName, particleName;
G4SDParticleFilter* gammaFilter
= new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma");
G4SDParticleFilter* electronFilter
= new G4SDParticleFilter(filterName="electronFilter",particleName="e-");
G4SDParticleFilter* positronFilter
= new G4SDParticleFilter(filterName="positronFilter",particleName="e+");
G4SDParticleFilter* epFilter
= new G4SDParticleFilter(filterName="epFilter");
epFilter->add(particleName="e-");
epFilter->add(particleName="e+");
for(G4int i=0;i<3;i++)
{
G4String detName = fCalName[i]+"_para";
G4MultiFunctionalDetector* det = new G4MultiFunctionalDetector(detName);
G4VPrimitiveScorer* primitive;
primitive = new G4PSEnergyDeposit("eDep");
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nGamma");
primitive->SetFilter(gammaFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nElectron");
primitive->SetFilter(electronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofSecondary("nPositron");
primitive->SetFilter(positronFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSTrackLength("trackLength");
primitive->SetFilter(epFilter);
det->RegisterPrimitive(primitive);
primitive = new G4PSNofStep("nStep");
primitive->SetFilter(epFilter);
det->RegisterPrimitive(primitive);
G4SDManager::GetSDMpointer()->AddNewDetector(det);
SetSensitiveDetector(fLayerLogical[i], det);
}
G4SDManager::GetSDMpointer()->SetVerboseLevel(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06ParallelWorld::SetSerialGeometry(G4bool serial)
{
if(fSerial==serial) return;
fSerial=serial;
if(!fConstructed) return;
for(G4int i=0;i<3;i++)
{
if(fSerial)
{
fCalorPhysical[i]
->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m));
}
else
{
fCalorPhysical[i]
->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.));
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,338 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06PhysicsList.cc
/// \brief Implementation of the RE06PhysicsList class
//
// $Id: RE06PhysicsList.cc 66526 2012-12-19 13:41:33Z ihrivnac $
//
#include "RE06PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06PhysicsList::RE06PhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1.0*mm;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06PhysicsList::~RE06PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructGeneral();
ConstructEM();
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructEM()
{
G4bool displacementFlg = true; // for multiple scattering
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
G4eMultipleScattering* theeminusMultipleScattering
= new G4eMultipleScattering();
theeminusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
G4VProcess* theeminusIonisation = new G4eIonisation();
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
//
// add processes
pmanager->AddProcess(theeminusMultipleScattering);
pmanager->AddProcess(theeminusIonisation);
pmanager->AddProcess(theeminusBremsstrahlung);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxAlongStep,3);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
} else if (particleName == "e+") {
//positron
G4eMultipleScattering* theeplusMultipleScattering
= new G4eMultipleScattering();
theeplusMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
G4VProcess* theeplusIonisation = new G4eIonisation();
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
//
// add processes
pmanager->AddProcess(theeplusMultipleScattering);
pmanager->AddProcess(theeplusIonisation);
pmanager->AddProcess(theeplusBremsstrahlung);
pmanager->AddProcess(theeplusAnnihilation);
//
// set ordering for AtRestDoIt
pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxAlongStep,3);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
G4MuMultipleScattering* aMultipleScattering
= new G4MuMultipleScattering();
aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* aPairProduction = new G4MuPairProduction();
G4VProcess* anIonisation = new G4MuIonisation();
//
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
pmanager->AddProcess(aBremsstrahlung);
pmanager->AddProcess(aPairProduction);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
pmanager->SetProcessOrdering(aBremsstrahlung, idxAlongStep,3);
pmanager->SetProcessOrdering(aPairProduction, idxAlongStep,4);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
G4hMultipleScattering* aMultipleScattering = new G4hMultipleScattering();
aMultipleScattering->SetLateralDisplasmentFlag(displacementFlg);
G4VProcess* anIonisation = new G4hIonisation();
//
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
}
}
}
#include "G4Decay.hh"
#include "G4ParallelWorldScoringProcess.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::ConstructGeneral()
{
// Add Decay Process and Parallel world Scoring Process
G4Decay* theDecayProcess = new G4Decay();
G4ParallelWorldScoringProcess* theParallelWorldScoringProcess
= new G4ParallelWorldScoringProcess("ParaWorldScoringProc");
theParallelWorldScoringProcess->SetParallelWorld("ParallelScoringWorld");
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
pmanager->AddProcess(theParallelWorldScoringProcess);
pmanager
->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
pmanager
->SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
pmanager
->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
}
}
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4ProductionCuts.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "RE06PhysicsList::SetCuts: default cut length : "
<< G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// These values are used as the default production thresholds
// for the world volume.
SetCutsWithDefault();
// Production thresholds for detector regions
G4String regName[] = {"Calor-A","Calor-B","Calor-C"};
G4double fuc = 1.;
for(G4int i=0;i<3;i++)
{
G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName[i]);
G4ProductionCuts* cuts = new G4ProductionCuts;
cuts->SetProductionCut(defaultCutValue*fuc);
reg->SetProductionCuts(cuts);
fuc *= 10.;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06PrimaryGeneratorAction.cc
/// \brief Implementation of the RE06PrimaryGeneratorAction class
//
// $Id: RE06PrimaryGeneratorAction.cc 66526 2012-12-19 13:41:33Z ihrivnac $
//
#include "RE06PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06PrimaryGeneratorAction::RE06PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fSerial(false)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleEnergy(100.*GeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06PrimaryGeneratorAction::~RE06PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(fSerial)
{
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-3.5*m));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
else
{
for(G4int i=0;i<3;i++)
{
fParticleGun
->SetParticlePosition(G4ThreeVector(0.,G4double(i-1)*m,-1.5*m));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,185 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06Run.cc
/// \brief Implementation of the RE06Run class
//
// $Id: RE06Run.cc 75123 2013-10-28 09:53:28Z gcosmo $
//
#include "RE06Run.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
#include "G4SDManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06Run::RE06Run()
: G4Run()
{
G4String detName[6]
= {"Calor-A_abs","Calor-A_gap",
"Calor-B_abs","Calor-B_gap",
"Calor-C_abs","Calor-C_gap"};
G4String primNameSum[6]
= {"eDep","nGamma","nElectron","nPositron","trackLength","nStep"};
G4String primNameMin[3]
= {"minEkinGamma","minEkinElectron","minEkinPositron"};
G4String paraName[3]
= {"Calor-AP_para","Calor-BP_para","Calor-CP_para"};
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
G4String fullName;
size_t i,j;
for(i=0;i<6;i++)
{
for(j=0;j<6;j++)
{
fullName = detName[i]+"/"+primNameSum[j];
fColIDSum[i][j] = SDMan->GetCollectionID(fullName);
}
for(j=0;j<3;j++)
{
fullName = detName[i]+"/"+primNameMin[j];
fColIDMin[i][j] = SDMan->GetCollectionID(fullName);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<6;j++)
{
fullName = paraName[i]+"/"+primNameSum[j];
fColIDPara[i][j] = SDMan->GetCollectionID(fullName);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06Run::~RE06Run()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06Run::RecordEvent(const G4Event* evt)
{
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
if(!HCE) return;
numberOfEvent++;
size_t i,j;
for(i=0;i<6;i++)
{
for(j=0;j<6;j++)
{
G4THitsMap<G4double>* evtMap
= (G4THitsMap<G4double>*)(HCE->GetHC(fColIDSum[i][j]));
fMapSum[i][j] += *evtMap;
}
for(j=0;j<3;j++)
{
G4THitsMap<G4double>* evtMap
= (G4THitsMap<G4double>*)(HCE->GetHC(fColIDMin[i][j]));
std::map<G4int,G4double*>::iterator itr = evtMap->GetMap()->begin();
for(; itr != evtMap->GetMap()->end(); itr++)
{
G4int key = (itr->first);
G4double val = *(itr->second);
G4double* mapP = fMapMin[i][j][key];
if( mapP && (val>*mapP) ) continue;
fMapMin[i][j].set(key,val);
}
}
}
for(i=0;i<3;i++)
{
for(j=0;j<6;j++)
{
G4THitsMap<G4double>* evtMap
= (G4THitsMap<G4double>*)(HCE->GetHC(fColIDPara[i][j]));
fMapPara[i][j] += *evtMap;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06Run::Merge(const G4Run * aRun) {
const RE06Run * localRun = static_cast<const RE06Run *>(aRun);
for(G4int i = 0; i < 6; i++) {
for(G4int j = 0; j < 6; j++) {
fMapSum[i][j] += localRun->fMapSum[i][j];
}
for(G4int j = 0; j < 3; j++) {
std::map<G4int, G4double*>::iterator itr = localRun->fMapMin[i][j].GetMap()->begin();
for(; itr != localRun->fMapMin[i][j].GetMap()->end(); itr++) {
G4int key = itr->first;
G4double val = *(itr->second);
G4double * mapP = fMapMin[i][j][key];
if(!mapP || val < *mapP) fMapMin[i][j].set(key, val);
}
}
}
for(G4int i = 0; i < 3; i++) {
for(G4int j = 0; j < 6; j++) {
fMapPara[i][j] += localRun->fMapPara[i][j];
}
}
G4Run::Merge(aRun);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double RE06Run::GetTotal(const G4THitsMap<G4double> &map) const
{
G4double tot = 0.;
if(map.GetSize()==0) return tot;
std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
for(; itr != map.GetMap()->end(); itr++)
{ tot += *(itr->second); }
return tot;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double RE06Run::FindMinimum(const G4THitsMap<G4double> &map) const
{
G4double val = DBL_MAX;
if(map.GetSize()==0) return val;
std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
for(; itr != map.GetMap()->end(); itr++)
{ if(val>*(itr->second)) val = *(itr->second); }
return val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,166 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06RunAction.cc
/// \brief Implementation of the RE06RunAction class
//
// $Id: RE06RunAction.cc 77498 2013-11-25 10:26:36Z gcosmo $
//
#include "RE06RunAction.hh"
#include "RE06Run.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4ProductionCuts.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "G4VSteppingVerbose.hh"
#include "RE06SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06RunAction::RE06RunAction()
: G4UserRunAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06RunAction::~RE06RunAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* RE06RunAction::GenerateRun()
{ return new RE06Run; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06RunAction::BeginOfRunAction(const G4Run*)
{
RE06SteppingVerbose* sv
= (RE06SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
sv->InitializeTimers();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06RunAction::EndOfRunAction(const G4Run* aRun)
{
static G4String regName[3] = {"Calor-A","Calor-B","Calor-C"};
const RE06Run* theRun = (const RE06Run*)aRun;
if(IsMaster()) {
G4cout
<< "############################################################" << G4endl;
G4cout
<< " Run Summary - Number of events : " << theRun->GetNumberOfEvent()
<< G4endl;
G4cout
<< "############################################################" << G4endl;
G4double nEvt = (G4double)(theRun->GetNumberOfEvent());
for(size_t i=0;i<3;i++)
{
size_t ih1 = 2*i;
size_t ih2 = 2*i+1;
G4Region* region = G4RegionStore::GetInstance()->GetRegion(regName[i]);
G4ProductionCuts* cuts = region->GetProductionCuts();
G4cout << "Region : " << region->GetName() << G4endl;
G4cout << " Production thresholds :" << G4endl << " "
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
<< G4endl;
G4cout << " Energy deposition in an event :" << G4endl << " "
<< " Absorber " << G4BestUnit((theRun->GetTotalE(ih1))/nEvt,"Energy")
<< " Gap " << G4BestUnit((theRun->GetTotalE(ih2))/nEvt,"Energy")
<< G4endl;
G4cout << " Number of secondaries in an event :" << G4endl << " "
<< " gamma in Absorber " << (theRun->GetNGamma(ih1))/nEvt
<< " in Gap " << (theRun->GetNGamma(ih2))/nEvt << G4endl << " "
<< " e- in Absorber " << (theRun->GetNElectron(ih1))/nEvt
<< " in Gap " << (theRun->GetNElectron(ih2))/nEvt << G4endl << " "
<< " e+ in Absorber " << (theRun->GetNPositron(ih1))/nEvt
<< " in Gap " << (theRun->GetNPositron(ih2))/nEvt << G4endl;
G4cout << " Minimum kinetic energy of generated secondaries :" << G4endl
<< " " << " gamma in Absorber "
<< G4BestUnit(theRun->GetEMinGamma(ih1),"Energy")
<< " in Gap " << G4BestUnit(theRun->GetEMinGamma(ih2),"Energy")
<< G4endl << " "
<< " e- in Absorber "
<< G4BestUnit(theRun->GetEMinElectron(ih1),"Energy")
<< " in Gap " << G4BestUnit(theRun->GetEMinElectron(ih2),"Energy")
<< G4endl << " "
<< " e+ in Absorber "
<< G4BestUnit(theRun->GetEMinPositron(ih1),"Energy")
<< " in Gap " << G4BestUnit(theRun->GetEMinPositron(ih2),"Energy")
<< G4endl;
G4cout << " Total track length of e+/e- in an event :" << G4endl
<< " "
<< " Absorber " << G4BestUnit((theRun->GetTotalL(ih1))/nEvt,"Length")
<< " Gap " << G4BestUnit((theRun->GetTotalL(ih2))/nEvt,"Length")
<< G4endl;
G4cout << " Total number of steps of e+/e- in an event :" << G4endl
<< " "
<< " Absorber " << (theRun->GetNStep(ih1))/nEvt
<< " Gap " << (theRun->GetNStep(ih2))/nEvt
<< G4endl;
G4cout
<< "------------------------------------------------------------"
<< G4endl;
G4cout << "Scores in parallel geometry" << G4endl;
G4cout
<< "layer eDep/evt nGamma/evt nElec/evt nPosi/evt stpLen/evt nStep/evt"
<< G4endl;
for(size_t k=0;k<20;k++)
{
G4cout << std::setw(8) << k;
for(size_t j=0;j<6;j++) {
G4cout << " " << std::setw(10) << (theRun->GetParaValue(i,j,k))/nEvt;
}
G4cout << G4endl;
}
G4cout
<< "############################################################"
<< G4endl;
}
} else {
G4cout << "CPU Time spent by each region" << G4endl;
RE06SteppingVerbose* sv
= (RE06SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
sv->Report();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,142 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RE06/src/RE06SteppingVerbose.cc
/// \brief Implementation of the RE06SteppingVerbose class
//
// $Id: RE06SteppingVerbose.cc 66526 2012-12-19 13:41:33Z ihrivnac $
//
#include "RE06SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4RunManagerKernel.hh"
#include "G4TrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06SteppingVerbose::RE06SteppingVerbose()
: G4VSteppingVerbose(),
fTimers(),
fNofTimers(0),
fRegIdx(-1),
fEp(false)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE06SteppingVerbose::~RE06SteppingVerbose()
{
for(G4int j=0;j<fNofTimers;j++)
{ delete fTimers[j]; }
fTimers.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06SteppingVerbose::InitializeTimers()
{
G4RegionStore* regionStore = G4RegionStore::GetInstance();
fNofRegions = regionStore->size();
fNofTimers = 2 * fNofRegions;
G4int nEnt = fTimers.size();
if(nEnt<fNofTimers)
{
for(G4int i=nEnt;i<fNofTimers;i++)
{ fTimers.push_back(new G4SliceTimer); }
}
for(G4int j=0;j<fNofTimers;j++)
{ fTimers[j]->Clear(); }
fRegIdx = -1;
fEp = false;
// Set verbosity for timing
G4RunManagerKernel::GetRunManagerKernel()->GetTrackingManager()->SetVerboseLevel(0);
#ifdef G4VERBOSE
fManager->SetVerboseLevel(1);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06SteppingVerbose::Report()
{
for(G4int i=0;i<fNofRegions;i++)
{
G4cout << G4endl;
G4cout << "Region <" << (*G4RegionStore::GetInstance())[i]->GetName() << ">" << G4endl;
G4cout << " All particles : User=" << fTimers[i]->GetUserElapsed()
<< " Real=" << fTimers[i]->GetRealElapsed()
<< " Sys=" << fTimers[i]->GetSystemElapsed() << G4endl;
G4cout << " e+ / e- : User=" << fTimers[fNofRegions+i]->GetUserElapsed()
<< " Real=" << fTimers[fNofRegions+i]->GetRealElapsed()
<< " Sys=" << fTimers[fNofRegions+i]->GetSystemElapsed() << G4endl;
}
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06SteppingVerbose::NewStep()
{
CopyState();
G4Region* reg = fTrack->GetStep()->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
fRegIdx = FindRegion(reg);
fTimers[fRegIdx]->Start();
G4ParticleDefinition* pd = fTrack->GetDefinition();
if(pd==G4Electron::ElectronDefinition() || pd==G4Positron::PositronDefinition()) fEp = true;
if(fEp) fTimers[fNofRegions+fRegIdx]->Start();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE06SteppingVerbose::StepInfo()
{
fTimers[fRegIdx]->Stop();
if(fEp)
{
fTimers[fNofRegions+fRegIdx]->Stop();
fEp = false;
}
fRegIdx = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int RE06SteppingVerbose::FindRegion(G4Region* rgn)
{
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int sz = regionStore->size();
for(G4int i=0;i<sz;i++)
{ if(rgn==(*regionStore)[i]) return i; }
return -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RE06WorkerInitialization.cc 66522 2012-12-19 12:26:04Z ihrivnac $
//
/// \file src/RE06WorkerInitialization.cc
/// \brief Implementation of the RE06WorkerInitialization class
//
#include "RE06WorkerInitialization.hh"
#include "RE06SteppingVerbose.hh"
RE06WorkerInitialization::RE06WorkerInitialization()
{;}
RE06WorkerInitialization::~RE06WorkerInitialization()
{;}
void RE06WorkerInitialization::WorkerInitialize() const
{
G4VSteppingVerbose* verbosity = new RE06SteppingVerbose;
G4VSteppingVerbose::SetInstance(verbosity);
}