|
Hello,
I got a question. I stimulated the effiency of a lo-ax detector from Ortec with
diameter of 70 mm and z of 30 mm with gamma. The program is a combined of TestEm4 and TestEm3
Then I compare it to an experimental data of 137Cs source
from the detector at various distances.
The stimulation gave 30% counts more than experiment. I did include distance of
Ge crystal from window = 4mm. However, If i shift the experimental distance
by 1.5cm, the data fits theory.
funny the deltaz in the code is 1.5cm
The distance in gun I took to be (0,0,1.5 + z cm) where z is the
distance from source to face of cylinder.
PrimaryGeneratorAction.cc
Detector construct.cc
-----------------------------------------------------------------------
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Tubs.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4UserLimits.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:defaultMaterial(0),solidWorld(0),logicWorld(0),physiWorld(0),
solidCalor(0),logicCalor(0),physiCalor(0),
solidLayer(0),logicLayer(0),physiLayer(0),
magField(0)
{
//--------------------------------------------------------------------
// default parameter values of the calorimeter
NbOfAbsor = 2;
//AbsorThickness[0] = 5.0*mm;
Rmin[0] = 0.000*cm;
Rmax[0] = 3.525*cm;
Rmin[1] = 3.525*cm;
Rmax[1] = 3.625*cm;
//Rmin[2] = 0.00*cm;
//Rmax[2] = 0.40*cm;
deltaZ[1] = 1.48*cm;
deltaZ[2] = 5.5*cm;
//deltaZ[3] = 0.15*cm;
//AbsorThickness[1] = 5.0*cm;
NbOfLayers = 1;
CalorSizeYZ = 40.*cm;
ComputeCalorParameters();
// materials
DefineMaterials();
SetWorldMaterial("Galactic");
SetAbsorMaterial(1,"Aluminium");
SetAbsorMaterial(0,"HPGe");
//SetAbsorMaterial(0,"Aluminium");
//SetAbsorMaterial(1,"HPGe");
//SetAbsorMaterial(2,"Aluminium");
//SetAbsorMaterial(2,"Galactic");
//------------------------------------------------------------------------------------
// create UserLimits
userLimits = new G4UserLimits();
// create commands for interactive definition of the calorimeter
detectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{
delete userLimits;
delete detectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
//This function illustrates the possible ways to define materials
//
// define Elements
//
G4double z,a;
G4Element* H = new G4Element("Hydrogen", "H" , z= 1., a= 1.008*g/mole);
G4Element* C = new G4Element("Carbon", "C" , z= 6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen", "N" , z= 7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen", "O" , z= 8., a= 16.00*g/mole);
G4Element* Si = new G4Element("Silicon", "Si", z= 14., a= 28.09*g/mole);
G4Element* Ge = new G4Element("Germanium", "Ge", z= 32., a= 72.59*g/mole);
G4Element* I = new G4Element("Iodine", "I" , z= 53., a= 126.90*g/mole);
G4Element* Cs = new G4Element("Cesium", "Cs", z= 55., a= 132.90*g/mole);
G4Element* Bi = new G4Element("Bismuth", "Bi", z= 83., a= 208.98*g/mole);
//
// define an Element from isotopes, by relative abundance
//
G4int iz, n; //iz=number of protons in an isotope;
// n=number of nucleons in an isotope;
G4int ncomponents;
G4double abundance;
G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole);
G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);
G4Element* U = new G4Element("enriched Uranium", "U", ncomponents=2);
U->AddIsotope(U5, abundance= 90.*perCent);
U->AddIsotope(U8, abundance= 10.*perCent);
//
// define simple materials
//
G4double density;
new G4Material("liquidH2", z=1., a= 1.008*g/mole, density= 70.8*mg/cm3);
new G4Material("Aluminium", z=13., a= 26.98*g/mole, density= 2.700*g/cm3);
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
new G4Material("Titanium", z=22., a= 47.867*g/mole, density= 4.54*g/cm3);
new G4Material("Iron", z=26., a= 55.85*g/mole, density= 7.870*g/cm3);
new G4Material("Copper", z=29., a= 63.55*g/mole, density= 8.960*g/cm3);
new G4Material("Tungsten", z=74., a= 183.85*g/mole, density= 19.30*g/cm3);
new G4Material("Gold", z=79., a= 196.97*g/mole, density= 19.32*g/cm3);
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
new G4Material("Uranium", z=92., a= 238.03*g/mole, density= 18.95*g/cm3);
new G4Material("HPGe", z=32., a= 72.59*g/mole, density= 5.32*g/cm3);
//
// define a material from elements. case 1: chemical molecule
//
G4int natoms;
//
// define a material from elements. case 2: mixture by fractional mass
//
G4double fractionmass;
G4Material* Air =
new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
G4Material* Air20 =
new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
kStateGas, 293.*kelvin, 1.*atmosphere);
Air20->AddElement(N, fractionmass=0.7);
Air20->AddElement(O, fractionmass=0.3);
//
// define a material from elements and others materials (mixture of mixtures)
//
G4Material* Aerog =
new G4Material("Aerogel", density= 0.200*g/cm3, ncomponents=3);
Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
Aerog->AddElement (C , fractionmass= 0.1*perCent);
//
// examples of gas in non STP conditions
//
G4double temperature, pressure;
G4Material* CO2 =
new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
kStateGas, temperature= 325.*kelvin, pressure= 50.*atmosphere);
CO2->AddElement(C, natoms=1);
CO2->AddElement(O, natoms=2);
G4Material* steam =
new G4Material("WaterSteam", density= 0.3*mg/cm3, ncomponents=1,
kStateGas, temperature= 500.*kelvin, pressure= 2.*atmosphere);
steam->AddMaterial(H2O, fractionmass=1.);
//
// examples of vacuum
//
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
new G4Material("Galactic", z=1., a=1.008*g/mole, density,
kStateGas,temperature,pressure);
density = 1.e-5*g/cm3;
pressure = 2.e-2*bar;
temperature = STP_Temperature; //from PhysicalConstants.h
G4Material* beam =
new G4Material("Beam", density, ncomponents=1,
kStateGas,temperature,pressure);
beam->AddMaterial(Air, fractionmass=1.);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
LayerThickness = 0.;
for (G4int iAbs=0; iAbs<NbOfAbsor; iAbs++)
LayerThickness += AbsorThickness[iAbs];
CalorThickness = NbOfLayers*LayerThickness;
WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
{
// complete the Calor parameters definition
ComputeCalorParameters();
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
//----------------------------------------------------------------------------
//solidWorld = new G4Box("World", //its name
// WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size
//-------------------------------------------------------------------------------
//Mother World
//------------------------------------------------------------------------------
//-Parameters for tubes
G4double deltaZ= 1.48*cm, Phimin=0., deltaPhi=360*degree;
solidWorld = new G4Tubs("World",
0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
logicWorld = new G4LogicalVolume(solidWorld, //its solid
defaultMaterial, //its material
"World"); //its name
physiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
//solidCalor = new G4Box("Calorimeter", //its name
// CalorThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);//size
//--------------------------------------------------------------------------
// Calorimeter
//
solidCalor = new G4Tubs("Calorimeter",
0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
logicCalor = new G4LogicalVolume(solidCalor, //its solid
defaultMaterial, //its material
"Calorimeter"); //its name
physiCalor = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicCalor, //its logical volume
"Calorimeter", //its name
logicWorld, //its mother volume
false, //no boolean operation
0); //copy number
//--------------------------------------------------------------------------------
// Layers
//
//solidLayer = new G4Box("Layer", //its name
// LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size
solidLayer = new G4Tubs("Layer", //its name
0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
//LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size
logicLayer = new G4LogicalVolume(solidLayer, //its solid
defaultMaterial, //its material
"Layer"); //its name
//if (NbOfLayers > 1)
// physiLayer = new G4PVReplica("Layer", //its name
// logicLayer, //its logical volume
// logicCalor, //its mother
// kXAxis, //axis of replication
// NbOfLayers, //number of replica
// LayerThickness); //witdth of replica
//else
physiLayer = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicLayer, //its logical volume
"Layer", //its name
logicCalor, //its mother volume
false, //no boolean operation
0); //copy number
//-------------------------------------------------------------------------------------------
//
// Absorbers
//
//G4double xfront = -0.5*LayerThickness;
for (G4int k=0; k<NbOfAbsor; k++)
//{ solidAbsor[k] = new G4Box("Absorber", //its name
// AbsorThickness[k]/2,CalorSizeYZ/2,CalorSizeYZ/2);
{ solidAbsor[k] = new G4Tubs("Absorber", //its name
Rmin[k],Rmax[k],deltaZ,Phimin,deltaPhi);//size;
logicAbsor[k] = new G4LogicalVolume(solidAbsor[k], //its solid
AbsorMaterial[k], //its material
AbsorMaterial[k]->GetName());
logicAbsor[k]->SetUserLimits(userLimits);
//G4double xcenter = xfront+0.5*AbsorThickness[k];
//xfront += AbsorThickness[k];
physiAbsor[k] = new G4PVPlacement(0, //no rotation
//G4ThreeVector(xcenter,0.,0.), //its position
G4ThreeVector(), //its position
logicAbsor[k], //its logical volume
AbsorMaterial[k]->GetName(), //its name
logicLayer, //its mother
false, //no boulean operat
k); //copy number
}
PrintCalorParameters();
//always return the physical World
//
return physiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n-------------------------------------------------------------"
<< "\n ---> The calorimeter is " << NbOfLayers << " layers of:";
for (G4int i=0; i<NbOfAbsor; i++)
{
G4cout << "\n \t" << std::setw(12) << AbsorMaterial[i]->GetName() <<": "
<< std::setw(6) << G4BestUnit(AbsorThickness[i],"Length");
}
G4cout << "\n-------------------------------------------------------------\n";
G4cout << "\n" << defaultMaterial << G4endl;
for (G4int j=0; j<NbOfAbsor; j++)
G4cout << "\n" << AbsorMaterial[j] << G4endl;
G4cout << "\n-------------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetWorldMaterial(G4String material)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(material);
if (pttoMaterial) defaultMaterial = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetNbOfLayers(G4int ival)
{
// set the number of Layers
//
if (ival < 1)
{ G4cout << "\n --->warning from SetNbOfLayers: "
<< ival << " must be at least 1. Command refused" << G4endl;
return;
}
NbOfLayers = ival;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetNbOfAbsor(G4int ival)
{
// set the number of Absorbers
//
if (ival < 1 || ival > MaxAbsor)
{ G4cout << "\n ---> warning from SetNbOfAbsor: "
<< ival << " must be at least 1 and and most " << MaxAbsor
<< ". Command refused" << G4endl;
return;
}
NbOfAbsor = ival;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorMaterial(G4int ival,G4String material)
{
// search the material by its name
//
if (ival >= NbOfAbsor)
{ G4cout << "\n --->warning from SetAbsorMaterial: absor number "
<< ival << " out of range. Command refused" << G4endl;
return;
}
G4Material* pttoMaterial = G4Material::GetMaterial(material);
if (pttoMaterial) AbsorMaterial[ival] = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorThickness(G4int ival,G4double val)
{
// change Absorber thickness
//
if (ival >= NbOfAbsor)
{ G4cout << "\n --->warning from SetAbsorThickness: absor number "
<< ival << " out of range. Command refused" << G4endl;
return;
}
if (val <= DBL_MIN)
{ G4cout << "\n --->warning from SetAbsorThickness: thickness "
<< val << " out of range. Command refused" << G4endl;
return;
}
AbsorThickness[ival] = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetCalorSizeYZ(G4double val)
{
// change the transverse size
//
if (val <= DBL_MIN)
{ G4cout << "\n --->warning from SetCalorSizeYZ: thickness "
<< val << " out of range. Command refused" << G4endl;
return;
}
CalorSizeYZ = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
void DetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
//
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
if(magField) delete magField; //delete the existing magn field
if(fieldValue!=0.) // create a new one if non nul
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
} else {
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaxStepSize(G4double val)
{
// set the maximum allowed step size
//
if (val <= DBL_MIN)
{ G4cout << "\n --->warning from SetMaxStepSize: maxStep "
<< val << " out of range. Command refused" << G4endl;
return;
}
userLimits->SetMaxAllowedStep(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|