Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -5,53 +5,57 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02DetectorConstruction.cc,v 1.4 2000/05/15 14:02:10 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02DetectorConstruction.cc,v 1.5 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02DetectorConstruction.hh"
#include "ExN02DetectorMessenger.hh"
#include "ExN02ChamberParameterisation.hh"
#include "ExN02MagneticField.hh"
#include "ExN02TrackerSD.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GeometryManager.hh"
#include "ExN02MagneticField.hh"
#include "G4PVParameterised.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
///#include "G4UserLimits.hh"
#include "G4SDManager.hh"
#include "ExN02TrackerSD.hh"
///#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorConstruction::ExN02DetectorConstruction()
:solidWorld(NULL),logicWorld(NULL),physiWorld(NULL),
:solidWorld(NULL), logicWorld(NULL), physiWorld(NULL),
solidTarget(NULL), logicTarget(NULL), physiTarget(NULL),
solidTracker(NULL),logicTracker(NULL),physiTracker(NULL),
solidTarget(NULL),logicTarget(NULL),physiTarget(NULL),
solidChamber(NULL),logicChamber(NULL),physiChamber(NULL),
myMaterial(NULL), fDetectorLength(0.),fWorldLength(0.)
TargetMater(NULL), ChamberMater(NULL),fpMagField(NULL),
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
{
fpMagField = new ExN02MagneticField();
detectorMessenger = new ExN02DetectorMessenger(this);
fpMagField = new ExN02MagneticField(); // G4FieldManager();
// magFieldManager = new G4FieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorConstruction::~ExN02DetectorConstruction()
{
delete detectorMessenger;
delete fpMagField;
// delete magFieldManager;
delete fpMagField;
delete detectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
{
//--------- Material definition ---------
@@ -81,13 +85,12 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Pb", z=82., a, density);
//Vacuum
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material* Vacuum =
new G4Material(name="Vacuum", z=1., a=1.01*g/mole, density,
kStateGas,temperature,pressure);
//Xenon gas
density = 5.458*mg/cm3;
pressure = 1*atmosphere;
temperature = 293.15*kelvin;
G4Material* Xenon = new G4Material(name="XenonGas", z=54., a=131.29*g/mole,
density, kStateGas,temperature,pressure);
// Print all the materials defined.
//
@@ -96,22 +99,27 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
//--------- Sizes of the principal geometrical components (solids) ---------
fDetectorLength = 1250.*cm ; // Full length of the detector
fTrackerLength = 500. * cm; // Full length of the Tracker
fTargetLength = 5.0 * cm; // Full length of the Target
NbOfChambers = 6;
ChamberWidth = 20*cm;
ChamberSpacing = 80*cm;
G4double detectorSize = 0.5*fDetectorLength;
G4double trackerSize = fTrackerLength * 0.5; // Half length of the Tracker
G4double targetSize = fTargetLength * 0.5; // Half length of the Target
fTrackerLength = NbOfChambers*ChamberSpacing; // Full length of the Tracker
fTargetLength = 5.0 * cm; // Full length of the Target
TargetMater = Pb;
ChamberMater = Xenon;
fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
G4double targetSize = 0.5*fTargetLength; // Half length of the Target
G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
myMaterial = Aluminium;
//------------------------------
// World
//------------------------------
fWorldLength= 1.2 * fDetectorLength;
G4double HalfWorldLength = 0.5*fWorldLength;
solidWorld= new G4Box("World",HalfWorldLength,HalfWorldLength,HalfWorldLength);
@@ -126,32 +134,36 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
0, // its mother volume
false, // no boolean operations
0); // no field specific to volume
//------------------------------
// Target
//------------------------------
//------------------------------
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
solidTarget = new G4Box("TargetSolid",targetSize,targetSize,targetSize);
logicTarget = new G4LogicalVolume(solidTarget ,myMaterial,"TargetLV",0,0,0);
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"TargetLV",0,0,0);
physiTarget = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
positionTarget, // at (x,y,z)
"TargetPV", // its name
logicTarget, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
G4cout << "Target is " << 2*targetSize/cm << " cm of Al " << G4endl;
G4cout << "Target is " << fTargetLength/cm << " cm of "
<< TargetMater->GetName() << G4endl;
//------------------------------
// Tracker
//------------------------------
G4ThreeVector positionTracker;
solidTracker = new G4Box("Tracker",trackerSize,trackerSize,trackerSize);
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
positionTracker= G4ThreeVector(0,0,trackerSize+targetSize);
//------------------------------
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
solidTracker = new G4Box("Tracker",trackerSize,trackerSize,trackerSize);
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
physiTracker = new G4PVPlacement(0, // no rotation
positionTracker, // at (0,0,0)
positionTracker, // at (x,y,z)
"Tracker", // its name
logicTracker, // its logical volume
physiWorld, // its mother volume
@@ -160,35 +172,41 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
//------------------------------
// Tracker segments
//------------------------------
//------------------------------
//
// An example of Parameterised volumes
// dummy values for G4Box -- modified by parameterised volume
G4VSolid * solidChamber
= new G4Box("chamberBox", 100*cm, 100*cm, 10*cm);
// chamberWidth, chamberWidth, chamberDepth);
G4LogicalVolume * trackerChamberLV
= new G4LogicalVolume(solidChamber, Aluminium, "trackerChamberLV",0,0,0);
G4VPVParameterisation * chamberParam
= new ExN02ChamberParameterisation(
6, // NoChambers,
-240.*cm, // Z of center of first
80*cm, // Z spacing of centers
20*cm, // Width Chamber,
50*cm, // lengthInitial,
trackerSize*2.); // lengthFinal
// dummy value : kXAxis -- modified by parameterised volume
G4VPhysicalVolume *trackerChamber_phys
= new G4PVParameterised("trkChamber", // TrackerChamber parameterised
trackerChamberLV, // Its logical volume
physiTracker, // Mother physical volume
kZAxis, // Are placed along this axis
6, // Number of chambers
chamberParam); // The parametrisation
G4VisAttributes* trackerChamber_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
trackerChamberLV->SetVisAttributes(trackerChamber_logVisAtt);
solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0);
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
G4double firstLength = fTrackerLength/10;
G4double lastLength = fTrackerLength;
G4VPVParameterisation* chamberParam = new ExN02ChamberParameterisation(
NbOfChambers, // NoChambers
firstPosition, // Z of center of first
ChamberSpacing, // Z spacing of centers
ChamberWidth, // Width Chamber
firstLength, // lengthInitial
lastLength); // lengthFinal
// dummy value : kZAxis -- modified by parameterised volume
//
physiChamber = new G4PVParameterised(
"Chamber", // their name
logicChamber, // their logical volume
physiTracker, // Mother physical volume
kZAxis, // Are placed along this axis
NbOfChambers, // Number of chambers
chamberParam); // The parametrisation
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
<< "The chambers are " << ChamberWidth/mm << " mm of "
<< ChamberMater->GetName() << "\n The distance between chamber is "
<< ChamberSpacing/cm << " cm" << G4endl;
//------------------------------------------------
// Sensitive detectors
//------------------------------------------------
@@ -198,68 +216,65 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
SDman->AddNewDetector( aTrackerSD );
trackerChamberLV->SetSensitiveDetector( aTrackerSD );
logicChamber->SetSensitiveDetector( aTrackerSD );
//--------- Visualization attributes -------------------------------
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
logicWorld ->SetVisAttributes(BoxVisAtt);
logicTarget ->SetVisAttributes(BoxVisAtt);
logicTracker->SetVisAttributes(BoxVisAtt);
G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
logicChamber->SetVisAttributes(ChamberVisAtt);
//--------- example of User Limits -------------------------------
G4VisAttributes * simpleBoxVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
logicTracker->SetVisAttributes(simpleBoxVisAtt);
//set a max Step length in the absorber
///G4double maxStep = fDetectorLength/0.7, maxLength=fDetectorLength/0.7;
//below is an example of how to set tracking constraints in a given
//logical volume(see also in N02PhysicsList how to setup the process
//G4UserSpecialCuts).
//set a max Step length in the tracker region
///G4double maxStep = 0.5*ChamberWidth, maxLength = 2*fTrackerLength;
///G4double maxTime = 0.1*ns, minEkin = 10*MeV;
///logicAbsorber->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
///logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
/// minEkin));
return physiWorld;
}
#if 0
void ExN02DetectorConstruction::setMaterial(G4String materialChoice)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorConstruction::setTargetMaterial(G4String materialName)
{
const G4MaterialTable*
theMaterialTable = G4Material::GetMaterialTable();
G4Material* pttoMaterial;
for (G4int J=0 ; J<theMaterialTable->length() ; J++)
{ pttoMaterial = (*theMaterialTable)(J);
if(pttoMaterial->GetName() == materialChoice)
{myMaterial = pttoMaterial;
logicTracker->SetMaterial(pttoMaterial);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << materialChoice
<< G4endl;}
}
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
if (pttoMaterial)
{TargetMater = pttoMaterial;
logicTarget->SetMaterial(pttoMaterial);
G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
<< materialName << G4endl;
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorConstruction::SetDetectorLength(G4double length)
void ExN02DetectorConstruction::setChamberMaterial(G4String materialName)
{
G4GeometryManager::GetInstance()->OpenGeometry();
fDetectorLength = length;
fWorldLength = 1.2*fDetectorLength;
G4double halfSize = 0.5 * fDetectorLength;
G4double halfWorldLength = 0.5*fWorldLength;
solidWorld -> SetXHalfLength(halfWorldLength);
solidWorld -> SetYHalfLength(halfWorldLength);
solidWorld -> SetZHalfLength(halfWorldLength);
solidTracker -> SetXHalfLength(halfSize);
solidTracker -> SetYHalfLength(halfSize);
solidTracker -> SetZHalfLength(halfSize);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << myMaterial->GetName()
<< G4endl;
}
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
if (pttoMaterial)
{ChamberMater = pttoMaterial;
logicChamber->SetMaterial(pttoMaterial);
G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of "
<< materialName << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorConstruction::SetMagField(G4double fieldValue)
{
fpMagField->SetFieldValue(fieldValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....