Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// 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: Em3CalorHit.cc,v 1.1.4.1 1999/12/07 20:47:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3CalorHit.hh"
|
||||
|
||||
G4Allocator<Em3CalorHit> Em3CalorHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3CalorHit::Em3CalorHit()
|
||||
{
|
||||
for (G4int i=0; i<MaxAbsor; i++)
|
||||
{ EdepAbs[i] = TrackLengthAbs[i] = 0.;}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3CalorHit::~Em3CalorHit()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3CalorHit::Em3CalorHit(const Em3CalorHit& right)
|
||||
{
|
||||
for (G4int i=0; i<MaxAbsor; i++)
|
||||
{ EdepAbs[i] = right.EdepAbs[i];
|
||||
TrackLengthAbs[i] = right.TrackLengthAbs[i];}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const Em3CalorHit& Em3CalorHit::operator=(const Em3CalorHit& right)
|
||||
{
|
||||
for (G4int i=0; i<MaxAbsor; i++)
|
||||
{ EdepAbs[i] = right.EdepAbs[i];
|
||||
TrackLengthAbs[i] = right.TrackLengthAbs[i];}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
int Em3CalorHit::operator==(const Em3CalorHit& right) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorHit::Draw()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorHit::Print()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
// 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: Em3CalorimeterSD.cc,v 1.1.4.1 1999/12/07 20:47:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3CalorimeterSD.hh"
|
||||
|
||||
#include "Em3CalorHit.hh"
|
||||
#include "Em3DetectorConstruction.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3CalorimeterSD::Em3CalorimeterSD(G4String name,
|
||||
Em3DetectorConstruction* det)
|
||||
:G4VSensitiveDetector(name),Detector(det)
|
||||
{
|
||||
collectionName.insert("CalCollection");
|
||||
HitID = new G4int[500];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3CalorimeterSD::~Em3CalorimeterSD()
|
||||
{
|
||||
delete [] HitID;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorimeterSD::Initialize(G4HCofThisEvent*HCE)
|
||||
{
|
||||
CalCollection = new Em3CalorHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
for (G4int j=0;j<Detector->GetNbOfLayers();j++) {HitID[j] = -1;};
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool Em3CalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if ((edep==0.)&&(stepl==0.)) return false;
|
||||
|
||||
G4TouchableHistory* theTouchable
|
||||
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
|
||||
//theTouchable->MoveUpHistory();
|
||||
G4int LayerNumber = 0;
|
||||
if (Detector->GetNbOfLayers()>1) LayerNumber=theTouchable->GetReplicaNumber(1);
|
||||
G4int AbsorNo = physVol->GetCopyNo();
|
||||
|
||||
if (HitID[LayerNumber]==-1)
|
||||
{
|
||||
Em3CalorHit* calHit = new Em3CalorHit();
|
||||
calHit->AddAbs(AbsorNo,edep,stepl);
|
||||
HitID[LayerNumber] = CalCollection->insert(calHit) - 1;
|
||||
if (verboseLevel>0)
|
||||
G4cout << " New Calorimeter Hit on layer: " << LayerNumber << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*CalCollection)[HitID[LayerNumber]]->AddAbs(AbsorNo,edep,stepl);
|
||||
if (verboseLevel>0)
|
||||
G4cout << " Energy added to Layer: " << LayerNumber << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection(HCID,CalCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorimeterSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorimeterSD::DrawAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3CalorimeterSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,495 @@
|
||||
// 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: Em3DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:47:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3DetectorConstruction.hh"
|
||||
#include "Em3DetectorMessenger.hh"
|
||||
|
||||
#include "Em3CalorimeterSD.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3DetectorConstruction::Em3DetectorConstruction()
|
||||
:solidWorld(NULL),logicWorld(NULL),physiWorld(NULL),
|
||||
solidCalor(NULL),logicCalor(NULL),physiCalor(NULL),
|
||||
solidLayer(NULL),logicLayer(NULL),physiLayer(NULL),
|
||||
defaultMaterial(NULL),
|
||||
magField(NULL),calorimeterSD(NULL)
|
||||
{
|
||||
for (G4int i=0; i<MaxAbsor; i++)
|
||||
{
|
||||
AbsorMaterial[i]=NULL; AbsorThickness[i]=0.;
|
||||
solidAbsor[i]=NULL;logicAbsor[i]=NULL;physiAbsor[i]=NULL;
|
||||
}
|
||||
//
|
||||
// default parameter values of the calorimeter
|
||||
NbOfAbsor = 2;
|
||||
AbsorThickness[0] = 2.3*mm;
|
||||
AbsorThickness[1] = 5.7*mm;
|
||||
NbOfLayers = 50;
|
||||
CalorSizeYZ = 40.*cm;
|
||||
ComputeCalorParameters();
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
detectorMessenger = new Em3DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3DetectorConstruction::~Em3DetectorConstruction()
|
||||
{ delete detectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* Em3DetectorConstruction::Construct()
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructCalorimeter();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
//This function illustrates the possible ways to define materials
|
||||
|
||||
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);
|
||||
|
||||
a = 28.09*g/mole;
|
||||
G4Element* Si = new G4Element(name="Silicon",symbol="Si" , z= 14., 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
|
||||
//
|
||||
|
||||
density = 2.700*g/cm3;
|
||||
a = 26.98*g/mole;
|
||||
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
|
||||
|
||||
density = 1.390*g/cm3;
|
||||
a = 39.95*g/mole;
|
||||
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
|
||||
|
||||
density = 7.700*g/cm3;
|
||||
a = 55.85*g/mole;
|
||||
G4Material* Fe = new G4Material(name="Iron" , z=26., a, density);
|
||||
|
||||
density = 8.960*g/cm3;
|
||||
a = 63.55*g/mole;
|
||||
G4Material* Cu = new G4Material(name="Copper" , z=29., a, density);
|
||||
|
||||
density = 19.30*g/cm3;
|
||||
a = 183.85*g/mole;
|
||||
G4Material* W = new G4Material(name="Tungsten" , z=74., a, density);
|
||||
|
||||
density = 11.35*g/cm3;
|
||||
a = 207.19*g/mole;
|
||||
G4Material* Pb = new G4Material(name="Lead" , z=82., a, density);
|
||||
|
||||
density = 18.95*g/cm3;
|
||||
a = 238.03*g/mole;
|
||||
G4Material* Ur = new G4Material(name="Uranium" , z=92., 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);
|
||||
|
||||
density = 2.330*g/cm3;
|
||||
G4Material* Sili = new G4Material(name="Silicium", density, ncomponents=1);
|
||||
Sili->AddElement(Si, natoms=1);
|
||||
|
||||
density = 2.200*g/cm3;
|
||||
G4Material* SiO2 = new G4Material(name="quartz", density, ncomponents=2);
|
||||
SiO2->AddElement(Si, natoms=1);
|
||||
SiO2->AddElement(O , natoms=2);
|
||||
|
||||
density = 1.700*g/cm3;
|
||||
G4Material* G10 = new G4Material(name="NemaG10", density, ncomponents=4);
|
||||
G10->AddElement(Si, natoms=1);
|
||||
G10->AddElement(O , natoms=2);
|
||||
G10->AddElement(C , natoms=3);
|
||||
G10->AddElement(H , natoms=3);
|
||||
|
||||
|
||||
//
|
||||
// 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);
|
||||
|
||||
//
|
||||
// define a material from elements and/or others materials (mixture of mixtures)
|
||||
//
|
||||
|
||||
density = 0.200*g/cm3;
|
||||
G4Material* Aerog = new G4Material(name="Aerogel", density, 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
|
||||
//
|
||||
|
||||
density = 27.*mg/cm3;
|
||||
pressure = 50.*atmosphere;
|
||||
temperature = 325.*kelvin;
|
||||
G4Material* CO2 = new G4Material(name="CarbonicGas", density, ncomponents=2,
|
||||
kStateGas,temperature,pressure);
|
||||
CO2->AddElement(C, natoms=1);
|
||||
CO2->AddElement(O, natoms=2);
|
||||
|
||||
density = 0.3*mg/cm3;
|
||||
pressure = 2.*atmosphere;
|
||||
temperature = 500.*kelvin;
|
||||
G4Material* steam = new G4Material(name="WaterSteam", density, ncomponents=1,
|
||||
kStateGas,temperature,pressure);
|
||||
steam->AddMaterial(H2O, fractionmass=1.);
|
||||
|
||||
//
|
||||
// examples of vacuum
|
||||
//
|
||||
|
||||
density = universe_mean_density; //from PhysicalConstants.h
|
||||
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);
|
||||
|
||||
density = 1.e-5*g/cm3;
|
||||
pressure = 2.e-2*bar;
|
||||
temperature = STP_Temperature; //from PhysicalConstants.h
|
||||
G4Material* beam = new G4Material(name="Beam", density, ncomponents=1,
|
||||
kStateGas,temperature,pressure);
|
||||
beam->AddMaterial(Air, fractionmass=1.);
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << endl;
|
||||
|
||||
//default materials of the calorimeter
|
||||
AbsorMaterial[0] = Pb;
|
||||
AbsorMaterial[1] = lAr;
|
||||
defaultMaterial = vacuum;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* Em3DetectorConstruction::ConstructCalorimeter()
|
||||
{
|
||||
// complete the Calor parameters definition
|
||||
ComputeCalorParameters();
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
solidWorld = new G4Box("World", //its name
|
||||
WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size
|
||||
|
||||
logicWorld = new G4LogicalVolume(solidWorld, //its solid
|
||||
defaultMaterial, //its material
|
||||
"World"); //its name
|
||||
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"World", //its name
|
||||
logicWorld, //its logical volume
|
||||
NULL, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
solidCalor=NULL; logicCalor=NULL; physiCalor=NULL;
|
||||
|
||||
solidCalor = new G4Box("Calorimeter", //its name
|
||||
CalorThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);//size
|
||||
|
||||
logicCalor = new G4LogicalVolume(solidCalor, //its solid
|
||||
defaultMaterial, //its material
|
||||
"Calorimeter"); //its name
|
||||
|
||||
physiCalor = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"Calorimeter", //its name
|
||||
logicCalor, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Layers
|
||||
//
|
||||
solidLayer=NULL; logicLayer=NULL; physiLayer=NULL;
|
||||
|
||||
solidLayer = new G4Box("Layer", //its name
|
||||
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
|
||||
physiCalor, //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)
|
||||
"Layer", //its name
|
||||
logicLayer, //its logical volume
|
||||
physiCalor, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Absorbers
|
||||
//
|
||||
for (G4int j=0; j<MaxAbsor; j++)
|
||||
{ solidAbsor[j]=NULL; logicAbsor[j]=NULL; physiAbsor[j]=NULL;}
|
||||
|
||||
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);
|
||||
|
||||
logicAbsor[k] = new G4LogicalVolume(solidAbsor[k], //its solid
|
||||
AbsorMaterial[k], //its material
|
||||
"Absorber"); //its name
|
||||
|
||||
G4double xcenter = xfront+0.5*AbsorThickness[k];
|
||||
xfront += AbsorThickness[k];
|
||||
physiAbsor[k] = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(xcenter,0.,0.), //its position
|
||||
"Absorber", //its name
|
||||
logicAbsor[k], //its logical volume
|
||||
physiLayer, //its mother
|
||||
false, //no boulean operat
|
||||
k); //copy number
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Sensitive Detectors: all Absorbers
|
||||
//
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
if(!calorimeterSD)
|
||||
{
|
||||
calorimeterSD = new Em3CalorimeterSD("CalorSD",this);
|
||||
SDman->AddNewDetector( calorimeterSD );
|
||||
}
|
||||
for (G4int l=0; l<NbOfAbsor; l++)
|
||||
logicAbsor[l]->SetSensitiveDetector(calorimeterSD);
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
////logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
logicCalor->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
PrintCalorParameters();
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::PrintCalorParameters()
|
||||
{
|
||||
G4cout << "\n-------------------------------------------------------------"
|
||||
<< "\n ---> The calorimeter is " << NbOfLayers << " layers of:";
|
||||
for (G4int i=0; i<NbOfAbsor; i++)
|
||||
{
|
||||
G4cout << "\n \t" << setw(12) << AbsorMaterial[i]->GetName() <<": "
|
||||
<< setw(6) << G4BestUnit(AbsorThickness[i],"Length");
|
||||
}
|
||||
G4cout << "\n-------------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::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" << endl;
|
||||
return;
|
||||
}
|
||||
NbOfAbsor = ival;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::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" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(material);
|
||||
if (pttoMaterial) AbsorMaterial[ival] = pttoMaterial;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::SetAbsorThickness(G4int ival,G4double val)
|
||||
{
|
||||
// change Absorber thickness
|
||||
//
|
||||
if (ival >= NbOfAbsor)
|
||||
{ G4cout << "\n --->warning from SetAbsorThickness: absor number "
|
||||
<< ival << " out of range. Command refused" << endl;
|
||||
return;
|
||||
}
|
||||
if (val <= DBL_MIN)
|
||||
{ G4cout << "\n --->warning from SetAbsorThickness: thickness "
|
||||
<< val << " out of range. Command refused" << endl;
|
||||
return;
|
||||
}
|
||||
AbsorThickness[ival] = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size
|
||||
//
|
||||
if (val <= DBL_MIN)
|
||||
{ G4cout << "\n --->warning from SetCalorSizeYZ: thickness "
|
||||
<< val << " out of range. Command refused" << endl;
|
||||
return;
|
||||
}
|
||||
CalorSizeYZ = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::SetNbOfLayers(G4int ival)
|
||||
{
|
||||
// set the number of Layers
|
||||
//
|
||||
if (ival < 1)
|
||||
{ G4cout << "\n --->warning from SetNbOfLayers: "
|
||||
<< ival << " must be at least 1. Command refused" << endl;
|
||||
return;
|
||||
}
|
||||
NbOfLayers = ival;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::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 = NULL;
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,141 @@
|
||||
// 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: Em3DetectorMessenger.cc,v 1.1.4.1 1999/12/07 20:47:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3DetectorMessenger.hh"
|
||||
|
||||
#include "Em3DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3DetectorMessenger::Em3DetectorMessenger(Em3DetectorConstruction * Em3Det)
|
||||
:Em3Detector(Em3Det)
|
||||
{
|
||||
Em3detDir = new G4UIdirectory("/calor/");
|
||||
Em3detDir->SetGuidance("Em3 detector control.");
|
||||
|
||||
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setSizeYZ",this);
|
||||
SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
|
||||
SizeYZCmd->SetParameterName("Size",false);
|
||||
SizeYZCmd->SetRange("Size>0.");
|
||||
SizeYZCmd->SetUnitCategory("Length");
|
||||
SizeYZCmd->AvailableForStates(Idle);
|
||||
|
||||
NbLayersCmd = new G4UIcmdWithAnInteger("/calor/setNbOfLayers",this);
|
||||
NbLayersCmd->SetGuidance("Set number of layers.");
|
||||
NbLayersCmd->SetParameterName("NbLayers",false);
|
||||
NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
|
||||
NbLayersCmd->AvailableForStates(Idle);
|
||||
|
||||
NbAbsorCmd = new G4UIcmdWithAnInteger("/calor/setNbOfAbsor",this);
|
||||
NbAbsorCmd->SetGuidance("Set number of Absorbers.");
|
||||
NbAbsorCmd->SetParameterName("NbAbsor",false);
|
||||
NbAbsorCmd->SetRange("NbAbsor>0");
|
||||
NbAbsorCmd->AvailableForStates(Idle);
|
||||
|
||||
AbsorCmd = new G4UIcommand("/calor/setAbsor",this);
|
||||
AbsorCmd->SetGuidance("Set the absor nb, the material, the thickness.");
|
||||
AbsorCmd->SetGuidance(" absor number : from 0 to NbOfAbsor-1");
|
||||
AbsorCmd->SetGuidance(" material name");
|
||||
AbsorCmd->SetGuidance(" thickness (with unit) : t>0.");
|
||||
//
|
||||
G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
|
||||
AbsNbPrm->SetGuidance("absor number : from 0 to NbOfAbsor-1");
|
||||
AbsNbPrm->SetParameterRange("AbsorNb>=0");
|
||||
AbsorCmd->SetParameter(AbsNbPrm);
|
||||
//
|
||||
G4UIparameter* MatPrm = new G4UIparameter("material",'s',false);
|
||||
MatPrm->SetGuidance("material name");
|
||||
AbsorCmd->SetParameter(MatPrm);
|
||||
//
|
||||
G4UIparameter* ThickPrm = new G4UIparameter("thickness",'d',false);
|
||||
ThickPrm->SetGuidance("thickness of absorber");
|
||||
ThickPrm->SetParameterRange("thickness>0.");
|
||||
AbsorCmd->SetParameter(ThickPrm);
|
||||
//
|
||||
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',false);
|
||||
unitPrm->SetGuidance("unit of thickness");
|
||||
G4String unitCandidates = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
|
||||
unitPrm->SetParameterCandidates(unitCandidates);
|
||||
AbsorCmd->SetParameter(unitPrm);
|
||||
//
|
||||
AbsorCmd->AvailableForStates(Idle);
|
||||
|
||||
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
|
||||
MagFieldCmd->SetGuidance("Define magnetic field.");
|
||||
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
|
||||
MagFieldCmd->SetParameterName("Bz",false);
|
||||
MagFieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
MagFieldCmd->AvailableForStates(Idle);
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
|
||||
UpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->AvailableForStates(Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3DetectorMessenger::~Em3DetectorMessenger()
|
||||
{
|
||||
delete SizeYZCmd;
|
||||
delete NbLayersCmd;
|
||||
delete NbAbsorCmd;
|
||||
delete AbsorCmd;
|
||||
delete MagFieldCmd;
|
||||
delete UpdateCmd;
|
||||
delete Em3detDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == SizeYZCmd )
|
||||
{ Em3Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == NbLayersCmd )
|
||||
{ Em3Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == NbAbsorCmd )
|
||||
{ Em3Detector->SetNbOfAbsor(NbAbsorCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if (command == AbsorCmd)
|
||||
{
|
||||
G4int num; G4double tick;
|
||||
char mat[30],unts[30];
|
||||
const char* t = newValue;
|
||||
istrstream is((char*)t);
|
||||
is >> num >> mat >> tick >> unts;
|
||||
G4String material=mat, unt=unts;
|
||||
tick *= G4UIcommand::ValueOf(unt);
|
||||
Em3Detector->SetAbsorMaterial (num,material);
|
||||
Em3Detector->SetAbsorThickness(num,tick);
|
||||
}
|
||||
|
||||
if( command == MagFieldCmd )
|
||||
{ Em3Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ Em3Detector->UpdateGeometry();}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,136 @@
|
||||
// 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: Em3EventAction.cc,v 1.1.2.1.2.1 1999/12/07 20:47:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3EventAction.hh"
|
||||
|
||||
#include "Em3RunAction.hh"
|
||||
#include "Em3DetectorConstruction.hh"
|
||||
#include "Em3CalorHit.hh"
|
||||
#include "Em3EventActionMessenger.hh"
|
||||
|
||||
#include "g4rw/tvordvec.h"
|
||||
|
||||
#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"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "CLHEP/Hist/HBookFile.h"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3EventAction::Em3EventAction(Em3RunAction* run, Em3DetectorConstruction* det)
|
||||
:Em3Run(run),Detector(det),calorimeterCollID(-1),drawFlag("all"),
|
||||
eventMessenger(NULL),printModulo(10000)
|
||||
{
|
||||
eventMessenger = new Em3EventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3EventAction::~Em3EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
G4cout << "\n---> Begin Of Event: " << evtNb << endl;
|
||||
|
||||
if (calorimeterCollID==-1)
|
||||
{
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
calorimeterCollID = SDman->GetCollectionID("CalCollection");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
Em3CalorHitsCollection* CHC = NULL;
|
||||
G4int NbHits=0;
|
||||
G4int NbOfAbsor=Detector->GetNbOfAbsor();
|
||||
G4double totEAbs, totLAbs;
|
||||
HepTuple* ntuple=Em3Run->GetnTuple();
|
||||
char str1[6], str2[6];
|
||||
strcpy(str1,"EAbs");strcpy(str2,"LAbs");
|
||||
|
||||
if (HCE) CHC = (Em3CalorHitsCollection*)(HCE->GetHC(calorimeterCollID));
|
||||
|
||||
if (CHC)
|
||||
{
|
||||
NbHits = CHC->entries();
|
||||
for (G4int k=0; k<NbOfAbsor; k++)
|
||||
{totEAbs=totLAbs=0.;
|
||||
for (G4int j=0;j<NbHits;j++)
|
||||
{
|
||||
totEAbs += (*CHC)[j]->GetEdepAbs(k);
|
||||
totLAbs += (*CHC)[j]->GetTrakAbs(k);
|
||||
}
|
||||
Em3Run->fillPerEvent(k,totEAbs,totLAbs);
|
||||
|
||||
//fill ntuple
|
||||
//
|
||||
str1[4] = str2[4] = (char)((int)('0') + k);
|
||||
ntuple->column(str1,totEAbs);
|
||||
ntuple->column(str2,totLAbs);
|
||||
}
|
||||
ntuple->dumpData();
|
||||
}
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
|
||||
for (G4int i=0; i<n_trajectories; i++)
|
||||
{ G4Trajectory* trj = (G4Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
|
||||
if (drawFlag == "all") trj->DrawTrajectory(50);
|
||||
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
|
||||
trj->DrawTrajectory(50);
|
||||
}
|
||||
}
|
||||
|
||||
//save rndm status
|
||||
if (Em3Run->GetRndmFreq() == 2)
|
||||
{
|
||||
HepRandom::saveEngineStatus("endOfEvent.rndm");
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
{
|
||||
G4cout << "\n---> End of Event: " << evtNb << endl;
|
||||
HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// 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: Em3EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3EventActionMessenger.hh"
|
||||
|
||||
#include "Em3EventAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3EventActionMessenger::Em3EventActionMessenger(Em3EventAction* EvAct)
|
||||
:eventAction(EvAct)
|
||||
{
|
||||
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
|
||||
DrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
DrawCmd->SetGuidance(" Choice : none, charged(default), all");
|
||||
DrawCmd->SetParameterName("choice",true);
|
||||
DrawCmd->SetDefaultValue("charged");
|
||||
DrawCmd->SetCandidates("none charged all");
|
||||
DrawCmd->AvailableForStates(Idle);
|
||||
|
||||
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
|
||||
PrintCmd->SetGuidance("Print events modulo n");
|
||||
PrintCmd->SetParameterName("EventNb",false);
|
||||
PrintCmd->SetRange("EventNb>0");
|
||||
PrintCmd->AvailableForStates(Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3EventActionMessenger::~Em3EventActionMessenger()
|
||||
{
|
||||
delete DrawCmd;
|
||||
delete PrintCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if(command == DrawCmd)
|
||||
{eventAction->SetDrawFlag(newValue);}
|
||||
|
||||
if(command == PrintCmd)
|
||||
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,237 @@
|
||||
// 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: Em3PhysicsList.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PhysicsList::Em3PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 0.5*mm;
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PhysicsList::~Em3PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::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();
|
||||
ConstructBarions();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4RhoZero::RhoZeroDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructBarions()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#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"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
//gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1,-1,3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1,-1,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
|
||||
pmanager->AddProcess(new G4hIonisation , -1,2,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void Em3PhysicsList::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "Em3PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(defaultCutValue, "gamma");
|
||||
SetCutValue(defaultCutValue, "e-");
|
||||
SetCutValue(defaultCutValue, "e+");
|
||||
|
||||
// set cut values for proton and anti_proton before all other hadrons
|
||||
// because some processes for hadrons need cut values for proton/anti_proton
|
||||
SetCutValue(defaultCutValue, "proton");
|
||||
SetCutValue(defaultCutValue, "anti_proton");
|
||||
|
||||
SetCutValueForOthers(defaultCutValue);
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// 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: Em3PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "Em3DetectorConstruction.hh"
|
||||
#include "Em3PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PrimaryGeneratorAction::Em3PrimaryGeneratorAction(
|
||||
Em3DetectorConstruction* Em3DC)
|
||||
:Em3Detector(Em3DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
SetDefaultKinematic();
|
||||
|
||||
//create a messenger for this class
|
||||
gunMessenger = new Em3PrimaryGeneratorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PrimaryGeneratorAction::~Em3PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PrimaryGeneratorAction::SetDefaultKinematic()
|
||||
{
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
particleGun->SetParticleEnergy(1.*GeV);
|
||||
G4double position = -0.5*(Em3Detector->GetWorldSizeX());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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: Em3PrimaryGeneratorMessenger.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "Em3PrimaryGeneratorAction.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PrimaryGeneratorMessenger::Em3PrimaryGeneratorMessenger(Em3PrimaryGeneratorAction* Em3Gun)
|
||||
:Em3Action(Em3Gun)
|
||||
{
|
||||
DefaultCmd = new G4UIcmdWithoutParameter("/gun/setDefault",this);
|
||||
DefaultCmd->SetGuidance("set/reset the kinematic defined in PrimaryGenerator");
|
||||
DefaultCmd->AvailableForStates(PreInit,Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3PrimaryGeneratorMessenger::~Em3PrimaryGeneratorMessenger()
|
||||
{
|
||||
delete DefaultCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command == DefaultCmd )
|
||||
{ Em3Action->SetDefaultKinematic();}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
// 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: Em3RunAction.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3RunAction.hh"
|
||||
#include "Em3RunActionMessenger.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "CLHEP/Hist/HBookFile.h"
|
||||
|
||||
#include <iomanip.h>
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3RunAction::Em3RunAction(Em3DetectorConstruction* det)
|
||||
:Detector(det)
|
||||
{
|
||||
bookHisto();
|
||||
runMessenger = new Em3RunActionMessenger(this);
|
||||
saveFlag = "off";
|
||||
saveRndm = 1;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3RunAction::~Em3RunAction()
|
||||
{
|
||||
// Delete HBOOK stuff
|
||||
delete ntuple;
|
||||
delete hbookManager;
|
||||
delete runMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3RunAction::bookHisto()
|
||||
{
|
||||
// init hbook
|
||||
hbookManager = new HBookFile("TestEm3.ntupl", 68);
|
||||
|
||||
// book a ntuple
|
||||
ntuple = hbookManager->ntuple("sum per event");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm > 0)
|
||||
{ HepRandom::showEngineStatus();
|
||||
HepRandom::saveEngineStatus("beginOfRun.rndm");
|
||||
}
|
||||
|
||||
//initialize cumulative quantities
|
||||
//
|
||||
for (G4int k=0; k<MaxAbsor; k++)
|
||||
sumEAbs[k]=sum2EAbs[k]=sumLAbs[k]=sum2LAbs[k]=0.;
|
||||
|
||||
//drawing
|
||||
//
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
UI->ApplyCommand("/vis/clear/view");
|
||||
UI->ApplyCommand("/vis/draw/current");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
|
||||
|
||||
//compute and print statistic
|
||||
//
|
||||
G4int NbOfEvents = aRun->GetNumberOfEvent();
|
||||
G4double norme = 1./NbOfEvents;
|
||||
|
||||
G4double MeanEAbs,rmsEAbs,MeanLAbs,rmsLAbs;
|
||||
|
||||
G4long oldform = G4cout.setf(ios::fixed,ios::floatfield);
|
||||
G4int oldprec = G4cout.precision(2);
|
||||
|
||||
G4cout << "\n-------------------------------------------------------------\n"
|
||||
<< setw(51) << "total energy dep" << setw(30) << "total tracklen \n \n";
|
||||
|
||||
for (G4int k=0; k<Detector->GetNbOfAbsor(); k++)
|
||||
{
|
||||
MeanEAbs = norme*sumEAbs[k];
|
||||
rmsEAbs = norme*sqrt(abs(NbOfEvents*sum2EAbs[k] - sumEAbs[k]*sumEAbs[k]));
|
||||
|
||||
MeanLAbs = norme*sumLAbs[k];
|
||||
rmsLAbs = norme*sqrt(abs(NbOfEvents*sum2LAbs[k] - sumLAbs[k]*sumLAbs[k]));
|
||||
|
||||
//print
|
||||
//
|
||||
G4cout
|
||||
<< " Absorber" << k
|
||||
<< " (" << setw(12) << Detector->GetAbsorMaterial(k)->GetName() << ") :"
|
||||
<< setw( 7) << G4BestUnit(MeanEAbs,"Energy") << " +- "
|
||||
<< setw( 5) << G4BestUnit( rmsEAbs,"Energy")
|
||||
<< setw(12) << G4BestUnit(MeanLAbs,"Length") << " +- "
|
||||
<< setw( 5) << G4BestUnit( rmsLAbs,"Length")
|
||||
<< endl;
|
||||
}
|
||||
|
||||
G4cout << "\n-------------------------------------------------------------";
|
||||
G4cout << endl;
|
||||
G4cout.setf(oldform,ios::floatfield);
|
||||
G4cout.precision(oldprec);
|
||||
|
||||
// Write histogram file
|
||||
if (saveFlag == "on") hbookManager->write();
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm == 1)
|
||||
{ HepRandom::showEngineStatus();
|
||||
HepRandom::saveEngineStatus("endOfRun.rndm");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,83 @@
|
||||
// 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: Em3RunActionMessenger.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3RunActionMessenger.hh"
|
||||
|
||||
#include "Em3RunAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3RunActionMessenger::Em3RunActionMessenger(Em3RunAction* run)
|
||||
:Em3Run(run)
|
||||
{
|
||||
SaveCmd = new G4UIcmdWithAString("/run/save",this);
|
||||
SaveCmd->SetGuidance("Save run statistic");
|
||||
SaveCmd->SetGuidance(" Choice : on(default),off");
|
||||
SaveCmd->SetParameterName("choice",true);
|
||||
SaveCmd->SetDefaultValue("on");
|
||||
SaveCmd->SetCandidates("on off");
|
||||
SaveCmd->AvailableForStates(Idle);
|
||||
|
||||
RndmDir = new G4UIdirectory("/rndm/");
|
||||
RndmDir->SetGuidance("Rndm status control.");
|
||||
|
||||
RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
|
||||
RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
|
||||
RndmSaveCmd->SetGuidance("freq = 0 not saved");
|
||||
RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
|
||||
RndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
|
||||
RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
|
||||
RndmSaveCmd->SetParameterName("frequency",false);
|
||||
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
|
||||
RndmSaveCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
|
||||
RndmReadCmd->SetGuidance("get rndm status from an external file.");
|
||||
RndmReadCmd->SetParameterName("fileName",true);
|
||||
RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
|
||||
RndmReadCmd->AvailableForStates(PreInit,Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3RunActionMessenger::~Em3RunActionMessenger()
|
||||
{
|
||||
delete SaveCmd;
|
||||
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3RunActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if (command == SaveCmd) Em3Run->SetSaveFlag(newValue);
|
||||
|
||||
if (command == RndmSaveCmd)
|
||||
Em3Run->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue));
|
||||
|
||||
if (command == RndmReadCmd)
|
||||
{ G4cout << "\n---> rndm status restored from file: " << newValue << endl;
|
||||
HepRandom::restoreEngineStatus(newValue);
|
||||
HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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: Em3SteppingAction.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em3SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3SteppingAction::Em3SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3SteppingAction::~Em3SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
// 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: Em3VisManager.cc,v 1.1.4.1 1999/12/07 20:47:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "Em3VisManager.hh"
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
#include "G4DAWNFILE.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_RAYX
|
||||
#include "G4RayX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em3VisManager::Em3VisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em3VisManager::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
#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_RAYX
|
||||
RegisterGraphicsSystem (new G4RayX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
#endif
|
||||
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
<< endl;
|
||||
PrintAvailableGraphicsSystems ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
Reference in New Issue
Block a user