Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -36,32 +36,30 @@
//
#include "ExErrorDetectorConstruction.hh"
#include "G4SteppingVerbose.hh"
#include "G4ErrorCylSurfaceTarget.hh"
#include "G4ErrorFreeTrajState.hh"
#include "G4ErrorGeomVolumeTarget.hh"
#include "G4ErrorPlaneSurfaceTarget.hh"
#include "G4ErrorPropagator.hh"
#include "G4ErrorPropagatorData.hh"
#include "G4ErrorPropagatorManager.hh"
#include "G4ErrorPlaneSurfaceTarget.hh"
#include "G4ErrorCylSurfaceTarget.hh"
#include "G4ErrorGeomVolumeTarget.hh"
#include "G4ErrorTrackLengthTarget.hh"
#include "G4ErrorFreeTrajState.hh"
#include "G4UImanager.hh"
#include "G4SteppingVerbose.hh"
#include "G4SystemOfUnits.hh"
#include "G4UImanager.hh"
void Initialize();
G4ErrorTarget* BuildTarget( G4int iTarget );
void ProcessEvent( G4int iProp, size_t nEv );
G4ErrorTarget* BuildTarget(G4int iTarget);
void ProcessEvent(G4int iProp, size_t nEv);
void Finalize();
G4ErrorTarget* theTarget;
G4ErrorMode theG4ErrorMode;
//-------------------------------------------------------------
int main()
int main()
{
Initialize();
//----- Choose propagation mode
@@ -69,45 +67,43 @@ int main()
// 1: propagate until target, returning control to the user at each step
G4int iProp = 0;
char* prop = std::getenv("G4ERROR_PROP");
if( prop ) {
if( G4String(prop) == G4String("UNTIL_TARGET") ){
if (prop) {
if (G4String(prop) == G4String("UNTIL_TARGET")) {
iProp = 0;
} else if ( G4String(prop) == G4String("STEP_BY_STEP") ) {
iProp = 1;
} else {
G4Exception("exG4eReco","Fatal error in Argument",
FatalErrorInArgument,
G4String("Variable G4ERROR_PROP = " + G4String(prop) +
" It must be: UNTIL_TARGET or STEP_BY_STEP").c_str());
}
} else {
G4Exception("exG4eReco","Fatal error in Argument",
JustWarning,
"Variable G4ERROR_PROP not defined, taking it = UNTIL_TARGET");
}
else if (G4String(prop) == G4String("STEP_BY_STEP")) {
iProp = 1;
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", FatalErrorInArgument,
G4String("Variable G4ERROR_PROP = " + G4String(prop)
+ " It must be: UNTIL_TARGET or STEP_BY_STEP")
.c_str());
}
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", JustWarning,
"Variable G4ERROR_PROP not defined, taking it = UNTIL_TARGET");
}
size_t nEvents = 3;
for( size_t ii = 0; ii < nEvents; ii++ ){
ProcessEvent( iProp, ii );
for (size_t ii = 0; ii < nEvents; ii++) {
ProcessEvent(iProp, ii);
}
Finalize();
}
//-------------------------------------------------------------
void Initialize()
void Initialize()
{
G4VSteppingVerbose::SetInstance(new G4SteppingVerbose);
// Initialize the GEANT4e manager
G4ErrorPropagatorManager* g4emgr
= G4ErrorPropagatorManager::GetErrorPropagatorManager();
G4ErrorPropagatorData* g4edata
= G4ErrorPropagatorData::GetErrorPropagatorData();
// Initialize the GEANT4e manager
G4ErrorPropagatorManager* g4emgr = G4ErrorPropagatorManager::GetErrorPropagatorManager();
G4ErrorPropagatorData* g4edata = G4ErrorPropagatorData::GetErrorPropagatorData();
g4emgr->SetUserInitialization(new ExErrorDetectorConstruction);
g4emgr->SetUserInitialization(new ExErrorDetectorConstruction);
G4UImanager::GetUIpointer()->ApplyCommand("/exerror/setField -10. kilogauss");
@@ -124,92 +120,93 @@ void Initialize()
// 4: TrackLengthTarget
G4int iTarget = 1;
char* target = std::getenv("G4ERROR_TARGET");
if( target ) {
if( G4String(target) == G4String("PLANE_SURFACE") ) {
if (target) {
if (G4String(target) == G4String("PLANE_SURFACE")) {
iTarget = 1;
}else if( G4String(target) == G4String("CYL_SURFACE") ) {
iTarget = 2;
}else if( G4String(target) == G4String("VOLUME") ) {
iTarget = 3;
}else if( G4String(target) == G4String("TRKLEN") ) {
iTarget = 4;
}else {
G4Exception("exG4eReco","Fatal error in Argument",
FatalErrorInArgument,
G4String("Variable G4ERROR_TARGET = " + G4String(target) +
" It must be: PLANE_SURFACE, CYL_SURFACE, VOLUME, TRKLEN").c_str());
}
} else {
G4Exception("exG4eReco","Fatal error in Argument",
JustWarning,"Variable G4ERROR_TARGET not defined, taking it = PLANE_SURFACE");
}
else if (G4String(target) == G4String("CYL_SURFACE")) {
iTarget = 2;
}
else if (G4String(target) == G4String("VOLUME")) {
iTarget = 3;
}
else if (G4String(target) == G4String("TRKLEN")) {
iTarget = 4;
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", FatalErrorInArgument,
G4String("Variable G4ERROR_TARGET = " + G4String(target)
+ " It must be: PLANE_SURFACE, CYL_SURFACE, VOLUME, TRKLEN")
.c_str());
}
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", JustWarning,
"Variable G4ERROR_TARGET not defined, taking it = PLANE_SURFACE");
}
theTarget = BuildTarget( iTarget );
g4edata->SetTarget( theTarget );
theTarget = BuildTarget(iTarget);
g4edata->SetTarget(theTarget);
theG4ErrorMode = G4ErrorMode_PropBackwards;
char* mode = std::getenv("G4ERROR_MODE");
if( mode ) {
if( G4String(mode) == G4String("FORWARDS") ) {
if (mode) {
if (G4String(mode) == G4String("FORWARDS")) {
theG4ErrorMode = G4ErrorMode_PropForwards;
} else if( G4String(mode) == G4String("BACKWARDS") ) {
theG4ErrorMode = G4ErrorMode_PropBackwards;
} else {
G4Exception("exG4eReco","Fatal error in Argument",
FatalErrorInArgument,
G4String("Variable G4ERROR_MODE = " + G4String(mode) +
" It must be: FORWARDS or BACKWARDS").c_str());
}
} else {
G4Exception("exG4eReco","Fatal error in Argument",
JustWarning,"Variable G4ERROR_MODE not defined, taking it = BACKWARDS");
}
else if (G4String(mode) == G4String("BACKWARDS")) {
theG4ErrorMode = G4ErrorMode_PropBackwards;
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", FatalErrorInArgument,
G4String("Variable G4ERROR_MODE = " + G4String(mode)
+ " It must be: FORWARDS or BACKWARDS")
.c_str());
}
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", JustWarning,
"Variable G4ERROR_MODE not defined, taking it = BACKWARDS");
}
}
void ProcessEvent( G4int iProp, size_t )
void ProcessEvent(G4int iProp, size_t)
{
// Set the starting trajectory.
G4ThreeVector xv3( 0, 0, 0 );
G4ThreeVector pv3( 20.0*GeV, 0.0, 0.0 );
G4ErrorTrajErr error( 5, 0 );
G4ErrorFreeTrajState* g4ErrorTrajState
= new G4ErrorFreeTrajState( "mu-", xv3, pv3, error );
// Set the starting trajectory.
G4ThreeVector xv3(0, 0, 0);
G4ThreeVector pv3(20.0 * GeV, 0.0, 0.0);
G4ErrorTrajErr error(5, 0);
G4ErrorFreeTrajState* g4ErrorTrajState = new G4ErrorFreeTrajState("mu-", xv3, pv3, error);
G4ErrorPropagatorManager* g4emgr
= G4ErrorPropagatorManager::GetErrorPropagatorManager();
G4ErrorPropagatorManager* g4emgr = G4ErrorPropagatorManager::GetErrorPropagatorManager();
//int ierr = 0;
// int ierr = 0;
G4Point3D surfPos(224.*cm,0.,0.);
G4Normal3D surfNorm(1.,0.,0.);
//- G4ErrorTarget* theG4ErrorTarget
G4Point3D surfPos(224. * cm, 0., 0.);
G4Normal3D surfNorm(1., 0., 0.);
//- G4ErrorTarget* theG4ErrorTarget
// = new G4ErrorPlaneSurfaceTarget(surfNorm, surfPos );
if( iProp == 0){
if (iProp == 0) {
// Propagate until G4ErrorTarget is found all in one go
//ierr =
g4emgr->Propagate( g4ErrorTrajState, theTarget, theG4ErrorMode );
} else if( iProp == 1){
// ierr =
g4emgr->Propagate(g4ErrorTrajState, theTarget, theG4ErrorMode);
}
else if (iProp == 1) {
// Propagate until G4ErrorTarget is reached step by step
g4emgr->InitTrackPropagation();
// G4Track* aTrack
// G4Track* aTrack
// = G4EventManager::GetEventManager()->GetTrackingManager()->GetTrack();
bool moreEvt = TRUE;
while( moreEvt ){
//ierr =
g4emgr->PropagateOneStep( g4ErrorTrajState, theG4ErrorMode );
while (moreEvt) {
// ierr =
g4emgr->PropagateOneStep(g4ErrorTrajState, theG4ErrorMode);
//---- Check if target is reached
if( g4emgr->GetPropagator()->CheckIfLastStep( g4ErrorTrajState->GetG4Track() )) {
g4emgr->GetPropagator()
->InvokePostUserTrackingAction( g4ErrorTrajState->GetG4Track() );
if (g4emgr->GetPropagator()->CheckIfLastStep(g4ErrorTrajState->GetG4Track())) {
g4emgr->GetPropagator()->InvokePostUserTrackingAction(g4ErrorTrajState->GetG4Track());
moreEvt = 0;
G4cout << "STEP_BY_STEP propagation: Last Step " << G4endl;
}
@@ -222,39 +219,38 @@ void ProcessEvent( G4int iProp, size_t )
G4Normal3D momEnd = g4ErrorTrajState->GetMomentum();
G4ErrorTrajErr errorEnd = g4ErrorTrajState->GetError();
G4cout << " Position: " << posEnd << G4endl
<< " Momentum: " << momEnd << G4endl
<< " Error: " << errorEnd << G4endl;
G4cout << " Position: " << posEnd << G4endl << " Momentum: " << momEnd << G4endl
<< " Error: " << errorEnd << G4endl;
}
//-------------------------------------------------------------
G4ErrorTarget* BuildTarget( G4int iTarget )
G4ErrorTarget* BuildTarget(G4int iTarget)
{
G4ErrorTarget* target = 0;
if( iTarget == 1 ) {
G4Point3D surfPos(221.*cm,0.,0.);
G4Normal3D surfNorm(1.,0.,0.);
target = new G4ErrorPlaneSurfaceTarget(surfNorm, surfPos );
}else if( iTarget == 2 ) {
G4double radius = 222*cm;
if (iTarget == 1) {
G4Point3D surfPos(221. * cm, 0., 0.);
G4Normal3D surfNorm(1., 0., 0.);
target = new G4ErrorPlaneSurfaceTarget(surfNorm, surfPos);
}
else if (iTarget == 2) {
G4double radius = 222 * cm;
target = new G4ErrorCylSurfaceTarget(radius);
}else if( iTarget == 3 ) {
}
else if (iTarget == 3) {
target = new G4ErrorGeomVolumeTarget("MUON");
}else if( iTarget == 4 ) {
target = new G4ErrorTrackLengthTarget(223.*cm);
}else {
G4Exception("exG4eReco","Fatal error in Argument",
FatalErrorInArgument,"Target type has to be between 1 and 4");
}
else if (iTarget == 4) {
target = new G4ErrorTrackLengthTarget(223. * cm);
}
else {
G4Exception("exG4eReco", "Fatal error in Argument", FatalErrorInArgument,
"Target type has to be between 1 and 4");
}
return target;
}
//-------------------------------------------------------------
void Finalize()
{
G4ErrorPropagatorManager::GetErrorPropagatorManager()->CloseGeometry();
}
@@ -10,7 +10,7 @@
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -18,7 +18,7 @@
WWW : http://geant4.org/
**************************************************************
creating G4RunManagerKernel 0x18540d0
creating G4RunManagerKernel 0x1000a80
G4ChordFinder: stepperDriverId: 2
The materials defined are :
@@ -94,15 +94,15 @@ G4Transportation: Current values for thresholds related to the killing of loop
Important Energy = 250 ( above this tracks are given multiple chances )
Extra Trials = 10 'important' tracks, i.e. those above 'important' energy
G4Transportation constructor> set fShortStepOptimisation to false
0x1b0e160G4ErrorPhysicsList:: particle process manager e+ = 0x1b12ab0
0x1b0dfc0G4ErrorPhysicsList:: particle process manager e- = 0x1b16f30
0x1b0de20G4ErrorPhysicsList:: particle process manager gamma = 0x1b170a0
0x1b0f4e0G4ErrorPhysicsList:: particle process manager geantino = 0x1b172f0
0x1b0e340G4ErrorPhysicsList:: particle process manager mu+ = 0x1b17540
0x1b0e690G4ErrorPhysicsList:: particle process manager mu- = 0x1b17790
0x1b0ea70G4ErrorPhysicsList:: particle process manager pi+ = 0x1b179e0
0x1b0ee90G4ErrorPhysicsList:: particle process manager pi- = 0x1b17c30
0x1b0f2b0G4ErrorPhysicsList:: particle process manager proton = 0x1b17e80
0x12a8a50G4ErrorPhysicsList:: particle process manager e+ = 0x12ad3a0
0x12a88b0G4ErrorPhysicsList:: particle process manager e- = 0x12adf10
0x12a8710G4ErrorPhysicsList:: particle process manager gamma = 0x12ae080
0x12a9dd0G4ErrorPhysicsList:: particle process manager geantino = 0x12b14c0
0x12a8c30G4ErrorPhysicsList:: particle process manager mu+ = 0x12b1710
0x12a8f80G4ErrorPhysicsList:: particle process manager mu- = 0x12b1960
0x12a9360G4ErrorPhysicsList:: particle process manager pi+ = 0x12b1bb0
0x12a9780G4ErrorPhysicsList:: particle process manager pi- = 0x12b1e00
0x12a9ba0G4ErrorPhysicsList:: particle process manager proton = 0x12b2050
physicsList->CheckParticleList() start.
physicsList->setCut() start.
G4ChordFinder: stepperDriverId: 2
@@ -31,10 +31,11 @@
#ifndef ExErrorDetectorConstruction_hh
#define ExErrorDetectorConstruction_hh 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "ExErrorMagneticField.hh"
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -44,7 +45,7 @@ class G4UserLimits;
/// Detector construction class
///
/// Creates a simplified typical HEP detector:
/// Creates a simplified typical HEP detector:
/// An air beamline ( BEAM )
/// An air central detector ( CDET )
/// A copper calorimeter, divided in four ( ECAL )
@@ -53,38 +54,36 @@ class G4UserLimits;
///
/// History:
/// Created: May 2007
/// \author P. Arce
/// \author P. Arce
//------------------------------------------------------------------------
class ExErrorDetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExErrorDetectorConstruction();
~ExErrorDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
void SetMagField(G4double);
public:
ExErrorDetectorConstruction();
~ExErrorDetectorConstruction();
private:
G4double fXBEAM;
G4double fXCDET;
G4double fXECAL;
G4double fXSOLN;
G4double fXHCAL;
G4double fXMUON;
G4double fNdivECAL;
G4double fNdivHCAL;
G4double fYZLength;
G4double fXHalfWorldLength;
virtual G4VPhysicalVolume* Construct();
void SetMagField(G4double);
G4UserLimits* fUserLimits;
ExErrorMagneticField* fMagField; // pointer to the magnetic field
ExErrorDetectorMessenger* fDetectorMessenger; // pointer to the Messenger
private:
G4double fXBEAM;
G4double fXCDET;
G4double fXECAL;
G4double fXSOLN;
G4double fXHCAL;
G4double fXMUON;
G4double fNdivECAL;
G4double fNdivHCAL;
G4double fYZLength;
G4double fXHalfWorldLength;
G4UserLimits* fUserLimits;
ExErrorMagneticField* fMagField; // pointer to the magnetic field
ExErrorDetectorMessenger* fDetectorMessenger; // pointer to the Messenger
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,8 +31,8 @@
#ifndef ExErrorDetectorMessenger_hh
#define ExErrorDetectorMessenger_hh 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class ExErrorDetectorConstruction;
class G4UIdirectory;
@@ -45,23 +45,22 @@ class G4UIcmdWithADoubleAndUnit;
///
/// History:
/// Created: May 2007
/// \author P. Arce
/// \author P. Arce
//------------------------------------------------------------------------
class ExErrorDetectorMessenger: public G4UImessenger
class ExErrorDetectorMessenger : public G4UImessenger
{
public:
ExErrorDetectorMessenger(ExErrorDetectorConstruction*);
~ExErrorDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
ExErrorDetectorConstruction* fMyDetector;
G4UIdirectory* fMydetDir;
G4UIcmdWithADoubleAndUnit* fFieldCmd;
public:
ExErrorDetectorMessenger(ExErrorDetectorConstruction*);
~ExErrorDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
ExErrorDetectorConstruction* fMyDetector;
G4UIdirectory* fMydetDir;
G4UIcmdWithADoubleAndUnit* fFieldCmd;
};
#endif
@@ -41,24 +41,22 @@ class G4FieldManager;
///
/// History:
/// Created: May 2007
/// \author P. Arce
/// \author P. Arce
//------------------------------------------------------------------------
class ExErrorMagneticField: public G4UniformMagField
class ExErrorMagneticField : public G4UniformMagField
{
public:
ExErrorMagneticField(G4ThreeVector); // The value of the field
ExErrorMagneticField(); // A zero field
//Set the field (0,0,fieldValue)
void SetFieldValue(G4double fieldValue);
void SetFieldValue(G4ThreeVector fieldVector);
ExErrorMagneticField(G4ThreeVector); // The value of the field
ExErrorMagneticField(); // A zero field
protected:
// Set the field (0,0,fieldValue)
void SetFieldValue(G4double fieldValue);
void SetFieldValue(G4ThreeVector fieldVector);
// Find the global Field Manager
G4FieldManager* GetGlobalFieldManager(); // static
protected:
// Find the global Field Manager
G4FieldManager* GetGlobalFieldManager(); // static
};
#endif
@@ -29,54 +29,59 @@
//
#include "ExErrorDetectorConstruction.hh"
#include "ExErrorDetectorMessenger.hh"
#include "ExErrorMagneticField.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4LogicalVolume.hh"
#include "G4NistManager.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SystemOfUnits.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExErrorDetectorConstruction::ExErrorDetectorConstruction()
: G4VUserDetectorConstruction(),
fXBEAM(5.*cm), fXCDET(20.*cm), fXECAL(40.*cm), fXSOLN(10.*cm), fXHCAL(100.*cm),
fXMUON(50.*cm), fNdivECAL(40./10.), fNdivHCAL(100./10.), fYZLength(50.*cm),
fXBEAM(5. * cm),
fXCDET(20. * cm),
fXECAL(40. * cm),
fXSOLN(10. * cm),
fXHCAL(100. * cm),
fXMUON(50. * cm),
fNdivECAL(40. / 10.),
fNdivHCAL(100. / 10.),
fYZLength(50. * cm),
fXHalfWorldLength(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON),
fUserLimits(0), fMagField(0), fDetectorMessenger(0)
fUserLimits(0),
fMagField(0),
fDetectorMessenger(0)
{
// create UserLimits
fUserLimits = new G4UserLimits();
fMagField = new ExErrorMagneticField(
G4ThreeVector(0.*kilogauss,0.*kilogauss,-1.*kilogauss));
fMagField =
new ExErrorMagneticField(G4ThreeVector(0. * kilogauss, 0. * kilogauss, -1. * kilogauss));
fDetectorMessenger = new ExErrorDetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExErrorDetectorConstruction::~ExErrorDetectorConstruction()
{
delete fMagField;
delete fDetectorMessenger;
delete fDetectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExErrorDetectorConstruction::Construct()
{
//--------- Material definition ---------
//--------- Material definition ---------
//Vacuum
// Vacuum
/* a = 1.*g/mole;
density = 1.E-9*g/cm3;
G4Material* Vacuum = new G4Material(name="Vacuum", z=1., a, density);
@@ -84,157 +89,149 @@ G4VPhysicalVolume* ExErrorDetectorConstruction::Construct()
G4NistManager* nistMgr = G4NistManager::Instance();
G4Material* air = nistMgr->FindOrBuildMaterial("G4_AIR");
//Al
// Al
G4Material* al = nistMgr->FindOrBuildMaterial("G4_Al");
//Fe
// Fe
G4Material* fe = nistMgr->FindOrBuildMaterial("G4_Fe");
//Cu
// Cu
G4Material* cu = nistMgr->FindOrBuildMaterial("G4_Cu");
// Print all the materials defined.
//
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//--- Sizes of the principal geometrical components (solids) --- (half lengths)
//double fXBEAM = 5.*2.*cm;
//double fXCDET = 90.*cm;
//double fXECAL = 40.*cm;
//double fXSOLN = 10.*cm;
//double fXHCAL = 100.*cm;
//double fXMUON = 50.*cm;
//double fNdivECAL = 10;
//double fNdivHCAL = 10;
//double fYZLength = 100.*cm;
// double fXBEAM = 5.*2.*cm;
// double fXCDET = 90.*cm;
// double fXECAL = 40.*cm;
// double fXSOLN = 10.*cm;
// double fXHCAL = 100.*cm;
// double fXMUON = 50.*cm;
// double fNdivECAL = 10;
// double fNdivHCAL = 10;
// double fYZLength = 100.*cm;
// double fXWorldLength= fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON;
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
//------------------------------
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
//------------------------------
// World
//------------------------------
//------------------------------
//- G4double HalfWorldLength = fXWorldLength;
G4cout << " HalfWorldLength " << fXHalfWorldLength << G4endl;
G4Box* solidWorld= new G4Box("world",fXHalfWorldLength,fYZLength,fYZLength);
G4LogicalVolume* logicWorld= new G4LogicalVolume( solidWorld, air, "World", 0, 0, 0);
G4Box* solidWorld = new G4Box("world", fXHalfWorldLength, fYZLength, fYZLength);
G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0);
// Must place the World Physical volume unrotated at (0,0,0).
//
G4VPhysicalVolume* physiWorld
= new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
logicWorld, // its logical volume
0, // its mother volume
false, // no boolean operations
0); // no field specific to volum
//------------------------------
//
G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
logicWorld, // its logical volume
0, // its mother volume
false, // no boolean operations
0); // no field specific to volum
//------------------------------
// BEAM
//------------------------------
G4Box* solidBEAM = new G4Box("BEAM",fXBEAM,fYZLength,fYZLength);
G4LogicalVolume* logicBEAM = new G4LogicalVolume(solidBEAM,air,"BEAM",0,0,0);
G4ThreeVector positionBEAM = G4ThreeVector(0.,0.,0.);
//G4VPhysicalVolume* physiBEAM =
new G4PVPlacement(0, // no rotation
//------------------------------
G4Box* solidBEAM = new G4Box("BEAM", fXBEAM, fYZLength, fYZLength);
G4LogicalVolume* logicBEAM = new G4LogicalVolume(solidBEAM, air, "BEAM", 0, 0, 0);
G4ThreeVector positionBEAM = G4ThreeVector(0., 0., 0.);
// G4VPhysicalVolume* physiBEAM =
new G4PVPlacement(0, // no rotation
positionBEAM, // at (x,y,z)
"BEAM", // its name
logicBEAM, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
"BEAM", // its name
logicBEAM, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//------------------------------
//------------------------------
// CDET (Central DETector)
//------------------------------
G4ThreeVector positionCdet = G4ThreeVector(fXBEAM + fXCDET/2.,0.,0.);
G4Box* solidCDET = new G4Box("CDET",fXCDET/2.,fYZLength,fYZLength);
G4LogicalVolume* logicCDET = new G4LogicalVolume(solidCDET,air,"Cdet",0,0,0);
// G4VPhysicalVolume* physiCDET =
new G4PVPlacement(0, // no rotation
//------------------------------
G4ThreeVector positionCdet = G4ThreeVector(fXBEAM + fXCDET / 2., 0., 0.);
G4Box* solidCDET = new G4Box("CDET", fXCDET / 2., fYZLength, fYZLength);
G4LogicalVolume* logicCDET = new G4LogicalVolume(solidCDET, air, "Cdet", 0, 0, 0);
// G4VPhysicalVolume* physiCDET =
new G4PVPlacement(0, // no rotation
positionCdet, // at (x,y,z)
"CDET", // its name
logicCDET, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
"CDET", // its name
logicCDET, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//------------------------------
//------------------------------
// ECAL
//------------------------------
G4ThreeVector positionECAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL/2., 0., 0.);
G4Box* solidECAL = new G4Box("ECAL",fXECAL/2.,fYZLength,fYZLength);
G4LogicalVolume* logicECAL = new G4LogicalVolume(solidECAL,cu,"ECAL",0,0,0);
G4VPhysicalVolume* physiECAL
= new G4PVPlacement(0, // no rotation
positionECAL, // at (x,y,z)
"ECAL", // its name
logicECAL, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//--------- Divide it
G4Box* solidECALdiv = new G4Box("ECAL",fXECAL/2./fNdivECAL,fYZLength,fYZLength);
G4LogicalVolume* logicECALdiv = new G4LogicalVolume(solidECALdiv,cu,"ECALdiv",0,0,0);
new G4PVReplica("DVEC", logicECALdiv, physiECAL,
kXAxis, G4int(fNdivECAL), fXECAL/fNdivECAL);
//------------------------------
G4ThreeVector positionECAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL / 2., 0., 0.);
G4Box* solidECAL = new G4Box("ECAL", fXECAL / 2., fYZLength, fYZLength);
G4LogicalVolume* logicECAL = new G4LogicalVolume(solidECAL, cu, "ECAL", 0, 0, 0);
G4VPhysicalVolume* physiECAL = new G4PVPlacement(0, // no rotation
positionECAL, // at (x,y,z)
"ECAL", // its name
logicECAL, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//--------- Divide it
G4Box* solidECALdiv = new G4Box("ECAL", fXECAL / 2. / fNdivECAL, fYZLength, fYZLength);
G4LogicalVolume* logicECALdiv = new G4LogicalVolume(solidECALdiv, cu, "ECALdiv", 0, 0, 0);
new G4PVReplica("DVEC", logicECALdiv, physiECAL, kXAxis, G4int(fNdivECAL), fXECAL / fNdivECAL);
//------------------------------
//------------------------------
// SOLN
//------------------------------
G4ThreeVector positionSOLN
= G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN/2., 0., 0.);
G4Box* solidSOLN = new G4Box("SOLN",fXSOLN/2.,fYZLength,fYZLength);
G4LogicalVolume* logicSOLN = new G4LogicalVolume(solidSOLN,al,"SOLN",0,0,0);
new G4PVPlacement(0, // no rotation
//------------------------------
G4ThreeVector positionSOLN = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN / 2., 0., 0.);
G4Box* solidSOLN = new G4Box("SOLN", fXSOLN / 2., fYZLength, fYZLength);
G4LogicalVolume* logicSOLN = new G4LogicalVolume(solidSOLN, al, "SOLN", 0, 0, 0);
new G4PVPlacement(0, // no rotation
positionSOLN, // at (x,y,z)
"SOLN", // its name
logicSOLN, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
"SOLN", // its name
logicSOLN, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//------------------------------
//------------------------------
// HCAL
//------------------------------
G4ThreeVector positionHCAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL/2., 0., 0.);
G4Box* solidHCAL = new G4Box("HCAL",fXHCAL/2.,fYZLength,fYZLength);
G4LogicalVolume* logicHCAL = new G4LogicalVolume(solidHCAL,fe,"HCAL",0,0,0);
G4VPhysicalVolume* physiHCAL
= new G4PVPlacement(0, // no rotation
positionHCAL, // at (x,y,z)
"HCAL", // its name
logicHCAL, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//--------- Divide it
G4Box* solidHCALdiv = new G4Box("HCAL",fXHCAL/2./fNdivHCAL,fYZLength,fYZLength);
G4LogicalVolume* logicHCALdiv = new G4LogicalVolume(solidHCALdiv,fe,"HCALdiv",0,0,0);
new G4PVReplica("DVEH", logicHCALdiv, physiHCAL,
kXAxis, G4int(fNdivHCAL), fXHCAL/fNdivHCAL);
//------------------------------
// MUON
//------------------------------
G4ThreeVector positionMUON
= G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON/2., 0., 0.);
G4Box* solidMUON = new G4Box("MUON",fXMUON/2.,fYZLength,fYZLength);
G4LogicalVolume* logicMUON = new G4LogicalVolume(solidMUON,air,"MUON",0,0,0);
new G4PVPlacement(0, // no rotation
positionMUON, // at (x,y,z)
"MUON", // its name
logicMUON, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//------------------------------
G4ThreeVector positionHCAL =
G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL / 2., 0., 0.);
G4Box* solidHCAL = new G4Box("HCAL", fXHCAL / 2., fYZLength, fYZLength);
G4LogicalVolume* logicHCAL = new G4LogicalVolume(solidHCAL, fe, "HCAL", 0, 0, 0);
G4VPhysicalVolume* physiHCAL = new G4PVPlacement(0, // no rotation
positionHCAL, // at (x,y,z)
"HCAL", // its name
logicHCAL, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
//--------- Divide it
G4Box* solidHCALdiv = new G4Box("HCAL", fXHCAL / 2. / fNdivHCAL, fYZLength, fYZLength);
G4LogicalVolume* logicHCALdiv = new G4LogicalVolume(solidHCALdiv, fe, "HCALdiv", 0, 0, 0);
new G4PVReplica("DVEH", logicHCALdiv, physiHCAL, kXAxis, G4int(fNdivHCAL), fXHCAL / fNdivHCAL);
//------------------------------
// MUON
//------------------------------
G4ThreeVector positionMUON =
G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON / 2., 0., 0.);
G4Box* solidMUON = new G4Box("MUON", fXMUON / 2., fYZLength, fYZLength);
G4LogicalVolume* logicMUON = new G4LogicalVolume(solidMUON, air, "MUON", 0, 0, 0);
new G4PVPlacement(0, // no rotation
positionMUON, // at (x,y,z)
"MUON", // its name
logicMUON, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
G4VisAttributes* worldVisAtt = new G4VisAttributes(0);
logicWorld->SetVisAttributes( worldVisAtt);
logicWorld->SetVisAttributes(worldVisAtt);
return physiWorld;
}
@@ -243,4 +240,3 @@ void ExErrorDetectorConstruction::SetMagField(G4double fieldValue)
{
fMagField->SetFieldValue(fieldValue);
}
@@ -31,27 +31,26 @@
#include "ExErrorDetectorMessenger.hh"
#include "ExErrorDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExErrorDetectorMessenger::ExErrorDetectorMessenger(ExErrorDetectorConstruction* myDet)
:G4UImessenger(),fMyDetector(myDet),fMydetDir(0),fFieldCmd(0)
{
: G4UImessenger(), fMyDetector(myDet), fMydetDir(0), fFieldCmd(0)
{
fMydetDir = new G4UIdirectory("/exerror/");
fMydetDir->SetGuidance("ExError control.");
fFieldCmd = new G4UIcmdWithADoubleAndUnit("/exerror/setField",this);
fFieldCmd = new G4UIcmdWithADoubleAndUnit("/exerror/setField", this);
fFieldCmd->SetGuidance("Define magnetic field.");
fFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
fFieldCmd->SetParameterName("Bz",false);
fFieldCmd->SetParameterName("Bz", false);
fFieldCmd->SetDefaultUnit("tesla");
fFieldCmd->SetUnitCategory("Magnetic flux density");
fFieldCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
fFieldCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -62,11 +61,9 @@ ExErrorDetectorMessenger::~ExErrorDetectorMessenger()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExErrorDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fFieldCmd ) {
void ExErrorDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == fFieldCmd) {
fMyDetector->SetMagField(fFieldCmd->GetNewDoubleValue(newValue));
}
}
@@ -29,12 +29,12 @@
//
#include "ExErrorMagneticField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExErrorMagneticField::ExErrorMagneticField()
: G4UniformMagField(G4ThreeVector())
ExErrorMagneticField::ExErrorMagneticField() : G4UniformMagField(G4ThreeVector())
{
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
@@ -44,28 +44,27 @@ ExErrorMagneticField::ExErrorMagneticField()
ExErrorMagneticField::ExErrorMagneticField(G4ThreeVector fieldVector)
: G4UniformMagField(fieldVector)
{
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExErrorMagneticField::SetFieldValue(G4double fieldValue)
{
G4UniformMagField::SetFieldValue(G4ThreeVector(0,0,fieldValue));
G4UniformMagField::SetFieldValue(G4ThreeVector(0, 0, fieldValue));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExErrorMagneticField::SetFieldValue(G4ThreeVector fieldVector)
{
// Find the Field Manager for the global field
G4FieldManager* fieldMgr= GetGlobalFieldManager();
if(fieldVector!=G4ThreeVector(0.,0.,0.))
{
G4FieldManager* fieldMgr = GetGlobalFieldManager();
if (fieldVector != G4ThreeVector(0., 0., 0.)) {
G4UniformMagField::SetFieldValue(fieldVector);
fieldMgr->SetDetectorField(this);
} else {
}
else {
// If the new field's value is Zero, then it is best to
// insure that it is not used for propagation.
G4MagneticField* magField = NULL;
@@ -74,8 +73,7 @@ void ExErrorMagneticField::SetFieldValue(G4ThreeVector fieldVector)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* ExErrorMagneticField::GetGlobalFieldManager()
G4FieldManager* ExErrorMagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
}