# Day2 - Exercise Geometry

## OBJECTIVE

The goal of this exercise is to learn the basics about

## GEOMETRY

A gamma beam of 10 GeV is directed in positive z-direction.

The setup consists of a single box containing 10 sandwich layers of 5mm Lead and 10mm Scintillator (z direction). The x and y dimensions are 50 cm.

Three "Tooling Balls" are placed on top.

## HOW

• unpack the code for this exercise into your working directory
```	% cd ~/g4course2011
% wget http://www.ifh.de/geant4/g4course2011/day2a.tgz
% tar xzf day2a.tgz
% cd day2a
```

• compile and generate an executable:
```	% gmake clean
% gmake -j2
```

• execute 'calorimeter' in interactive mode with visualization:
```        % \$G4WORKDIR/bin/\$G4SYSTEM/calorimeter
....
Idle> # type your commands. example:

Idle> /run/beamOn 1
....
Idle> exit
```

## PRACTICE

For background information see User's Guide for Application Developer (section 2.2) : http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s02.html

### Exercise 2.1.1 - Geometry definition I

Create the main volume of the Calorimeter (CalorBox) and fill with air
• Define a solid box (use CalorBoxX, CalorBoxY and CalorBoxZ variables already defined)
• Define a logical volume called "logicCalorBox"
• Define a physical volume "physiCalorBox" and place it at (0,0,0) inside the world volume. (look for Task 2 in DetectorConstruction.cc)

### Exercise 2.1.2 - Geometry definition II

(look for Task 3-5 in DetectorConstruction.cc)

Create a Lead and a Scintillator layer in a virtual envelope layer

• Define the envelope layer solid and logic (dimensions EnvLayerX, EnvLayerY and EnvLayerZ)
• Define a logical volume called "logicEnvLayer" and fill it with the "myAir" material.

• Define a solid box called "solidPbLayer" with the dimensions PbLayerX, PbLayerY and PbLayerZ
• Define a logical volume called "logicPbLayer" and fill it with the "myAir" material.
• Define a physical volume "physiPbLayer" and place it at (0 , 0 , -EnvLayerWidthZ/2 + PbLayerWidthZ/2 ) inside the envelope (logicEnvLayer) and give it copy no 1.

• Define a solid box called "solidScintillator" (dimensions ScintillatorX, ScintillatorY and ScintillatorZ)
• Define a logical volume called "logicScintillator" and fill it with the "myAir" material.
• Define a physical volume "physiScintillator" and place it at (0, 0 , EnvLayerZ/2. - ScintillatorZ/2.) inside the envelope (logicEnvLayer) and give it copy no 2.

### Exercise 2.1.3 - Geometry definition III

Now we "replicate" the envelope layer 10 times inside "logicCalorBox"
• Define a replication of the logical envolope layer "logicEnvLayer" inside "logicCalorBox" 10 times along the Z axis using G4PVReplica

### Hints 2.1.4: Help & Visualisation

• Uncomment the provided Vis Attributes lines.

• For better visualisation of the geometry you may try the following UI commands
```   Idle> /run/beamOn 1
Idle> /vis/viewer/set/style surface
Idle> /run/beamOn 1
Idle> /run/beamOn 1
```

• Check the graphical help system for of the Qt UI for useful Geant4 macro commands.

### Exercise 2.1.5 (optional) - Geometry definition IV

Make Union-Solid between a cylinder and a Sphere to implement a kind of tooling balls on top of the calorimeter box.

• Define a solid Sphere "G4Sphere" called "solidGlassBall" with the dimensions Rmin= 0 , Rmax=5 cm, minPhi=0 deg, maxPhi = twopi, minRho=0, maxRho=pi
• Define a solud cylinder "G4Tubs" called "SolidBallSup" with the dimensions Rmin= 0 , Rmax=5 cm, minPhi=0 deg, z=1 cm maxPhi = twopi
• Define a Rotation matrix which rotate a solid by 90 deg around the X axis.
• Define a Union solid called "solidToolingBall" resulting from an Union between "solidGlassBall" and "SolidBallSup".
• Make a 3D translation of SolidBallSup at (0,-5.*cm,0) and rotate it using the predefined rotationmarix in Step 3.
• Define a logical volume called "logicToolingBall" and fill it with the Glass material.
• Define a physical volume "physiPbLayer" and make three placement with different copy number at each one at the folowing positions:
• copy 0 at : (CalorBoxOutX/2.-5.*cm , CalorBoxOutY/2.+5.5*cm , CalorBoxOutWidthZ/2.-5.*cm)
• copy 1 at : (CalorBoxOutX/2.-5.*cm , CalorBoxOutY/2.+5.5*cm , CalorBoxOutWidthZ/2.-5.*cm)
• copy 1 at : (-CalorBoxOutX/2.+5.*cm , CalorBoxOutY/2.+5.5*cm , CalorBoxOutWidthZ/2.-5.*cm)

Generated on Wed May 11 15:39:16 2011