Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
-64
View File
@@ -1,64 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ExN07CalorHit.cc,v 1.2 2003/05/21 22:01:17 asaim Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
#include "ExN07CalorHit.hh"
G4Allocator<ExN07CalorHit> ExN07CalorHitAllocator;
ExN07CalorHit::ExN07CalorHit()
:Edep(0.),TrackLength(0.),nStep(0)
{;}
ExN07CalorHit::~ExN07CalorHit()
{;}
ExN07CalorHit::ExN07CalorHit(const ExN07CalorHit& right):G4VHit()
{
Edep = right.Edep;
TrackLength = right.TrackLength;
nStep= right.nStep;
}
const ExN07CalorHit& ExN07CalorHit::operator=(const ExN07CalorHit& right)
{
Edep = right.Edep;
TrackLength = right.TrackLength;
nStep= right.nStep;
return *this;
}
int ExN07CalorHit::operator==(const ExN07CalorHit& right) const
{
return (this==&right);
}
void ExN07CalorHit::Draw()
{;}
void ExN07CalorHit::Print()
{;}
@@ -1,115 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ExN07CalorimeterSD.cc,v 1.2 2003/05/21 22:01:17 asaim Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
#include "ExN07CalorimeterSD.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Track.hh"
#include "G4ios.hh"
G4int ExN07CalorimeterSD::numberOfLayers = 40;
ExN07CalorimeterSD::ExN07CalorimeterSD(G4String name)
:G4VSensitiveDetector(name),AbsCollID(-1),GapCollID(-1)
{
collectionName.insert("AbsCollection");
collectionName.insert("GapCollection");
}
ExN07CalorimeterSD::~ExN07CalorimeterSD()
{;}
void ExN07CalorimeterSD::Initialize(G4HCofThisEvent*HCE)
{
AbsCollection = new ExN07CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for(int i=0;i<numberOfLayers;i++)
{ AbsCollection->insert(new ExN07CalorHit); }
if(AbsCollID<0)
{ AbsCollID = GetCollectionID(0); }
HCE->AddHitsCollection(AbsCollID,AbsCollection);
GapCollection = new ExN07CalorHitsCollection
(SensitiveDetectorName,collectionName[1]);
for(int j=0;j<numberOfLayers;j++)
{ GapCollection->insert(new ExN07CalorHit); }
if(GapCollID<0)
{ GapCollID = GetCollectionID(1); }
HCE->AddHitsCollection(GapCollID,GapCollection);
}
G4bool ExN07CalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
G4double stepl = aStep->GetStepLength();
G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4int LayerNumber = theTouchable->GetReplicaNumber();
G4int copyNo = LayerNumber/2;
if(LayerNumber%2)
{ // odd number corresponds to Gap
(*GapCollection)[copyNo]->AddEnergy(edep);
if(particle==G4Electron::ElectronDefinition()
|| particle==G4Positron::PositronDefinition())
(*GapCollection)[copyNo]->AddStep(stepl);
}
else
{ // even number corresponds to Abs
(*AbsCollection)[copyNo]->AddEnergy(edep);
if(particle==G4Electron::ElectronDefinition()
|| particle==G4Positron::PositronDefinition())
(*AbsCollection)[copyNo]->AddStep(stepl);
}
return true;
}
void ExN07CalorimeterSD::EndOfEvent(G4HCofThisEvent*)
{;}
void ExN07CalorimeterSD::clear()
{;}
void ExN07CalorimeterSD::DrawAll()
{;}
void ExN07CalorimeterSD::PrintAll()
{;}
@@ -21,56 +21,85 @@
// ********************************************************************
//
//
// $Id: ExN07DetectorConstruction.cc,v 1.4 2004/11/17 03:07:30 kurasige Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07DetectorConstruction.cc,v 1.5 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
#include "ExN07DetectorConstruction.hh"
#include "G4RunManager.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.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 "ExN07DetectorMessenger.hh"
#include "ExN07CalorimeterSD.hh"
#include "ExN07GapParameterisation.hh"
#include "ExN07PrimaryGeneratorAction.hh"
ExN07DetectorConstruction::ExN07DetectorConstruction()
:numberOfLayers(40),worldMaterial(0),absorberMaterial(0),gapMaterial(0),
gapSolid(0),worldLogical(0),worldPhysical(0),serial(false)
:constructed(false),worldMaterial(0),absorberMaterial(0),gapMaterial(0),
layerSolid(0),gapSolid(0),worldLogical(0),worldPhysical(0),serial(false)
{
numberOfLayers = 40;
totalThickness = 2.0*m;
layerThickness = totalThickness / numberOfLayers;
for(size_t i=0;i<3;i++)
{
calorLogical[i] = 0;
layerLogical[i] = 0;
gapLogical[i] = 0;
calorPhysical[i] = 0;
layerPhysical[i] = 0;
gapPhysical[i] = 0;
}
gapParam = new ExN07GapParameterisation;
gapParam->SetNumberOfLayers(numberOfLayers);
ExN07CalorimeterSD::SetNumberOfLayers(numberOfLayers);
DefineMaterials();
calName[0] = "Calor-A";
calName[1] = "Calor-B";
calName[2] = "Calor-C";
detectorMessenger = new ExN07DetectorMessenger(this);
}
ExN07DetectorConstruction::~ExN07DetectorConstruction()
{ delete detectorMessenger;}
G4VPhysicalVolume* ExN07DetectorConstruction::Construct()
{
if(!constructed)
{
constructed = true;
DefineMaterials();
SetupGeometry();
SetupDetectors();
}
return worldPhysical;
}
void ExN07DetectorConstruction::DefineMaterials()
{
G4String name, symbol; //a=mass of a mole;
G4double a, z, density; //z=mean number of protons;
G4int iz, n; //iz=number of protons in an isotope;
// n=number of nucleons in an isotope;
G4int iz; //iz=number of protons in an isotope;
G4int n; // n=number of nucleons in an isotope;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
@@ -108,6 +137,10 @@ void ExN07DetectorConstruction::DefineMaterials()
//
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;
@@ -156,16 +189,14 @@ void ExN07DetectorConstruction::DefineMaterials()
worldMaterial = Vacuum;
absorberMaterial = Pb;
gapMaterial = lAr;
gapParam->SetAbsorberMaterial(absorberMaterial);
gapParam->SetGapMaterial(gapMaterial);
}
G4VPhysicalVolume* ExN07DetectorConstruction::Construct()
void ExN07DetectorConstruction::SetupGeometry()
{
//
// World
//
G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,4.*m);
G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,totalThickness*2.);
worldLogical = new G4LogicalVolume(worldSolid,worldMaterial,"World");
worldPhysical = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
0,false,0);
@@ -173,61 +204,57 @@ G4VPhysicalVolume* ExN07DetectorConstruction::Construct()
//
// Calorimeter
//
G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,1.*m);
G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,totalThickness/2.);
G4int i;
G4String calNam[3] = {"Cal-A","Cal-B","Cal-C"};
for(i=0;i<3;i++)
{
calorLogical[i] = new G4LogicalVolume(calorSolid,absorberMaterial,calNam[i]);
calorLogical[i] = new G4LogicalVolume(calorSolid,absorberMaterial,calName[i]);
if(serial)
{
calorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,0.,G4double(i-1)*2.*m),
calorLogical[i],calNam[i],worldLogical,false,i);
G4ThreeVector(0.,0.,G4double(i-1)*totalThickness),
calorLogical[i],calName[i],worldLogical,false,i);
}
else
{
calorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,G4double(i-1)*m,0.),
calorLogical[i],calNam[i],worldLogical,false,i);
calorLogical[i],calName[i],worldLogical,false,i);
}
}
//
// Layers -- material is parameterised
// Layers --- as absorbers
//
gapSolid = new G4Box("Gap",0.5*m,0.5*m,1.*m/G4double(2*numberOfLayers));
layerSolid = new G4Box("Layer",0.5*m,0.5*m,layerThickness/2.);
for(i=0;i<3;i++)
{
layerLogical[i] = new G4LogicalVolume(gapSolid,absorberMaterial,"Layer");
layerPhysical[i] =
new G4PVParameterised("Layer",layerLogical[i],calorLogical[i],kZAxis,
2*numberOfLayers,gapParam);
layerLogical[i] = new G4LogicalVolume(layerSolid,absorberMaterial,"Layer");
layerPhysical[i] = new G4PVReplica(calName[i]+"_Layer",layerLogical[i],calorLogical[i],kZAxis,
numberOfLayers,layerThickness);
}
//
// Regions
// Gap
//
G4String regName[] = {"Calor-A","Calor-B","Calor-C"};
gapSolid = new G4Box("Gap",0.5*m,0.5*m,layerThickness/4.);
for(i=0;i<3;i++)
{
G4Region* aRegion = new G4Region(regName[i]);
gapLogical[i] = new G4LogicalVolume(gapSolid,gapMaterial,"Gap");
gapPhysical[i] = new G4PVPlacement(0,G4ThreeVector(0.,0.,layerThickness/4.),
gapLogical[i],calName[i]+"_gap",layerLogical[i],false,0);
}
//
// Regions
//
for(i=0;i<3;i++)
{
G4Region* aRegion = new G4Region(calName[i]);
calorLogical[i]->SetRegion(aRegion);
aRegion->AddRootLogicalVolume(calorLogical[i]);
}
//
// Sensitive Detectors: Absorber and Gap
//
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String detName[] = {"CalorSD-A","CalorSD-B","CalorSD-C"};
for(i=0;i<3;i++)
{
G4VSensitiveDetector* calorSD = new ExN07CalorimeterSD(detName[i]);
SDman->AddNewDetector(calorSD);
layerLogical[i]->SetSensitiveDetector(calorSD);
}
//
// Visualization attributes
//
@@ -238,10 +265,77 @@ G4VPhysicalVolume* ExN07DetectorConstruction::Construct()
{
calorLogical[i]->SetVisAttributes(simpleBoxVisAtt);
layerLogical[i]->SetVisAttributes(simpleBoxVisAtt);
gapLogical[i]->SetVisAttributes(simpleBoxVisAtt);
}
PrintCalorParameters();
return worldPhysical;
}
void ExN07DetectorConstruction::SetupDetectors()
{
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 = calName[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);
G4SDManager::GetSDMpointer()->AddNewDetector(det);
if(j==0)
{ layerLogical[i]->SetSensitiveDetector(det); }
else
{ gapLogical[i]->SetSensitiveDetector(det); }
}
}
}
void ExN07DetectorConstruction::PrintCalorParameters() const
@@ -263,8 +357,7 @@ void ExN07DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
if(pttoMaterial)
{
absorberMaterial = pttoMaterial;
gapParam->SetAbsorberMaterial(pttoMaterial);
for(size_t i=0;i<3;i++)
if(constructed) for(size_t i=0;i<3;i++)
{
calorLogical[i]->SetMaterial(absorberMaterial);
layerLogical[i]->SetMaterial(absorberMaterial);
@@ -284,7 +377,8 @@ void ExN07DetectorConstruction::SetGapMaterial(G4String materialChoice)
if(pttoMaterial)
{
gapMaterial = pttoMaterial;
gapParam->SetGapMaterial(pttoMaterial);
if(constructed) for(size_t i=0;i<3;i++)
{ gapLogical[i]->SetMaterial(absorberMaterial); }
}
else
{ G4cerr << materialChoice << " is not defined. - Command is ignored." << G4endl; }
@@ -297,6 +391,10 @@ void ExN07DetectorConstruction::SetSerialGeometry(G4bool ser)
{
if(serial==ser) return;
serial=ser;
ExN07PrimaryGeneratorAction* gen = (ExN07PrimaryGeneratorAction*)
(G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
if(gen) gen->SetSerial(serial);
if(!constructed) return;
for(G4int i=0;i<3;i++)
{
if(serial)
@@ -304,49 +402,25 @@ void ExN07DetectorConstruction::SetSerialGeometry(G4bool ser)
else
{ calorPhysical[i]->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.)); }
}
ExN07PrimaryGeneratorAction* gen = (ExN07PrimaryGeneratorAction*)
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction();
gen->SetSerial(serial);
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
void ExN07DetectorConstruction::SetNumberOfLayers(G4int nl)
{
numberOfLayers = nl;
gapSolid->SetZHalfLength(1.*m/G4double(2*numberOfLayers));
gapParam->SetNumberOfLayers(nl);
layerThickness = totalThickness/numberOfLayers;
if(!constructed) return;
layerSolid->SetZHalfLength(layerThickness/2.);
gapSolid->SetZHalfLength(layerThickness/4.);
for(size_t i=0;i<3;i++)
{
if(layerPhysical[i])
{
calorLogical[i]->RemoveDaughter(layerPhysical[i]);
delete layerPhysical[i];
}
layerPhysical[i] =
new G4PVParameterised("Layer",layerLogical[i],calorLogical[i],kZAxis,
2*numberOfLayers,gapParam);
calorLogical[i]->RemoveDaughter(layerPhysical[i]);
delete layerPhysical[i];
layerPhysical[i] = new G4PVReplica(calName[i]+"_Layer",layerLogical[i],calorLogical[i],kZAxis,
numberOfLayers,layerThickness);
gapPhysical[i]->SetTranslation(G4ThreeVector(0.,0.,layerThickness/4.));
}
ExN07CalorimeterSD::SetNumberOfLayers(nl);
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
void ExN07DetectorConstruction::CreateMaterial(G4String materialChoice)
{
if ( G4Material::GetMaterial(materialChoice) != 0) return;
G4double a,z,density;
if (materialChoice == "Silicon"){
new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3);
} else if (materialChoice =="Iron"){
new G4Material("Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3);
} else if (materialChoice =="ArgonGas"){
new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3);
} else if (materialChoice =="He"){
new G4Material("He", z=2., a=4.0*g/mole, density=0.1786e-03*g/cm3);
}
}
@@ -21,14 +21,13 @@
// ********************************************************************
//
//
// $Id: ExN07DetectorMessenger.cc,v 1.3 2004/11/17 03:07:30 kurasige Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07DetectorMessenger.cc,v 1.4 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN07DetectorMessenger.hh"
#include "ExN07DetectorConstruction.hh"
#include "ExN07EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
@@ -42,11 +41,6 @@ ExN07DetectorMessenger::ExN07DetectorMessenger(
N07Dir = new G4UIdirectory("/N07/");
N07Dir->SetGuidance("UI commands of this example");
AddMaterCmd = new G4UIcmdWithAString("/N07/addMat",this);
AddMaterCmd->SetGuidance("Add Material");
AddMaterCmd->SetParameterName("choice",false);
AddMaterCmd->AvailableForStates(G4State_PreInit);
G4String matList;
const G4MaterialTable* matTbl = G4Material::GetMaterialTable();
for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
@@ -78,51 +72,30 @@ ExN07DetectorMessenger::ExN07DetectorMessenger(
SerialCmd->SetParameterName("serialize",false);
SerialCmd->AvailableForStates(G4State_Idle);
verboseCmd = new G4UIcmdWithAnInteger("/N07/verbose", this);
verboseCmd->SetGuidance("Set verbosity of each event.");
verboseCmd->SetParameterName("vl",true,true);
verboseCmd->SetRange("vl>=0 && vl<10");
}
ExN07DetectorMessenger::~ExN07DetectorMessenger()
{
delete AddMaterCmd;
delete AbsMaterCmd;
delete GapMaterCmd;
delete numLayerCmd;
delete SerialCmd;
delete verboseCmd;
delete N07Dir;
}
void ExN07DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AddMaterCmd ){
ExN07Detector->CreateMaterial(newValue);
// update candidate list
G4String matList;
const G4MaterialTable* matTbl = G4Material::GetMaterialTable();
for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++){
matList += (*matTbl)[i]->GetName();
matList += " ";
}
GapMaterCmd->SetCandidates(matList);
AbsMaterCmd->SetCandidates(matList);
} else if( command == AbsMaterCmd ) {
if( command == AbsMaterCmd ) {
ExN07Detector->SetAbsorberMaterial(newValue);
} else if( command == GapMaterCmd ){
ExN07Detector->SetGapMaterial(newValue);
} else if( command == numLayerCmd ) {
ExN07Detector->SetNumberOfLayers(numLayerCmd->GetNewIntValue(newValue));
ExN07Detector->SetNumberOfLayers(numLayerCmd->GetNewIntValue(newValue));
} else if( command == SerialCmd ) {
ExN07Detector->SetSerialGeometry(SerialCmd->GetNewBoolValue(newValue));
}else if( command == verboseCmd ) {
ExN07EventAction::SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
}
}
@@ -137,8 +110,6 @@ G4String ExN07DetectorMessenger::GetCurrentValue(G4UIcommand * command)
{ ans=numLayerCmd->ConvertToString(ExN07Detector->GetNumberOfLayers()); }
else if( command == SerialCmd )
{ ans=SerialCmd->ConvertToString(ExN07Detector->IsSerial()); }
else if( command == verboseCmd )
{ ans=verboseCmd->ConvertToString(ExN07EventAction::GetVerboseLevel()); }
return ans;
}
-149
View File
@@ -1,149 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ExN07EventAction.cc,v 1.5 2003/06/16 16:50:07 gunter Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
#include "ExN07EventAction.hh"
#include "ExN07CalorHit.hh"
#include "ExN07StackingAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
G4int ExN07EventAction::verboseLevel=0;
ExN07EventAction::ExN07EventAction()
{
for(size_t i=0;i<6;i++)
{ calorimeterCollID[i] = -1; }
}
ExN07EventAction::~ExN07EventAction()
{;}
void ExN07EventAction::BeginOfEventAction(const G4Event*)
{
for(size_t i=0;i<6;i++)
{
if(calorimeterCollID[i]==-1)
{
G4String colName;
switch(i)
{
case 0:
colName = "CalorSD-A/AbsCollection"; break;
case 1:
colName = "CalorSD-A/GapCollection"; break;
case 2:
colName = "CalorSD-B/AbsCollection"; break;
case 3:
colName = "CalorSD-B/GapCollection"; break;
case 4:
colName = "CalorSD-C/AbsCollection"; break;
case 5:
colName = "CalorSD-C/GapCollection"; break;
}
calorimeterCollID[i] =
G4SDManager::GetSDMpointer()->GetCollectionID(colName);
}
}
}
void ExN07EventAction::EndOfEventAction(const G4Event* evt)
{
if(verboseLevel==0) return;
if(evt->GetEventID()>4 && (evt->GetEventID())%10>(verboseLevel-1)) return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
if(!HCE) return;
G4cout << G4endl << "Event : " << evt->GetEventID() << G4endl;
ExN07CalorHitsCollection* CHC = 0;
for(size_t i=0;i<6;i++)
{
G4double totE=0.;
G4double totL=0.;
G4int nStep=0;
if (HCE) CHC = (ExN07CalorHitsCollection*)(HCE->GetHC(calorimeterCollID[i]));
if (CHC)
{
G4int nHit = CHC->entries();
for (G4int ii=0;ii<nHit;ii++)
{
totE += (*CHC)[ii]->GetEdep();
totL += (*CHC)[ii]->GetTrak();
nStep += (*CHC)[ii]->GetNStep();
}
}
switch(i)
{
case 0:
G4cout << "Calor-A : Absorber" << G4endl; break;
case 1:
G4cout << "Calor-A : SensitiveGap" << G4endl; break;
case 2:
G4cout << "Calor-B : Absorber" << G4endl; break;
case 3:
G4cout << "Calor-B : SensitiveGap" << G4endl; break;
case 4:
G4cout << "Calor-C : Absorber" << G4endl; break;
case 5:
G4cout << "Calor-C : SensitiveGap" << G4endl; break;
}
G4cout
<< " total energy deposition : " << std::setw(7)
<< G4BestUnit(totE,"Energy") << G4endl;
G4cout
<< " number of particles generated :" << G4endl
<< " gamma " << ExN07StackingAction::GetNGamma(i)
<< " e- " << ExN07StackingAction::GetNElectron(i)
<< " e+ " << ExN07StackingAction::GetNPositron(i) << G4endl;
G4cout
<< " minimum kinetic energy of generated secondaries :" << G4endl << std::setw(7)
<< " gamma " << G4BestUnit(ExN07StackingAction::GetEMinGamma(i),"Energy")
<< " e- " << G4BestUnit(ExN07StackingAction::GetEMinElectron(i),"Energy")
<< " e+ " << G4BestUnit(ExN07StackingAction::GetEMinPositron(i),"Energy")
<< G4endl;
G4cout
<< " total track length of e+/e- : " << std::setw(7)
<< G4BestUnit(totL,"Length") << G4endl;
G4cout
<< " number of steps of e+/e- : " << nStep
<< G4endl;
}
}
@@ -1,62 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ExN07GapParameterisation.cc,v 1.2 2003/05/28 11:24:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
#include "ExN07GapParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
ExN07GapParameterisation::ExN07GapParameterisation()
:numberOfLayers(40),absMaterial(0),gapMaterial(0)
{;}
ExN07GapParameterisation::~ExN07GapParameterisation()
{;}
void ExN07GapParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
G4double halfZ = 1.*m/G4double(2*numberOfLayers);
G4double Zposition= G4double(copyNo)*2.*halfZ - (1.*m-halfZ);
G4ThreeVector origin(0,0,Zposition);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
if(copyNo%2==0)
{ physVol->SetName("Abs"); }
else
{ physVol->SetName("Gap"); }
}
G4Material*
ExN07GapParameterisation::
ComputeMaterial (const G4int copyNo, G4VPhysicalVolume*)
{
if(copyNo%2==0) { return absMaterial; }
return gapMaterial;
}
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: ExN07PhysicsList.cc,v 1.4 2003/10/24 12:42:10 maire Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07PhysicsList.cc,v 1.5 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN07PhysicsList.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: ExN07PrimaryGeneratorAction.cc,v 1.1 2003/03/10 01:43:36 asaim Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07PrimaryGeneratorAction.cc,v 1.2 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN07PrimaryGeneratorAction.hh"
+52 -36
View File
@@ -21,32 +21,35 @@
// ********************************************************************
//
//
// $Id: ExN07Run.cc,v 1.3 2003/04/09 23:20:59 asaim Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07Run.cc,v 1.4 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN07Run.hh"
#include "ExN07CalorHit.hh"
#include "ExN07StackingAction.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
G4Allocator<ExN07Run> anExN07RunAllocator;
#include "G4SDManager.hh"
ExN07Run::ExN07Run()
{
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"};
G4SDManager* SDMan = G4SDManager::GetSDMpointer();
G4String fullName;
for(size_t i=0;i<6;i++)
{
totE[i] = 0.;
totL[i] = 0.;
nStep[i] = 0;
nGamma[i] = 0;
nElectron[i] = 0;
nPositron[i] = 0;
eMinGamma[i] = DBL_MAX;
eMinElectron[i] = DBL_MAX;
eMinPositron[i] = DBL_MAX;
for(size_t j=0;j<6;j++)
{
fullName = detName[i]+"/"+primNameSum[j];
colIDSum[i][j] = SDMan->GetCollectionID(fullName);
}
for(size_t k=0;k<3;k++)
{
fullName = detName[i]+"/"+primNameMin[k];
colIDMin[i][k] = SDMan->GetCollectionID(fullName);
}
}
}
@@ -58,33 +61,46 @@ void ExN07Run::RecordEvent(const G4Event* evt)
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
if(!HCE) return;
numberOfEvent++;
for(int j=0;j<6;j++)
{
nGamma[j] += ExN07StackingAction::GetNGamma(j);
nElectron[j] += ExN07StackingAction::GetNElectron(j);
nPositron[j] += ExN07StackingAction::GetNPositron(j);
if(eMinGamma[j]>ExN07StackingAction::GetEMinGamma(j))
{ eMinGamma[j] = ExN07StackingAction::GetEMinGamma(j); }
if(eMinElectron[j]>ExN07StackingAction::GetEMinElectron(j))
{ eMinElectron[j] = ExN07StackingAction::GetEMinElectron(j); }
if(eMinPositron[j]>ExN07StackingAction::GetEMinPositron(j))
{ eMinPositron[j] = ExN07StackingAction::GetEMinPositron(j); }
}
ExN07CalorHitsCollection* CHC = 0;
for(size_t i=0;i<6;i++)
{
if (HCE) CHC = (ExN07CalorHitsCollection*)(HCE->GetHC(i));
if (CHC)
for(size_t j=0;j<6;j++)
{
G4int nHit = CHC->entries();
for (G4int ii=0;ii<nHit;ii++)
G4THitsMap<G4double>* evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(colIDSum[i][j]));
mapSum[i][j] += *evtMap;
}
for(size_t k=0;k<3;k++)
{
G4THitsMap<G4double>* evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(colIDMin[i][k]));
std::map<G4int,G4double*>::iterator itr = evtMap->GetMap()->begin();
for(; itr != evtMap->GetMap()->end(); itr++)
{
totE[i] += (*CHC)[ii]->GetEdep();
totL[i] += (*CHC)[ii]->GetTrak();
nStep[i] += (*CHC)[ii]->GetNStep();
G4int key = (itr->first);
G4double val = *(itr->second);
G4double* mapP = mapMin[i][k][key];
if( mapP && (val>*mapP) ) continue;
mapMin[i][k].set(key,val);
}
}
}
}
G4double ExN07Run::GetTotal(const G4THitsMap<G4double> &map) const
{
G4double tot = 0.;
std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
for(; itr != map.GetMap()->end(); itr++)
{ tot += *(itr->second); }
return tot;
}
G4double ExN07Run::FindMinimum(const G4THitsMap<G4double> &map) const
{
G4double val = DBL_MAX;
std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
for(; itr != map.GetMap()->end(); itr++)
{ if(val>*(itr->second)) val = *(itr->second); }
return val;
}
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: ExN07RunAction.cc,v 1.3 2003/04/09 23:20:59 asaim Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: ExN07RunAction.cc,v 1.4 2005/11/22 22:20:55 asaim Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN07RunAction.hh"
@@ -1,97 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "ExN07StackingAction.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4TouchableHistory.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VProcess.hh"
G4int ExN07StackingAction::nGamma[6] = {0,0,0,0,0,0};
G4int ExN07StackingAction::nElectron[6] = {0,0,0,0,0,0};
G4int ExN07StackingAction::nPositron[6] = {0,0,0,0,0,0};
G4double ExN07StackingAction::eMinGamma[6] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX};
G4double ExN07StackingAction::eMinElectron[6] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX};
G4double ExN07StackingAction::eMinPositron[6] = {DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX,DBL_MAX};
ExN07StackingAction::ExN07StackingAction()
{;}
ExN07StackingAction::~ExN07StackingAction()
{;}
G4ClassificationOfNewTrack
ExN07StackingAction::ClassifyNewTrack(const G4Track * aTrack)
{
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aTrack->GetTouchable());
if(theTouchable&&theTouchable->GetHistoryDepth()>1)
{
G4VPhysicalVolume* calPhys = theTouchable->GetVolume(1);
if(calPhys)
{
G4int i = 0;
if(calPhys->GetName()=="Cal-B") { i = 2; }
else if(calPhys->GetName()=="Cal-C") { i = 4; }
G4int layerNumber = theTouchable->GetReplicaNumber();
i += layerNumber%2;
G4ParticleDefinition * particleType = aTrack->GetDefinition();
if(particleType==G4Gamma::GammaDefinition())
{
nGamma[i]++;
if(eMinGamma[i]>aTrack->GetKineticEnergy())
{ eMinGamma[i]=aTrack->GetKineticEnergy(); }
}
else if(particleType==G4Electron::ElectronDefinition())
{
nElectron[i]++;
if(eMinElectron[i]>aTrack->GetKineticEnergy())
{ eMinElectron[i]=aTrack->GetKineticEnergy(); }
}
else if(particleType==G4Positron::PositronDefinition())
{
nPositron[i]++;
if(eMinPositron[i]>aTrack->GetKineticEnergy())
{ eMinPositron[i]=aTrack->GetKineticEnergy(); }
}
}
}
return fUrgent;
}
void ExN07StackingAction::PrepareNewEvent()
{
for(int i=0;i<6;i++)
{
nGamma[i] = 0;
nElectron[i] = 0;
nPositron[i] = 0;
eMinGamma[i] = DBL_MAX;
eMinElectron[i] = DBL_MAX;
eMinPositron[i] = DBL_MAX;
}
}