Sensitive Detectors and Hit Collection - help!

Hello all,

My project involves a neutron source enclosed within three detector volumes at varying distances. The desired output is an Ntuple with the total energy deposited by the neutrons for each of the three detectors.

I managed to assign three sensitive detectors to their respective logical volumes, and I verified that they’re working as intended; I’m just having issues setting up the hit collection.

The relevant code is attached. I’m getting an error for ‘SetEdep’ and ‘GetEdep’ within “Initialize” in the Detector.cc file. Am I missing definitions for those in the Hit.cc file, which is currently empty? I couldn’t find any documentation for that anywhere.

I tried getting Edep from aStep directly in “ProcessHits” without making a hit class, but the output for Edep was 0 for each detector. Am I on the right track now?

detectorHH

hitHH

hitCC

1 Like

Why do you have lines 21-24 inside Initialize()? I might be wrong, but I think this method is invoked at the beginning of each event, so there is no step to register.

You should have your lines 21-24 inside ProcessHits, which is called for every step in the volume(s) where this sensitive detector is assigned.

I agree with joaodfc.:slight_smile: