Import Geant4 9.6.0 source tree
This commit is contained in:
+46
-20
@@ -25,10 +25,11 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file TrDetectorConstruction.cc
|
||||
/// \brief Implementation of the TrDetectorConstruction class
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
#include "TrDetectorConstruction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
@@ -40,30 +41,46 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ReflectionFactory.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
TrDetectorConstruction::TrDetectorConstruction()
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(this),
|
||||
fMessenger(0),
|
||||
fMethod(kWithDirectMatrix)
|
||||
{
|
||||
fMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
TrDetectorConstruction::~TrDetectorConstruction()
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* TrDetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Materials
|
||||
G4NistManager* nist = G4NistManager::Instance();
|
||||
G4bool fromIsotopes = false;
|
||||
G4Material* material = nist->FindOrBuildMaterial("G4_AIR", fromIsotopes);
|
||||
|
||||
|
||||
// Clean old geometry, if any
|
||||
//
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
G4PhysicalVolumeStore::GetInstance()->Clean();
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// World
|
||||
//
|
||||
G4double rmin = 0.;
|
||||
@@ -126,7 +143,7 @@ G4VPhysicalVolume* TrDetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstruction::PlaceWithDirectMatrix()
|
||||
void DetectorConstruction::PlaceWithDirectMatrix()
|
||||
{
|
||||
G4double og = 3*cm;
|
||||
|
||||
@@ -158,7 +175,7 @@ void TrDetectorConstruction::PlaceWithDirectMatrix()
|
||||
G4RotationMatrix rotm2 = G4RotationMatrix(u, v, w);
|
||||
G4ThreeVector position2 = og*w;
|
||||
G4Transform3D transform2 = G4Transform3D(rotm2,position2);
|
||||
new G4PVPlacement(transform2, //position, rotation
|
||||
new G4PVPlacement(transform2, //position, rotation
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -168,7 +185,7 @@ void TrDetectorConstruction::PlaceWithDirectMatrix()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstruction::PlaceWithInverseMatrix()
|
||||
void DetectorConstruction::PlaceWithInverseMatrix()
|
||||
{
|
||||
G4double og = 3*cm;
|
||||
|
||||
@@ -213,7 +230,7 @@ void TrDetectorConstruction::PlaceWithInverseMatrix()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstruction::PlaceWithAxialRotations()
|
||||
void DetectorConstruction::PlaceWithAxialRotations()
|
||||
{
|
||||
G4double og = 3*cm;
|
||||
|
||||
@@ -229,7 +246,7 @@ void TrDetectorConstruction::PlaceWithAxialRotations()
|
||||
G4ThreeVector position1 = og*w;
|
||||
G4Transform3D transform1(rotm1,position1);
|
||||
|
||||
new G4PVPlacement(transform1, //rotation,position
|
||||
new G4PVPlacement(transform1, //rotation,position
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -247,8 +264,8 @@ void TrDetectorConstruction::PlaceWithAxialRotations()
|
||||
w = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector position2 = og*w;
|
||||
|
||||
new G4PVPlacement(rotm2Inv, //rotation
|
||||
position2, //position
|
||||
new G4PVPlacement(rotm2Inv, //rotation
|
||||
position2, //position
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -258,7 +275,7 @@ void TrDetectorConstruction::PlaceWithAxialRotations()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstruction::PlaceWithEulerAngles()
|
||||
void DetectorConstruction::PlaceWithEulerAngles()
|
||||
{
|
||||
//definitions : mother frame = {x,y,z} ; daughter frame = {u,v,w}
|
||||
// n = node line = intercept of xy and uv planes
|
||||
@@ -284,7 +301,7 @@ void TrDetectorConstruction::PlaceWithEulerAngles()
|
||||
G4ThreeVector position1 = og*w;
|
||||
G4Transform3D transform1 = G4Transform3D(rotm1,position1);
|
||||
|
||||
new G4PVPlacement(transform1, //position, rotation
|
||||
new G4PVPlacement(transform1, //position, rotation
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -301,8 +318,8 @@ void TrDetectorConstruction::PlaceWithEulerAngles()
|
||||
w = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector position2 = og*w;
|
||||
|
||||
new G4PVPlacement(rotm2Inv, //rotation
|
||||
position2, //position
|
||||
new G4PVPlacement(rotm2Inv, //rotation
|
||||
position2, //position
|
||||
fTrdVolume, //logical volume
|
||||
"Trd", //name
|
||||
fWorldVolume, //mother volume
|
||||
@@ -312,7 +329,7 @@ void TrDetectorConstruction::PlaceWithEulerAngles()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstruction::PlaceWithReflections()
|
||||
void DetectorConstruction::PlaceWithReflections()
|
||||
{
|
||||
/// Placement with reflcetions.
|
||||
/// In order to better show the reflection symmetry we do not apply
|
||||
@@ -383,3 +400,12 @@ void TrDetectorConstruction::PlaceWithReflections()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
void DetectorConstruction::SetMethod(EMethod method) {
|
||||
fMethod = method;
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+16
-17
@@ -25,39 +25,38 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file TrDetectorConstructionMessenger.cc
|
||||
/// \brief Implementation of the TrDetectorConstructionMessenger class
|
||||
/// \file DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
|
||||
#include "TrDetectorConstructionMessenger.hh"
|
||||
#include "TrDetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
TrDetectorConstructionMessenger::TrDetectorConstructionMessenger(
|
||||
TrDetectorConstruction* detectorConstruction)
|
||||
DetectorMessenger::DetectorMessenger(
|
||||
DetectorConstruction* detectorConstruction)
|
||||
: G4UImessenger(),
|
||||
fDetectorConstruction(detectorConstruction),
|
||||
fDirectory(0),
|
||||
fSetMethodCmd(0)
|
||||
{
|
||||
fDirectory = new G4UIdirectory("/transform/");
|
||||
fDirectory = new G4UIdirectory("/placement/");
|
||||
fDirectory->SetGuidance("Transform example detector control");
|
||||
|
||||
fSetMethodCmd
|
||||
= new G4UIcmdWithAString("/transform/setMethod",this);
|
||||
= new G4UIcmdWithAString("/placement/setMethod",this);
|
||||
fSetMethodCmd->SetGuidance("Select method for definition of transformations.");
|
||||
fSetMethodCmd->SetParameterName("Method", false);
|
||||
fSetMethodCmd->SetCandidates(
|
||||
"WithDirectMatrix WithInverseMatrix WithAxialRotations WithEulerAngles WithReflections");
|
||||
fSetMethodCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
TrDetectorConstructionMessenger::~TrDetectorConstructionMessenger()
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fDirectory;
|
||||
delete fSetMethodCmd;
|
||||
@@ -65,21 +64,21 @@ TrDetectorConstructionMessenger::~TrDetectorConstructionMessenger()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrDetectorConstructionMessenger::SetNewValue(G4UIcommand* command,
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == fSetMethodCmd ) {
|
||||
TrDetectorConstruction::EMethod method;
|
||||
DetectorConstruction::EMethod method;
|
||||
if ( newValue == "WithDirectMatrix" )
|
||||
method = TrDetectorConstruction::kWithDirectMatrix;
|
||||
method = DetectorConstruction::kWithDirectMatrix;
|
||||
else if ( newValue == "WithInverseMatrix" )
|
||||
method = TrDetectorConstruction::kWithInverseMatrix;
|
||||
method = DetectorConstruction::kWithInverseMatrix;
|
||||
else if ( newValue == "WithAxialRotations" )
|
||||
method = TrDetectorConstruction::kWithAxialRotations;
|
||||
method = DetectorConstruction::kWithAxialRotations;
|
||||
else if ( newValue == "WithEulerAngles" )
|
||||
method = TrDetectorConstruction::kWithEulerAngles;
|
||||
method = DetectorConstruction::kWithEulerAngles;
|
||||
else if ( newValue == "WithReflections" )
|
||||
method = TrDetectorConstruction::kWithReflections;
|
||||
method = DetectorConstruction::kWithReflections;
|
||||
else return;
|
||||
fDetectorConstruction->SetMethod(method);
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction02 class
|
||||
|
||||
#include "ExG4DetectorConstruction02.hh"
|
||||
#include "ExG4DetectorConstruction02Messenger.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02::ExG4DetectorConstruction02(
|
||||
const G4String& boxMaterialName,
|
||||
G4double boxHx, G4double boxHy, G4double boxHz,
|
||||
const G4String& worldMaterialName,
|
||||
G4double worldSizeFactor)
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(this),
|
||||
fBoxMaterialName(boxMaterialName),
|
||||
fWorldMaterialName(worldMaterialName),
|
||||
fBoxDimensions(boxHx*2, boxHy*2, boxHz*2),
|
||||
fWorldSizeFactor(worldSizeFactor),
|
||||
fBoxVolume(0),
|
||||
fWorldVolume(0)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02::~ExG4DetectorConstruction02()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* ExG4DetectorConstruction02::Construct()
|
||||
{
|
||||
// Define materials via NIST manager
|
||||
//
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
G4Material* worldMaterial
|
||||
= nistManager->FindOrBuildMaterial(fWorldMaterialName, fromIsotopes);
|
||||
|
||||
G4Material* boxMaterial
|
||||
= nistManager->FindOrBuildMaterial(fBoxMaterialName, fromIsotopes);
|
||||
|
||||
// Geometry parameters
|
||||
//
|
||||
G4ThreeVector worldDimensions = fBoxDimensions * fWorldSizeFactor;
|
||||
|
||||
|
||||
// World
|
||||
//
|
||||
G4Box* sWorld
|
||||
= new G4Box("World", //name
|
||||
worldDimensions.x(), //dimensions (half-lentghs)
|
||||
worldDimensions.y(),
|
||||
worldDimensions.z());
|
||||
|
||||
fWorldVolume
|
||||
= new G4LogicalVolume(sWorld, //shape
|
||||
worldMaterial, //material
|
||||
"World"); //name
|
||||
|
||||
G4VPhysicalVolume* pWorld
|
||||
= new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fWorldVolume, //logical volume
|
||||
"World", //name
|
||||
0, //mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
// Box
|
||||
//
|
||||
G4Box* sBox
|
||||
= new G4Box("Box", //its name
|
||||
fBoxDimensions.x(), //dimensions (half-lengths)
|
||||
fBoxDimensions.y(),
|
||||
fBoxDimensions.z());
|
||||
|
||||
fBoxVolume
|
||||
= new G4LogicalVolume(sBox, //its shape
|
||||
boxMaterial, //its material
|
||||
"Box"); //its name
|
||||
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fBoxVolume, //its logical volume
|
||||
"Box", //its name
|
||||
fWorldVolume, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//always return the root volume
|
||||
//
|
||||
return pWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetBoxMaterial(const G4String& materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
G4Material* newMaterial
|
||||
= nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
|
||||
|
||||
if ( ! newMaterial ) {
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fBoxVolume ) fBoxVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetWorldMaterial(const G4String& materialName)
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
G4bool fromIsotopes = false;
|
||||
|
||||
G4Material* newMaterial
|
||||
= nistManager->FindOrBuildMaterial(materialName, fromIsotopes);
|
||||
|
||||
if ( ! newMaterial ) {
|
||||
G4cerr << "Material " << materialName << " not found." << G4endl;
|
||||
G4cerr << "The box material was not changed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( fWorldVolume ) fWorldVolume->SetMaterial(newMaterial);
|
||||
G4cout << "Material of box changed to " << materialName << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetBoxDimensions(
|
||||
G4double hx, G4double hy, G4double hz)
|
||||
{
|
||||
/// Set box dimension (in half lengths).
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fBoxDimensions = G4ThreeVector(hx, hy, hz);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02::SetWorldSizeFactor(G4double factor)
|
||||
{
|
||||
/// Set the multiplication factor from box dimensions to world dimensions.
|
||||
/// This setting has effect only if called in PreInit> phase
|
||||
|
||||
fWorldSizeFactor = factor;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,125 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4DetectorConstruction02Messenger.cc
|
||||
/// \brief Implementation of the ExG4DetectorConstruction02Messenger class
|
||||
|
||||
#include "ExG4DetectorConstruction02Messenger.hh"
|
||||
#include "ExG4DetectorConstruction02.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWith3VectorAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02Messenger::ExG4DetectorConstruction02Messenger(
|
||||
ExG4DetectorConstruction02* detectorConstruction)
|
||||
: G4UImessenger(),
|
||||
fDetectorConstruction(detectorConstruction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetBoxMaterialCmd(0),
|
||||
fSetWorldMaterialCmd(0),
|
||||
fSetBoxDimensionsCmd(0),
|
||||
fSetWorldSizeFactorCmd(0)
|
||||
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/det/");
|
||||
fDirectory->SetGuidance("Detector control");
|
||||
|
||||
fSetBoxMaterialCmd
|
||||
= new G4UIcmdWithAString("/ExG4/det/setBoxMaterial",this);
|
||||
fSetBoxMaterialCmd->SetGuidance("Select material of the box.");
|
||||
fSetBoxMaterialCmd->SetParameterName("BoxMaterial", false);
|
||||
fSetBoxMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetWorldMaterialCmd
|
||||
= new G4UIcmdWithAString("/ExG4/det/setWorldMaterial",this);
|
||||
fSetWorldMaterialCmd->SetGuidance("Select material of the world.");
|
||||
fSetWorldMaterialCmd->SetParameterName("WorldMaterial", false);
|
||||
fSetWorldMaterialCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetBoxDimensionsCmd
|
||||
= new G4UIcmdWith3VectorAndUnit("/ExG4/det/setBoxDimensions",this);
|
||||
fSetBoxDimensionsCmd->SetGuidance("Set box dimensions (in half lentgh).");
|
||||
fSetBoxDimensionsCmd->SetParameterName(
|
||||
"BoxDimensionsHx", "BoxDimensionsHy","BoxDimensionsHz",
|
||||
false);
|
||||
//fSetBoxDimensionsCmd->SetUnitCategory("Length");
|
||||
fSetBoxDimensionsCmd->AvailableForStates(G4State_PreInit);
|
||||
|
||||
fSetWorldSizeFactorCmd
|
||||
= new G4UIcmdWithADouble("/ExG4/det/setWorldSizeFactor",this);
|
||||
fSetWorldSizeFactorCmd->SetGuidance(
|
||||
"Set the multiplication factor from box dimensions to world dimensions.");
|
||||
fSetWorldSizeFactorCmd->SetParameterName("WorldSizeFactor", false);
|
||||
fSetWorldSizeFactorCmd->SetRange("WorldSizeFactor >= 1");
|
||||
fSetWorldSizeFactorCmd->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4DetectorConstruction02Messenger::~ExG4DetectorConstruction02Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetBoxMaterialCmd;
|
||||
delete fSetWorldMaterialCmd;
|
||||
delete fSetBoxDimensionsCmd;
|
||||
delete fSetWorldSizeFactorCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4DetectorConstruction02Messenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == fSetBoxMaterialCmd ) {
|
||||
fDetectorConstruction->SetBoxMaterial(newValue);
|
||||
}
|
||||
else if( command == fSetWorldMaterialCmd ) {
|
||||
fDetectorConstruction->SetWorldMaterial(newValue);
|
||||
}
|
||||
else if( command == fSetBoxDimensionsCmd ) {
|
||||
G4ThreeVector newDimensions
|
||||
= fSetBoxDimensionsCmd->GetNew3VectorValue(newValue);
|
||||
fDetectorConstruction
|
||||
->SetBoxDimensions(
|
||||
newDimensions.x(), newDimensions.y(), newDimensions.z());
|
||||
}
|
||||
else if ( command == fSetWorldSizeFactorCmd ) {
|
||||
fDetectorConstruction
|
||||
->SetWorldSizeFactor(fSetWorldSizeFactorCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -1,104 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4EventAction01.cc
|
||||
/// \brief Implementation of the ExG4EventAction01 class
|
||||
|
||||
#include "ExG4EventAction01.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
const G4int ExG4EventAction01::fgkDefaultVerboseLevel = 1;
|
||||
const G4int ExG4EventAction01::fgkDefaultPrintModulo = 10000;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4EventAction01::ExG4EventAction01()
|
||||
: G4UserEventAction(),
|
||||
fMessenger(this),
|
||||
fVerboseLevel(fgkDefaultVerboseLevel),
|
||||
fPrintModulo(fgkDefaultPrintModulo),
|
||||
fSaveRndm(false)
|
||||
{
|
||||
/// Standard constructor
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4EventAction01::~ExG4EventAction01()
|
||||
{
|
||||
/// Destructor
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4EventAction01::BeginOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Print event info
|
||||
//
|
||||
G4int eventNumber = event->GetEventID();
|
||||
if ( eventNumber%fPrintModulo == 0 ) {
|
||||
G4cout << "\n---> Begin of Event: " << eventNumber << G4endl;
|
||||
}
|
||||
|
||||
// Print verbose info
|
||||
//
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "<<< Event " << eventNumber << " started." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4EventAction01::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Print verbose info
|
||||
//
|
||||
if ( fVerboseLevel > 1 ) {
|
||||
G4cout << "<<< Event " << event->GetEventID() << " ended." << G4endl;
|
||||
}
|
||||
|
||||
// Save rndm status
|
||||
//
|
||||
if ( fSaveRndm ) {
|
||||
const G4Run* run = G4RunManager::GetRunManager()->GetCurrentRun();
|
||||
G4int runNumber = run->GetRunID();
|
||||
G4int eventNumber = event->GetEventID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << "event" << eventNumber << ".rndm";
|
||||
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
|
||||
|
||||
if ( eventNumber%fPrintModulo == 0 ) {
|
||||
G4cout << "\n---> End of Event: " << eventNumber << G4endl;
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4EventAction01Messenger.cc
|
||||
/// \brief Implementation of the ExG4EventAction01Messenger class
|
||||
|
||||
#include "ExG4EventAction01Messenger.hh"
|
||||
#include "ExG4EventAction01.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4EventAction01Messenger::ExG4EventAction01Messenger(ExG4EventAction01* eventAction)
|
||||
: G4UImessenger(),
|
||||
fEventAction(eventAction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetVerboseLevelCmd(0),
|
||||
fSetPrintModuloCmd(0),
|
||||
fSetSaveRndmCmd(0)
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/event/");
|
||||
fDirectory->SetGuidance("Event control");
|
||||
|
||||
fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
|
||||
fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
|
||||
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
|
||||
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
|
||||
|
||||
fSetPrintModuloCmd = new G4UIcmdWithAnInteger("/ExG4/event/printModulo",this);
|
||||
fSetPrintModuloCmd->SetGuidance("Print events modulo n");
|
||||
fSetPrintModuloCmd->SetParameterName("PrintModulo",false);
|
||||
fSetPrintModuloCmd->SetRange("PrintModulo>0");
|
||||
fSetPrintModuloCmd->AvailableForStates(G4State_Idle, G4State_Init);
|
||||
|
||||
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
|
||||
fSetSaveRndmCmd->SetGuidance("Activate saving random number at endOfEvent.");
|
||||
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
|
||||
fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4EventAction01Messenger::~ExG4EventAction01Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetVerboseLevelCmd;
|
||||
delete fSetPrintModuloCmd;
|
||||
delete fSetSaveRndmCmd;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4EventAction01Messenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if(command == fSetVerboseLevelCmd) {
|
||||
fEventAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
else if ( command == fSetPrintModuloCmd ) {
|
||||
fEventAction->SetPrintModulo(fSetPrintModuloCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
else if ( command == fSetSaveRndmCmd ) {
|
||||
fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4RunAction01.cc
|
||||
/// \brief Implementation of the ExG4RunAction01 class
|
||||
|
||||
#include "ExG4RunAction01.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
//#include "G4ios.hh"
|
||||
//#include <iomanip>
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
const G4String ExG4RunAction01::fgkDefaultRndmFileName = "run0.rndm";
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4RunAction01::ExG4RunAction01()
|
||||
: G4UserRunAction(),
|
||||
fMessenger(this),
|
||||
fRndmFileName(fgkDefaultRndmFileName),
|
||||
fVerboseLevel(1),
|
||||
fSaveRndm(false),
|
||||
fReadRndm(false),
|
||||
fAutoSeed(false)
|
||||
{
|
||||
/// Standard constructor
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
ExG4RunAction01::~ExG4RunAction01()
|
||||
{
|
||||
/// Destructor
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4RunAction01::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
if ( fVerboseLevel > 0 ) {
|
||||
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
// read Rndm status
|
||||
if ( fReadRndm ) {
|
||||
G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
|
||||
CLHEP::HepRandom::restoreEngineStatus(fRndmFileName);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
|
||||
// automatic (time-based) random seeds for each run
|
||||
if ( fAutoSeed ) {
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
|
||||
|
||||
G4cout << "*******************" << G4endl;
|
||||
G4cout << "*** AUTOSEED ON ***" << G4endl;
|
||||
G4cout << "*******************" << G4endl;
|
||||
|
||||
long seeds[2];
|
||||
time_t systime = time(NULL);
|
||||
seeds[0] = (long) systime;
|
||||
seeds[1] = (long) (systime*G4UniformRand());
|
||||
CLHEP::HepRandom::setTheSeeds(seeds);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
|
||||
// save Rndm status
|
||||
if ( fSaveRndm ) {
|
||||
G4int runNumber = run->GetRunID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << ".rndm";
|
||||
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
|
||||
if ( G4VVisManager::GetConcreteInstance() ) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void ExG4RunAction01::EndOfRunAction(const G4Run* run)
|
||||
{
|
||||
// save Rndm status
|
||||
if ( fSaveRndm ) {
|
||||
G4int runNumber = run->GetRunID();
|
||||
std::ostringstream fileName;
|
||||
fileName << "run" << runNumber << "end.rndm";
|
||||
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
}
|
||||
|
||||
if ( G4VVisManager::GetConcreteInstance() ) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4RunAction01Messenger.cc
|
||||
/// \brief Implementation of the ExG4RunAction01Messenger class
|
||||
|
||||
#include "ExG4RunAction01Messenger.hh"
|
||||
#include "ExG4RunAction01.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
ExG4RunAction01Messenger::ExG4RunAction01Messenger(ExG4RunAction01* runAction)
|
||||
: G4UImessenger(),
|
||||
fRunAction (runAction),
|
||||
fTopDirectory(0),
|
||||
fDirectory(0),
|
||||
fSetVerboseLevelCmd(0),
|
||||
fSetSaveRndmCmd(0),
|
||||
fSetReadRndmCmd(0),
|
||||
fSetRndmFileNameCmd(0),
|
||||
fSetAutoSeedCmd(0)
|
||||
{
|
||||
fTopDirectory = new G4UIdirectory("/ExG4/");
|
||||
fTopDirectory->SetGuidance("UI commands of common example classes");
|
||||
|
||||
fDirectory = new G4UIdirectory("/ExG4/event/");
|
||||
fDirectory->SetGuidance("Event control");
|
||||
|
||||
fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/run/verboseLevel",this);
|
||||
fSetVerboseLevelCmd->SetGuidance("Set run verbose level ." );
|
||||
fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
|
||||
fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
|
||||
|
||||
fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/run/saveRndm",this);
|
||||
fSetSaveRndmCmd
|
||||
->SetGuidance("Activate saving random number at beginOfRun and endOfRun .");
|
||||
fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
|
||||
fSetSaveRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetReadRndmCmd = new G4UIcmdWithABool("/ExG4/run/readRndm",this);
|
||||
fSetReadRndmCmd->SetGuidance("Get rndm status from an external file at beginOfRun.");
|
||||
fSetReadRndmCmd->SetParameterName("ReadRndm",false);
|
||||
fSetReadRndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetRndmFileNameCmd = new G4UIcmdWithAString("/ExG4/run/rndmFileName",this);
|
||||
fSetRndmFileNameCmd->SetGuidance("Set rndm file name (to read from).");
|
||||
fSetRndmFileNameCmd->SetParameterName("RndmFileName",false);
|
||||
fSetRndmFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
fSetAutoSeedCmd = new G4UIcmdWithABool("/ExG4/run/autoSeed",this);
|
||||
fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
|
||||
fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
|
||||
fSetAutoSeedCmd->SetGuidance(" false: use command 'random/resetEngineFrom'");
|
||||
fSetAutoSeedCmd->SetParameterName("AutoSeed",false);
|
||||
fSetAutoSeedCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
ExG4RunAction01Messenger::~ExG4RunAction01Messenger()
|
||||
{
|
||||
delete fTopDirectory;
|
||||
delete fDirectory;
|
||||
delete fSetVerboseLevelCmd;
|
||||
delete fSetSaveRndmCmd;
|
||||
delete fSetReadRndmCmd;
|
||||
delete fSetRndmFileNameCmd;
|
||||
delete fSetAutoSeedCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void ExG4RunAction01Messenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
{
|
||||
if ( command == fSetVerboseLevelCmd ) {
|
||||
fRunAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
else if ( command == fSetSaveRndmCmd ) {
|
||||
fRunAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
else if ( command == fSetReadRndmCmd ) {
|
||||
fRunAction->SetReadRndm(fSetReadRndmCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
else if (command == fSetRndmFileNameCmd) {
|
||||
fRunAction->SetRndmFileName(newValues);
|
||||
}
|
||||
else if ( command == fSetAutoSeedCmd ) {
|
||||
fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValues));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file geometry/transforms/src/PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::PhysicsList()
|
||||
: G4VUserPhysicsList()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
G4Geantino::GeantinoDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
SetCutsWithDefault();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+27
-22
@@ -23,54 +23,59 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file geometry/transforms/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
/// \file ExG4PrimaryGeneratorAction01.cc
|
||||
/// \brief Implementation of the ExG4PrimaryGeneratorAction01 class
|
||||
//
|
||||
|
||||
#include "ExG4PrimaryGeneratorAction01.hh"
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction01::ExG4PrimaryGeneratorAction01(
|
||||
const G4String& particleName,
|
||||
G4double energy,
|
||||
G4ThreeVector position,
|
||||
G4ThreeVector momentumDirection)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName);
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("geantino");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleEnergy(energy);
|
||||
fParticleGun->SetParticlePosition(position);
|
||||
fParticleGun->SetParticleMomentumDirection(momentumDirection);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.732, 1., 0.));
|
||||
fParticleGun->SetParticleEnergy(1*eV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExG4PrimaryGeneratorAction01::~ExG4PrimaryGeneratorAction01()
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExG4PrimaryGeneratorAction01::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// this function is called at the begining of event
|
||||
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file geometry/transforms/src/SteppingVerbose.cc
|
||||
/// \brief Implementation of the SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "SteppingVerbose.hh"
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingVerbose::SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingVerbose::~SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
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")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
|
||||
const G4VProcess* process
|
||||
= fStep->GetPostStepPoint()->GetProcessDefinedStep();
|
||||
G4String procName = " UserLimit";
|
||||
if (process) procName = process->GetProcessName();
|
||||
if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
|
||||
G4cout << " " << std::setw(10) << procName;
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << "\n :----- List of secondaries ----------------"
|
||||
<< G4endl;
|
||||
G4cout.precision(4);
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< std::setw(13)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
|
||||
<< ": energy ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< " time ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :------------------------------------------\n"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
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")
|
||||
<< std::setw(10) << fTrack->GetVolume()->GetName()
|
||||
<< " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user