The solutions are indicated in red.
Exercise 2-4
#include "G4Tubs.hh" G4VPhysicalVolume* DetectorConstruction::Construct() { ... G4LogicalVolume* worldVolLogic = new G4LogicalVolume(worldVolSolid, // geometrical object air, // material "World"); // name ... G4double nitrogenInnerRadius = 0.0*cm; G4double nitrogenOuterRadius = 10.0*cm; G4double nitrogenHeight = 20.0*cm; G4Tubs* liquidNitrogenTube = new G4Tubs("liquidNitrogenTube", nitrogenInnerRadius, nitrogenOuterRadius, nitrogenHeight/2., 0,twopi); G4LogicalVolume* liquidNitrogenLog = new G4LogicalVolume(liquidNitrogenTube, liquidNitrogen, "LiqNitrogenLog"); G4RotationMatrix* rotationMatrix = new G4RotationMatrix(); rotationMatrix->rotateY(90*deg); G4VPhysicalVolume* liquidNitrogenPhys = new G4PVPlacement(rotationMatrix, G4ThreeVector(), //no translation "LiquidNitrogen", // name liquidNitrogenLog, // logical volume of the detector worldVolPhys, // physical volume of mother volume false, // parameter for future use 0); // copy number ... // Definition of the physical volume of the detector. Notice: the // translation of the detVolPhys must be referred to its mother volume // coordinate system. Since the mother is rotated, the z axis of the world // corresponds to the x axis of the cylinder! detVolPhys = new G4PVPlacement(0, // no rotation G4ThreeVector(boxLength * 0.5,0,0), // translation "Detector", // name detVolLogic, // logical volume of the detector liquidNitrogenPhys, // physical volume of mother volume false, // parameter for future use 0); // copy number } Source code
Exercise 2-5
G4VPhysicalVolume* DetectorConstruction::Construct() { ... detVolLogic = new G4LogicalVolume(detVolSolid, // geometrical object enrGe, // material "Detector"); // name ... detVolUserLimits = new G4UserLimits(0.5 * micrometer); detVolLogic -> SetUserLimits(detVolUserLimits); G4UserLimits* liquidNitrogenUserLimits = new G4UserLimits(0.1*mm); liquidNitrogenLog->SetUserLimits(liquidNitrogenUserLimits); }Source code