Hands on 3: Build detector, retrieve simulation results

Back to Agenda


Introduction

In this third hands-on you will learn:

The code for this example can be found here, while the complete solution is here. Download the exercise code and unpack it:
  $ cd <tutorial> #change <tutorial> to your working directory
  $ tar xzf HandsOn3.tar.gz #Or tar -xzf HandsOn3.tar.gz
  $ cd HandsOn3

Follow the instructions of Hands On 1 to configure with cmake the example and build it.
Try out the application:
  $ source <where-G4-was-installed>/bin/geant4.[c]sh
  $ mkdir build-HandsOn3
  $ cmake -DGeant4_DIR=<tutorial>/lib/Geant4-10.0.1 <tutorial>/HandsOn3
  $ [g]make [-jN]
  $ ./SlacTut

This geometry should be displayed if you have visualization enabled:

The geomtry is basically the same as in Hands On 2, we will start from here to build a spectrometer. The first arm is already defined, and in the first exercise you will build the second arm and a calorimetric system:

The second arm is movable and can be rotated, between runs. The magnetic-field can also be set to user value.

At the end of this hands on part the complete geometry will look like:


Building the geometry

Different aspects of the geometry will be covered in this exercise. There are 6 steps involved in this exercise. Depending on how you build the geometry it is guaranteed that the application will compile and work correctly only when the first 5 steps are concluded (however it is a good idea to try to compile at each step to check for typos and errors).
The last step is optional because it has the goal to change visualization attributes (it make sense only if you have visualization enabled).

Different aspects of defining geometry will be presented:

Check the DetectorConstruction.hh file, since many variables you will need are already defined there.

Exercise 1 Step 1

Implement the second hodoscope.

The second hodoscope is composed on 25 planes of dimensions: 10x40x1 cm. The hodoscopes tiles are composed of scintillator material. Instantiate a single shape and logical volume. Place 25 physical volume placements in the second arm mother volume. Each tile is positioned at Y=Z=0 with respect to the mother volume, while the X coordinates depends on the tile numnber.

Hint: Check what is done for the hodosope of the first arm. Remember dimensions passed to Geant4 shape classes are half the full dimention.

Solution

DetectorConstruction File:
  // =============================================
  // Exercise 1
  // Complete full geometry.
  // Note that second arm, by default is rotated of
  // 30 deg.
  // Step 1: Add an hodoscope with dimensions (X,Y,Z):
  // (10,40,1)cm made of scintillator.
  // There are 25 planes placed at Y,Z=0 (w.r.t. mother volume)
  // hodoscopes in second arm
  G4VSolid* hodoscope2Solid = new G4Box("hodoscope2Box",5.*cm,20.*cm,0.5*cm);
  fHodoscope2Logical = new G4LogicalVolume(hodoscope2Solid,scintillator,"hodoscope2Logical");
  for (G4int i=0;i<25;i++)
  {
    G4double x2 = (i-12)*10.*cm;
    new G4PVPlacement(0,G4ThreeVector(x2,0.,0.),fHodoscope2Logical,"hodoscope2Physical",secondArmLogical,false,i,checkOverlaps);
  }

Exercise 1 Step 2

Build the drift chambers.

The second arm contains 5 drift chambers made of argon gas with dimensions 300x60x2 cm. These are equally spaced inside the second arm at distances from -2.5 m to -0.5 m along the Z coordinate.

Hint: Use same methods used for step 1.

Solution

DetectorConstruction File:
  // Step 2: Add 5 drift chambers made of argon, with dimensions (X,Y,Z):
  // (300,60,2)cm
  // These are placed equidistant inside the second arm at distances from -2.5m
  // to -0.5m
  // drift chambers in second arm
  G4VSolid* chamber2Solid = new G4Box("chamber2Box",1.5*m,30.*cm,1.*cm);
  G4LogicalVolume* chamber2Logical = new G4LogicalVolume(chamber2Solid,argonGas,"chamber2Logical");
  for (G4int i=0;i<5;i++)
  {
    G4double z2 = (i-2)*0.5*m - 1.5*m;
    new G4PVPlacement(0,G4ThreeVector(0.,0.,z2),chamber2Logical,"chamber2Physical",secondArmLogical,false,i,checkOverlaps);
  }

Exercise 1 Step 3

Add a virtual wire plane in the drift chambers.

Add a plane of wires in the drift chambers of step 2. To simplify our problem we do not describe the single wires, instead we add a new argon-filled volume of dimensions 300x60x0.02 cm in the center of each of the five drift chambers.

This exercise is technically simple (a single placement), however it shows a very useful concept: we create a single instance of this volume and we place it once inside the mother logical volume (the drift chamber logical volume), since the mother volume is repeated with five placements, each of them gets its own wire plane. We are reducing the number of class instances needed for the description of our geometry (and thus reducing the memory footprint of our application, beside making the code compact and readable).

Solution

DetectorConstruction File:
  // Step 3: Add a virtual wire plane of (300,60,0.02)cm
  // at (0,0,0) in the drift chamber
  // virtual wire plane
  G4VSolid* wirePlane2Solid = new G4Box("wirePlane2Box",1.5*m,30.*cm,0.1*mm);
  fWirePlane2Logical = new G4LogicalVolume(wirePlane2Solid,argonGas,"wirePlane2Logical");
  new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fWirePlane2Logical, "wirePlane2Physical",chamber2Logical,false,0,checkOverlaps);

Exercise 1 Step 4

Build an electro-magnetic calorimeter.

An electro-magnetic calorimeter has the goal to measure the energy of an absorbed particle. Its dimensions are such that an electron or gamma of the tipical beam energy is fully absorbed (via an electro-magnetic shower) in the calorimeter (while hadrons, such as protons, only leave part of their energy in an electromagnetic calorimeter, because it is "too short"). In our example we implement a homogenous calorimeter made of a matrix of CsI crystals (a charged paricles emits light when interacting with this material, the quantity of light produced is proportional to the lost energy).

Build a 300x60x30 cm CsI caloriemter. The calorimeter is made of a matrix of 15x15x30 cm crystals. Instead of using placements we show how to use parametrised solids. The idea is that the position of the placement is a function of the crystal number. The parametrisation class is already available for you in CellParametrisation. Study the method CellParameterisation::ComputeTransformation(...) to understand how the calorimeter cells are implemented.
The calorimeter should be places at 2 m downstream of the second arm mother volume.

Hint: You can skip the cell definition and the application will work anyway with a single giant crystal. If you are running out of time, you can come back to parametrisations later.

Solution

DetectorConstruction File:
  // Step 4: Build CsI EM-calorimeter of (300,60,30)cm
  // placed at (0,0,2)m in the second arm.
  // The calorimeter is made of 80 cells,
  // parametrised according to CellParametrisation
  // G4VPVParameterisation concrete instance.
  // This class paramtrises the position of each cell depending
  // on its copy number.
  // The cells have dimensions 15x15x30 cm.
  // (you could use placements or replicas, but here
  // we show how to use parametrisations to build geometry)
  // CsI calorimeter
  G4VSolid* emCalorimeterSolid = new G4Box("EMcalorimeterBox",1.5*m,30.*cm,15.*cm);
  G4LogicalVolume* emCalorimeterLogical = new G4LogicalVolume(emCalorimeterSolid,csI,"EMcalorimeterLogical");
  new G4PVPlacement(0,G4ThreeVector(0.,0.,2.*m),emCalorimeterLogical,"EMcalorimeterPhysical",secondArmLogical,false,0,checkOverlaps);
 
  // EMcalorimeter cells
  G4VSolid* cellSolid = new G4Box("cellBox",7.5*cm,7.5*cm,15.*cm);
  fCellLogical = new G4LogicalVolume(cellSolid,csI,"cellLogical");
  G4VPVParameterisation* cellParam = new CellParameterisation();
  new G4PVParameterised("cellPhysical",fCellLogical,emCalorimeterLogical,kXAxis,80,cellParam);

Exercise 1 Step 5

Implement the hadronic calorimeter

This is a sampling calorimeter made of lead as absorber material (used for its high density) interleaved with plates of scintillator (the active material). It is called sampling because only a fraction of the energy lost by the particles is measured (the one lost in the active material), however this is proportional to the total energy loss and hence to the impinging particle energy (you may be aware of the problems with non-compensation, but we will not discuss them here).

Implement the calorimeter using replicas to slice a volume. Each cell has 20 layers of 4 cm thick lead plate and 1 cm thick scintillator plate. The size of the plate is 30 cm square. The calorimeter array has 10 horizontal columns in 2 vertical rows. Here is a schematic drawing of the calorimeter.