Hi! Beginner user here. I am wondering how I can get the number of optical photons produced when a charged particle traverses my crenkov radiator.
I understand the following:
One can store hits using the ProcessHits
method of a sensitive detector, with the help of a Hit class, and a Hit Collection. I use this to store hits of optical photons penetrating a PMT volume I defined.
I also believe to understand that the ProcessHits method takes a step as an argument, so a particle track inside the sensitive volume would add x hits to the hit collection if the track was divided in x steps (provided I insert the hits in the ProcessHits method).
So in my PMT example I just kill the tracks to make sure this does not happen.
The process hits method basically looks like this then:
G4bool OpticalDetectorSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
// Get the track and particle associated with the step
G4Track* track = step->GetTrack();
const G4ParticleDefinition* particle = track->GetDefinition();
// Check if the particle is an optical photon
if (particle == G4OpticalPhoton::OpticalPhotonDefinition()) {
// Create a new hit object
OpticalHit* newHit = new OpticalHit();
// Add the hit to the hits collection
fHitsCollection->insert(newHit);
track->SetTrackStatus(fStopAndKill);
}
return true;
}
My approach to get the number of optical photons produced in the cerenkov radiator would be the following:
Define the radiator as an sensitive detector and insert hits when particle is an optical photon and ONLY IF it is the first step in this volume (the first “touch”). Of course I do not want to kill the tracks.
I have not found a way to do this yet and I am wondering if this is the right approach or if there is an easier way.
Also as a follow up question, I am wondering how I could count the photons depending on their production mechanism. So the total number of photons created by the primary cerenkov effect and the total number of photons produced by secondary effects.
I would appreciate some guidance or hints on how to approach the problem.