Import Geant4 5.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:15:15 +02:00
parent 37fff30d2e
commit fbd4999cf7
4396 changed files with 56662 additions and 52446 deletions
+64
View File
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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.1 2003/03/10 01:43:36 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07CalorHit.hh"
G4Allocator<ExN07CalorHit> ExN07CalorHitAllocator;
ExN07CalorHit::ExN07CalorHit()
:Edep(0.),TrackLength(0.),nStep(0)
{;}
ExN07CalorHit::~ExN07CalorHit()
{;}
ExN07CalorHit::ExN07CalorHit(const ExN07CalorHit& right)
{
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 0;
}
void ExN07CalorHit::Draw()
{;}
void ExN07CalorHit::Print()
{;}
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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.1 2003/03/10 01:43:36 asaim Exp $
// GEANT4 tag $Name: geant4-05-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* ROhist)
{
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* HCE)
{;}
void ExN07CalorimeterSD::clear()
{;}
void ExN07CalorimeterSD::DrawAll()
{;}
void ExN07CalorimeterSD::PrintAll()
{;}
@@ -0,0 +1,332 @@
//
// ********************************************************************
// * 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: ExN07DetectorConstruction.cc,v 1.3 2003/04/08 15:47:00 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
#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 "G4VisAttributes.hh"
#include "G4Colour.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)
{
for(size_t i=0;i<3;i++)
{
calorLogical[i] = 0;
layerLogical[i] = 0;
calorPhysical[i] = 0;
layerPhysical[i] = 0;
}
gapParam = new ExN07GapParameterisation;
gapParam->SetNumberOfLayers(numberOfLayers);
ExN07CalorimeterSD::SetNumberOfLayers(numberOfLayers);
DefineMaterials();
detectorMessenger = new ExN07DetectorMessenger(this);
}
ExN07DetectorConstruction::~ExN07DetectorConstruction()
{ delete detectorMessenger;}
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 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);
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);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials of the calorimeter
worldMaterial = Vacuum;
absorberMaterial = Pb;
gapMaterial = lAr;
gapParam->SetAbsorberMaterial(absorberMaterial);
gapParam->SetGapMaterial(gapMaterial);
}
G4VPhysicalVolume* ExN07DetectorConstruction::Construct()
{
//
// World
//
G4VSolid* worldSolid = new G4Box("World",2.*m,2.*m,4.*m);
worldLogical = new G4LogicalVolume(worldSolid,worldMaterial,"World");
worldPhysical = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
0,false,0);
//
// Calorimeter
//
G4VSolid* calorSolid = new G4Box("Calor",0.5*m,0.5*m,1.*m);
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]);
if(serial)
{
calorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,0.,G4double(i-1)*2.*m),
calorLogical[i],calNam[i],worldLogical,false,i);
}
else
{
calorPhysical[i] = new G4PVPlacement(0,
G4ThreeVector(0.,G4double(i-1)*m,0.),
calorLogical[i],calNam[i],worldLogical,false,i);
}
}
//
// Layers -- material is parameterised
//
gapSolid = new G4Box("Gap",0.5*m,0.5*m,1.*m/G4double(2*numberOfLayers));
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);
}
//
// Regions
//
G4String regName[] = {"Calor-A","Calor-B","Calor-C"};
for(i=0;i<3;i++)
{
G4Region* aRegion = new G4Region(regName[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
//
worldLogical->SetVisAttributes(G4VisAttributes::Invisible);
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
for(i=0;i<3;i++)
{
calorLogical[i]->SetVisAttributes(simpleBoxVisAtt);
layerLogical[i]->SetVisAttributes(simpleBoxVisAtt);
}
PrintCalorParameters();
return worldPhysical;
}
void ExN07DetectorConstruction::PrintCalorParameters() const
{
G4cout << "--------------------------------------------------------" << G4endl;
if(serial)
{ G4cout << " Calorimeters are placed in serial." << G4endl; }
else
{ G4cout << " Calorimeters are placed in parallel." << G4endl; }
G4cout << " Absorber is made of " << absorberMaterial->GetName() << G4endl;
G4cout << " Gap is made of " << gapMaterial->GetName() << G4endl;
G4cout << "--------------------------------------------------------" << G4endl;
}
void ExN07DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if(pttoMaterial)
{
absorberMaterial = pttoMaterial;
gapParam->SetAbsorberMaterial(pttoMaterial);
for(size_t i=0;i<3;i++)
{
calorLogical[i]->SetMaterial(absorberMaterial);
layerLogical[i]->SetMaterial(absorberMaterial);
}
}
else
{ G4cerr << materialChoice << " is not defined. - Command is ignored." << G4endl; }
}
G4String ExN07DetectorConstruction::GetAbsorberMaterial() const
{ return absorberMaterial->GetName(); }
void ExN07DetectorConstruction::SetGapMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if(pttoMaterial)
{
gapMaterial = pttoMaterial;
gapParam->SetGapMaterial(pttoMaterial);
}
else
{ G4cerr << materialChoice << " is not defined. - Command is ignored." << G4endl; }
}
G4String ExN07DetectorConstruction::GetGapMaterial() const
{ return gapMaterial->GetName(); }
void ExN07DetectorConstruction::SetSerialGeometry(G4bool ser)
{
if(serial==ser) return;
serial=ser;
for(G4int i=0;i<3;i++)
{
if(serial)
{ calorPhysical[i]->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m)); }
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);
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);
}
ExN07CalorimeterSD::SetNumberOfLayers(nl);
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * 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: ExN07DetectorMessenger.cc,v 1.2 2003/04/08 15:47:00 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07DetectorMessenger.hh"
#include "ExN07DetectorConstruction.hh"
#include "ExN07EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4Material.hh"
ExN07DetectorMessenger::ExN07DetectorMessenger(
ExN07DetectorConstruction* ExN07Det)
:ExN07Detector(ExN07Det)
{
N07Dir = new G4UIdirectory("/N07/");
N07Dir->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 += " ";
}
AbsMaterCmd = new G4UIcmdWithAString("/N07/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",false);
AbsMaterCmd->AvailableForStates(G4State_Idle);
AbsMaterCmd->SetCandidates(matList);
GapMaterCmd = new G4UIcmdWithAString("/N07/setGapMat",this);
GapMaterCmd->SetGuidance("Select Material of the Gap.");
GapMaterCmd->SetParameterName("choice",false);
GapMaterCmd->AvailableForStates(G4State_Idle);
GapMaterCmd->SetCandidates(matList);
numLayerCmd = new G4UIcmdWithAnInteger("/N07/numberOfLayers",this);
numLayerCmd->SetGuidance("Set number of layers.");
numLayerCmd->SetParameterName("nl",false);
numLayerCmd->AvailableForStates(G4State_Idle);
numLayerCmd->SetRange("nl>0");
SerialCmd = new G4UIcmdWithABool("/N07/serialGeometry",this);
SerialCmd->SetGuidance("Select calorimeters to be placed in serial or parallel.");
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 AbsMaterCmd;
delete GapMaterCmd;
delete numLayerCmd;
delete SerialCmd;
delete verboseCmd;
delete N07Dir;
}
void ExN07DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AbsMaterCmd )
{ ExN07Detector->SetAbsorberMaterial(newValue);}
else if( command == GapMaterCmd )
{ ExN07Detector->SetGapMaterial(newValue);}
else if( command == numLayerCmd )
{ ExN07Detector->SetNumberOfLayers(numLayerCmd->GetNewIntValue(newValue));}
else if( command == SerialCmd )
{ ExN07Detector->SetSerialGeometry(SerialCmd->GetNewBoolValue(newValue));}
else if( command == verboseCmd )
{ ExN07EventAction::SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));}
}
G4String ExN07DetectorMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String ans;
if( command == AbsMaterCmd )
{ ans=ExN07Detector->GetAbsorberMaterial(); }
else if( command == GapMaterCmd )
{ ans=ExN07Detector->GetGapMaterial(); }
else if( command == numLayerCmd )
{ 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
@@ -0,0 +1,149 @@
//
// ********************************************************************
// * 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.3 2003/04/08 15:47:01 asaim Exp $
// GEANT4 tag $Name: geant4-05-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* evt)
{
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 : " << G4std::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 << G4std::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- : " << G4std::setw(7)
<< G4BestUnit(totL,"Length") << G4endl;
G4cout
<< " number of steps of e+/e- : " << nStep
<< G4endl;
}
}
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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.1 2003/03/10 01:43:36 asaim Exp $
// GEANT4 tag $Name: geant4-05-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* physVol)
{
if(copyNo%2==0) { return absMaterial; }
return gapMaterial;
}
+286
View File
@@ -0,0 +1,286 @@
//
// ********************************************************************
// * 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: ExN07PhysicsList.cc,v 1.2 2003/04/09 23:20:59 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4ios.hh"
ExN07PhysicsList::ExN07PhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1.0*mm;
SetVerboseLevel(1);
}
ExN07PhysicsList::~ExN07PhysicsList()
{}
void ExN07PhysicsList::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();
}
void ExN07PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
}
void ExN07PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void ExN07PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
void ExN07PhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void ExN07PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
void ExN07PhysicsList::ConstructEM()
{
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
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
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);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
} else if (particleName == "e+") {
//positron
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
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);
//
// 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
G4VProcess* aMultipleScattering = new G4MultipleScattering();
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);
//
// 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
G4VProcess* aMultipleScattering = new G4MultipleScattering();
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"
void ExN07PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4ProductionCuts.hh"
void ExN07PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "ExN07PhysicsList::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.;
}
}
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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: ExN07PrimaryGeneratorAction.cc,v 1.1 2003/03/10 01:43:36 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
ExN07PrimaryGeneratorAction::ExN07PrimaryGeneratorAction()
:serial(false)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(100.*GeV);
}
ExN07PrimaryGeneratorAction::~ExN07PrimaryGeneratorAction()
{
delete particleGun;
}
void ExN07PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(serial)
{
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-3.5*m));
particleGun->GeneratePrimaryVertex(anEvent);
}
else
{
for(G4int i=0;i<3;i++)
{
particleGun->SetParticlePosition(G4ThreeVector(0.,G4double(i-1)*m,-1.5*m));
particleGun->GeneratePrimaryVertex(anEvent);
}
}
}
+90
View File
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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: ExN07Run.cc,v 1.3 2003/04/09 23:20:59 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07Run.hh"
#include "ExN07CalorHit.hh"
#include "ExN07StackingAction.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
G4Allocator<ExN07Run> anExN07RunAllocator;
ExN07Run::ExN07Run()
{
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;
}
}
ExN07Run::~ExN07Run()
{;}
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)
{
G4int nHit = CHC->entries();
for (G4int ii=0;ii<nHit;ii++)
{
totE[i] += (*CHC)[ii]->GetEdep();
totL[i] += (*CHC)[ii]->GetTrak();
nStep[i] += (*CHC)[ii]->GetNStep();
}
}
}
}
+107
View File
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * 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: ExN07RunAction.cc,v 1.3 2003/04/09 23:20:59 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#include "ExN07RunAction.hh"
#include "ExN07Run.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4ProductionCuts.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
ExN07RunAction::ExN07RunAction()
{;}
ExN07RunAction::~ExN07RunAction()
{;}
G4Run* ExN07RunAction::GenerateRun()
{ return new ExN07Run; }
void ExN07RunAction::EndOfRunAction(const G4Run* aRun)
{
static G4String regName[3] = {"Calor-A","Calor-B","Calor-C"};
const ExN07Run* theRun = (const ExN07Run*)aRun;
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;
}
}
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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;
}
}
+145
View File
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * 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: ExN07VisManager.cc,v 1.1 2003/03/10 01:43:37 asaim Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
#ifdef G4VIS_USE
#include "ExN07VisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4HepRepFile.hh"
#include "G4HepRep.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
ExN07VisManager::ExN07VisManager () {}
void ExN07VisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4HepRep);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif