Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -56,6 +56,6 @@ void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
SetUserAction(new RunAction(fFileName));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+21
-21
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = 0;
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -57,7 +57,7 @@ DetectorConstruction::DetectorConstruction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -71,11 +71,11 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
// There is no need to test if materials were built/found
|
||||
// as G4NistManager would issue an error otherwise
|
||||
// Try the code with "XYZ".
|
||||
// Try the code with "XYZ".
|
||||
|
||||
// Print all materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
// Option to switch on/off checking of volumes overlaps
|
||||
G4bool checkOverlaps = true;
|
||||
|
||||
@@ -85,12 +85,12 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
// The world dimensions
|
||||
G4double worldHxyz = 2.*m;
|
||||
|
||||
|
||||
// world volume
|
||||
G4Box* worldS = new G4Box("World", worldHxyz, worldHxyz, worldHxyz);
|
||||
G4Box* worldS = new G4Box("World", worldHxyz, worldHxyz, worldHxyz);
|
||||
|
||||
G4LogicalVolume* worldLV = new G4LogicalVolume(worldS, air, "World");
|
||||
|
||||
|
||||
G4VPhysicalVolume* worldPV
|
||||
= new G4PVPlacement(
|
||||
0, G4ThreeVector(), worldLV, "World", 0, false, 0, checkOverlaps);
|
||||
@@ -102,12 +102,12 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
// The box dimensions
|
||||
G4double boxHxy = 1.*m;
|
||||
G4double boxHz = 10.*cm;
|
||||
|
||||
|
||||
// box volume
|
||||
G4Box* boxS = new G4Box("World", boxHxy, boxHxy, boxHz);
|
||||
G4Box* boxS = new G4Box("World", boxHxy, boxHxy, boxHz);
|
||||
|
||||
G4LogicalVolume* boxLV = new G4LogicalVolume(boxS, csi, "Box");
|
||||
|
||||
|
||||
// The box position
|
||||
G4double posz = 0.*m;
|
||||
|
||||
@@ -121,12 +121,12 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
// The screen dimensions
|
||||
G4double screenHxy = 1.999*m;
|
||||
G4double screenHz = 1.*mm;
|
||||
|
||||
|
||||
// Screen volume
|
||||
G4Box* screenS = new G4Box("World", screenHxy, screenHxy, screenHz);
|
||||
|
||||
G4Box* screenS = new G4Box("World", screenHxy, screenHxy, screenHz);
|
||||
|
||||
G4LogicalVolume* screenLV = new G4LogicalVolume(screenS, air, "Screen");
|
||||
|
||||
|
||||
// The screen position
|
||||
posz += boxHz + screenHz;
|
||||
|
||||
@@ -134,7 +134,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
0, G4ThreeVector(0, 0, posz),
|
||||
screenLV, "Screen", worldLV, false, 0, checkOverlaps);
|
||||
|
||||
//
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLV->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
@@ -156,14 +156,14 @@ void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
|
||||
|
||||
//
|
||||
//
|
||||
// Sensitive detectors
|
||||
//
|
||||
auto screenSD = new ScreenSD("ScreenSD");
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(screenSD);
|
||||
SetSensitiveDetector("Screen", screenSD);
|
||||
|
||||
//
|
||||
//
|
||||
// Magnetic field
|
||||
//
|
||||
// Create global magnetic field messenger.
|
||||
@@ -172,7 +172,7 @@ void DetectorConstruction::ConstructSDandField()
|
||||
G4ThreeVector fieldValue;
|
||||
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
|
||||
fMagFieldMessenger->SetVerboseLevel(1);
|
||||
|
||||
|
||||
// Register the field messenger for deleting
|
||||
G4AutoDelete::Register(fMagFieldMessenger);
|
||||
}
|
||||
|
||||
+5
-5
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
|
||||
@@ -69,7 +69,7 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
// This function is called at the begining of event
|
||||
|
||||
// In order to avoid dependence of PrimaryGeneratorAction
|
||||
// on DetectorConstruction class we get world volume
|
||||
// on DetectorConstruction class we get world volume
|
||||
// from G4LogicalVolumeStore
|
||||
//
|
||||
G4double worldZHalfLength = 0.;
|
||||
@@ -82,7 +82,7 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
}
|
||||
|
||||
if ( worldBox ) {
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription msg;
|
||||
@@ -91,8 +91,8 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
msg << "The gun will be place in the center.";
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set gun position
|
||||
fParticleGun
|
||||
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
RunAction::RunAction(const G4String& fileName)
|
||||
: G4UserRunAction(),
|
||||
fFileName(fileName)
|
||||
{
|
||||
{
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
// in Analysis.hh
|
||||
@@ -59,7 +59,7 @@ RunAction::RunAction(const G4String& fileName)
|
||||
analysisManager->CreateNtupleIColumn("ID"); // column id = 0
|
||||
analysisManager->CreateNtupleIColumn("PDG"); // column id = 1
|
||||
analysisManager->CreateNtupleDColumn("Ekin"); // column id = 2
|
||||
analysisManager->CreateNtupleDColumn("Xpos"); // column id = 3
|
||||
analysisManager->CreateNtupleDColumn("Xpos"); // column id = 3
|
||||
analysisManager->CreateNtupleDColumn("Ypos"); // column id = 4
|
||||
analysisManager->CreateNtupleDColumn("time"); // column id = 5
|
||||
analysisManager->FinishNtuple();
|
||||
@@ -69,13 +69,13 @@ RunAction::RunAction(const G4String& fileName)
|
||||
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
{
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
|
||||
@@ -76,16 +76,16 @@ G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/)
|
||||
// Obtain local coordinates:
|
||||
const G4VTouchable* touchable = preStepPoint->GetTouchable();
|
||||
G4ThreeVector globalPosition = preStepPoint->GetPosition();
|
||||
G4ThreeVector localPosition
|
||||
G4ThreeVector localPosition
|
||||
= touchable->GetHistory()->GetTopTransform().TransformPoint(globalPosition);
|
||||
// // Example for obtaining the local direction:
|
||||
// G4ThreeVector globalDirection = preStepPoint->GetMomentumDirection();
|
||||
// G4ThreeVector localDirection
|
||||
// G4ThreeVector localDirection
|
||||
// = touchable->GetHistory()->GetTopTransform().TransformAxis(localDirection);
|
||||
|
||||
// Time
|
||||
G4double time = preStepPoint->GetGlobalTime();
|
||||
|
||||
|
||||
// Store hit in the ntuple
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillNtupleIColumn(0, ID);
|
||||
@@ -94,7 +94,7 @@ G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/)
|
||||
analysisManager->FillNtupleDColumn(3, localPosition.x()/cm);
|
||||
analysisManager->FillNtupleDColumn(4, localPosition.y()/cm);
|
||||
analysisManager->FillNtupleDColumn(5, time/ns);
|
||||
analysisManager->AddNtupleRow();
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user