Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -0,0 +1,505 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "F04DetectorConstruction.hh"
|
||||
#include "F04DetectorMessenger.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "F04DetectorConstruction.hh"
|
||||
#include "F04DetectorMessenger.hh"
|
||||
#include "F04Materials.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
#include "F04SimpleSolenoid.hh"
|
||||
#include "F04FocusSolenoid.hh"
|
||||
|
||||
F04DetectorConstruction::F04DetectorConstruction()
|
||||
: solidWorld(0), logicWorld(0), physiWorld(0),
|
||||
solidTarget(0), logicTarget(0), physiTarget(0),
|
||||
solidDegrader(0),logicDegrader(0), physiDegrader(0),
|
||||
solidCaptureMgnt(0), logicCaptureMgnt(0), physiCaptureMgnt(0),
|
||||
solidTransferMgnt(0), logicTransferMgnt(0), physiTransferMgnt(0),
|
||||
WorldMaterial(0), TargetMaterial(0), DegraderMaterial(0),
|
||||
focusSolenoid(0), simpleSolenoid(0)
|
||||
{
|
||||
WorldSizeZ = 50.*m;
|
||||
WorldSizeR = 5.*m;
|
||||
|
||||
TargetRadius = 0.4*cm;
|
||||
TargetThickness = 16.0*cm;
|
||||
|
||||
SetTargetAngle(170);
|
||||
|
||||
DegraderRadius = 30.0*cm;
|
||||
DegraderThickness = 0.1*cm;
|
||||
|
||||
CaptureMgntRadius = 0.6*m;
|
||||
CaptureMgntLength = 4.0*m;
|
||||
|
||||
SetCaptureMgntB1(2.5*tesla);
|
||||
SetCaptureMgntB2(5.0*tesla);
|
||||
|
||||
TransferMgntRadius = 0.3*m;
|
||||
TransferMgntLength = 15.0*m;
|
||||
|
||||
SetTransferMgntB(5.0*tesla);
|
||||
|
||||
DegraderPos = -TransferMgntLength/2. + DegraderThickness/2.;
|
||||
|
||||
// ensure the global field is initialized
|
||||
(void)F04GlobalField::getObject();
|
||||
|
||||
detectorMessenger = new F04DetectorMessenger(this);
|
||||
}
|
||||
|
||||
F04DetectorConstruction::~F04DetectorConstruction()
|
||||
{
|
||||
delete detectorMessenger;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* F04DetectorConstruction::Construct()
|
||||
{
|
||||
materials = F04Materials::GetInstance();
|
||||
|
||||
DefineMaterials();
|
||||
|
||||
return ConstructDetector();
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
//define materials for the experiment
|
||||
|
||||
Vacuum = materials->GetMaterial("G4_Galactic");
|
||||
|
||||
WorldMaterial = materials->GetMaterial("G4_AIR");
|
||||
DegraderMaterial = materials->GetMaterial("G4_Pb");
|
||||
TargetMaterial = materials->GetMaterial("G4_W");
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* F04DetectorConstruction::ConstructDetector()
|
||||
{
|
||||
solidWorld = new G4Tubs("World",
|
||||
0.,GetWorldSizeR(),GetWorldSizeZ()/2.,0.,twopi);
|
||||
|
||||
logicWorld = new G4LogicalVolume(solidWorld,
|
||||
GetWorldMaterial(),
|
||||
"World");
|
||||
|
||||
physiWorld = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
"World",
|
||||
logicWorld,
|
||||
0,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Capture Magnet
|
||||
|
||||
solidCaptureMgnt = new G4Tubs("CaptureMgnt",
|
||||
0.,GetCaptureMgntRadius(),
|
||||
GetCaptureMgntLength()/2.,0.,twopi);
|
||||
|
||||
logicCaptureMgnt = new G4LogicalVolume(solidCaptureMgnt,
|
||||
Vacuum,
|
||||
"CaptureMgnt");
|
||||
|
||||
G4ThreeVector CaptureMgntCenter = G4ThreeVector();
|
||||
|
||||
physiCaptureMgnt = new G4PVPlacement(0,
|
||||
CaptureMgntCenter,
|
||||
"CaptureMgnt",
|
||||
logicCaptureMgnt,
|
||||
physiWorld,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Transfer Magnet
|
||||
|
||||
solidTransferMgnt = new G4Tubs("TransferMgnt",
|
||||
0.,GetTransferMgntRadius(),
|
||||
GetTransferMgntLength()/2.,0.,twopi);
|
||||
|
||||
logicTransferMgnt = new G4LogicalVolume(solidTransferMgnt,
|
||||
Vacuum,
|
||||
"TransferMgnt");
|
||||
|
||||
G4double z = GetCaptureMgntLength()/2. + GetTransferMgntLength()/2.
|
||||
+ GetTransferMgntPos();
|
||||
G4double x = GetTransferMgntPos()/2.;
|
||||
|
||||
G4ThreeVector TransferMgntCenter = G4ThreeVector(x,0.,z);
|
||||
|
||||
G4RotationMatrix* g4rot = new G4RotationMatrix();
|
||||
*g4rot = stringToRotationMatrix("Y30,X10");
|
||||
*g4rot = g4rot->inverse();
|
||||
if (*g4rot == G4RotationMatrix()) g4rot = NULL;
|
||||
|
||||
physiTransferMgnt = new G4PVPlacement(g4rot,
|
||||
TransferMgntCenter,
|
||||
"TransferMgnt",
|
||||
logicTransferMgnt,
|
||||
physiWorld,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Test Plane
|
||||
|
||||
G4Tubs* solidTestPlane = new G4Tubs("TestPlane",
|
||||
0.,GetTransferMgntRadius(),
|
||||
1.*mm,0.,twopi);
|
||||
|
||||
G4LogicalVolume* logicTestPlane = new G4LogicalVolume(solidTestPlane,
|
||||
Vacuum,
|
||||
"TestPlane");
|
||||
|
||||
|
||||
z = GetTransferMgntLength()/2. - 1.*mm;
|
||||
|
||||
G4ThreeVector TestPlaneCenter = G4ThreeVector(0.,0.,z);
|
||||
|
||||
new G4PVPlacement(0,
|
||||
TestPlaneCenter,
|
||||
"TestPlane",
|
||||
logicTestPlane,
|
||||
physiTransferMgnt,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Target
|
||||
|
||||
if (GetTargetThickness() > 0.)
|
||||
{
|
||||
solidTarget = new G4Tubs("Target",
|
||||
0.,GetTargetRadius(),
|
||||
GetTargetThickness()/2.,0.,twopi);
|
||||
|
||||
logicTarget = new G4LogicalVolume(solidTarget,
|
||||
GetTargetMaterial(),
|
||||
"Target");
|
||||
|
||||
G4int i = GetTargetAngle();
|
||||
|
||||
char c[4];
|
||||
sprintf(c,"%d",i);
|
||||
G4String Angle = c;
|
||||
Angle = Angle.strip(G4String::both,' ');
|
||||
Angle = "Y" + Angle;
|
||||
|
||||
g4rot = new G4RotationMatrix();
|
||||
*g4rot = stringToRotationMatrix(Angle);
|
||||
*g4rot = g4rot->inverse();
|
||||
if (*g4rot == G4RotationMatrix()) g4rot = NULL;
|
||||
|
||||
G4ThreeVector TargetCenter(0.,0.,GetTargetPos());
|
||||
|
||||
physiTarget = new G4PVPlacement(g4rot,
|
||||
TargetCenter,
|
||||
"Target",
|
||||
logicTarget,
|
||||
physiCaptureMgnt,
|
||||
false,
|
||||
0);
|
||||
}
|
||||
|
||||
// Degrader
|
||||
|
||||
if (GetDegraderThickness() > 0.)
|
||||
{
|
||||
solidDegrader = new G4Tubs("Degrader",
|
||||
0., GetDegraderRadius(),
|
||||
GetDegraderThickness()/2., 0.,twopi);
|
||||
|
||||
logicDegrader = new G4LogicalVolume(solidDegrader,
|
||||
GetDegraderMaterial(),
|
||||
"Degrader");
|
||||
|
||||
G4ThreeVector DegraderCenter = G4ThreeVector(0.,0.,GetDegraderPos());
|
||||
|
||||
physiDegrader = new G4PVPlacement(0,
|
||||
DegraderCenter,
|
||||
"Degrader",
|
||||
logicDegrader,
|
||||
physiTransferMgnt,
|
||||
false,
|
||||
0);
|
||||
}
|
||||
|
||||
G4double l = 0.0;
|
||||
G4double B1 = GetCaptureMgntB1();
|
||||
G4double B2 = GetCaptureMgntB2();
|
||||
|
||||
if (focusSolenoid) delete focusSolenoid;
|
||||
focusSolenoid = new F04FocusSolenoid(B1, B2, l,
|
||||
logicCaptureMgnt,CaptureMgntCenter);
|
||||
focusSolenoid -> SetHalf(true);
|
||||
|
||||
l = 0.0;
|
||||
G4double B = GetTransferMgntB();
|
||||
|
||||
if (simpleSolenoid) delete simpleSolenoid;
|
||||
simpleSolenoid = new F04SimpleSolenoid(B, l,
|
||||
logicTransferMgnt,TransferMgntCenter);
|
||||
|
||||
simpleSolenoid->setColor("1,0,1");
|
||||
simpleSolenoid->setColor("0,1,1");
|
||||
simpleSolenoid->setMaxStep(1.5*mm);
|
||||
simpleSolenoid->setMaxStep(2.5*mm);
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetWorldMaterial(const G4String materialChoice)
|
||||
{
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
|
||||
if (pttoMaterial != WorldMaterial) {
|
||||
if ( pttoMaterial ) {
|
||||
WorldMaterial = pttoMaterial;
|
||||
} else {
|
||||
G4cout << "\n--> WARNING from SetWorldMaterial : "
|
||||
<< materialChoice << " not found" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTargetMaterial(const G4String materialChoice)
|
||||
{
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
|
||||
if (pttoMaterial != TargetMaterial) {
|
||||
if ( pttoMaterial ) {
|
||||
TargetMaterial = pttoMaterial;
|
||||
} else {
|
||||
G4cout << "\n--> WARNING from SetTargetMaterial : "
|
||||
<< materialChoice << " not found" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetDegraderMaterial(const G4String materialChoice)
|
||||
|
||||
{
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
|
||||
if (pttoMaterial != DegraderMaterial) {
|
||||
if ( pttoMaterial ) {
|
||||
DegraderMaterial = pttoMaterial;
|
||||
} else {
|
||||
G4cout << "\n--> WARNING from SetDegraderMaterial : "
|
||||
<< materialChoice << " not found" << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetWorldSizeZ(G4double val)
|
||||
{
|
||||
WorldSizeZ = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetWorldSizeR(G4double val)
|
||||
{
|
||||
WorldSizeR = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetCaptureMgntRadius(G4double val)
|
||||
{
|
||||
CaptureMgntRadius = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetCaptureMgntLength(G4double val)
|
||||
{
|
||||
CaptureMgntLength = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetCaptureMgntB1(G4double val)
|
||||
{
|
||||
CaptureMgntB1 = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetCaptureMgntB2(G4double val)
|
||||
{
|
||||
CaptureMgntB2 = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTransferMgntRadius(G4double val)
|
||||
{
|
||||
TransferMgntRadius = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTransferMgntLength(G4double val)
|
||||
{
|
||||
TransferMgntLength = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTransferMgntB(G4double val)
|
||||
{
|
||||
TransferMgntB = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTransferMgntPos(G4double val)
|
||||
{
|
||||
TransferMgntPos = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTargetRadius(G4double val)
|
||||
{
|
||||
TargetRadius = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTargetThickness(G4double val)
|
||||
{
|
||||
TargetThickness = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTargetPos(G4double val)
|
||||
{
|
||||
TargetPos = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetTargetAngle(G4int val)
|
||||
{
|
||||
TargetAngle = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetDegraderRadius(G4double val)
|
||||
{
|
||||
DegraderRadius = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetDegraderThickness(G4double val)
|
||||
{
|
||||
DegraderThickness = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::SetDegraderPos(G4double val)
|
||||
{
|
||||
DegraderPos = val;
|
||||
}
|
||||
|
||||
void F04DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
if (!physiWorld) return;
|
||||
|
||||
// clean-up previous geometry
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
//define new one
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
|
||||
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList(physiWorld);
|
||||
|
||||
}
|
||||
|
||||
G4RotationMatrix
|
||||
F04DetectorConstruction::stringToRotationMatrix(G4String rotation)
|
||||
{
|
||||
// We apply successive rotations OF THE OBJECT around the FIXED
|
||||
// axes of the parent's local coordinates; rotations are applied
|
||||
// left-to-right (rotation="r1,r2,r3" => r1 then r2 then r3).
|
||||
|
||||
G4RotationMatrix rot;
|
||||
|
||||
unsigned int place = 0;
|
||||
|
||||
while (place < rotation.size()) {
|
||||
|
||||
G4double angle;
|
||||
char* p;
|
||||
|
||||
angle = strtod(rotation.substr(place+1).c_str(),&p) * deg;
|
||||
G4cout << "Angle: " << angle/deg << "deg " << G4endl;
|
||||
|
||||
if (!p || (*p != ',' && *p != '\0')) {
|
||||
G4cerr << "Invalid rotation specification: " <<
|
||||
rotation.c_str() << G4endl;
|
||||
return rot;
|
||||
}
|
||||
|
||||
G4RotationMatrix thisRotation;
|
||||
|
||||
switch(rotation.substr(place,1).c_str()[0]) {
|
||||
case 'X': case 'x':
|
||||
thisRotation = G4RotationMatrix(CLHEP::HepRotationX(angle));
|
||||
break;
|
||||
case 'Y': case 'y':
|
||||
thisRotation = G4RotationMatrix(CLHEP::HepRotationY(angle));
|
||||
break;
|
||||
case 'Z': case 'z':
|
||||
thisRotation = G4RotationMatrix(CLHEP::HepRotationZ(angle));
|
||||
break;
|
||||
default:
|
||||
G4cerr << " Invalid rotation specification: "
|
||||
<< rotation << G4endl;
|
||||
return rot;
|
||||
}
|
||||
|
||||
rot = thisRotation * rot;
|
||||
place = rotation.find(',',place);
|
||||
if (place > rotation.size()) break;
|
||||
++place;
|
||||
}
|
||||
|
||||
return rot;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04DetectorMessenger.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
F04DetectorMessenger::F04DetectorMessenger(F04DetectorConstruction * Det)
|
||||
: Detector(Det)
|
||||
{
|
||||
detDir = new G4UIdirectory("/field04/");
|
||||
detDir->SetGuidance(" field04 Simulation ");
|
||||
|
||||
WorldMaterCmd = new G4UIcmdWithAString("/field04/SetWorldMat",this);
|
||||
WorldMaterCmd->SetGuidance("Select Material of the World");
|
||||
WorldMaterCmd->SetParameterName("wchoice",true);
|
||||
WorldMaterCmd->SetDefaultValue("Air");
|
||||
WorldMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
WorldRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldR",this);
|
||||
WorldRCmd->SetGuidance("Set Radius of the World");
|
||||
WorldRCmd->SetParameterName("WSizeR",false,false);
|
||||
WorldRCmd->SetDefaultUnit("cm");
|
||||
WorldRCmd->SetRange("WSizeR>0.");
|
||||
WorldRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
WorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ",this);
|
||||
WorldZCmd->SetGuidance("Set Length of the World");
|
||||
WorldZCmd->SetParameterName("WSizeZ",false,false);
|
||||
WorldZCmd->SetDefaultUnit("cm");
|
||||
WorldZCmd->SetRange("WSizeZ>0.");
|
||||
WorldZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
CaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR",this);
|
||||
CaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
|
||||
CaptureRCmd->SetParameterName("CSizeR",false,false);
|
||||
CaptureRCmd->SetDefaultUnit("cm");
|
||||
CaptureRCmd->SetRange("CSizeR>0.");
|
||||
CaptureRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
CaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ",this);
|
||||
CaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
|
||||
CaptureZCmd->SetParameterName("CSizeZ",false,false);
|
||||
CaptureZCmd->SetDefaultUnit("cm");
|
||||
CaptureZCmd->SetRange("CSizeZ>0.");
|
||||
CaptureZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
CaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureB1",this);
|
||||
CaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet");
|
||||
CaptureB1Cmd->SetParameterName("CSizeB1",false,false);
|
||||
CaptureB1Cmd->SetDefaultUnit("tesla");
|
||||
CaptureB1Cmd->SetRange("CSizeB1>0.");
|
||||
CaptureB1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
CaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureB2",this);
|
||||
CaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet");
|
||||
CaptureB2Cmd->SetParameterName("CSizeB2",false,false);
|
||||
CaptureB2Cmd->SetDefaultUnit("tesla");
|
||||
CaptureB2Cmd->SetRange("CSizeB2>0.");
|
||||
CaptureB2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR",this);
|
||||
TransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
|
||||
TransferRCmd->SetParameterName("TSizeR",false,false);
|
||||
TransferRCmd->SetDefaultUnit("cm");
|
||||
TransferRCmd->SetRange("TSizeR>0.");
|
||||
TransferRCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ",this);
|
||||
TransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
|
||||
TransferZCmd->SetParameterName("TSizeZ",false,false);
|
||||
TransferZCmd->SetDefaultUnit("cm");
|
||||
TransferZCmd->SetRange("TSizeZ>0.");
|
||||
TransferZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TransferBCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferB",this);
|
||||
TransferBCmd->SetGuidance("Set B of the Transfer Magnet");
|
||||
TransferBCmd->SetParameterName("TSizeB",false,false);
|
||||
TransferBCmd->SetDefaultUnit("tesla");
|
||||
TransferBCmd->SetRange("TSizeB>0.");
|
||||
TransferBCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP",this);
|
||||
TransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
|
||||
TransferPCmd->SetParameterName("TSizeP",false,false);
|
||||
TransferPCmd->SetDefaultUnit("cm");
|
||||
TransferPCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat",this);
|
||||
TgtMaterCmd->SetGuidance("Select Material of the Target");
|
||||
TgtMaterCmd->SetParameterName("tchoice",true);
|
||||
TgtMaterCmd->SetDefaultValue("Tungsten");
|
||||
TgtMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad",this);
|
||||
TgtRadCmd->SetGuidance("Set Radius of the Target");
|
||||
TgtRadCmd->SetParameterName("TgtSizeR",false,false);
|
||||
TgtRadCmd->SetDefaultUnit("cm");
|
||||
TgtRadCmd->SetRange("TgtSizeR>0.");
|
||||
TgtRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick",this);
|
||||
TgtThickCmd->SetGuidance("Set Thickness of the Target");
|
||||
TgtThickCmd->SetParameterName("TgtSizeZ",false,false);
|
||||
TgtThickCmd->SetDefaultUnit("cm");
|
||||
TgtThickCmd->SetRange("TgtSizeZ>0.");
|
||||
TgtThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos",this);
|
||||
TgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
|
||||
TgtPosCmd->SetParameterName("TgtSizeP",false,false);
|
||||
TgtPosCmd->SetDefaultUnit("cm");
|
||||
TgtPosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
TgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng",this);
|
||||
TgtAngCmd->SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
|
||||
TgtAngCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
DgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat",this);
|
||||
DgrMaterCmd->SetGuidance("Select Material of the Degrader");
|
||||
DgrMaterCmd->SetParameterName("dchoice",true);
|
||||
DgrMaterCmd->SetDefaultValue("Lead");
|
||||
DgrMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
DgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad",this);
|
||||
DgrRadCmd->SetGuidance("Set Radius of the Degrader");
|
||||
DgrRadCmd->SetParameterName("DrgSizeR",false,false);
|
||||
DgrRadCmd->SetDefaultUnit("cm");
|
||||
DgrRadCmd->SetRange("DrgSizeR>0.");
|
||||
DgrRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
DgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick",this);
|
||||
DgrThickCmd->SetGuidance("Set Thickness of the Degrader");
|
||||
DgrThickCmd->SetParameterName("DgrSizeZ",false,false);
|
||||
DgrThickCmd->SetDefaultUnit("cm");
|
||||
DgrThickCmd->SetRange("DgrSizeZ>0.");
|
||||
DgrThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
DgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos",this);
|
||||
DgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
|
||||
DgrPosCmd->SetParameterName("DgrSizeP",false,false);
|
||||
DgrPosCmd->SetDefaultUnit("cm");
|
||||
DgrPosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/field04/Update",this);
|
||||
UpdateCmd->SetGuidance("Update field04 geometry");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
F04DetectorMessenger::~F04DetectorMessenger()
|
||||
{
|
||||
delete detDir;
|
||||
|
||||
delete WorldMaterCmd;
|
||||
delete WorldRCmd;
|
||||
delete WorldZCmd;
|
||||
|
||||
delete CaptureRCmd;
|
||||
delete CaptureZCmd;
|
||||
delete CaptureB1Cmd;
|
||||
delete CaptureB2Cmd;
|
||||
|
||||
delete TransferRCmd;
|
||||
delete TransferZCmd;
|
||||
delete TransferBCmd;
|
||||
delete TransferPCmd;
|
||||
|
||||
delete TgtMaterCmd;
|
||||
delete TgtRadCmd;
|
||||
delete TgtThickCmd;
|
||||
delete TgtPosCmd;
|
||||
delete TgtAngCmd;
|
||||
|
||||
delete DgrMaterCmd;
|
||||
delete DgrRadCmd;
|
||||
delete DgrThickCmd;
|
||||
delete DgrPosCmd;
|
||||
|
||||
delete UpdateCmd;
|
||||
}
|
||||
|
||||
void F04DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == WorldMaterCmd )
|
||||
{ Detector->SetWorldMaterial(newValue);}
|
||||
|
||||
if( command == TgtMaterCmd )
|
||||
{ Detector->SetTargetMaterial(newValue);}
|
||||
|
||||
if( command == DgrMaterCmd )
|
||||
{ Detector->SetDegraderMaterial(newValue);}
|
||||
|
||||
if( command == WorldRCmd )
|
||||
{ Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == WorldZCmd )
|
||||
{ Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == CaptureRCmd )
|
||||
{ Detector->SetCaptureMgntRadius(CaptureRCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == CaptureZCmd )
|
||||
{ Detector->SetCaptureMgntLength(CaptureZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == CaptureB1Cmd )
|
||||
{ Detector->SetCaptureMgntB1(CaptureB1Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == CaptureB2Cmd )
|
||||
{ Detector->SetCaptureMgntB2(CaptureB2Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TransferRCmd )
|
||||
{ Detector->SetTransferMgntRadius(TransferRCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TransferZCmd )
|
||||
{ Detector->SetTransferMgntLength(TransferZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TransferBCmd )
|
||||
{ Detector->SetTransferMgntB(TransferBCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TransferPCmd )
|
||||
{ Detector->SetTransferMgntPos(TransferPCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TgtRadCmd )
|
||||
{ Detector->SetTargetRadius(TgtRadCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TgtThickCmd )
|
||||
{ Detector->SetTargetThickness(TgtThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TgtPosCmd )
|
||||
{ Detector->SetTargetPos(TgtPosCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == TgtAngCmd )
|
||||
{ Detector->SetTargetAngle(TgtAngCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == DgrRadCmd )
|
||||
{ Detector->SetDegraderRadius(DgrRadCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == DgrThickCmd )
|
||||
{ Detector->SetDegraderThickness(DgrThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == DgrPosCmd )
|
||||
{ Detector->SetDegraderPos(DgrPosCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == WorldZCmd )
|
||||
{ Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == WorldRCmd )
|
||||
{ Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ Detector->UpdateGeometry(); }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "F04ElementField.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
G4Navigator* F04ElementField::aNavigator;
|
||||
|
||||
F04ElementField::F04ElementField(G4ThreeVector c, G4LogicalVolume* lv)
|
||||
{
|
||||
center = c;
|
||||
|
||||
minX = minY = minZ = -DBL_MAX;
|
||||
maxX = maxY = maxZ = DBL_MAX;
|
||||
|
||||
F04GlobalField::getObject()->addElementField(this);
|
||||
|
||||
color = "1,1,1";
|
||||
|
||||
userLimits = new G4UserLimits();
|
||||
|
||||
lvolume = lv;
|
||||
lvolume->SetVisAttributes(getVisAttribute(color));
|
||||
|
||||
maxStep = 1*mm;
|
||||
|
||||
userLimits->SetMaxAllowedStep(maxStep);
|
||||
|
||||
userLimits->SetUserMaxTrackLength(500.*m);
|
||||
userLimits->SetUserMaxTime(10*ms);
|
||||
userLimits->SetUserMinEkine(0.1*MeV);
|
||||
// userLimits->SetUserMinRange(1*mm);
|
||||
|
||||
lvolume->SetUserLimits(userLimits);
|
||||
}
|
||||
|
||||
void F04ElementField::construct()
|
||||
{
|
||||
G4Navigator* theNavigator =
|
||||
G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking();
|
||||
|
||||
if (!aNavigator) {
|
||||
aNavigator = new G4Navigator();
|
||||
if ( theNavigator->GetWorldVolume() )
|
||||
aNavigator->SetWorldVolume(theNavigator->GetWorldVolume());
|
||||
}
|
||||
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
|
||||
if (!geomManager->IsGeometryClosed()) {
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(true);
|
||||
}
|
||||
|
||||
aNavigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
|
||||
G4TouchableHistoryHandle fTouchable = aNavigator->
|
||||
CreateTouchableHistoryHandle();
|
||||
|
||||
G4int depth = fTouchable->GetHistoryDepth();
|
||||
for (G4int i = 0; i<depth; ++i) {
|
||||
if(fTouchable->GetVolume()->GetLogicalVolume() == lvolume)break;
|
||||
fTouchable->MoveUpHistory();
|
||||
}
|
||||
|
||||
// set global2local transform
|
||||
global2local = fTouchable->GetHistory()->GetTopTransform();
|
||||
|
||||
// set global bounding box
|
||||
G4double local[4], global[4];
|
||||
|
||||
G4ThreeVector globalPosition;
|
||||
local[3] = 0.0;
|
||||
for (int i=0; i<2; ++i) {
|
||||
local[0] = (i==0 ? -1.0 : 1.0) * getWidth();
|
||||
for (int j=0; j<2; ++j) {
|
||||
local[1] = (j==0 ? -1.0 : 1.0) * getHeight();
|
||||
for (int k=0; k<2; ++k) {
|
||||
local[2] = (k==0 ? -1.0 : 1.0) * getLength()/2.;
|
||||
G4ThreeVector localPosition(local[0],local[1],local[2]);
|
||||
globalPosition =
|
||||
global2local.Inverse().TransformPoint(localPosition);
|
||||
global[0] = globalPosition.x();
|
||||
global[1] = globalPosition.y();
|
||||
global[2] = globalPosition.z();
|
||||
setGlobalPoint(global);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4VisAttributes* F04ElementField::getVisAttribute(G4String color)
|
||||
{
|
||||
G4VisAttributes* p = NULL;
|
||||
if(color.size() > 0 &&
|
||||
(isdigit(color.c_str()[0]) || color.c_str()[0] == '.')) {
|
||||
G4double red=0.0, green=0.0, blue=0.0;
|
||||
if (sscanf(color.c_str(),"%lf,%lf,%lf",&red,&green,&blue) == 3) {
|
||||
p = new G4VisAttributes(true,G4Color(red,green,blue));
|
||||
} else {
|
||||
G4cout << " Invalid color " << color << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p) p = new G4VisAttributes(G4VisAttributes::Invisible);
|
||||
p->SetDaughtersInvisible(false);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04EventAction.hh"
|
||||
|
||||
#include "F04RunAction.hh"
|
||||
|
||||
#include "F04EventActionMessenger.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
F04EventAction::F04EventAction(F04RunAction* RA)
|
||||
: runaction(RA), verboselevel(0),
|
||||
printModulo(10), drawFlag("all")
|
||||
{
|
||||
eventMessenger = new F04EventActionMessenger(this);
|
||||
}
|
||||
|
||||
F04EventAction::~F04EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
void F04EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
|
||||
|
||||
if(verboselevel>0)
|
||||
G4cout << "<<< Event " << evtNb << " started." << G4endl;
|
||||
}
|
||||
|
||||
void F04EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
|
||||
if(pVVisManager)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (verboselevel>0)
|
||||
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
|
||||
|
||||
if (runaction->GetRndmFreq() == 2)
|
||||
{
|
||||
CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
{
|
||||
G4cout << "\n---> End of Event: " << evtNb << G4endl;
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4int F04EventAction::GetEventNo()
|
||||
{
|
||||
G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID();
|
||||
return evno ;
|
||||
}
|
||||
|
||||
void F04EventAction::SetEventVerbose(G4int level)
|
||||
{
|
||||
verboselevel = level ;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include "F04EventAction.hh"
|
||||
#include "F04EventActionMessenger.hh"
|
||||
|
||||
F04EventActionMessenger::F04EventActionMessenger(F04EventAction* EvAct)
|
||||
:eventAction(EvAct)
|
||||
{
|
||||
setVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
|
||||
setVerboseCmd->SetGuidance("Set verbose level ." );
|
||||
setVerboseCmd->SetParameterName("level",true);
|
||||
setVerboseCmd->SetDefaultValue(0);
|
||||
|
||||
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
|
||||
DrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
DrawCmd->SetGuidance(" Choice : none,charged, all");
|
||||
DrawCmd->SetParameterName("choice",true);
|
||||
DrawCmd->SetDefaultValue("all");
|
||||
DrawCmd->SetCandidates("none charged all");
|
||||
DrawCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
|
||||
PrintCmd->SetGuidance("Print events modulo n");
|
||||
PrintCmd->SetParameterName("EventNb",false);
|
||||
PrintCmd->SetRange("EventNb>0");
|
||||
PrintCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
F04EventActionMessenger::~F04EventActionMessenger()
|
||||
{
|
||||
delete setVerboseCmd;
|
||||
delete DrawCmd;
|
||||
delete PrintCmd;
|
||||
}
|
||||
|
||||
void F04EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if(command == setVerboseCmd)
|
||||
{eventAction->SetEventVerbose(setVerboseCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if(command == DrawCmd)
|
||||
{eventAction->SetDrawFlag(newValue);}
|
||||
|
||||
if(command == PrintCmd)
|
||||
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
#include "G4UserSpecialCuts.hh"
|
||||
#include "G4StepLimiter.hh"
|
||||
|
||||
#include "F04ExtraPhysics.hh"
|
||||
|
||||
F04ExtraPhysics::F04ExtraPhysics()
|
||||
: G4VPhysicsConstructor("Extra") { }
|
||||
|
||||
F04ExtraPhysics::~F04ExtraPhysics() { }
|
||||
|
||||
void F04ExtraPhysics::ConstructParticle() { }
|
||||
|
||||
void F04ExtraPhysics::ConstructProcess()
|
||||
{
|
||||
G4cout << "F04ExtraPhysics:: Add Extra Physics Processes"
|
||||
<< G4endl;
|
||||
|
||||
theParticleIterator->reset();
|
||||
|
||||
while ((*theParticleIterator)()) {
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4double charge = particle->GetPDGCharge();
|
||||
|
||||
if (!pmanager) {
|
||||
std::ostringstream o;
|
||||
o << "Particle " << particleName << "without a Process Manager";
|
||||
G4Exception("F04ExtraPhysics::ConstructProcess()","",
|
||||
FatalException,o.str().c_str());
|
||||
}
|
||||
|
||||
if (charge != 0.0) {
|
||||
// All charged particles should have a step limiter
|
||||
// to make sure that the steps do not get too long.
|
||||
pmanager->AddDiscreteProcess(new G4StepLimiter());
|
||||
pmanager->AddDiscreteProcess(new G4UserSpecialCuts());
|
||||
} else if (particleName == "neutron") {
|
||||
// time cuts for ONLY neutrons:
|
||||
pmanager->AddDiscreteProcess(new G4UserSpecialCuts());
|
||||
} else {
|
||||
// Energy cuts for all other neutral particles
|
||||
pmanager->AddDiscreteProcess(new G4UserSpecialCuts());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04FieldMessenger.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield)
|
||||
: fGlobalField(pEMfield)
|
||||
{
|
||||
detDir = new G4UIdirectory("/field/");
|
||||
detDir->SetGuidance(" Field tracking control ");
|
||||
|
||||
fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this);
|
||||
fStepperCMD->SetGuidance("Select stepper type for field");
|
||||
fStepperCMD->SetParameterName("choice",true);
|
||||
fStepperCMD->SetDefaultValue(4);
|
||||
fStepperCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fUpdateCMD = new G4UIcmdWithoutParameter("/field/update",this);
|
||||
fUpdateCMD->SetGuidance("Update Field");
|
||||
fUpdateCMD->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
fUpdateCMD->SetGuidance("if you changed field settings.");
|
||||
fUpdateCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
|
||||
fMinStepCMD->SetGuidance("Define minimal step");
|
||||
fMinStepCMD->SetParameterName("min step",false,false);
|
||||
fMinStepCMD->SetDefaultUnit("mm");
|
||||
fMinStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
|
||||
fDeltaChordCMD->SetGuidance("Define delta chord");
|
||||
fDeltaChordCMD->SetParameterName("delta chord",false,false);
|
||||
fDeltaChordCMD->SetDefaultUnit("mm");
|
||||
fDeltaChordCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fDeltaOneStepCMD =
|
||||
new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
|
||||
fDeltaOneStepCMD->SetGuidance("Define delta one step");
|
||||
fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
|
||||
fDeltaOneStepCMD->SetDefaultUnit("mm");
|
||||
fDeltaOneStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fDeltaIntersectionCMD =
|
||||
new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
|
||||
fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
|
||||
fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
|
||||
fDeltaIntersectionCMD->SetDefaultUnit("mm");
|
||||
fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
|
||||
fEpsMinCMD->SetGuidance("Define eps min");
|
||||
fEpsMinCMD->SetParameterName("eps min",false,false);
|
||||
fEpsMinCMD->SetDefaultUnit("mm");
|
||||
fEpsMinCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
|
||||
fEpsMaxCMD->SetGuidance("Define eps max");
|
||||
fEpsMaxCMD->SetParameterName("eps max",false,false);
|
||||
fEpsMaxCMD->SetDefaultUnit("mm");
|
||||
fEpsMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
F04FieldMessenger::~F04FieldMessenger()
|
||||
{
|
||||
delete detDir;
|
||||
|
||||
delete fStepperCMD;
|
||||
delete fMinStepCMD;
|
||||
delete fDeltaChordCMD;
|
||||
delete fDeltaOneStepCMD;
|
||||
delete fDeltaIntersectionCMD;
|
||||
delete fEpsMinCMD;
|
||||
delete fEpsMaxCMD;
|
||||
delete fUpdateCMD;
|
||||
}
|
||||
|
||||
void F04FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if( command == fStepperCMD )
|
||||
{
|
||||
fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
|
||||
}
|
||||
if( command == fUpdateCMD )
|
||||
{
|
||||
fGlobalField->updateField();
|
||||
}
|
||||
if( command == fMinStepCMD )
|
||||
{
|
||||
fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
if( command == fDeltaChordCMD )
|
||||
{
|
||||
fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
if( command == fDeltaOneStepCMD )
|
||||
{
|
||||
fGlobalField->
|
||||
SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
if( command == fDeltaIntersectionCMD )
|
||||
{
|
||||
fGlobalField->
|
||||
SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
if( command == fEpsMinCMD )
|
||||
{
|
||||
fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
if( command == fEpsMaxCMD )
|
||||
{
|
||||
fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
#include "F04FocusSolenoid.hh"
|
||||
#include "F04SimpleSolenoid.hh"
|
||||
|
||||
F04FocusSolenoid::F04FocusSolenoid(G4double Ba, G4double Bb, G4double fz,
|
||||
G4LogicalVolume* lv,
|
||||
G4ThreeVector c) : F04SimpleSolenoid(B1, fz, lv, c)
|
||||
|
||||
{
|
||||
B1 = Ba;
|
||||
B2 = Bb;
|
||||
Half = false;
|
||||
}
|
||||
|
||||
void F04FocusSolenoid::addFieldValue(const G4double point[4],
|
||||
G4double field[6]) const
|
||||
{
|
||||
G4ThreeVector global(point[0],point[1],point[2]);
|
||||
|
||||
G4ThreeVector local = global2local.TransformPoint(global);
|
||||
|
||||
if (isOutside(local)) return;
|
||||
|
||||
G4double length = ((F04SimpleSolenoid*)this)->getLength();
|
||||
|
||||
G4double Bz = (B2-B1) * std::abs(local.z())/(length/2.) + B1;
|
||||
|
||||
if (Half) { if (local.z() >= 0.) Bz = B1; }
|
||||
|
||||
G4ThreeVector B(0.0,0.0,Bz);
|
||||
|
||||
B = global2local.Inverse().TransformAxis(B);
|
||||
|
||||
field[0] += B[0];
|
||||
field[1] += B[1];
|
||||
field[2] += B[2];
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
#include "G4ExplicitEuler.hh"
|
||||
#include "G4ImplicitEuler.hh"
|
||||
#include "G4SimpleRunge.hh"
|
||||
#include "G4SimpleHeum.hh"
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4CashKarpRKF45.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
F04GlobalField* F04GlobalField::object = 0;
|
||||
|
||||
F04GlobalField::F04GlobalField() : G4ElectroMagneticField(),
|
||||
minStep(0.01*mm), deltaChord(3.0*mm),
|
||||
deltaOneStep(0.01*mm), deltaIntersection(0.1*mm),
|
||||
epsMin(2.5e-7*mm), epsMax(0.05*mm),
|
||||
fEquation(0), fFieldManager(0),
|
||||
fFieldPropagator(0), fStepper(0), fChordFinder(0)
|
||||
//F04GlobalField::F04GlobalField() : G4MagneticField(),
|
||||
// minStep(0.01*mm), deltaChord(3.0*mm),
|
||||
// deltaOneStep(0.01*mm), deltaIntersection(0.1*mm),
|
||||
// epsMin(2.5e-7*mm), epsMax(0.05*mm),
|
||||
// fEquation(0), fFieldManager(0),
|
||||
// fFieldPropagator(0), fStepper(0), fChordFinder(0)
|
||||
{
|
||||
fFieldMessenger = new F04FieldMessenger(this);
|
||||
|
||||
fields = new FieldList();
|
||||
|
||||
fStepperType = 4 ; // ClassicalRK4 is default stepper
|
||||
|
||||
// set object
|
||||
|
||||
object = this;
|
||||
|
||||
updateField();
|
||||
}
|
||||
|
||||
F04GlobalField::~F04GlobalField()
|
||||
{
|
||||
clear();
|
||||
|
||||
delete fFieldMessenger;
|
||||
|
||||
if (fEquation) delete fEquation;
|
||||
if (fFieldManager) delete fFieldManager;
|
||||
if (fFieldPropagator) delete fFieldPropagator;
|
||||
if (fStepper) delete fStepper;
|
||||
if (fChordFinder) delete fChordFinder;
|
||||
}
|
||||
|
||||
void F04GlobalField::updateField()
|
||||
{
|
||||
first = true;
|
||||
|
||||
nfp = 0;
|
||||
fp = 0;
|
||||
|
||||
clear();
|
||||
|
||||
// Construct equ. of motion of particles through B fields
|
||||
// fEquation = new G4Mag_EqRhs(this);
|
||||
// Construct equ. of motion of particles through e.m. fields
|
||||
// fEquation = new G4EqMagElectricField(this);
|
||||
// Construct equ. of motion of particles including spin through B fields
|
||||
// fEquation = new G4Mag_SpinEqRhs(this);
|
||||
// Construct equ. of motion of particles including spin through e.m. fields
|
||||
fEquation = new G4EqEMFieldWithSpin(this);
|
||||
|
||||
// Get transportation, field, and propagator managers
|
||||
G4TransportationManager* fTransportManager =
|
||||
G4TransportationManager::GetTransportationManager();
|
||||
|
||||
fFieldManager = GetGlobalFieldManager();
|
||||
|
||||
fFieldPropagator = fTransportManager->GetPropagatorInField();
|
||||
|
||||
// Need to SetFieldChangesEnergy to account for a time varying electric
|
||||
// field (r.f. fields)
|
||||
fFieldManager->SetFieldChangesEnergy(true);
|
||||
|
||||
// Set the field
|
||||
fFieldManager->SetDetectorField(this);
|
||||
|
||||
// Choose a stepper for integration of the equation of motion
|
||||
SetStepper();
|
||||
|
||||
// Create a cord finder providing the (global field, min step length,
|
||||
// a pointer to the stepper)
|
||||
fChordFinder = new G4ChordFinder((G4MagneticField*)this,minStep,fStepper);
|
||||
|
||||
// Set accuracy parameters
|
||||
fChordFinder->SetDeltaChord( deltaChord );
|
||||
|
||||
fFieldManager->SetAccuraciesWithDeltaOneStep(deltaOneStep);
|
||||
|
||||
fFieldManager->SetDeltaIntersection(deltaIntersection);
|
||||
|
||||
fFieldPropagator->SetMinimumEpsilonStep(epsMin);
|
||||
fFieldPropagator->SetMaximumEpsilonStep(epsMax);
|
||||
|
||||
G4cout << "Accuracy Parameters:" <<
|
||||
" MinStep=" << minStep <<
|
||||
" DeltaChord=" << deltaChord <<
|
||||
" DeltaOneStep=" << deltaOneStep << G4endl;
|
||||
G4cout << " " <<
|
||||
" DeltaIntersection=" << deltaIntersection <<
|
||||
" EpsMin=" << epsMin <<
|
||||
" EpsMax=" << epsMax << G4endl;
|
||||
|
||||
fFieldManager->SetChordFinder(fChordFinder);
|
||||
|
||||
}
|
||||
|
||||
F04GlobalField* F04GlobalField::getObject()
|
||||
{
|
||||
if (!object) new F04GlobalField();
|
||||
return object;
|
||||
}
|
||||
|
||||
void F04GlobalField::SetStepper()
|
||||
{
|
||||
if(fStepper) delete fStepper;
|
||||
|
||||
switch ( fStepperType )
|
||||
{
|
||||
case 0:
|
||||
// fStepper = new G4ExplicitEuler( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4ExplicitEuler( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4ExplicitEuler is called" << G4endl;
|
||||
break;
|
||||
case 1:
|
||||
// fStepper = new G4ImplicitEuler( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4ImplicitEuler( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4ImplicitEuler is called" << G4endl;
|
||||
break;
|
||||
case 2:
|
||||
// fStepper = new G4SimpleRunge( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4SimpleRunge( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4SimpleRunge is called" << G4endl;
|
||||
break;
|
||||
case 3:
|
||||
// fStepper = new G4SimpleHeum( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4SimpleHeum( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4SimpleHeum is called" << G4endl;
|
||||
break;
|
||||
case 4:
|
||||
// fStepper = new G4ClassicalRK4( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4ClassicalRK4( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4ClassicalRK4 (default) is called" << G4endl;
|
||||
break;
|
||||
case 5:
|
||||
// fStepper = new G4CashKarpRKF45( fEquation, 8 ); // no spin tracking
|
||||
fStepper = new G4CashKarpRKF45( fEquation, 12 ); // with spin tracking
|
||||
G4cout << "G4CashKarpRKF45 is called" << G4endl;
|
||||
break;
|
||||
default: fStepper = 0;
|
||||
}
|
||||
}
|
||||
|
||||
G4FieldManager* F04GlobalField::GetGlobalFieldManager()
|
||||
{
|
||||
return G4TransportationManager::GetTransportationManager()
|
||||
->GetFieldManager();
|
||||
}
|
||||
|
||||
void F04GlobalField::GetFieldValue(const G4double* point, G4double* field) const
|
||||
{
|
||||
// NOTE: this routine dominates the CPU time for tracking.
|
||||
// Using the simple array fp[] instead of fields[]
|
||||
// directly sped it up
|
||||
|
||||
field[0] = field[1] = field[2] = field[3] = field[4] = field[5] = 0.0;
|
||||
|
||||
// protect against Geant4 bug that calls us with point[] NaN.
|
||||
if(point[0] != point[0]) return;
|
||||
|
||||
// (can't use nfp or fp, as they may change)
|
||||
if (first) ((F04GlobalField*)this)->setupArray(); // (cast away const)
|
||||
|
||||
for (int i=0; i<nfp; ++i) {
|
||||
const F04ElementField* p = fp[i];
|
||||
if (p->isInBoundingBox(point)) {
|
||||
p->addFieldValue(point,field);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void F04GlobalField::clear()
|
||||
{
|
||||
if (fields) {
|
||||
if (fields->size()>0) {
|
||||
FieldList::iterator i;
|
||||
for (i=fields->begin(); i!=fields->end(); ++i) delete *i;
|
||||
fields->clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (fp) delete[] fp;
|
||||
|
||||
first = true;
|
||||
|
||||
nfp = 0;
|
||||
fp = NULL;
|
||||
}
|
||||
|
||||
void F04GlobalField::setupArray()
|
||||
{
|
||||
first = false;
|
||||
nfp = fields->size();
|
||||
fp = new const F04ElementField* [nfp+1]; // add 1 so it's never 0
|
||||
for (int i=0; i<nfp; ++i) fp[i] = (*fields)[i];
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04Materials.hh"
|
||||
|
||||
F04Materials::F04Materials()
|
||||
{
|
||||
nistMan = G4NistManager::Instance();
|
||||
|
||||
nistMan->SetVerbose(2);
|
||||
|
||||
CreateMaterials();
|
||||
}
|
||||
|
||||
F04Materials::~F04Materials()
|
||||
{
|
||||
delete Vacuum;
|
||||
delete Air;
|
||||
delete Sci;
|
||||
delete BeO;
|
||||
}
|
||||
|
||||
F04Materials* F04Materials::instance = 0;
|
||||
|
||||
F04Materials* F04Materials::GetInstance()
|
||||
{
|
||||
if (instance == 0)
|
||||
{
|
||||
instance = new F04Materials();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
G4Material* F04Materials::GetMaterial(const G4String material)
|
||||
{
|
||||
G4Material* mat = nistMan->FindOrBuildMaterial(material);
|
||||
|
||||
if (!mat) mat = G4Material::GetMaterial(material);
|
||||
if (!mat) {G4cout << material << "Not Found, Please Retry"<< G4endl;}
|
||||
|
||||
return mat;
|
||||
}
|
||||
|
||||
void F04Materials::CreateMaterials()
|
||||
{
|
||||
G4double density;
|
||||
std::vector<G4int> natoms;
|
||||
std::vector<G4double> fractionMass;
|
||||
std::vector<G4String> elements;
|
||||
|
||||
// Materials Definitions
|
||||
// =====================
|
||||
|
||||
// Define Vacuum
|
||||
|
||||
Vacuum = nistMan->FindOrBuildMaterial("G4_Galactic");
|
||||
|
||||
// Define Air
|
||||
|
||||
Air = nistMan->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
// Define BeO
|
||||
|
||||
BeO = nistMan->FindOrBuildMaterial("G4_BERYLLIUM_OXIDE");
|
||||
|
||||
// Define Scintillator
|
||||
|
||||
elements.push_back("C"); natoms.push_back(9);
|
||||
elements.push_back("H"); natoms.push_back(10);
|
||||
|
||||
// density = 1.032*g/cm3;
|
||||
// ==> when using ConstructNewMaterial give the density in g/cm3
|
||||
// ==> but do NOT multiply by the unit!!!
|
||||
|
||||
density = 1.032;
|
||||
|
||||
Sci = nistMan->
|
||||
ConstructNewMaterial("Scintillator", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
|
||||
G4cout << G4endl << "The materials defined are: " << G4endl << G4endl;
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4Scintillation.hh"
|
||||
#include "G4Cerenkov.hh"
|
||||
|
||||
#include "G4OpAbsorption.hh"
|
||||
#include "G4OpRayleigh.hh"
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
#include "G4OpWLS.hh"
|
||||
|
||||
#include "F04OpticalPhysics.hh"
|
||||
|
||||
F04OpticalPhysics::F04OpticalPhysics()
|
||||
: G4VPhysicsConstructor("Optical") { }
|
||||
|
||||
F04OpticalPhysics::~F04OpticalPhysics() { }
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
#include "G4OpticalPhoton.hh"
|
||||
|
||||
void F04OpticalPhysics::ConstructParticle()
|
||||
{
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
}
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
void F04OpticalPhysics::ConstructProcess()
|
||||
{
|
||||
G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
|
||||
<< G4endl;
|
||||
|
||||
G4Scintillation* theScintProcess = new G4Scintillation();
|
||||
G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
|
||||
|
||||
G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
|
||||
G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
|
||||
G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
|
||||
G4OpWLS* theWLSProcess=new G4OpWLS();
|
||||
|
||||
G4ProcessManager* pManager =
|
||||
G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
|
||||
|
||||
if (!pManager) {
|
||||
std::ostringstream o;
|
||||
o << "Optical Photon without a Process Manager";
|
||||
G4Exception("F04OpticalPhysics::ConstructProcess()","",
|
||||
FatalException,o.str().c_str());
|
||||
}
|
||||
|
||||
|
||||
pManager->AddDiscreteProcess(theAbsorptionProcess);
|
||||
pManager->AddDiscreteProcess(theRayleighScattering);
|
||||
|
||||
theBoundaryProcess->SetModel(unified);
|
||||
// theBoundaryProcess->SetModel(glisur);
|
||||
|
||||
pManager->AddDiscreteProcess(theBoundaryProcess);
|
||||
|
||||
theWLSProcess->UseTimeProfile("delta");
|
||||
// theWLSProcess->UseTimeProfile("exponential");
|
||||
|
||||
pManager->AddDiscreteProcess(theWLSProcess);
|
||||
|
||||
theScintProcess->SetScintillationYieldFactor(1.);
|
||||
theScintProcess->SetScintillationExcitationRatio(0.0);
|
||||
theScintProcess->SetTrackSecondariesFirst(true);
|
||||
|
||||
theParticleIterator->reset();
|
||||
|
||||
while( (*theParticleIterator)() ){
|
||||
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
pManager = particle->GetProcessManager();
|
||||
if (!pManager) {
|
||||
std::ostringstream o;
|
||||
o << "Particle " << particleName << "without a Process Manager";
|
||||
G4Exception("F04OpticalPhysics::ConstructProcess()","",
|
||||
FatalException,o.str().c_str());
|
||||
}
|
||||
|
||||
if(theCerenkovProcess->IsApplicable(*particle)){
|
||||
pManager->AddContinuousProcess(theCerenkovProcess);
|
||||
}
|
||||
if(theScintProcess->IsApplicable(*particle)){
|
||||
pManager->AddProcess(theScintProcess);
|
||||
pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
|
||||
pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,629 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04PhysicsList.hh"
|
||||
#include "F04PhysicsListMessenger.hh"
|
||||
|
||||
#include "F04ExtraPhysics.hh"
|
||||
//#include "F04OpticalPhysics.hh"
|
||||
|
||||
#include "G4DecayPhysics.hh"
|
||||
|
||||
#include "G4EmStandardPhysics_option1.hh"
|
||||
#include "G4EmStandardPhysics_option2.hh"
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
|
||||
#include "G4EmExtraPhysics.hh"
|
||||
#include "G4EmProcessOptions.hh"
|
||||
|
||||
#include "G4HadronElasticPhysics.hh"
|
||||
#include "G4HadronQElasticPhysics.hh"
|
||||
#include "G4HadronHElasticPhysics.hh"
|
||||
#include "G4NeutronTrackingCut.hh"
|
||||
#include "G4QStoppingPhysics.hh"
|
||||
#include "G4LHEPStoppingPhysics.hh"
|
||||
#include "G4IonBinaryCascadePhysics.hh"
|
||||
#include "G4IonPhysics.hh"
|
||||
|
||||
#include "HadronPhysicsFTFP.hh"
|
||||
#include "HadronPhysicsFTFC.hh"
|
||||
|
||||
#include "HadronPhysicsLHEP.hh"
|
||||
#include "HadronPhysicsLHEP_BERT.hh"
|
||||
#include "HadronPhysicsLHEP_EMV.hh"
|
||||
#include "HadronPhysicsLHEP_PRECO_HP.hh"
|
||||
|
||||
#include "HadronPhysicsQGSC.hh"
|
||||
#include "HadronPhysicsQGSC_EFLOW.hh"
|
||||
|
||||
#include "HadronPhysicsQGSP.hh"
|
||||
#include "HadronPhysicsQGSP_BERT.hh"
|
||||
#include "HadronPhysicsQGSP_BERT_HP.hh"
|
||||
#include "HadronPhysicsQGSP_BERT_TRV.hh"
|
||||
#include "HadronPhysicsQGSP_BIC.hh"
|
||||
#include "HadronPhysicsQGSP_BIC_HP.hh"
|
||||
|
||||
#include "G4HadronInelasticQBBC.hh"
|
||||
#include "G4HadronInelasticQLHEP.hh"
|
||||
|
||||
#include "G4IonPhysics.hh"
|
||||
|
||||
#include "G4HadronProcessStore.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
|
||||
#include "F04StepMax.hh"
|
||||
|
||||
#include "G4ProcessTable.hh"
|
||||
|
||||
#include "G4PionDecayMakeSpin.hh"
|
||||
#include "G4DecayWithSpin.hh"
|
||||
|
||||
#include "G4DecayTable.hh"
|
||||
#include "G4MuonDecayChannelWithSpin.hh"
|
||||
#include "G4MuonRadiativeDecayChannelWithSpin.hh"
|
||||
|
||||
F04PhysicsList::F04PhysicsList(G4String physicsList) : G4VModularPhysicsList()
|
||||
{
|
||||
G4LossTableManager::Instance();
|
||||
|
||||
defaultCutValue = 1.*mm;
|
||||
fCutForGamma = defaultCutValue;
|
||||
fCutForElectron = defaultCutValue;
|
||||
fCutForPositron = defaultCutValue;
|
||||
fDump = false;
|
||||
|
||||
fMessenger = new F04PhysicsListMessenger(this);
|
||||
|
||||
fEMPhysics = new PhysicsListVector();
|
||||
fHadronPhysics = new PhysicsListVector();
|
||||
|
||||
// Particles
|
||||
fParticleList = new G4DecayPhysics("decays");
|
||||
|
||||
// EM physics
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
|
||||
// Set the default hadronic physics.
|
||||
AddPhysicsList(physicsList);
|
||||
|
||||
stepMaxProcess = new F04StepMax();
|
||||
}
|
||||
|
||||
F04PhysicsList::~F04PhysicsList()
|
||||
{
|
||||
delete fMessenger;
|
||||
delete fParticleList;
|
||||
|
||||
ClearEMPhysics();
|
||||
ClearHadronPhysics();
|
||||
|
||||
delete fEMPhysics;
|
||||
delete fHadronPhysics;
|
||||
|
||||
delete stepMaxProcess;
|
||||
}
|
||||
|
||||
void F04PhysicsList::ClearEMPhysics()
|
||||
{
|
||||
for (PhysicsListVector::iterator p = fEMPhysics->begin();
|
||||
p != fEMPhysics->end(); ++p) {
|
||||
delete (*p);
|
||||
}
|
||||
fEMPhysics->clear();
|
||||
}
|
||||
|
||||
void F04PhysicsList::ClearHadronPhysics()
|
||||
{
|
||||
for (PhysicsListVector::iterator p = fHadronPhysics->begin();
|
||||
p != fHadronPhysics->end(); ++p) {
|
||||
delete (*p);
|
||||
}
|
||||
fHadronPhysics->clear();
|
||||
}
|
||||
|
||||
void F04PhysicsList::ConstructParticle()
|
||||
{
|
||||
fParticleList->ConstructParticle();
|
||||
|
||||
G4DecayTable* MuonPlusDecayTable = new G4DecayTable();
|
||||
MuonPlusDecayTable -> Insert(new
|
||||
G4MuonDecayChannelWithSpin("mu+",0.986));
|
||||
MuonPlusDecayTable -> Insert(new
|
||||
G4MuonRadiativeDecayChannelWithSpin("mu+",0.014));
|
||||
G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(MuonPlusDecayTable);
|
||||
|
||||
G4DecayTable* MuonMinusDecayTable = new G4DecayTable();
|
||||
MuonMinusDecayTable -> Insert(new
|
||||
G4MuonDecayChannelWithSpin("mu-",0.986));
|
||||
MuonMinusDecayTable -> Insert(new
|
||||
G4MuonRadiativeDecayChannelWithSpin("mu-",0.014));
|
||||
G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable);
|
||||
|
||||
}
|
||||
|
||||
void F04PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
|
||||
for (PhysicsListVector::iterator p = fEMPhysics->begin();
|
||||
p != fEMPhysics->end(); ++p) {
|
||||
(*p)->ConstructProcess();
|
||||
}
|
||||
|
||||
fParticleList->ConstructProcess();
|
||||
|
||||
G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
|
||||
|
||||
G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
|
||||
|
||||
G4VProcess* decay;
|
||||
decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
|
||||
|
||||
G4ProcessManager* fManager;
|
||||
fManager = G4MuonPlus::MuonPlus()->GetProcessManager();
|
||||
|
||||
if (fManager) {
|
||||
if (decay) fManager->RemoveProcess(decay);
|
||||
fManager->AddProcess(decayWithSpin);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
|
||||
fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
|
||||
}
|
||||
|
||||
decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
|
||||
|
||||
fManager = G4MuonMinus::MuonMinus()->GetProcessManager();
|
||||
|
||||
if (fManager) {
|
||||
if (decay) fManager->RemoveProcess(decay);
|
||||
fManager->AddProcess(decayWithSpin);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
|
||||
fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
|
||||
}
|
||||
|
||||
G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
|
||||
|
||||
decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
|
||||
|
||||
fManager = G4PionPlus::PionPlus()->GetProcessManager();
|
||||
|
||||
if (fManager) {
|
||||
if (decay) fManager->RemoveProcess(decay);
|
||||
fManager->AddProcess(poldecay);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
fManager ->SetProcessOrdering(poldecay, idxPostStep);
|
||||
fManager ->SetProcessOrdering(poldecay, idxAtRest);
|
||||
}
|
||||
|
||||
decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
|
||||
|
||||
fManager = G4PionMinus::PionMinus()->GetProcessManager();
|
||||
|
||||
if (fManager) {
|
||||
if (decay) fManager->RemoveProcess(decay);
|
||||
fManager->AddProcess(poldecay);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
fManager ->SetProcessOrdering(poldecay, idxPostStep);
|
||||
fManager ->SetProcessOrdering(poldecay, idxAtRest);
|
||||
}
|
||||
|
||||
for (PhysicsListVector::iterator p = fHadronPhysics->begin();
|
||||
p != fHadronPhysics->end();++p) {
|
||||
(*p)->ConstructProcess();
|
||||
}
|
||||
|
||||
AddStepMax();
|
||||
|
||||
if (fDump) G4HadronProcessStore::Instance()->Dump(1);
|
||||
}
|
||||
|
||||
void F04PhysicsList::RemoveFromEMPhysicsList(const G4String& name)
|
||||
{
|
||||
G4bool success = false;
|
||||
for (PhysicsListVector::iterator p = fEMPhysics->begin();
|
||||
p != fEMPhysics->end(); ++p) {
|
||||
G4VPhysicsConstructor* e = (*p);
|
||||
if (e->GetPhysicsName() == name) {
|
||||
fEMPhysics->erase(p);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!success) {
|
||||
std::ostringstream message;
|
||||
message << "PhysicsList::RemoveFromEMPhysicsList "<< name << "not found";
|
||||
G4Exception(message.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void F04PhysicsList::RemoveFromHadronPhysicsList(const G4String& name)
|
||||
{
|
||||
G4bool success = false;
|
||||
for (PhysicsListVector::iterator p = fHadronPhysics->begin();
|
||||
p != fHadronPhysics->end(); ++p) {
|
||||
G4VPhysicsConstructor* e = (*p);
|
||||
if (e->GetPhysicsName() == name) {
|
||||
fHadronPhysics->erase(p);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!success) {
|
||||
G4String message("F04PhysicsList::RemoveFromHadronPhysicsList \"");
|
||||
message += name;
|
||||
message += " not found \"";
|
||||
G4Exception(message);
|
||||
}
|
||||
}
|
||||
|
||||
void F04PhysicsList::AddPhysicsList(const G4String& name)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "F04PhysicsList::AddPhysicsList: <" << name
|
||||
<< ">" << G4endl;
|
||||
}
|
||||
|
||||
if (name == "emstandard_opt1") {
|
||||
|
||||
ClearEMPhysics();
|
||||
fEMPhysics->push_back(new G4EmStandardPhysics_option1());
|
||||
fEMPhysics->push_back(new F04ExtraPhysics());
|
||||
// fEMPhysics->push_back(new F04OpticalPhysics());
|
||||
|
||||
} else if (name == "emstandard_opt2") {
|
||||
|
||||
ClearEMPhysics();
|
||||
fEMPhysics->push_back(new G4EmStandardPhysics_option2());
|
||||
fEMPhysics->push_back(new F04ExtraPhysics());
|
||||
// fEMPhysics->push_back(new F04OpticalPhysics());
|
||||
|
||||
} else if (name == "FTFC") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsFTFC("hadron",true));
|
||||
|
||||
} else if (name == "FTFP") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsFTFP("hadron",true));
|
||||
|
||||
} else if (name == "FTFP_EMV") {
|
||||
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
AddPhysicsList("FTFP");
|
||||
|
||||
} else if (name == "LHEP") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
|
||||
verboseLevel,
|
||||
false));
|
||||
fHadronPhysics->push_back(new HadronPhysicsLHEP("hadron"));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "LHEP_BERT") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
|
||||
verboseLevel,
|
||||
false));
|
||||
fHadronPhysics->push_back(new HadronPhysicsLHEP_BERT("hadron"));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "LHEP_EMV") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
|
||||
verboseLevel,
|
||||
false));
|
||||
fHadronPhysics->push_back(new HadronPhysicsLHEP_EMV("hadron"));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "LHEP_PRECO_HP") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
|
||||
verboseLevel,
|
||||
false));
|
||||
fHadronPhysics->push_back(new HadronPhysicsLHEP_PRECO_HP("hadron"));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "QBBC") {
|
||||
|
||||
SetStandardList(false,true);
|
||||
fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
|
||||
verboseLevel,
|
||||
false,false,
|
||||
false,false,true));
|
||||
|
||||
} else if (name == "QBBCG") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
|
||||
verboseLevel,
|
||||
false,false,
|
||||
false,false,false));
|
||||
|
||||
} else if (name == "QBEC") {
|
||||
|
||||
SetStandardList(false,true);
|
||||
fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
|
||||
verboseLevel,
|
||||
false,true,
|
||||
false,false,true));
|
||||
|
||||
} else if (name == "QBBC_HP") {
|
||||
|
||||
SetStandardList(true,true);
|
||||
fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
|
||||
verboseLevel,
|
||||
false,false,
|
||||
false,true,true));
|
||||
|
||||
} else if (name == "QBEC_HP") {
|
||||
|
||||
SetStandardList(true,true);
|
||||
fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
|
||||
verboseLevel,
|
||||
false,true,
|
||||
false,true,true));
|
||||
|
||||
} else if (name == "QGSC") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSC("hadron",true));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel,false));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fHadronPhysics->push_back(new G4NeutronTrackingCut());
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "QGSC_EFLOW") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSC_EFLOW("hadron",true));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel,false));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fHadronPhysics->push_back(new G4NeutronTrackingCut());
|
||||
fDump = true;
|
||||
|
||||
} else if (name == "QGSC_EMV") {
|
||||
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
AddPhysicsList("QGSC");
|
||||
|
||||
} else if (name == "QGSP") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_BERT") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_BERT_EMV") {
|
||||
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
AddPhysicsList("QGSP_BERT");
|
||||
|
||||
} else if (name == "QGSP_BERT_HP") {
|
||||
|
||||
SetStandardList(true, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT_HP("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_BERT_NQE") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT("hadron",false));
|
||||
|
||||
} else if (name == "QGSP_BERT_TRV") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT_TRV("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_BIC") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BIC("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_BIC_HP") {
|
||||
|
||||
SetStandardList(true, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP_BIC_HP("hadron",true));
|
||||
|
||||
} else if (name == "QGSP_EMV") {
|
||||
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
AddPhysicsList("QGSP");
|
||||
|
||||
} else if (name == "QGSP_EMV_NQE") {
|
||||
|
||||
AddPhysicsList("emstandard_opt1");
|
||||
AddPhysicsList("QGSP_NQE");
|
||||
|
||||
} else if (name == "QGSP_EMX") {
|
||||
|
||||
AddPhysicsList("emstandard_opt2");
|
||||
AddPhysicsList("QGSP");
|
||||
|
||||
} else if (name == "QGSP_NQE") {
|
||||
|
||||
SetStandardList(false, false);
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",false));
|
||||
|
||||
} else if (name == "QGSP_QEL") {
|
||||
|
||||
ClearHadronPhysics();
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",true));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new G4IonPhysics("ion"));
|
||||
fHadronPhysics->push_back(new G4NeutronTrackingCut());
|
||||
fDump = true;
|
||||
|
||||
} else {
|
||||
|
||||
G4cout << "F04PhysicsList::AddPhysicsList: <" << name << ">"
|
||||
<< " is not defined" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetStandardList(G4bool flagHP, G4bool glauber)
|
||||
{
|
||||
ClearHadronPhysics();
|
||||
|
||||
fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
|
||||
fHadronPhysics->push_back(new G4HadronElasticPhysics("elastic",
|
||||
verboseLevel,
|
||||
flagHP,glauber));
|
||||
fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
|
||||
verboseLevel));
|
||||
fHadronPhysics->push_back(new G4IonBinaryCascadePhysics("binary_ion"));
|
||||
fHadronPhysics->push_back(new G4NeutronTrackingCut());
|
||||
|
||||
fDump = true;
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0) {
|
||||
G4cout << "F04PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// 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(fCutForGamma, "gamma");
|
||||
SetCutValue(fCutForElectron, "e-");
|
||||
SetCutValue(fCutForPositron, "e+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
fCutForGamma = cut;
|
||||
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
fCutForElectron = cut;
|
||||
SetParticleCuts(fCutForElectron, G4Electron::Electron());
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetCutForPositron(G4double cut)
|
||||
{
|
||||
fCutForPositron = cut;
|
||||
SetParticleCuts(fCutForPositron, G4Positron::Positron());
|
||||
}
|
||||
|
||||
void F04PhysicsList::List()
|
||||
{
|
||||
G4cout << "### PhysicsLists available: FTFC FTFP FTFP_EMV"
|
||||
<< " LHEP LHEP_BERT LHEP_EMV"
|
||||
<< G4endl;
|
||||
G4cout << " LHEP_PRECO_HP QBBC QBBCG"
|
||||
<< " QBEC QBBC_HP QBEC_HP"
|
||||
<< G4endl;
|
||||
G4cout << " QGSC QGSC_EFLOW QGSC_EMV"
|
||||
<< " QGSP QGSP_BERT QGSP_BER_EMV"
|
||||
<< G4endl;
|
||||
G4cout << " QGSP_BERT_HP QGSP_BERT_NQE"
|
||||
<< " QGSP_BERT_TRV"
|
||||
<< G4endl;
|
||||
G4cout << " QGSP_BIC QGSP_BIC_HP QGSP_EMV"
|
||||
<< " QGSP_EMV_NQE"
|
||||
<< G4endl;
|
||||
G4cout << " QGSC_EMX QGSP_NQE QGSP_QEL"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
void F04PhysicsList::SetStepMax(G4double step)
|
||||
{
|
||||
MaxChargedStep = step ;
|
||||
stepMaxProcess->SetStepMax(MaxChargedStep);
|
||||
}
|
||||
|
||||
F04StepMax* F04PhysicsList::GetStepMaxProcess()
|
||||
{
|
||||
return stepMaxProcess;
|
||||
}
|
||||
|
||||
void F04PhysicsList::AddStepMax()
|
||||
{
|
||||
// Step limitation seen as a process
|
||||
|
||||
theParticleIterator->reset();
|
||||
while ((*theParticleIterator)()){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
|
||||
{
|
||||
if (pmanager) pmanager ->AddDiscreteProcess(stepMaxProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "F04PhysicsListMessenger.hh"
|
||||
#include "F04PhysicsList.hh"
|
||||
|
||||
#include <G4UIdirectory.hh>
|
||||
#include <G4UIcmdWithAString.hh>
|
||||
#include <G4UIcmdWithoutParameter.hh>
|
||||
#include <G4UIcmdWithADoubleAndUnit.hh>
|
||||
|
||||
#include "G4PhaseSpaceDecayChannel.hh"
|
||||
#include "G4PionRadiativeDecayChannel.hh"
|
||||
|
||||
F04PhysicsListMessenger::F04PhysicsListMessenger(F04PhysicsList* pPhys)
|
||||
: fPhysicsList(pPhys)
|
||||
{
|
||||
fDirectory = new G4UIdirectory("/exp/phys/");
|
||||
fDirectory->SetGuidance("Control the physics lists");
|
||||
|
||||
fGammaCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/gammaCut",this);
|
||||
fGammaCutCMD->SetGuidance("Set gamma cut");
|
||||
fGammaCutCMD->SetParameterName("Gcut",false);
|
||||
fGammaCutCMD->SetUnitCategory("Length");
|
||||
fGammaCutCMD->SetRange("Gcut>0.0");
|
||||
fGammaCutCMD->SetDefaultUnit("mm");
|
||||
fGammaCutCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fElectCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/electronCut",
|
||||
this);
|
||||
fElectCutCMD->SetGuidance("Set electron cut");
|
||||
fElectCutCMD->SetParameterName("Ecut",false);
|
||||
fElectCutCMD->SetUnitCategory("Length");
|
||||
fElectCutCMD->SetRange("Ecut>0.0");
|
||||
fElectCutCMD->SetDefaultUnit("mm");
|
||||
fElectCutCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fPosCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/positronCut",
|
||||
this);
|
||||
fPosCutCMD->SetGuidance("Set positron cut");
|
||||
fPosCutCMD->SetParameterName("Pcut",false);
|
||||
fPosCutCMD->SetUnitCategory("Length");
|
||||
fPosCutCMD->SetRange("Pcut>0.0");
|
||||
fPosCutCMD->SetDefaultUnit("mm");
|
||||
fPosCutCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fAllCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/allCuts",this);
|
||||
fAllCutCMD->SetGuidance("Set cut for all");
|
||||
fAllCutCMD->SetParameterName("cut",false);
|
||||
fAllCutCMD->SetUnitCategory("Length");
|
||||
fAllCutCMD->SetRange("cut>0.0");
|
||||
fAllCutCMD->SetDefaultUnit("mm");
|
||||
fAllCutCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/stepMax",this);
|
||||
fStepMaxCMD->SetGuidance("Set max. step length in the detector");
|
||||
fStepMaxCMD->SetParameterName("mxStep",false);
|
||||
fStepMaxCMD->SetUnitCategory("Length");
|
||||
fStepMaxCMD->SetRange("mxStep>0.0");
|
||||
fStepMaxCMD->SetDefaultUnit("mm");
|
||||
fStepMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fAddPhysicsCMD = new G4UIcmdWithAString("/exp/phys/addPhysics",this);
|
||||
fAddPhysicsCMD->SetGuidance("Add to modular physics list");
|
||||
fAddPhysicsCMD->SetParameterName("PList",false);
|
||||
fAddPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fClearEMPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearEMPhysics",this);
|
||||
fClearEMPhysicsCMD->SetGuidance("Clear the EM physics list");
|
||||
fClearEMPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fClearHadronPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearHadronPhysics",this);
|
||||
fClearHadronPhysicsCMD->SetGuidance("Clear the Hadron physics list");
|
||||
fClearHadronPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fRemoveEMPhysicsCMD = new G4UIcmdWithAString("/exp/phys/removeEMPhysics",this);
|
||||
fRemoveEMPhysicsCMD->SetGuidance("Remove a physics process from EM Physics List");
|
||||
fRemoveEMPhysicsCMD->SetParameterName("PList",false);
|
||||
fRemoveEMPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fRemoveHadronPhysicsCMD = new G4UIcmdWithAString("/exp/phys/removeHadronPhysics",this);
|
||||
fRemoveHadronPhysicsCMD->SetGuidance("Remove a physics process from Hadron Physics List");
|
||||
fRemoveHadronPhysicsCMD->SetParameterName("PList",false);
|
||||
fRemoveHadronPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fListCMD = new G4UIcmdWithoutParameter("/exp/phys/list",this);
|
||||
fListCMD->SetGuidance("Available Physics Lists");
|
||||
fListCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fDecayDirectory = new G4UIdirectory("/decay/");
|
||||
fDecayDirectory->SetGuidance("Decay chain control commands.");
|
||||
|
||||
fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
|
||||
fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
|
||||
|
||||
fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
|
||||
fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
|
||||
|
||||
}
|
||||
|
||||
F04PhysicsListMessenger::~F04PhysicsListMessenger()
|
||||
{
|
||||
delete fGammaCutCMD;
|
||||
delete fElectCutCMD;
|
||||
delete fPosCutCMD;
|
||||
delete fAllCutCMD;
|
||||
|
||||
delete fAddPhysicsCMD;
|
||||
delete fClearEMPhysicsCMD;
|
||||
delete fClearHadronPhysicsCMD;
|
||||
delete fRemoveEMPhysicsCMD;
|
||||
delete fRemoveHadronPhysicsCMD;
|
||||
|
||||
delete fListCMD;
|
||||
|
||||
delete fPienuCMD;
|
||||
delete fPimunuCMD;
|
||||
}
|
||||
|
||||
void F04PhysicsListMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
|
||||
if (command == fPienuCMD) {
|
||||
particleTable = G4ParticleTable::GetParticleTable();
|
||||
particleDef = particleTable->FindParticle("pi+");
|
||||
mode = new G4PhaseSpaceDecayChannel("pi+",0.999983,2,"e+","nu_e");
|
||||
table=new G4DecayTable();
|
||||
table->Insert(mode);
|
||||
mode = new G4PionRadiativeDecayChannel("pi+",0.000017);
|
||||
table->Insert(mode);
|
||||
particleDef->SetDecayTable(table);
|
||||
}
|
||||
|
||||
if (command == fPimunuCMD) {
|
||||
particleTable = G4ParticleTable::GetParticleTable();
|
||||
particleDef = particleTable->FindParticle("pi+");
|
||||
mode = new G4PhaseSpaceDecayChannel("pi+",1.000,2,"mu+","nu_mu");
|
||||
table=new G4DecayTable();
|
||||
table->Insert(mode);
|
||||
particleDef->SetDecayTable(table);
|
||||
}
|
||||
|
||||
if (command == fGammaCutCMD) {
|
||||
fPhysicsList->SetCutForGamma(fGammaCutCMD
|
||||
->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if (command == fElectCutCMD) {
|
||||
fPhysicsList->SetCutForElectron(fElectCutCMD
|
||||
->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if (command == fPosCutCMD) {
|
||||
fPhysicsList->SetCutForPositron(fPosCutCMD
|
||||
->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if (command == fAllCutCMD) {
|
||||
G4double cut = fAllCutCMD->GetNewDoubleValue(newValue);
|
||||
fPhysicsList->SetCutForGamma(cut);
|
||||
fPhysicsList->SetCutForElectron(cut);
|
||||
fPhysicsList->SetCutForPositron(cut);
|
||||
}
|
||||
else if (command == fStepMaxCMD) {
|
||||
fPhysicsList->SetStepMax(fStepMaxCMD
|
||||
->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if (command == fAddPhysicsCMD) {
|
||||
G4String name = newValue;
|
||||
if (name == "PHYSLIST") {
|
||||
char* path = getenv(name);
|
||||
if (path) name = G4String(path);
|
||||
else {
|
||||
G4cout << "### F04PhysicsListMessenger WARNING: "
|
||||
<< " environment variable PHYSLIST is not defined"
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
fPhysicsList->AddPhysicsList(name);
|
||||
}
|
||||
else if (command == fClearEMPhysicsCMD) {
|
||||
fPhysicsList->ClearEMPhysics();
|
||||
}
|
||||
else if (command == fClearHadronPhysicsCMD) {
|
||||
fPhysicsList->ClearHadronPhysics();
|
||||
}
|
||||
else if (command == fRemoveEMPhysicsCMD) {
|
||||
G4String name = newValue;
|
||||
fPhysicsList->RemoveFromEMPhysicsList(name);
|
||||
}
|
||||
else if (command == fRemoveHadronPhysicsCMD) {
|
||||
G4String name = newValue;
|
||||
fPhysicsList->RemoveFromHadronPhysicsList(name);
|
||||
}
|
||||
else if (command == fListCMD) {
|
||||
fPhysicsList->List();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "F04PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "F04DetectorConstruction.hh"
|
||||
#include "F04PrimaryGeneratorMessenger.hh"
|
||||
|
||||
G4bool F04PrimaryGeneratorAction::first = false;
|
||||
|
||||
F04PrimaryGeneratorAction::F04PrimaryGeneratorAction(F04DetectorConstruction* DC)
|
||||
: Detector(DC), rndmFlag("off"),
|
||||
xvertex(0.), yvertex(0.), zvertex(0.),
|
||||
vertexdefined(false)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
gunMessenger = new F04PrimaryGeneratorMessenger(this);
|
||||
|
||||
G4String particleName;
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
particleGun->SetParticleDefinition(particleTable->
|
||||
FindParticle(particleName="proton"));
|
||||
particleGun->SetParticleEnergy(500.*MeV);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
|
||||
zvertex = -0.5*(Detector->GetTargetThickness());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(xvertex,yvertex,zvertex));
|
||||
|
||||
}
|
||||
|
||||
F04PrimaryGeneratorAction::~F04PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
}
|
||||
|
||||
void F04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
|
||||
if (!first) {
|
||||
|
||||
first = true;
|
||||
|
||||
G4Navigator* theNavigator =
|
||||
G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking();
|
||||
G4Navigator* aNavigator = new G4Navigator();
|
||||
if ( theNavigator->GetWorldVolume() )
|
||||
aNavigator->SetWorldVolume(theNavigator->GetWorldVolume());
|
||||
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
|
||||
if (!geomManager->IsGeometryClosed()) {
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(true);
|
||||
}
|
||||
|
||||
G4ThreeVector center(0.,0.,0.);
|
||||
aNavigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
|
||||
G4TouchableHistoryHandle fTouchable = aNavigator->
|
||||
CreateTouchableHistoryHandle();
|
||||
|
||||
// set global2local transform
|
||||
global2local = fTouchable->GetHistory()->GetTopTransform();
|
||||
|
||||
G4ThreeVector direction(0.0,0.0,1.0);
|
||||
direction = global2local.Inverse().TransformAxis(direction);
|
||||
|
||||
particleGun->SetParticleMomentumDirection(direction);
|
||||
}
|
||||
|
||||
G4double x0,y0,z0 ;
|
||||
|
||||
if(vertexdefined)
|
||||
{
|
||||
x0 = xvertex ;
|
||||
y0 = yvertex ;
|
||||
z0 = zvertex ;
|
||||
}
|
||||
else
|
||||
{
|
||||
x0 = 0. ;
|
||||
y0 = 0. ;
|
||||
z0 = -0.5*(Detector->GetTargetThickness());
|
||||
}
|
||||
|
||||
G4double r0,phi0 ;
|
||||
|
||||
if (rndmFlag == "on")
|
||||
{
|
||||
r0 = (Detector->GetTargetRadius())*std::sqrt(G4UniformRand());
|
||||
phi0 = twopi*G4UniformRand();
|
||||
x0 = r0*std::cos(phi0);
|
||||
y0 = r0*std::sin(phi0);
|
||||
}
|
||||
|
||||
G4ThreeVector localPosition(x0,y0,z0);
|
||||
G4ThreeVector globalPosition =
|
||||
global2local.Inverse().TransformPoint(localPosition);
|
||||
|
||||
particleGun->SetParticlePosition(globalPosition);
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
void F04PrimaryGeneratorAction::Setxvertex(G4double x)
|
||||
{
|
||||
vertexdefined = true ;
|
||||
xvertex = x ;
|
||||
G4cout << " X coordinate of the primary vertex = " << xvertex/mm <<
|
||||
" mm." << G4endl;
|
||||
}
|
||||
|
||||
void F04PrimaryGeneratorAction::Setyvertex(G4double y)
|
||||
{
|
||||
vertexdefined = true ;
|
||||
yvertex = y ;
|
||||
G4cout << " Y coordinate of the primary vertex = " << yvertex/mm <<
|
||||
" mm." << G4endl;
|
||||
}
|
||||
|
||||
void F04PrimaryGeneratorAction::Setzvertex(G4double z)
|
||||
{
|
||||
vertexdefined = true ;
|
||||
zvertex = z ;
|
||||
G4cout << " Z coordinate of the primary vertex = " << zvertex/mm <<
|
||||
" mm." << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include "F04PrimaryGeneratorAction.hh"
|
||||
#include "F04PrimaryGeneratorMessenger.hh"
|
||||
|
||||
F04PrimaryGeneratorMessenger::F04PrimaryGeneratorMessenger(F04PrimaryGeneratorAction* Gun)
|
||||
: Action(Gun)
|
||||
{
|
||||
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(G4State_PreInit,G4State_Idle);
|
||||
|
||||
setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
|
||||
setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
|
||||
setxvertexCmd->SetParameterName("xv",true);
|
||||
setxvertexCmd->SetDefaultValue(0.0*mm) ;
|
||||
|
||||
setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
|
||||
setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
|
||||
setyvertexCmd->SetParameterName("yv",true);
|
||||
setyvertexCmd->SetDefaultValue(0.0*mm) ;
|
||||
|
||||
setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
|
||||
setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
|
||||
setzvertexCmd->SetParameterName("zv",true);
|
||||
setzvertexCmd->SetDefaultValue(0.0*mm) ;
|
||||
|
||||
}
|
||||
|
||||
F04PrimaryGeneratorMessenger::~F04PrimaryGeneratorMessenger()
|
||||
{
|
||||
delete RndmCmd;
|
||||
delete setxvertexCmd;
|
||||
delete setyvertexCmd;
|
||||
delete setzvertexCmd;
|
||||
}
|
||||
|
||||
void F04PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command == RndmCmd )
|
||||
{ Action->SetRndmFlag(newValue);}
|
||||
if( command == setxvertexCmd)
|
||||
{ Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == setyvertexCmd)
|
||||
{ Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == setzvertexCmd)
|
||||
{ Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04RunAction.hh"
|
||||
#include "F04RunActionMessenger.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
F04RunAction::F04RunAction()
|
||||
: saveRndm(0)
|
||||
{
|
||||
runMessenger = new F04RunActionMessenger(this);
|
||||
}
|
||||
|
||||
F04RunAction::~F04RunAction()
|
||||
{
|
||||
delete runMessenger;
|
||||
}
|
||||
|
||||
void F04RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
|
||||
|
||||
if (saveRndm > 0)
|
||||
{
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("BeginOfRun.rndm");
|
||||
}
|
||||
|
||||
FieldList* fields = F04GlobalField::getObject()->getFields();
|
||||
|
||||
if (fields) {
|
||||
if (fields->size()>0) {
|
||||
FieldList::iterator i;
|
||||
for (i=fields->begin(); i!=fields->end(); ++i)(*i)->construct();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F04RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
if (saveRndm == 1)
|
||||
{
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
#include "F04RunAction.hh"
|
||||
#include "F04RunActionMessenger.hh"
|
||||
|
||||
F04RunActionMessenger::F04RunActionMessenger(F04RunAction* RA)
|
||||
: runAction (RA)
|
||||
{
|
||||
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(G4State_PreInit,G4State_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(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
F04RunActionMessenger::~F04RunActionMessenger()
|
||||
{
|
||||
delete RndmDir; delete RndmSaveCmd; delete RndmReadCmd;
|
||||
}
|
||||
|
||||
void F04RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
{
|
||||
if (command == RndmSaveCmd)
|
||||
runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
|
||||
|
||||
if (command == RndmReadCmd)
|
||||
{ G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
|
||||
CLHEP::HepRandom::restoreEngineStatus(newValues);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
#include "F04SimpleSolenoid.hh"
|
||||
|
||||
F04SimpleSolenoid::F04SimpleSolenoid(G4double Bz, G4double fz,
|
||||
G4LogicalVolume* lv,
|
||||
G4ThreeVector c) : F04ElementField(c,lv)
|
||||
{
|
||||
Bfield = Bz;
|
||||
fringeZ = fz;
|
||||
|
||||
fieldLength = 2.*((G4Tubs*)lvolume->GetSolid())->GetZHalfLength()+fringeZ;
|
||||
fieldRadius = ((G4Tubs*)lvolume->GetSolid())->GetOuterRadius();
|
||||
}
|
||||
|
||||
void F04SimpleSolenoid::addFieldValue(const G4double point[4],
|
||||
G4double field[6]) const
|
||||
{
|
||||
G4ThreeVector global(point[0],point[1],point[2]);
|
||||
G4ThreeVector local;
|
||||
|
||||
local = global2local.TransformPoint(global);
|
||||
|
||||
if (isOutside(local)) return;
|
||||
|
||||
G4ThreeVector B(0.0,0.0,Bfield);
|
||||
|
||||
B = global2local.Inverse().TransformAxis(B);
|
||||
|
||||
field[0] += B[0];
|
||||
field[1] += B[1];
|
||||
field[2] += B[2];
|
||||
}
|
||||
|
||||
G4bool F04SimpleSolenoid::isOutside(G4ThreeVector& local) const
|
||||
{
|
||||
// EInside inside = tubs->Inside(local);
|
||||
// return (inside == kOutside);
|
||||
G4double r = std::sqrt(local.x()*local.x()+local.y()*local.y());
|
||||
return (r > fieldRadius || std::fabs(local.z()) > fieldLength/2.0);
|
||||
}
|
||||
|
||||
G4bool F04SimpleSolenoid::isWithin(G4ThreeVector& local) const
|
||||
{
|
||||
// EInside inside = tubs->Inside(local);
|
||||
// return (inside == kInside);
|
||||
G4double r = std::sqrt(local.x()*local.x()+local.y()*local.y());
|
||||
return (r < fieldRadius && std::fabs(local.z()) < fieldLength/2.0);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04StackingAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
F04StackingAction::F04StackingAction() { }
|
||||
|
||||
F04StackingAction::~F04StackingAction() { }
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
F04StackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
{
|
||||
G4ParticleDefinition* particleType = aTrack->GetDefinition();
|
||||
const G4String name = particleType->GetParticleName();
|
||||
|
||||
// keep primary particle
|
||||
if (aTrack->GetParentID() == 0) return fUrgent;
|
||||
|
||||
if (particleType != G4Proton::ProtonDefinition() &&
|
||||
particleType != G4Neutron::NeutronDefinition() &&
|
||||
particleType != G4KaonPlus::KaonPlusDefinition() &&
|
||||
particleType != G4PionPlus::PionPlusDefinition() &&
|
||||
particleType != G4MuonPlus::MuonPlusDefinition() &&
|
||||
particleType != G4Positron::PositronDefinition()) return fKill;
|
||||
|
||||
if (name != "pi+" && name != "mu+") return fKill;
|
||||
|
||||
// if (name == "mu+") G4RunManager::GetRunManager()->rndmSaveThisEvent();
|
||||
|
||||
return fUrgent;
|
||||
}
|
||||
|
||||
void F04StackingAction::NewStage() { }
|
||||
|
||||
void F04StackingAction::PrepareNewEvent() { }
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
#include "F04StepMax.hh"
|
||||
|
||||
F04StepMax::F04StepMax(const G4String& aName)
|
||||
: G4VDiscreteProcess(aName), MaxChargedStep(DBL_MAX)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created "<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
F04StepMax::~F04StepMax() { }
|
||||
|
||||
F04StepMax::F04StepMax(F04StepMax& right) : G4VDiscreteProcess(right) { }
|
||||
|
||||
G4bool F04StepMax::IsApplicable(const G4ParticleDefinition& particle)
|
||||
{
|
||||
return (particle.GetPDGCharge() != 0.);
|
||||
}
|
||||
|
||||
void F04StepMax::SetStepMax(G4double step) { MaxChargedStep = step ; }
|
||||
|
||||
G4double F04StepMax::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
G4double ProposedStep = DBL_MAX;
|
||||
|
||||
if ( MaxChargedStep > 0.) ProposedStep = MaxChargedStep ;
|
||||
|
||||
return ProposedStep;
|
||||
}
|
||||
|
||||
G4VParticleChange* F04StepMax::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& )
|
||||
{
|
||||
// do nothing
|
||||
aParticleChange.Initialize(aTrack);
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
G4double F04StepMax::GetMeanFreePath(const G4Track&,G4double,G4ForceCondition*)
|
||||
{
|
||||
return 0.;
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4Track.hh"
|
||||
|
||||
#include "F04SteppingAction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "F04SteppingActionMessenger.hh"
|
||||
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
#include "F04UserTrackInformation.hh"
|
||||
|
||||
F04SteppingAction::F04SteppingAction()
|
||||
{
|
||||
steppingMessenger = new F04SteppingActionMessenger(this);
|
||||
}
|
||||
|
||||
F04SteppingAction::~F04SteppingAction()
|
||||
{
|
||||
delete steppingMessenger ;
|
||||
}
|
||||
|
||||
void F04SteppingAction::UserSteppingAction(const G4Step* theStep)
|
||||
{
|
||||
G4Track* theTrack = theStep->GetTrack();
|
||||
|
||||
if (theTrack->GetParentID()==0) {
|
||||
//This is a primary track
|
||||
G4String theVolumeName = theStep->GetPreStepPoint()->
|
||||
GetPhysicalVolume()->GetName();
|
||||
if (theVolumeName != "Target") {
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// G4ParticleDefinition* particleType = theTrack->GetDefinition();
|
||||
|
||||
// check if it is entering the test volume
|
||||
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
|
||||
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
|
||||
G4String thePrePVname = thePrePV->GetName();
|
||||
|
||||
G4String thePostPVname = " ";
|
||||
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
|
||||
|
||||
if (thePostPoint) {
|
||||
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
|
||||
if (thePostPV) thePostPVname = thePostPV->GetName();
|
||||
}
|
||||
|
||||
if (thePrePVname != "TestPlane" &&
|
||||
thePostPVname == "TestPlane") {
|
||||
|
||||
// G4double x = theTrack->GetPosition().x();
|
||||
// G4double y = theTrack->GetPosition().y();
|
||||
|
||||
G4ThreeVector theMomentumDirection = theTrack->
|
||||
GetDynamicParticle()->GetMomentumDirection();
|
||||
// G4double theTotalMomentum = theTrack->GetDynamicParticle()->
|
||||
// GetTotalMomentum();
|
||||
|
||||
// then kill the track
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// G4double z = theTrack->GetPosition().z();
|
||||
|
||||
F04UserTrackInformation* trackInformation =
|
||||
(F04UserTrackInformation*)theTrack->GetUserInformation();
|
||||
|
||||
if (trackInformation->GetTrackStatusFlag() != reverse) {
|
||||
if (thePrePVname != "Target" ) {
|
||||
if ( theTrack-> GetMomentumDirection().z()>0.0 &&
|
||||
theTrack->GetVertexMomentumDirection().z()<0.0 )
|
||||
{
|
||||
trackInformation->SetTrackStatusFlag(reverse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if it is alive
|
||||
if (theTrack->GetTrackStatus() == fAlive) { return; }
|
||||
|
||||
if (thePostPoint->GetProcessDefinedStep() != 0) {
|
||||
if (thePostPoint->GetProcessDefinedStep()->GetProcessName() != "Decay") return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "F04SteppingAction.hh"
|
||||
|
||||
#include "F04SteppingActionMessenger.hh"
|
||||
|
||||
F04SteppingActionMessenger::F04SteppingActionMessenger(F04SteppingAction* SA)
|
||||
: steppingAction (SA)
|
||||
{
|
||||
steppingDir = new G4UIdirectory("/stepping/");
|
||||
steppingDir->SetGuidance("stepping control");
|
||||
}
|
||||
|
||||
F04SteppingActionMessenger::~F04SteppingActionMessenger()
|
||||
{
|
||||
delete steppingDir;
|
||||
}
|
||||
|
||||
void F04SteppingActionMessenger::SetNewValue(G4UIcommand*, G4String) { }
|
||||
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "F04SteppingVerbose.hh"
|
||||
|
||||
F04SteppingVerbose::F04SteppingVerbose()
|
||||
{
|
||||
G4VSteppingVerbose::SetSilent(1);
|
||||
}
|
||||
|
||||
F04SteppingVerbose::~F04SteppingVerbose()
|
||||
{}
|
||||
|
||||
void F04SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(8);
|
||||
|
||||
if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
|
||||
// if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
|
||||
// if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
|
||||
if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw(10) << "X" << " "
|
||||
<< std::setw(10) << "Y" << " "
|
||||
<< std::setw(10) << "Z" << " "
|
||||
<< std::setw(10) << "KineE" << " "
|
||||
<< std::setw(10) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "NextVolu"
|
||||
<< std::setw(10) << "Process"
|
||||
<< std::setw(10) << "Dir_x" << " "
|
||||
<< std::setw(10) << "Dir_y" << " "
|
||||
<< std::setw(10) << "Dir_z" << " "
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(10) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
|
||||
G4cout << " "
|
||||
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << " UserLimit";
|
||||
}
|
||||
|
||||
// G4cout << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().x(),"Length")
|
||||
// << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().y(),"Length")
|
||||
// << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().z(),"Length");
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
void F04SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
|
||||
// if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
|
||||
// if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
|
||||
if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
G4cout << "* G4Track Information: "
|
||||
<< " Particle = " << fTrack->GetDefinition()->GetParticleName()
|
||||
<< ","
|
||||
<< " Track ID = " << fTrack->GetTrackID()
|
||||
<< ","
|
||||
<< " Parent ID = " << fTrack->GetParentID()
|
||||
<< G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
G4cout << " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//#include "F04Trajectory.hh"
|
||||
|
||||
#include "F04UserTrackInformation.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
|
||||
#include "F04TrackingAction.hh"
|
||||
|
||||
void F04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
F04UserTrackInformation* trackInformation = new F04UserTrackInformation();
|
||||
|
||||
fpTrackingManager->SetUserTrackInformation(trackInformation);
|
||||
|
||||
if (aTrack->GetMomentumDirection().z()>0.0) {
|
||||
trackInformation->SetTrackStatusFlag(right);
|
||||
} else {
|
||||
trackInformation->SetTrackStatusFlag(left);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void F04TrackingAction::PostUserTrackingAction(const G4Track* aTrack){
|
||||
|
||||
F04UserTrackInformation*
|
||||
trackInformation = (F04UserTrackInformation*)aTrack->GetUserInformation();
|
||||
|
||||
if ( aTrack->GetDefinition()==G4MuonPlus::MuonPlusDefinition() ||
|
||||
aTrack->GetDefinition()==G4PionPlus::PionPlusDefinition() ) {
|
||||
if (trackInformation->GetTrackStatusFlag() == reverse) {
|
||||
// G4RunManager::GetRunManager()->rndmSaveThisEvent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "F04Trajectory.hh"
|
||||
#include "F04TrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<F04Trajectory> aTrajectoryAllocator;
|
||||
|
||||
F04Trajectory::F04Trajectory()
|
||||
: fpPointsContainer(0), fTrackID(0), fParentID(0),
|
||||
PDGCharge(0.0), PDGEncoding(0), ParticleName(""),
|
||||
initialMomentum(G4ThreeVector()) {;}
|
||||
|
||||
F04Trajectory::F04Trajectory(const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
|
||||
ParticleName = fpParticleDefinition->GetParticleName();
|
||||
PDGCharge = fpParticleDefinition->GetPDGCharge();
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
initialMomentum = aTrack->GetMomentum();
|
||||
fpPointsContainer = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fpPointsContainer->push_back(new F04TrajectoryPoint(aTrack));
|
||||
}
|
||||
|
||||
F04Trajectory::F04Trajectory(F04Trajectory & right) : G4VTrajectory()
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialMomentum = right.initialMomentum;
|
||||
fpPointsContainer = new TrajectoryPointContainer();
|
||||
|
||||
for(size_t i=0;i<right.fpPointsContainer->size();++i) {
|
||||
F04TrajectoryPoint* rightPoint
|
||||
= (F04TrajectoryPoint*)((*(right.fpPointsContainer))[i]);
|
||||
fpPointsContainer->push_back(new F04TrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
F04Trajectory::~F04Trajectory()
|
||||
{
|
||||
for(size_t i=0;i<fpPointsContainer->size();++i){
|
||||
delete (*fpPointsContainer)[i];
|
||||
}
|
||||
fpPointsContainer->clear();
|
||||
|
||||
delete fpPointsContainer;
|
||||
}
|
||||
|
||||
void F04Trajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void F04Trajectory::DrawTrajectory(G4int i_mode) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::DrawTrajectory(i_mode);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void F04Trajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpPointsContainer->push_back(new F04TrajectoryPoint(aStep));
|
||||
}
|
||||
|
||||
G4ParticleDefinition* F04Trajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
void F04Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(!secondTrajectory) return;
|
||||
|
||||
F04Trajectory* second = (F04Trajectory*)secondTrajectory;
|
||||
G4int ent = second->GetPointEntries();
|
||||
// initial point of the second trajectory should not be merged
|
||||
for(G4int i=1; i<ent; ++i) {
|
||||
fpPointsContainer->push_back((*(second->fpPointsContainer))[i]);
|
||||
}
|
||||
delete (*second->fpPointsContainer)[0];
|
||||
second->fpPointsContainer->clear();
|
||||
}
|
||||
|
||||
const std::map<G4String,G4AttDef>* F04Trajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("Trajectory",isNew);
|
||||
|
||||
if (isNew) {
|
||||
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom,
|
||||
"Momentum of track at start of trajectory",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] = G4AttDef(IMag,
|
||||
"Magnitude of momentum of track at start of trajectory",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Bookkeeping","","G4int");
|
||||
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* F04Trajectory::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
|
||||
|
||||
values->push_back(G4AttValue("PN",ParticleName,""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("Ch",G4UIcommand::ConvertToString(PDGCharge),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
return values;
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04TrajectoryPoint.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4StepStatus.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4Allocator<F04TrajectoryPoint> aTrajPointAllocator;
|
||||
|
||||
F04TrajectoryPoint::F04TrajectoryPoint()
|
||||
: fTime(0.), fMomentum(0.,0.,0.),
|
||||
fStepStatus(fUndefined), fVolumeName("") { }
|
||||
|
||||
F04TrajectoryPoint::F04TrajectoryPoint(const G4Step* aStep)
|
||||
: G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
|
||||
{
|
||||
fTime = aStep->GetPostStepPoint()->GetGlobalTime();
|
||||
fMomentum = aStep->GetPostStepPoint()->GetMomentum();
|
||||
fStepStatus = aStep->GetPostStepPoint()->GetStepStatus();
|
||||
if (aStep->GetPostStepPoint()->GetPhysicalVolume())
|
||||
{
|
||||
fVolumeName = aStep->GetPostStepPoint()->
|
||||
GetPhysicalVolume()->GetName();
|
||||
} else {
|
||||
fVolumeName = " ";
|
||||
}
|
||||
}
|
||||
|
||||
F04TrajectoryPoint::F04TrajectoryPoint(const G4Track* aTrack)
|
||||
: G4TrajectoryPoint(aTrack->GetPosition())
|
||||
{
|
||||
fTime = aTrack->GetGlobalTime();
|
||||
fMomentum = aTrack->GetMomentum();
|
||||
fStepStatus = fUndefined;
|
||||
fVolumeName = aTrack->GetVolume()->GetName();
|
||||
}
|
||||
|
||||
F04TrajectoryPoint::F04TrajectoryPoint(const F04TrajectoryPoint &right)
|
||||
: G4TrajectoryPoint(right)
|
||||
{
|
||||
fTime = right.fTime;
|
||||
fMomentum = right.fMomentum;
|
||||
fStepStatus = right.fStepStatus;
|
||||
fVolumeName = right.fVolumeName;
|
||||
}
|
||||
|
||||
F04TrajectoryPoint::~F04TrajectoryPoint() { }
|
||||
|
||||
const std::map<G4String,G4AttDef>* F04TrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("TrajectoryPoint",isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] =
|
||||
G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
G4String Time("Time");
|
||||
(*store)[Time] =
|
||||
G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String Momentum("Momentum");
|
||||
(*store)[Momentum] =
|
||||
G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
G4String StepStatus("StepStatus");
|
||||
(*store)[StepStatus] =
|
||||
G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus");
|
||||
|
||||
G4String VolumeName("VolumeName");
|
||||
(*store)[VolumeName] =
|
||||
G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
|
||||
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* F04TrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
|
||||
|
||||
values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),""));
|
||||
|
||||
values->push_back(G4AttValue("StepStatus",fStepStatus,""));
|
||||
|
||||
values->push_back(G4AttValue("VolumeName",fVolumeName,""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "F04UserTrackInformation.hh"
|
||||
|
||||
F04UserTrackInformation::F04UserTrackInformation()
|
||||
: status(undefined) { }
|
||||
|
||||
F04UserTrackInformation::~F04UserTrackInformation() { }
|
||||
Reference in New Issue
Block a user