Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -1,95 +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: DetectorMessenger.cc,v 1.3 2008-12-18 12:57:06 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// Class DetectorMessenger implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
DetectorMessenger::DetectorMessenger( DetectorConstruction* myDet )
|
||||
: theDetector( myDet )
|
||||
{
|
||||
theDetectorDir = new G4UIdirectory( "/mydet/" );
|
||||
theDetectorDir->SetGuidance("Detector control.");
|
||||
|
||||
theReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
|
||||
theReadCommand ->SetGuidance("READ GDML file with given name");
|
||||
theReadCommand ->SetParameterName("FileRead", false);
|
||||
theReadCommand ->SetDefaultValue("test.gdml");
|
||||
theReadCommand ->AvailableForStates(G4State_PreInit);
|
||||
|
||||
theWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
|
||||
theWriteCommand ->SetGuidance("WRITE geometry to GDML file with given name");
|
||||
theWriteCommand ->SetParameterName("FileWrite", false);
|
||||
theWriteCommand ->SetDefaultValue("wtest.gdml");
|
||||
theWriteCommand ->AvailableForStates(G4State_PreInit);
|
||||
|
||||
theStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
|
||||
theStepCommand ->SetGuidance("Read STEP Tools files (name without extension)");
|
||||
theStepCommand ->SetParameterName("STEPFile", false);
|
||||
theStepCommand ->SetDefaultValue("mbb");
|
||||
theStepCommand ->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete theReadCommand;
|
||||
delete theWriteCommand;
|
||||
delete theStepCommand;
|
||||
delete theDetectorDir;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if ( command == theReadCommand )
|
||||
{
|
||||
theDetector->SetReadFile(newValue );
|
||||
}
|
||||
if ( command == theWriteCommand )
|
||||
{
|
||||
theDetector->SetWriteFile(newValue );
|
||||
}
|
||||
if ( command == theStepCommand )
|
||||
{
|
||||
theDetector->SetStepFile(newValue );
|
||||
}
|
||||
}
|
||||
+17
-15
@@ -23,24 +23,26 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/gdml/G02/src/G02ChamberParameterisation.cc
|
||||
/// \brief Implementation of the G02ChamberParameterisation class
|
||||
//
|
||||
// $Id: ChamberParameterisation.cc,v 1.2 2008-12-18 12:57:02 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// Class ChamberParameterisation implementation
|
||||
// $Id$
|
||||
//
|
||||
// Class G02ChamberParameterisation implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "ChamberParameterisation.hh"
|
||||
#include "G02ChamberParameterisation.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ChamberParameterisation::
|
||||
ChamberParameterisation( G4int NoChambers,
|
||||
G02ChamberParameterisation::
|
||||
G02ChamberParameterisation( G4int NoChambers,
|
||||
G4double startZ, // Z of center of first
|
||||
G4double spacingZ, // Z spacing of centers
|
||||
G4double widthChamber,
|
||||
@@ -58,21 +60,21 @@ ChamberParameterisation( G4int NoChambers,
|
||||
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
|
||||
if (spacingZ < widthChamber)
|
||||
{
|
||||
G4Exception("ExN02ChamberParameterisation::ChamberParameterisation()",
|
||||
G4Exception("ExN02G02ChamberParameterisation::G02ChamberParameterisation()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Invalid construction: Width>Spacing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ChamberParameterisation::~ChamberParameterisation()
|
||||
G02ChamberParameterisation::~G02ChamberParameterisation()
|
||||
{}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ChamberParameterisation::
|
||||
void G02ChamberParameterisation::
|
||||
ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4double Zposition = fStartZ + (copyNo+1) * fSpacing;
|
||||
@@ -81,9 +83,9 @@ ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
physVol->SetRotation(0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ChamberParameterisation::
|
||||
void G02ChamberParameterisation::
|
||||
ComputeDimensions (G4Box& trackerChamber, const G4int copyNo,
|
||||
const G4VPhysicalVolume*) const
|
||||
{
|
||||
@@ -93,4 +95,4 @@ ComputeDimensions (G4Box& trackerChamber, const G4int copyNo,
|
||||
trackerChamber.SetZHalfLength(fHalfWidth);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
+91
-86
@@ -22,16 +22,18 @@
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//g
|
||||
/// \file persistency/gdml/G02/src/G02DetectorConstruction.cc
|
||||
/// \brief Implementation of the G02DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.8 2009-04-24 15:47:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
// $Id$
|
||||
//
|
||||
// Class DetectorConstruction implementation
|
||||
// Class G02DetectorConstruction implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G02DetectorConstruction.hh"
|
||||
|
||||
// Geant4 includes
|
||||
//
|
||||
@@ -67,53 +69,56 @@
|
||||
|
||||
// Volume parameterisations
|
||||
//
|
||||
#include "ChamberParameterisation.hh"
|
||||
#include "G02ChamberParameterisation.hh"
|
||||
|
||||
// Messenger
|
||||
//
|
||||
#include "DetectorMessenger.hh"
|
||||
#include "G02DetectorMessenger.hh"
|
||||
|
||||
// GDML parser include
|
||||
//
|
||||
#include "G4GDMLParser.hh"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: Air(0), Aluminum(0), Pb(0), Xenon(0)
|
||||
G02DetectorConstruction::G02DetectorConstruction()
|
||||
: fAir(0), fAluminum(0), fPb(0), fXenon(0)
|
||||
{
|
||||
expHall_x=5.*m;
|
||||
fExpHall_x=5.*m;
|
||||
|
||||
fReadFile ="test.gdml";
|
||||
fWriteFile="wtest.gdml";
|
||||
fStepFile ="mbb";
|
||||
writingChoice=1;
|
||||
fWritingChoice=1;
|
||||
|
||||
detectorMessenger = new DetectorMessenger( this );
|
||||
fDetectorMessenger = new G02DetectorMessenger( this );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Destructor
|
||||
//
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
G02DetectorConstruction::~G02DetectorConstruction()
|
||||
{
|
||||
if(detectorMessenger) delete detectorMessenger;
|
||||
if(fDetectorMessenger) delete fDetectorMessenger;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Constructs geometries and materials
|
||||
//
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* G02DetectorConstruction::Construct()
|
||||
{
|
||||
// Writing or Reading of Geometry using G4GDML
|
||||
|
||||
G4VPhysicalVolume* fWorldPhysVol;
|
||||
|
||||
if(writingChoice==0)
|
||||
if(fWritingChoice==0)
|
||||
{
|
||||
// **** LOOK HERE*** FOR READING GDML FILES
|
||||
//
|
||||
@@ -121,15 +126,15 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
// ACTIVATING OVERLAP CHECK when read volumes are placed.
|
||||
// Can take long time in case of complex geometries
|
||||
//
|
||||
// parser.SetOverlapCheck(true);
|
||||
// fParser.SetOverlapCheck(true);
|
||||
|
||||
parser.Read(fReadFile);
|
||||
fParser.Read(fReadFile);
|
||||
|
||||
// READING GDML FILES OPTION: 2nd Boolean argument "Validate".
|
||||
// Flag to "false" disables check with the Schema when reading GDML file.
|
||||
// See the GDML Documentation for more information.
|
||||
//
|
||||
// parser.Read(fReadFile,false);
|
||||
// fParser.Read(fReadFile,false);
|
||||
|
||||
// Prints the material information
|
||||
//
|
||||
@@ -137,9 +142,9 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
// Giving World Physical Volume from GDML Parser
|
||||
//
|
||||
fWorldPhysVol = parser.GetWorldVolume();
|
||||
fWorldPhysVol = fParser.GetWorldVolume();
|
||||
}
|
||||
else if(writingChoice==1)
|
||||
else if(fWritingChoice==1)
|
||||
{
|
||||
// **** LOOK HERE*** FOR WRITING GDML FILES
|
||||
// Detector Construction and WRITING to GDML
|
||||
@@ -167,11 +172,11 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
//
|
||||
// or
|
||||
//
|
||||
// parser.Write(fWriteFile, fWorldPhysVol, false);
|
||||
// fParser.Write(fWriteFile, fWorldPhysVol, false);
|
||||
|
||||
// Writing Geometry to GDML File
|
||||
//
|
||||
parser.Write(fWriteFile, fWorldPhysVol);
|
||||
fParser.Write(fWriteFile, fWorldPhysVol);
|
||||
|
||||
// OPTION: SPECIFYING THE SCHEMA LOCATION
|
||||
//
|
||||
@@ -185,7 +190,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
// You can change the Schema path by adding a parameter to the Write
|
||||
// command, as follows:
|
||||
//
|
||||
// parser.Write(fWriteFile, fWorldPhysVol, "your-path-to-schema/gdml.xsd");
|
||||
// fParser.Write(fWriteFile, fWorldPhysVol, "your-path-to-schema/gdml.xsd");
|
||||
}
|
||||
else // Demonstration how to Read STEP files using GDML
|
||||
{
|
||||
@@ -195,23 +200,23 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
// Arbitrary values that should enclose any reasonable geometry
|
||||
//
|
||||
const G4double expHall_y = expHall_x/50.;
|
||||
const G4double expHall_z = expHall_x/50.;
|
||||
const G4double expHall_y = fExpHall_x/50.;
|
||||
const G4double expHall_z = fExpHall_x/50.;
|
||||
|
||||
// Create the hall
|
||||
//
|
||||
G4Box * experimentalHallBox
|
||||
= new G4Box("ExpHallBox",expHall_x/50.,expHall_y,expHall_z);
|
||||
= new G4Box("ExpHallBox",fExpHall_x/50.,expHall_y,expHall_z);
|
||||
G4LogicalVolume * experimentalHallLV
|
||||
= new G4LogicalVolume(experimentalHallBox, Air,"ExpHallLV");
|
||||
= new G4LogicalVolume(experimentalHallBox, fAir,"ExpHallLV");
|
||||
fWorldPhysVol
|
||||
= new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),
|
||||
experimentalHallLV, "ExpHallPhys", 0, false, 0);
|
||||
|
||||
// DetectorConstruction via reading STEP File
|
||||
// G02DetectorConstruction via reading STEP File
|
||||
//
|
||||
G4LogicalVolume* LogicalVolST
|
||||
= parser.ParseST(fStepFile,Air,Aluminum);
|
||||
= fParser.ParseST(fStepFile,fAir,fAluminum);
|
||||
|
||||
// Placement inside of the hall
|
||||
//
|
||||
@@ -227,11 +232,11 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
return fWorldPhysVol;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Utility to build and list necessary materials
|
||||
//
|
||||
void DetectorConstruction::ListOfMaterials()
|
||||
void G02DetectorConstruction::ListOfMaterials()
|
||||
{
|
||||
G4double a; // atomic mass
|
||||
G4double z; // atomic number
|
||||
@@ -258,23 +263,23 @@ void DetectorConstruction::ListOfMaterials()
|
||||
// Air
|
||||
//
|
||||
density = 1.29*mg/cm3;
|
||||
Air = new G4Material(name="Air", density, ncomponents=2);
|
||||
Air->AddElement(elN, fractionmass=0.7);
|
||||
Air->AddElement(elO, fractionmass=0.3);
|
||||
fAir = new G4Material(name="Air", density, ncomponents=2);
|
||||
fAir->AddElement(elN, fractionmass=0.7);
|
||||
fAir->AddElement(elO, fractionmass=0.3);
|
||||
|
||||
// Aluminum
|
||||
//
|
||||
density = 2.70*g/cm3;
|
||||
Aluminum = new G4Material(name="Aluminum", density, ncomponents=1);
|
||||
Aluminum->AddElement(elAl, fractionmass=1.0);
|
||||
fAluminum = new G4Material(name="Aluminum", density, ncomponents=1);
|
||||
fAluminum->AddElement(elAl, fractionmass=1.0);
|
||||
|
||||
// Lead
|
||||
//
|
||||
Pb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
|
||||
fPb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
|
||||
|
||||
// Xenon gas
|
||||
//
|
||||
Xenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
|
||||
fXenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
|
||||
density= 5.458*mg/cm3, kStateGas,
|
||||
temperature= 293.15*kelvin, pressure= 1*atmosphere);
|
||||
|
||||
@@ -283,7 +288,7 @@ void DetectorConstruction::ListOfMaterials()
|
||||
G4cout << *(G4Material::GetMaterialTable() ) << G4endl;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Detector Construction
|
||||
//
|
||||
@@ -291,27 +296,27 @@ void DetectorConstruction::ListOfMaterials()
|
||||
// SubDetectors1 and 2 show how to use Reflection Factory and Assembly
|
||||
// SubDetectors 3 and 4 show how to use Parameterisation
|
||||
//
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
|
||||
G4VPhysicalVolume* G02DetectorConstruction::ConstructDetector()
|
||||
{
|
||||
// Arbitary values that should enclose any reasonable geometry
|
||||
//
|
||||
const G4double expHall_y = expHall_x;
|
||||
const G4double expHall_z = expHall_x;
|
||||
const G4double expHall_y = fExpHall_x;
|
||||
const G4double expHall_z = fExpHall_x;
|
||||
|
||||
// Create the hall
|
||||
//
|
||||
G4Box * experimentalHallBox =
|
||||
new G4Box("ExpHallBox", expHall_x, expHall_y, expHall_z);
|
||||
new G4Box("ExpHallBox", fExpHall_x, expHall_y, expHall_z);
|
||||
G4LogicalVolume * experimentalHallLV =
|
||||
new G4LogicalVolume(experimentalHallBox, Air, "ExpHallLV");
|
||||
new G4LogicalVolume(experimentalHallBox, fAir, "ExpHallLV");
|
||||
G4PVPlacement * experimentalHallPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), experimentalHallLV,
|
||||
"ExpHallPhys", 0, false, 0);
|
||||
|
||||
// DetectorConstruction
|
||||
// G02DetectorConstruction
|
||||
|
||||
const G4double det_x = expHall_x*0.8;
|
||||
const G4double det_y = expHall_x*0.7;
|
||||
const G4double det_x = fExpHall_x*0.8;
|
||||
const G4double det_y = fExpHall_x*0.7;
|
||||
const G4double det_z = det_y;
|
||||
|
||||
// Create the detector box
|
||||
@@ -319,28 +324,28 @@ G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
|
||||
G4Box * detectorBox =
|
||||
new G4Box("detectorBox", det_x, det_y, det_z);
|
||||
G4LogicalVolume * detectorLV =
|
||||
new G4LogicalVolume(detectorBox, Air, "detLV");
|
||||
new G4LogicalVolume(detectorBox, fAir, "detLV");
|
||||
// G4PVPlacement * detectorPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), detectorLV,
|
||||
"detPhys", experimentalHallLV, false, 0);
|
||||
|
||||
// Create the Control room box
|
||||
//
|
||||
const G4double room_x = expHall_x/20.;
|
||||
const G4double room_x = fExpHall_x/20.;
|
||||
const G4double room_y = room_x;
|
||||
const G4double room_z = room_x;
|
||||
|
||||
G4Box * roomBox =
|
||||
new G4Box("roomBox", room_x, room_y, room_z);
|
||||
G4LogicalVolume * roomLV =
|
||||
new G4LogicalVolume(roomBox, Air, "roomLV");
|
||||
new G4LogicalVolume(roomBox, fAir, "roomLV");
|
||||
// G4PVPlacement * roomPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(expHall_x-room_x-10.,0.0,0.0), roomLV,
|
||||
new G4PVPlacement(0, G4ThreeVector(fExpHall_x-room_x-10.,0.0,0.0), roomLV,
|
||||
"roomPhys", experimentalHallLV, false, 0);
|
||||
|
||||
// SubDetector1
|
||||
//
|
||||
const G4double bigL=expHall_x/5.+50.;
|
||||
const G4double bigL=fExpHall_x/5.+50.;
|
||||
G4LogicalVolume* subDetectorLV1 = ConstructSubDetector1();
|
||||
// G4PVPlacement * detPhys1 =
|
||||
new G4PVPlacement(0, G4ThreeVector(bigL,0.0,0.0), subDetectorLV1,
|
||||
@@ -384,13 +389,13 @@ G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
|
||||
return experimentalHallPhys;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// SubDetector1
|
||||
//
|
||||
G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
|
||||
G4LogicalVolume* G02DetectorConstruction::ConstructSubDetector1()
|
||||
{
|
||||
const G4double sub_x = expHall_x/5.;
|
||||
const G4double sub_x = fExpHall_x/5.;
|
||||
const G4double sub_y = sub_x;
|
||||
|
||||
// Create the hall
|
||||
@@ -398,7 +403,7 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
|
||||
G4Tubs * subTub =
|
||||
new G4Tubs("subTub", 0., sub_x, sub_y, -90.*deg, 180*deg);
|
||||
G4LogicalVolume * subTubLV =
|
||||
new G4LogicalVolume(subTub, Pb, "tubLV");
|
||||
new G4LogicalVolume(subTub, fPb, "tubLV");
|
||||
G4LogicalVolume *AssemblyLV = ConstructAssembly();
|
||||
// G4PVPlacement * detAss =
|
||||
new G4PVPlacement(0, G4ThreeVector(sub_x/3,0.0,0.0), AssemblyLV,
|
||||
@@ -406,13 +411,13 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector1()
|
||||
return subTubLV;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// SubDetector2
|
||||
//
|
||||
G4LogicalVolume* DetectorConstruction::ConstructSubDetector2()
|
||||
G4LogicalVolume* G02DetectorConstruction::ConstructSubDetector2()
|
||||
{
|
||||
const G4double sub_x = expHall_x/10.;
|
||||
const G4double sub_x = fExpHall_x/10.;
|
||||
const G4double sub_y = sub_x*2.;
|
||||
const G4double sub_z = sub_x;
|
||||
|
||||
@@ -421,18 +426,18 @@ G4LogicalVolume* DetectorConstruction::ConstructSubDetector2()
|
||||
G4Box * detHallBox =
|
||||
new G4Box("detHallBox", sub_x, sub_y, sub_z);
|
||||
G4LogicalVolume * detHallLV =
|
||||
new G4LogicalVolume(detHallBox, Aluminum, "detHallLV");
|
||||
new G4LogicalVolume(detHallBox, fAluminum, "detHallLV");
|
||||
|
||||
return detHallLV;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Assembly
|
||||
//
|
||||
G4LogicalVolume* DetectorConstruction::ConstructAssembly()
|
||||
G4LogicalVolume* G02DetectorConstruction::ConstructAssembly()
|
||||
{
|
||||
const G4double big_x = expHall_x/17;
|
||||
const G4double big_x = fExpHall_x/17;
|
||||
const G4double big_y = big_x;
|
||||
const G4double big_z = big_x;
|
||||
|
||||
@@ -441,7 +446,7 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
|
||||
G4Box * OuterBox =
|
||||
new G4Box("OuterBox", big_x, big_y, big_z);
|
||||
G4LogicalVolume * OuterBoxLV =
|
||||
new G4LogicalVolume(OuterBox, Air, "OuterBoxLV");
|
||||
new G4LogicalVolume(OuterBox, fAir, "OuterBoxLV");
|
||||
// G4PVPlacement * OuterBoxPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0), OuterBoxLV,
|
||||
"OuterBoxPhys", 0, false, 0);
|
||||
@@ -455,15 +460,15 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
|
||||
G4Box * BigBox =
|
||||
new G4Box("BBox", bigL, bigL, bigL);
|
||||
G4LogicalVolume * BigBoxLV =
|
||||
new G4LogicalVolume(BigBox, Aluminum, "AlBigBoxLV");
|
||||
new G4LogicalVolume(BigBox, fAluminum, "AlBigBoxLV");
|
||||
G4Box * MedBox =
|
||||
new G4Box("MBox", medL, medL, medL);
|
||||
G4LogicalVolume * MedBoxLV1 =
|
||||
new G4LogicalVolume(MedBox, Aluminum, "AlMedBoxLV1");
|
||||
new G4LogicalVolume(MedBox, fAluminum, "AlMedBoxLV1");
|
||||
G4Box * SmallBox =
|
||||
new G4Box("SBox", smalL, smalL, smalL);
|
||||
G4LogicalVolume * SmallBoxLV =
|
||||
new G4LogicalVolume(SmallBox, Aluminum, "AlSmaBoxLV");
|
||||
new G4LogicalVolume(SmallBox, fAluminum, "AlSmaBoxLV");
|
||||
|
||||
const G4double bigPlace=bigL+10.;
|
||||
const G4double medPlace=medL+10.;
|
||||
@@ -485,7 +490,7 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
|
||||
G4ReflectedSolid * ReflBig =
|
||||
new G4ReflectedSolid("Refll_Big", BigTube, transform);
|
||||
G4LogicalVolume * ReflBigLV =
|
||||
new G4LogicalVolume(ReflBig, Xenon, "ReflBigAl");
|
||||
new G4LogicalVolume(ReflBig, fXenon, "ReflBigAl");
|
||||
new G4PVPlacement(0, G4ThreeVector(0.,0.0,0.0), ReflBigLV,
|
||||
"AlPhysBigTube", SmallBoxLV, false, 0);
|
||||
//
|
||||
@@ -529,13 +534,13 @@ G4LogicalVolume* DetectorConstruction::ConstructAssembly()
|
||||
return OuterBoxLV;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// Parameterised Chamber
|
||||
//
|
||||
G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
|
||||
G4LogicalVolume* G02DetectorConstruction::ConstructParametrisationChamber()
|
||||
{
|
||||
const G4double chamber_x = expHall_x/12.;
|
||||
const G4double chamber_x = fExpHall_x/12.;
|
||||
const G4double chamber_y = chamber_x;
|
||||
const G4double chamber_z = chamber_x;
|
||||
|
||||
@@ -544,7 +549,7 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
|
||||
G4Box * paramChamberBox =
|
||||
new G4Box("ChamberBox", chamber_x, chamber_y, chamber_z);
|
||||
G4LogicalVolume * paramChamberLV =
|
||||
new G4LogicalVolume(paramChamberBox, Air, "ChamberLV");
|
||||
new G4LogicalVolume(paramChamberBox, fAir, "ChamberLV");
|
||||
|
||||
// Parametrisation Chamber (taken from N02 novice example)
|
||||
//
|
||||
@@ -560,14 +565,14 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
|
||||
G4Box *solidChamber =
|
||||
new G4Box("chamber", 10*cm, 10*cm, 1*cm);
|
||||
G4LogicalVolume* logicChamber =
|
||||
new G4LogicalVolume(solidChamber, Aluminum, "Chamber", 0, 0, 0);
|
||||
new G4LogicalVolume(solidChamber, fAluminum, "Chamber", 0, 0, 0);
|
||||
|
||||
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
|
||||
G4double firstLength = fTrackerLength/10;
|
||||
G4double lastLength = fTrackerLength;
|
||||
|
||||
G4VPVParameterisation* chamberParam =
|
||||
new ChamberParameterisation( NbOfChambers, // NoChambers
|
||||
new G02ChamberParameterisation( NbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
@@ -583,32 +588,32 @@ G4LogicalVolume* DetectorConstruction::ConstructParametrisationChamber()
|
||||
return paramChamberLV;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// SetReadFile
|
||||
//
|
||||
void DetectorConstruction::SetReadFile( const G4String& File )
|
||||
void G02DetectorConstruction::SetReadFile( const G4String& File )
|
||||
{
|
||||
fReadFile=File;
|
||||
writingChoice=0;
|
||||
fWritingChoice=0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// SetWriteFile
|
||||
//
|
||||
void DetectorConstruction::SetWriteFile( const G4String& File )
|
||||
void G02DetectorConstruction::SetWriteFile( const G4String& File )
|
||||
{
|
||||
fWriteFile=File;
|
||||
writingChoice=1;
|
||||
fWritingChoice=1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
// SetStepFile
|
||||
//
|
||||
void DetectorConstruction::SetStepFile( const G4String& File )
|
||||
void G02DetectorConstruction::SetStepFile( const G4String& File )
|
||||
{
|
||||
fStepFile=File;
|
||||
writingChoice=3;
|
||||
fWritingChoice=3;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 persistency/gdml/G02/src/G02DetectorMessenger.cc
|
||||
/// \brief Implementation of the G02DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Class G02DetectorMessenger implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G02DetectorMessenger.hh"
|
||||
#include "G02DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G02DetectorMessenger::G02DetectorMessenger( G02DetectorConstruction* myDet )
|
||||
: fTheDetector( myDet )
|
||||
{
|
||||
fTheDetectorDir = new G4UIdirectory( "/mydet/" );
|
||||
fTheDetectorDir->SetGuidance("Detector control.");
|
||||
|
||||
fTheReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
|
||||
fTheReadCommand ->SetGuidance("READ GDML file with given name");
|
||||
fTheReadCommand ->SetParameterName("FileRead", false);
|
||||
fTheReadCommand ->SetDefaultValue("test.gdml");
|
||||
fTheReadCommand ->AvailableForStates(G4State_PreInit);
|
||||
|
||||
fTheWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
|
||||
fTheWriteCommand ->SetGuidance("WRITE geometry to GDML file with given name");
|
||||
fTheWriteCommand ->SetParameterName("FileWrite", false);
|
||||
fTheWriteCommand ->SetDefaultValue("wtest.gdml");
|
||||
fTheWriteCommand ->AvailableForStates(G4State_PreInit);
|
||||
|
||||
fTheStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
|
||||
fTheStepCommand ->SetGuidance("Read STEP Tools files (name without extension)");
|
||||
fTheStepCommand ->SetParameterName("STEPFile", false);
|
||||
fTheStepCommand ->SetDefaultValue("mbb");
|
||||
fTheStepCommand ->AvailableForStates(G4State_PreInit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G02DetectorMessenger::~G02DetectorMessenger()
|
||||
{
|
||||
delete fTheReadCommand;
|
||||
delete fTheWriteCommand;
|
||||
delete fTheStepCommand;
|
||||
delete fTheDetectorDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G02DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if ( command == fTheReadCommand )
|
||||
{
|
||||
fTheDetector->SetReadFile(newValue );
|
||||
}
|
||||
if ( command == fTheWriteCommand )
|
||||
{
|
||||
fTheDetector->SetWriteFile(newValue );
|
||||
}
|
||||
if ( command == fTheStepCommand )
|
||||
{
|
||||
fTheDetector->SetStepFile(newValue );
|
||||
}
|
||||
}
|
||||
+21
-18
@@ -23,52 +23,55 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/gdml/G02/src/G02PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the G02PrimaryGeneratorAction class
|
||||
//
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.2 2008-12-18 12:57:08 gunter Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// Class PrimaryGeneratorAction implementation
|
||||
// $Id$
|
||||
//
|
||||
// Class G02PrimaryGeneratorAction implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G02PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
G02PrimaryGeneratorAction::G02PrimaryGeneratorAction()
|
||||
{
|
||||
// Particle gun and particle table
|
||||
//
|
||||
particleGun = new G4ParticleGun();
|
||||
particleTable = G4ParticleTable::GetParticleTable();
|
||||
fParticleGun = new G4ParticleGun();
|
||||
fParticleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
// Default particle
|
||||
//
|
||||
particleGun->SetParticleDefinition(particleTable->FindParticle("geantino"));
|
||||
particleGun->SetParticleEnergy( 1.0*MeV );
|
||||
fParticleGun->SetParticleDefinition(fParticleTable->FindParticle("geantino"));
|
||||
fParticleGun->SetParticleEnergy( 1.0*MeV );
|
||||
|
||||
G4ThreeVector err1=G4ThreeVector(-1260,-560,40); // outside
|
||||
G4ThreeVector err2=G4ThreeVector(100,-240,120); // inside
|
||||
G4ThreeVector err2v=(err2-err1).unit();
|
||||
|
||||
particleGun->SetParticleMomentumDirection(err2v);
|
||||
particleGun->SetParticlePosition(err1);
|
||||
fParticleGun->SetParticleMomentumDirection(err2v);
|
||||
fParticleGun->SetParticlePosition(err1);
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
G02PrimaryGeneratorAction::~G02PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void G02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
+14
-12
@@ -23,11 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file persistency/gdml/G02/src/G02RunAction.cc
|
||||
/// \brief Implementation of the G02RunAction class
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.1 2008-08-27 10:30:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
// Class RunAction implementation
|
||||
// $Id$
|
||||
//
|
||||
// Class G02RunAction implementation
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -36,35 +38,35 @@
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "G02RunAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction()
|
||||
G02RunAction::G02RunAction()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
G02RunAction::~G02RunAction()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
void G02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run*)
|
||||
void G02RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
Reference in New Issue
Block a user