Time and Energy from individual hits

There are two detectors on the end of the cylindrical tube. A particle is emitted at the center and, it travels(in the magentic field in the decay trap) and deposits energy in the detector. I have a working geant code for this. However, i need to now find out TIME when the particle hits and ENERGY deposited in each HIT.
Can anyone suggest what should i use to get this information?
Motivation: Since, this particle can get back-scattered as well multiple times I am looking for the energy deposited and time it hits the detector everytime before it loses all the energy.
TIA!

Use a stepping action or a sensitive detector. The G4Step, and post-step G4StepPoint, contain all of that information.

i did set up the logical volume of detector 1 and detector 2 to the 2 sensitive detectors and have set up the collection hits. However, i notice it is not updating the hits correctly (which could be verified visually). to do this
Under detectorConstruction.cc

Silicon1 = new G4Tubs("Silicon1", innerRadiusSilicon, outerRadiusSilicon, heightCylinder,
                        startAngleSilicon, spanningAngleSilicon);
 logicalSilicon1 = new G4LogicalVolume(Silicon1,Sci, "Silicon1");
 physicalSilicon1 = new G4PVPlacement(0, G4ThreeVector(xSilicon,ySilicon,zSilicon),
                                     logicalSilicon1, "Silicon1", logicalWorld, false, 0);
   
  Silicon2 = new G4Tubs("Silicon2", innerRadiusSilicon, outerRadiusSilicon, heightCylinder,
			startAngleSilicon, spanningAngleSilicon);
 logicalSilicon2 = new G4LogicalVolume(Silicon2, Sci, "Silicon2");
 physicalSilicon2 = new G4PVPlacement(0, G4ThreeVector(xSilicon,ySilicon,-1.*zSilicon2),
                                   logicalSilicon2, "Silicon2", logicalWorld, false, 0);
G4SDManager* SDman = G4SDManager::GetSDMpointer();
    G4String SDname;
 G4VSensitiveDetector* Silicon1_sd = new TrackerSD(SDname="/Silicon1_sd");
    SDman->AddNewDetector(Silicon1_sd);
    logicalSilicon1->SetSensitiveDetector(Silicon1_sd);

    G4VSensitiveDetector* Silicon2_sd  = new TrackerSD(SDname="/Silicon2_sd");
    SDman->AddNewDetector(Silicon2_sd);
    logicalSilicon2->SetSensitiveDetector(Silicon2_sd);

Can an entire logical volume be defined as sensitive detector ? Or should i divide the logical volume into smaller parts and then activate the smaller parts as sensitive detector ?

Are you running with a multithreaded build of Geant4? You need to do the SD attachments separately, in the function ConstructSDandField(). This function is called for each of the worker threads. Unfortunately, the interface requires that you store the pointers to your LVs so that function can find them.

No, i am not using the multithreaded mode. I am a newbie and am not quite sure how that works. I will have a look at it. Is there some reference you would want to link me to? Thanks!

You should probably start with one of the basic examples: B2, B3, B4 and B5 all include ConstructSDandField().

1 Like

Are SDs just used when a particle “passes or cross” the detector?
Or can the be also used when there is backscattering from the detector. At several places, the following statement is written “sensitive” to the passage of particles

The SD is invoked for every step within the volume(s) where it is attached. it’s up to you to add appropriate “if” statements to skip over steps that aren’t of interest to you (steps with no energy deposit, or with the wrong particle type, or whatever).

1 Like

Also, i used the construct sd and field mode. I have a couple of more questions about the same.

  1. It gives a lot of hits within the same logical volume and at almost the same position. Something that even SLAC tutorial 3 mentions in hint 4 " More than one step can be done by the same particle in a single volume (why?)". Could you please shed some light on that as well ?

  2. I added the same conditions as SLAC Geant4 Tutorial Hands On 3 to count as one hit. It gives me the following results for instance:
    Screenshot from 2021-08-12 13-35-49
    Here, there seems something incorrect since for detector 2 at (x,y,+z) to have two hits detector 1 at (x,y,-z) should have atleast one hit too which is not the case. Something like this:
    Screenshot from 2021-08-12 13-37-59
    would make more sense it shows that the particle went to detector 1 and then be stopped at detector 2.
    My problem of interest is having two detectors 1 and 2. Look for the events when it goes from a->b->c->d (multiscatter) and not lose any information from the detectors.
    I am sure, this might seem like a confusing question but, any help would be of great importance. Thanks for your time!
    Screenshot from 2021-08-13 15-16-02
    Screenshot from 2021-08-13 15-15-59

In Geant4, a step is limited by some sort of interaction process. For instance, a photon might hit an atom and knock out an ionization electron, losing a few or tens of eV in the process. As you can imagine, this could happen many times while traversing a macroscopic volume.