Day 3 - Geant4 Sensitive Detector

Geant4 and Calorimetry in HEP

OBJECTIVE

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.

HOW

PRACTICE

You will have to modify the DetectorConstruction::Construct() method in src/DetectorConstruction.cc file.

The sensitive detector is defined in ScintillatorSD class.

Exercise 3.5.1 : Sensitive Detector definition

Look at class ScintillatorSD. The basic structure of the class has been already created for you. Read briefly the code and understand what the main methods are used for.

Now change the DetectorConstruction::ConstructCalorimeter() (src/DetectorConstruction.cc) method to add the SD to the scintiation layers of the calorimeter.

Test the application:

     % gmake
     % calorimeter sd.mac
Verify that the output includes the following line:
Creating SD with name: /myDet/Adsorber
This line is printed in ScintillatorSD constructor and thus shows that the SD has been correctly initialized.

Exercise 3.5.2 : Add print out information for each G4Step

We want now to add some print out for each step that is simulated in the Scintillator layers. Open the src/ScintillatorSD.cc file and modify the ScintillatorSD::ProcessHits(G4Step *step, G4TouchableHistory *) method. Add some print out lines (see commented lines in source code).

Un-comment the lines and recompile. Try with the provided macro.

    % gmake
    % calorimeter sd2.mac

This will generate a muon of 20 GeV kinetic energy

Exercise 3.5.3 : Try different particles

Start the application in interactive mode and shoot a muon of 1 GeV
     % calorimeter
     ...
     Idle> /gps/particle mu-
     Idle> /gps/energy 1 GeV
     Idle> /run/beamOn 1

Hint: to exit the application issue the comamnd exit

Try now with a 5 GeV electron:

     Idle> /gps/particle e-
     Idle> /gsp/energy 5 GeV
     Idle> /run/beamOn 1

Finally try with a 5 GeV pion

     Idle> /gps/particle pi-
     Idle> /gsp/energy 5 GeV
     Idle> /run/beamOn 1

SOLUTION

These are the relevant lines of DetectorConstruction::ConstructCalorimeter():
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
{
	.....
  sensitive= new ScintillatorSD("/myDet/Adsorber");

  solidScintillator = new G4Box("Scintillator", ScintillatorX/2., ScintillatorY/2., ScintillatorWidthZ/2.); 
  logicScintillator = new G4LogicalVolume(solidScintillator, ScintillatorMater ,"Scintillator",0,0,0);
  logicScintillator->SetSensitiveDetector(sensitive);

  G4SDManager::GetSDMpointer()->AddNewDetector(sensitive);  //needed to garantee calls to Initialize and EndOfEvent methods!

	....

These are the relevel lines of G4bool ScintillatorSD::ProcessHits(G4Step *step, G4TouchableHistory *)

  G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle();

  G4int copyNo = touchable->GetReplicaNumber();
  G4int plane = touchable->GetReplicaNumber(1);
  std::cout<<" CopyNo = "<<copyNo<<" : "<<plane<<std::endl;

return true;

Generated on Thu May 12 14:04:28 2011