34 #include "DetectorConstruction.hh"
35 #include "DetectorMessenger.hh"
59 :fDefaultMaterial(0),fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
60 fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
61 fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
66 fAbsorThickness[1] = 2.3*
mm;
67 fAbsorThickness[2] = 5.7*
mm;
69 fCalorSizeYZ = 40.*
cm;
70 ComputeCalorParameters();
86 delete fDetectorMessenger;
93 return ConstructCalorimeter();
98 void DetectorConstruction::DefineMaterials()
163 new G4Material(
"Polystyrene", density= 1.032*
g/
cm3, ncomponents=2);
168 new G4Material(
"Scintillator", density= 1.032*
g/
cm3, ncomponents=2);
267 temperature = 2.73*
kelvin;
271 density = 1.e-5*
g/
cm3;
272 pressure = 2.e-2*
bar;
275 new G4Material(
"Beam", density, ncomponents=1,
284 void DetectorConstruction::ComputeCalorParameters()
287 fLayerThickness = 0.;
288 for (
G4int iAbs=1; iAbs<=fNbOfAbsor; iAbs++) {
289 fLayerThickness += fAbsorThickness[iAbs];
291 fCalorThickness = fNbOfLayers*fLayerThickness;
292 fWorldSizeX = 1.2*fCalorThickness;
293 fWorldSizeYZ = 1.2*fCalorSizeYZ;
301 ComputeCalorParameters();
313 fSolidWorld =
new G4Box(
"World",
314 fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2);
331 fSolidCalor =
new G4Box(
"Calorimeter",
332 fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
350 fSolidLayer =
new G4Box(
"Layer",
351 fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
376 G4double xfront = -0.5*fLayerThickness;
377 for (
G4int k=1; k<=fNbOfAbsor; k++) {
378 fSolidAbsor[k] =
new G4Box(
"Absorber",
379 fAbsorThickness[k]/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
383 fAbsorMaterial[k]->GetName());
385 G4double xcenter = xfront+0.5*fAbsorThickness[k];
386 xfront += fAbsorThickness[k];
390 fAbsorMaterial[k]->GetName(),
409 G4cout <<
"\n-------------------------------------------------------------"
410 <<
"\n ---> The calorimeter is " << fNbOfLayers <<
" layers of:";
411 for (
G4int i=1; i<=fNbOfAbsor; i++)
413 G4cout <<
"\n \t" << std::setw(12) << fAbsorMaterial[i]->
GetName() <<
": "
414 << std::setw(6) <<
G4BestUnit(fAbsorThickness[i],
"Length");
416 G4cout <<
"\n-------------------------------------------------------------\n";
419 for (
G4int j=1; j<=fNbOfAbsor; j++)
420 G4cout <<
"\n" << fAbsorMaterial[j] << G4endl;
422 G4cout <<
"\n-------------------------------------------------------------\n";
432 if (pttoMaterial) fDefaultMaterial = pttoMaterial;
442 {
G4cout <<
"\n --->warning from SetfNbOfLayers: "
443 << ival <<
" must be at least 1. Command refused" <<
G4endl;
455 if (ival < 1 || ival > (
MaxAbsor-1))
456 {
G4cout <<
"\n ---> warning from SetfNbOfAbsor: "
457 << ival <<
" must be at least 1 and and most " <<
MaxAbsor-1
458 <<
". Command refused" <<
G4endl;
470 if (ival > fNbOfAbsor || ival <= 0)
471 {
G4cout <<
"\n --->warning from SetAbsorMaterial: absor number "
472 << ival <<
" out of range. Command refused" <<
G4endl;
478 if (pttoMaterial) fAbsorMaterial[ival] = pttoMaterial;
487 if (ival > fNbOfAbsor || ival <= 0)
488 {
G4cout <<
"\n --->warning from SetAbsorThickness: absor number "
489 << ival <<
" out of range. Command refused" <<
G4endl;
493 {
G4cout <<
"\n --->warning from SetAbsorThickness: thickness "
494 << val <<
" out of range. Command refused" <<
G4endl;
497 fAbsorThickness[ival] = val;
507 {
G4cout <<
"\n --->warning from SetfCalorSizeYZ: thickness "
508 << val <<
" out of range. Command refused" <<
G4endl;
526 if(fMagField)
delete fMagField;