Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,62 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02ChamberParameterisation.cc,v 1.1 1998/10/09 14:35:30 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "ExN02ChamberParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
ExN02ChamberParameterisation::ExN02ChamberParameterisation(
G4int NoChambers,
G4double startZ, // Z of center of first
G4double spacingZ, // Z spacing of centers
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal )
{
fNoChambers= NoChambers;
fStartZ= startZ;
fHalfWidth= widthChamber*0.5;
fSpacing= spacingZ;
fHalfLengthFirst= 0.5 * lengthInitial;
// fHalfLengthLast= lengthFinal;
if( NoChambers > 1 ){
fHalfLengthIncr= 0.5 * (lengthFinal-lengthInitial)/(NoChambers-1);
if( spacingZ < widthChamber ) {
G4Exception( "ExN02ChamberParameterisation construction: Width > Spacing" );
}
}
}
ExN02ChamberParameterisation::~ExN02ChamberParameterisation()
{}
void ExN02ChamberParameterisation::ComputeTransformation
(const G4int copyNo,G4VPhysicalVolume *physVol) const
{
G4double Zposition= fStartZ + copyNo * fSpacing;
G4ThreeVector origin(0,0,Zposition);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
}
void ExN02ChamberParameterisation::ComputeDimensions
(G4Box & trackerChamber, const G4int copyNo,
const G4VPhysicalVolume * physVol) const
{
G4double halfLength= fHalfLengthFirst + (copyNo-1) * fHalfLengthIncr;
trackerChamber.SetXHalfLength(halfLength);
trackerChamber.SetYHalfLength(halfLength);
trackerChamber.SetZHalfLength(fHalfWidth);
}
@@ -0,0 +1,256 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02DetectorConstruction.cc,v 1.9 1998/12/04 21:26:12 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02DetectorConstruction.hh"
#include "ExN02DetectorMessenger.hh"
#include "ExN02ChamberParameterisation.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GeometryManager.hh"
#include "ExN02MagneticField.hh"
#include "G4PVParameterised.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
///#include "G4UserLimits.hh"
#include "G4SDManager.hh"
#include "ExN02TrackerSD.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
ExN02DetectorConstruction::ExN02DetectorConstruction()
:solidWorld(NULL),logicWorld(NULL),physiWorld(NULL),
solidTracker(NULL),logicTracker(NULL),physiTracker(NULL),
solidTarget(NULL),logicTarget(NULL),physiTarget(NULL),
solidChamber(NULL),logicChamber(NULL),physiChamber(NULL),
myMaterial(NULL), fDetectorLength(0.),fWorldLength(0.)
{
detectorMessenger = new ExN02DetectorMessenger(this);
fpMagField = new ExN02MagneticField(); // G4FieldManager();
// magFieldManager = new G4FieldManager();
}
ExN02DetectorConstruction::~ExN02DetectorConstruction()
{
delete detectorMessenger;
delete fpMagField;
// delete magFieldManager;
}
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
{
//--------- Material definition ---------
G4double a, iz, z, density;
G4String name, symbol;
G4int nel;
//Air
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
density = 1.29*mg/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
//Al
a = 26.98*g/mole;
density = 2.7*g/cm3;
G4Material* Aluminium = new G4Material(name="Al", z=13., a, density);
//Pb
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Pb", z=82., a, density);
//Vacuum
a = 1.*g/mole;
density = 1.e-20*g/cm3;
G4Material* Vacuum = new G4Material(name="Vacuum",z=1.,a,density);
//--------- Sizes of the principal geometrical components (solids) ---------
fDetectorLength = 750.*cm ; // Full length of the detector
fTrackerLength = 500. * cm; // Full length of the Tracker
fTargetLength = 5.0 * cm; // Full length of the Target
G4double detectorSize = 0.5*fDetectorLength;
G4double trackerSize = fTrackerLength * 0.5; // Half length of the Tracker
G4double targetSize = fTargetLength * 0.5; // Half length of the Target
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
myMaterial = Aluminium;
//------------------------------
// World
//------------------------------
fWorldLength= 1.2 * fDetectorLength;
G4double HalfWorldLength = 0.5*fWorldLength;
solidWorld= new G4Box("World",HalfWorldLength,HalfWorldLength,HalfWorldLength);
logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
// Must place the World Physical volume unrotated at (0,0,0).
//
physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"WorldPV", // its name
logicWorld, // its logical volume
0, // its mother volume
false, // no boolean operations
0); // no field specific to volume
//------------------------------
// Target
//------------------------------
solidTarget = new G4Box("TargetSolid",targetSize,targetSize,targetSize);
logicTarget = new G4LogicalVolume(solidTarget ,myMaterial,"TargetLV",0,0,0);
physiTarget = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"TargetPV", // its name
logicTarget, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
G4cout << "Target is " << 2*targetSize/cm << " cm of Al " << endl;
//------------------------------
// Tracker
//------------------------------
G4ThreeVector positionTracker;
solidTracker = new G4Box("Tracker",trackerSize,trackerSize,trackerSize);
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
positionTracker= G4ThreeVector(0,0,trackerSize+targetSize);
physiTracker = new G4PVPlacement(0, // no rotation
positionTracker, // at (0,0,0)
"Tracker", // its name
logicTracker, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//------------------------------
// Tracker segments
//------------------------------
// An example of Parameterised volumes
// dummy values for G4Box -- modified by parameterised volume
G4VSolid * solidChamber
= new G4Box("chamberBox", 100*cm, 100*cm, 10*cm);
// chamberWidth, chamberWidth, chamberDepth);
G4LogicalVolume * trackerChamberLV
= new G4LogicalVolume(solidChamber, Aluminium, "trackerChamberLV",0,0,0);
G4VPVParameterisation * chamberParam
= new ExN02ChamberParameterisation(
6, // NoChambers,
-240.*cm, // Z of center of first
80*cm, // Z spacing of centers
20*cm, // Width Chamber,
50*cm, // lengthInitial,
trackerSize*2.); // lengthFinal
// dummy value : kXAxis -- modified by parameterised volume
G4VPhysicalVolume *trackerChamber_phys
= new G4PVParameterised("trkChamber", // TrackerChamber parameterised
trackerChamberLV, // Its logical volume
physiTracker, // Mother physical volume
kZAxis, // Are placed along this axis
6, // Number of chambers
chamberParam); // The parametrisation
G4VisAttributes* trackerChamber_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
trackerChamberLV->SetVisAttributes(trackerChamber_logVisAtt);
//------------------------------------------------
// Sensitive detectors
//------------------------------------------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
SDman->AddNewDetector( aTrackerSD );
trackerChamberLV->SetSensitiveDetector( aTrackerSD );
//--------- Visualization attributes -------------------------------
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
G4VisAttributes * simpleBoxVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
logicTracker->SetVisAttributes(simpleBoxVisAtt);
//set a max Step length in the absorber
///G4double maxStep = fDetectorLength/0.7, maxLength=fDetectorLength/0.7;
///G4double maxTime = 0.1*ns, minEkin = 10*MeV;
///logicAbsorber->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
/// minEkin));
return physiWorld;
}
#if 0
void ExN02DetectorConstruction::setMaterial(G4String materialChoice)
{
const G4MaterialTable*
theMaterialTable = G4Material::GetMaterialTable();
G4Material* pttoMaterial;
for (G4int J=0 ; J<theMaterialTable->length() ; J++)
{ pttoMaterial = (*theMaterialTable)(J);
if(pttoMaterial->GetName() == materialChoice)
{myMaterial = pttoMaterial;
logicTracker->SetMaterial(pttoMaterial);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << materialChoice
<< endl;}
}
}
#endif
void ExN02DetectorConstruction::SetDetectorLength(G4double length)
{
G4GeometryManager::GetInstance()->OpenGeometry();
fDetectorLength = length;
fWorldLength = 1.2*fDetectorLength;
G4double halfSize = 0.5 * fDetectorLength;
G4double halfWorldLength = 0.5*fWorldLength;
solidWorld -> SetXHalfLength(halfWorldLength);
solidWorld -> SetYHalfLength(halfWorldLength);
solidWorld -> SetZHalfLength(halfWorldLength);
solidTracker -> SetXHalfLength(halfSize);
solidTracker -> SetYHalfLength(halfSize);
solidTracker -> SetZHalfLength(halfSize);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << myMaterial->GetName()
<< endl;
}
void ExN02DetectorConstruction::SetMagField(G4double fieldValue)
{
fpMagField->SetFieldValue(fieldValue);
}
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02DetectorMessenger.cc,v 1.4 1998/10/09 14:35:32 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02DetectorMessenger.hh"
#include "ExN02DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction * myDet)
:myDetector(myDet)
{
mydetDir = new G4UIdirectory("/mydet/");
mydetDir->SetGuidance("ExN02 detector control.");
MatCmd = new G4UIcmdWithAString("/mydet/setMaterial",this);
MatCmd->SetGuidance("Select Material of the SimpleBox.");
MatCmd->SetGuidance(" Choice : Air, Al(default), Pb, Vacuum");
MatCmd->SetParameterName("choice",true);
MatCmd->SetDefaultValue("Al");
MatCmd->SetCandidates("Air Al Pb Vacuum");
MatCmd->AvailableForStates(PreInit,Idle);
SizeCmd = new G4UIcmdWithADoubleAndUnit("/mydet/setSize",this);
SizeCmd->SetGuidance("Set full Size of the Box");
SizeCmd->SetParameterName("Size",false,false);
SizeCmd->SetDefaultUnit("cm");
SizeCmd->SetUnitCategory("Length");
SizeCmd->AvailableForStates(PreInit,Idle);
FieldCmd = new G4UIcmdWithADoubleAndUnit("/mydet/setField",this);
FieldCmd->SetGuidance("Define magnetic field.");
FieldCmd->SetGuidance("Magnetic field will be in Z direction.");
FieldCmd->SetParameterName("Bz",false,false);
FieldCmd->SetDefaultUnit("tesla");
FieldCmd->SetUnitCategory("Magnetic flux density");
FieldCmd->AvailableForStates(PreInit,Idle);
}
ExN02DetectorMessenger::~ExN02DetectorMessenger()
{
delete MatCmd;
delete SizeCmd;
delete FieldCmd;
delete mydetDir;
}
void ExN02DetectorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
// if( command == MatCmd )
// { myDetector->setMaterial(newValues);}
if( command == SizeCmd )
{ myDetector->SetDetectorLength(SizeCmd->GetNewDoubleValue(newValues));}
if( command == FieldCmd )
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValues));}
}
@@ -0,0 +1,56 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02EventAction.cc,v 1.3 1998/10/09 14:35:32 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02EventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
ExN02EventAction::ExN02EventAction()
{}
ExN02EventAction::~ExN02EventAction()
{}
void ExN02EventAction::BeginOfEventAction()
{}
void ExN02EventAction::EndOfEventAction()
{
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4cout << ">>> Event " << evt->GetEventID() << endl;
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if(trajectoryContainer)
{ n_trajectories = trajectoryContainer->entries(); }
G4cout << " " << n_trajectories
<< " trajectories stored in this event." << endl;
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
for(G4int i=0; i<n_trajectories; i++)
{ (*(evt->GetTrajectoryContainer()))[i]->DrawTrajectory(50); }
}
}
@@ -0,0 +1,70 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02MagneticField.cc,v 1.2 1998/12/04 20:25:22 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// User Field class implementation.
//
#include "ExN02MagneticField.hh"
#include "G4FieldManager.hh"
// Constructors:
ExN02MagneticField::ExN02MagneticField()
: G4UniformMagField(G4ThreeVector())
{
GetGlobalFieldManager()->CreateChordFinder(this);
}
ExN02MagneticField::ExN02MagneticField(G4ThreeVector fieldVector)
: G4UniformMagField(fieldVector)
{
GetGlobalFieldManager()->CreateChordFinder(this);
}
// Set the value of the Global Field to fieldValue along Z
//
void ExN02MagneticField::SetFieldValue(G4double fieldValue)
{
G4UniformMagField::SetFieldValue(G4ThreeVector(0,0,fieldValue));
}
// Set the value of the Global Field
//
void ExN02MagneticField::SetFieldValue(G4ThreeVector fieldVector)
{
// Find the Field Manager for the global field
G4FieldManager* fieldMgr= GetGlobalFieldManager();
if(fieldVector!=G4ThreeVector(0.,0.,0.))
{
G4UniformMagField::SetFieldValue(fieldVector);
fieldMgr->SetDetectorField(this);
} else {
// If the new field's value is Zero, then it is best to
// insure that it is not used for propagation.
G4MagneticField* magField = NULL;
fieldMgr->SetDetectorField(magField);
}
}
ExN02MagneticField::~ExN02MagneticField()
{
// GetGlobalFieldManager()->SetDetectorField(0);
}
// Utility method
#include "G4TransportationManager.hh"
G4FieldManager* ExN02MagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
}
+288
View File
@@ -0,0 +1,288 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02PhysicsList.cc,v 1.4 1998/10/09 14:35:33 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a version for maximum particle set
// ------------------------------------------------------------
#include "globals.hh"
#include "ExN02PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip.h>
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList(),
thePhotoElectricEffect(NULL),theComptonScattering(NULL),
theGammaConversion(NULL),
theeminusMultipleScattering(NULL),theeminusIonisation(NULL),
theeminusBremsstrahlung(NULL),
theeplusMultipleScattering(NULL),theeplusIonisation(NULL),
theeplusBremsstrahlung(NULL),
theeplusAnnihilation(NULL)
{
defaultCutValue = 2.0*mm;
SetVerboseLevel(1);
}
ExN02PhysicsList::~ExN02PhysicsList()
{
}
void ExN02PhysicsList::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();
}
void ExN02PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void ExN02PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void ExN02PhysicsList::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();
}
void ExN02PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void ExN02PhysicsList::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"
///#include "G4UserSpecialCuts.hh"
void ExN02PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
thePhotoElectricEffect = new G4PhotoElectricEffect();
theComptonScattering = new G4ComptonScattering();
theGammaConversion = new G4GammaConversion();
// add processes
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
pmanager->AddDiscreteProcess(theComptonScattering);
pmanager->AddDiscreteProcess(theGammaConversion);
} else if (particleName == "e-") {
//electron
// Construct processes for electron
theeminusMultipleScattering = new G4MultipleScattering();
theeminusIonisation = new G4eIonisation();
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
// Construct processes for positron
theeplusMultipleScattering = new G4MultipleScattering();
theeplusIonisation = new G4eIonisation();
theeplusBremsstrahlung = new G4eBremsstrahlung();
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
// Construct processes for 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();
//>>G4VProcess* theUserSpecialCuts = new G4UserSpecialCuts();
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
/// pmanager->AddProcess(theUserSpecialCuts);
// set ordering for AtRestDoIt
//>>pmanager->SetProcessOrderingToFirst(theUserSpecialCuts, idxAtRest);
// 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(theUserSpecialCuts, idxPostStep, 3);
}
}
}
#include "G4Decay.hh"
void ExN02PhysicsList::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);
}
}
}
void ExN02PhysicsList::SetCuts(G4double cut)
{
if (verboseLevel >0){
G4cout << "ExN02PhysicsList::SetCuts:";
G4cout << "CutLength : " << cut/mm << " (mm)" << 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(cut, "gamma");
SetCutValue(cut, "e-");
SetCutValue(cut, "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(cut, "proton");
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
if (verboseLevel>1) {
DumpCutValuesTable();
}
}
@@ -0,0 +1,70 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02PrimaryGeneratorAction.cc,v 1.3 1998/10/09 14:35:34 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// $ Id: $
//
// From exampleEmPhys2/MyPrimaryGeneratorAction.cc,v 1.1 1998/02/06 maire
#include "ExN02PrimaryGeneratorAction.hh"
#include "ExN02DetectorConstruction.hh"
#include "ExN02PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
#include "Randomize.hh"
ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction(ExN02DetectorConstruction* myDC)
:myDetector(myDC),rndmFlag("off")
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
gunMessenger = new ExN02PrimaryGeneratorMessenger(this);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="proton");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
particleGun->SetParticleEnergy(3.0*GeV);
G4double position = -0.5*(myDetector->GetWorldFullLength());
particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
}
ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
void ExN02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// The Target is a box placed at (0,0,0)
//
G4double x0 = -0.5*(myDetector->GetTargetFullLength());
G4double y0 = 0.*cm, z0 = 0.*cm;
if (rndmFlag == "on")
{y0 = (myDetector->GetTargetFullLength())*(G4UniformRand()-0.5);
z0 = (myDetector->GetTargetFullLength())*(G4UniformRand()-0.5);
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,42 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02PrimaryGeneratorMessenger.cc,v 1.3 1998/10/09 14:35:34 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02PrimaryGeneratorMessenger.hh"
#include "ExN02PrimaryGeneratorAction.hh"
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
ExN02PrimaryGeneratorMessenger::ExN02PrimaryGeneratorMessenger(ExN02PrimaryGeneratorAction* myGun)
:myAction(myGun)
{
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on, off(default)");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("off");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(PreInit,Idle);
}
ExN02PrimaryGeneratorMessenger::~ExN02PrimaryGeneratorMessenger()
{
delete RndmCmd;
}
void ExN02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command == RndmCmd )
{ myAction->SetRndmFlag(newValues);}
}
+58
View File
@@ -0,0 +1,58 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02RunAction.cc,v 1.3 1998/10/09 14:35:34 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02RunAction.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
ExN02RunAction::ExN02RunAction()
{
runIDcounter = 0;
}
ExN02RunAction::~ExN02RunAction()
{
}
void ExN02RunAction::BeginOfRunAction(G4Run* aRun)
{
aRun->SetRunID(runIDcounter++);
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/tracking/storeTrajectory 1");
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
UI->ApplyCommand("/vis~/clear/view");
UI->ApplyCommand("/vis~/draw/current");
}
}
void ExN02RunAction::EndOfRunAction(G4Run* aRun)
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4UImanager::GetUIpointer()->ApplyCommand("/vis~/show/view");
}
}
@@ -0,0 +1,41 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02SteppingAction.cc,v 1.3 1998/10/09 14:35:35 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "ExN02SteppingAction.hh"
#include "ExN02DetectorConstruction.hh"
#include "ExN02EventAction.hh"
#include "G4SteppingManager.hh"
ExN02SteppingAction::ExN02SteppingAction(ExN02DetectorConstruction* myDC, ExN02EventAction* myEA)
:myDetector(myDC), eventAction(myEA)
{ }
void ExN02SteppingAction::UserSteppingAction()
{
G4Step* aStep = GetSteppingManager()->GetStep();
// collect the energy deposited in the absorber
const G4VPhysicalVolume* currentVolume = aStep->GetPreStepPoint()-> GetPhysicalVolume();
#if 0
const G4VPhysicalVolume* absorber = myDetector->getAbsorber();
if (currentVolume == absorber)
{
G4double EdepStep = aStep->GetTotalEnergyDeposit();
eventAction->addEdep(EdepStep);
}
#endif
}
@@ -0,0 +1,73 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02TrackerHit.cc,v 1.1 1998/10/09 14:35:35 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "ExN02TrackerHit.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
ExN02TrackerHit::ExN02TrackerHit()
{;}
ExN02TrackerHit::~ExN02TrackerHit()
{;}
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
}
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
return *this;
}
int ExN02TrackerHit::operator==(const ExN02TrackerHit &right) const
{
return 0;
}
void ExN02TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
circle.SetScreenSize(0.04);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
void ExN02TrackerHit::Print()
{
}
// This is a forward declarations of an instantiated G4Allocator<Type> object.
// It has been added in order to make code portable for the GNU g++
// (release 2.7.2) compiler.
// Whenever a new Type is instantiated via G4Allocator, it has to be forward
// declared to make object code (compiled with GNU g++) link successfully.
//
#ifdef GNU_GCC
template class G4Allocator<ExN02TrackerHit>;
#endif
+69
View File
@@ -0,0 +1,69 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02TrackerSD.cc,v 1.1 1998/10/09 14:35:35 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "ExN02TrackerSD.hh"
#include "ExN02TrackerHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4Track.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
ExN02TrackerSD::ExN02TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
}
ExN02TrackerSD::~ExN02TrackerSD(){;}
void ExN02TrackerSD::Initialize(G4HCofThisEvent*HCE)
{
trackerCollection = new ExN02TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
static G4int HCID = -1;
if(HCID<0)
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
HCE->AddHitsCollection( HCID, trackerCollection );
}
G4bool ExN02TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
G4Track* aTrack = aStep->GetTrack();
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return true;
ExN02TrackerHit* newHit = new ExN02TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
trackerCollection->insert( newHit );
return true;
}
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent*HCE)
{
}
void ExN02TrackerSD::clear()
{
}
void ExN02TrackerSD::DrawAll()
{
}
void ExN02TrackerSD::PrintAll()
{
}
+141
View File
@@ -0,0 +1,141 @@
// This code implementation is the intellectual property of
// the RD44 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: ExN02VisManager.cc,v 1.4 1998/11/30 10:21:31 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 24th January 1998.
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4VIS_USE
#include "ExN02VisManager.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....
ExN02VisManager::ExN02VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02VisManager::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....