34 #include "DetectorConstruction.hh"
35 #include "DetectorMessenger.hh"
60 fDefaultMaterial(0),fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
61 fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
62 fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
63 fMagField(0),fDetectorMessenger(0)
67 fAbsorThickness[1] = 2.3*
mm;
68 fAbsorThickness[2] = 5.7*
mm;
70 fCalorSizeYZ = 40.*
cm;
71 ComputeCalorParameters();
87 delete fDetectorMessenger;
94 return ConstructCalorimeter();
99 void DetectorConstruction::DefineMaterials()
164 new G4Material(
"Polystyrene", density= 1.032*
g/
cm3, ncomponents=2);
169 new G4Material(
"Scintillator", density= 1.032*
g/
cm3, ncomponents=2);
268 temperature = 2.73*
kelvin;
272 density = 1.e-5*
g/
cm3;
273 pressure = 2.e-2*
bar;
276 new G4Material(
"Beam", density, ncomponents=1,
285 void DetectorConstruction::ComputeCalorParameters()
288 fLayerThickness = 0.;
289 for (
G4int iAbs=1; iAbs<=fNbOfAbsor; iAbs++) {
290 fLayerThickness += fAbsorThickness[iAbs];
292 fCalorThickness = fNbOfLayers*fLayerThickness;
293 fWorldSizeX = 1.2*fCalorThickness;
294 fWorldSizeYZ = 1.2*fCalorSizeYZ;
302 ComputeCalorParameters();
314 fSolidWorld =
new G4Box(
"World",
315 fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2);
332 fSolidCalor =
new G4Box(
"Calorimeter",
333 fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
351 fSolidLayer =
new G4Box(
"Layer",
352 fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
377 G4double xfront = -0.5*fLayerThickness;
378 for (
G4int k=1; k<=fNbOfAbsor; k++) {
379 fSolidAbsor[k] =
new G4Box(
"Absorber",
380 fAbsorThickness[k]/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
384 fAbsorMaterial[k]->GetName());
386 G4double xcenter = xfront+0.5*fAbsorThickness[k];
387 xfront += fAbsorThickness[k];
391 fAbsorMaterial[k]->GetName(),
410 G4cout <<
"\n-------------------------------------------------------------"
411 <<
"\n ---> The calorimeter is " << fNbOfLayers <<
" layers of:";
412 for (
G4int i=1; i<=fNbOfAbsor; i++)
414 G4cout <<
"\n \t" << std::setw(12) << fAbsorMaterial[i]->
GetName() <<
": "
415 << std::setw(6) <<
G4BestUnit(fAbsorThickness[i],
"Length");
417 G4cout <<
"\n-------------------------------------------------------------\n";
420 for (
G4int j=1; j<=fNbOfAbsor; j++)
421 G4cout <<
"\n" << fAbsorMaterial[j] << G4endl;
423 G4cout <<
"\n-------------------------------------------------------------\n";
433 if (pttoMaterial) fDefaultMaterial = pttoMaterial;
443 {
G4cout <<
"\n --->warning from SetfNbOfLayers: "
444 << ival <<
" must be at least 1. Command refused" <<
G4endl;
456 if (ival < 1 || ival > (
MaxAbsor-1))
457 {
G4cout <<
"\n ---> warning from SetfNbOfAbsor: "
458 << ival <<
" must be at least 1 and and most " <<
MaxAbsor-1
459 <<
". Command refused" <<
G4endl;
471 if (ival > fNbOfAbsor || ival <= 0)
472 {
G4cout <<
"\n --->warning from SetAbsorMaterial: absor number "
473 << ival <<
" out of range. Command refused" <<
G4endl;
479 if (pttoMaterial) fAbsorMaterial[ival] = pttoMaterial;
488 if (ival > fNbOfAbsor || ival <= 0)
489 {
G4cout <<
"\n --->warning from SetAbsorThickness: absor number "
490 << ival <<
" out of range. Command refused" <<
G4endl;
494 {
G4cout <<
"\n --->warning from SetAbsorThickness: thickness "
495 << val <<
" out of range. Command refused" <<
G4endl;
498 fAbsorThickness[ival] = val;
508 {
G4cout <<
"\n --->warning from SetfCalorSizeYZ: thickness "
509 << val <<
" out of range. Command refused" <<
G4endl;
527 if(fMagField)
delete fMagField;
G4IonisParamMat * GetIonisation() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void SetChemicalFormula(const G4String &chF)
CLHEP::Hep3Vector G4ThreeVector
G4bool SetDetectorField(G4Field *detectorField)
void AddMaterial(G4Material *material, G4double fraction)
int universe_mean_density
void SetMeanExcitationEnergy(G4double value)
const G4String & GetName() const
G4VPhysicalVolume * Construct()
void SetBirksConstant(G4double value)
void SetWorldMaterial(const G4String &)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4NistManager * Instance()
void SetNbOfLayers(G4int)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4PhysicalVolumeStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
void SetAbsorMaterial(G4int, const G4String &)
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
static G4LogicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
static G4GeometryManager * GetInstance()
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
static G4RunManager * GetRunManager()
void SetCalorSizeYZ(G4double)
void SetMagField(G4double)
void SetAbsorThickness(G4int, G4double)
void OpenGeometry(G4VPhysicalVolume *vol=0)
void AddElement(G4Element *element, G4int nAtoms)
G4Material * ConstructNewGasMaterial(const G4String &name, const G4String &nameNist, G4double temp, G4double pres, G4bool isotopes=true)
void CreateChordFinder(G4MagneticField *detectorMagField)
void PrintCalorParameters()
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)