exercises alberto ribon alberto ribon cern ph/sft cern ph/sft geant4 tutorial, 25-26 may 2005

8
Exercise Exercise s s Alberto Alberto Ribon Ribon CERN CERN PH/SFT PH/SFT Geant4 tutorial, 25-26 May 2005

Upload: oswald-bridges

Post on 06-Jan-2018

217 views

Category:

Documents


0 download

DESCRIPTION

Geant4 tutorial: Exercises 3 Exercise on: Geometry Add a G4Box of dimensions: Add a G4Box of dimensions: 1 mm x CalorSizeYZ x CalorSizeYZ 1 mm x CalorSizeYZ x CalorSizeYZ Material: scintillator, Sci Material: scintillator, Sci Caveat: you need to define a private member variable to store the local variable Sci. Caveat: you need to define a private member variable to store the local variable Sci. Place the box 1 cm in front (i.e. before) of the calorimeter along the x-axis Place the box 1 cm in front (i.e. before) of the calorimeter along the x-axis Hint: the position along the x-axis of the calorimeter starts at x = - CalorThickness/2.0 and the center of the box should be 1 cm before it (i.e at lower x). Hint: the position along the x-axis of the calorimeter starts at x = - CalorThickness/2.0 and the center of the box should be 1 cm before it (i.e at lower x).

TRANSCRIPT

Page 1: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

ExerciseExercisess

Alberto RibonAlberto Ribon

CERN PH/SFTCERN PH/SFT

Geant4 tutorial, 25-26 May 2005

Page 2: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 2

Introduction

Copy the example Copy the example N03N03 in your local area in your local area Try to build it and run it.Try to build it and run it.

For each exercise, do the following:For each exercise, do the following: Read carefully the textRead carefully the text Try to solve it, by modifying some files of Try to solve it, by modifying some files of

the example N03 in your areathe example N03 in your area Look at the solution.Look at the solution.

Page 3: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 3

Exercise on: Geometry

Add a Add a G4BoxG4Box of dimensions: of dimensions: 1 mm x CalorSizeYZ x 1 mm x CalorSizeYZ x

CalorSizeYZCalorSizeYZ Material: scintillator, Material: scintillator, SciSci Caveat: you need to define a private member variable to Caveat: you need to define a private member variable to

store the local variable store the local variable Sci.Sci. Place the box Place the box 1 cm1 cm in front (i.e. before) in front (i.e. before)

of the calorimeter along the of the calorimeter along the x-axisx-axis Hint: the position along the x-axis of the calorimeter starts Hint: the position along the x-axis of the calorimeter starts

at at x = - CalorThickness/2.0x = - CalorThickness/2.0 and the center of the box and the center of the box should be should be 1 cm1 cm before it (i.e at lower x). before it (i.e at lower x).

Page 4: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 4

(continuation)

The solution is in the directory:The solution is in the directory: geometry/geometry/

Copy the header files Copy the header files .hh.hh in your local in your local directory directory include/ include/ and the source and the source files files .cc.cc in your local directory in your local directory src/src/

Page 5: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 5

Exercise on: B field

A global uniform magnetic field is applied A global uniform magnetic field is applied along the along the z-axisz-axis. Change it in such a way . Change it in such a way that the field is applied along the that the field is applied along the x-axisx-axis . .

Hint: look at the constructor Hint: look at the constructor G4ThreeVector(x,y,z)G4ThreeVector(x,y,z) in the in the method method ExN03DetectorConstruction::SetMagFieldExN03DetectorConstruction::SetMagField

Solution is in the directory: Solution is in the directory: bfield/bfield/

Page 6: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 6

Exercise on: Physics

In the directory: In the directory: physics_example/ physics_example/ you you find how to use the Physics List find how to use the Physics List LHEP .LHEP .

Copy the files in your local directory.Copy the files in your local directory. Change it in such a way to use the Physics Change it in such a way to use the Physics

List List QGSPQGSP instead of instead of LHEPLHEP.. Hint: look at the main program Hint: look at the main program exampleN03.ccexampleN03.cc

Solution is in the directory: Solution is in the directory: physics/physics/

Page 7: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 7

Exercise on: Sensitivity

In the directory: In the directory: sensitivity_example/ sensitivity_example/ you find you find how to make the added scintillator box a how to make the added scintillator box a sensitive sensitive volumevolume. . Each deposit of energy in this volume Each deposit of energy in this volume produces a produces a hithit which stores that deposited which stores that deposited energy. energy.

Copy the files in your local directory.Copy the files in your local directory.

Add to the hit the information of the Add to the hit the information of the (x,y,z) position(x,y,z) position of the energy deposit. of the energy deposit.

Hint: use Hint: use G4Step::GetPreStepPoint()G4Step::GetPreStepPoint() and and G4StepPoint::GetPosition()G4StepPoint::GetPosition()

Solution in the directory: Solution in the directory: sensitivitysensitivity//

Page 8: Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, 25-26 May 2005

Geant4 tutorial: Exercises 8

Exercise on: Analysis

In the directory: In the directory: analysis_example/ analysis_example/ you find a you find a very simple analysis: at the end of each event, very simple analysis: at the end of each event, the sum of the energy deposits (stored in the hits) the sum of the energy deposits (stored in the hits) in the scintillator box is printed. in the scintillator box is printed.

Copy the files in your local directory.Copy the files in your local directory.

Print also the Print also the average distanceaverage distance of these of these hits from the origin hits from the origin (0,0,0).(0,0,0).

Hint: use MyTrackerHit::GetPos() and G4ThreeVector::mag()Hint: use MyTrackerHit::GetPos() and G4ThreeVector::mag() Solution in the directory: Solution in the directory: analysisanalysis//