Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
Geant4 Version: 11.2.2
Operating System: AlmaLinux 9
Compiler/Version: 13.1.0
CMake Version: 3.26.2
Hi,
I’m simulating a rectangular scintillating crystal with two SiPMs attached to the bases of the crystal. I activated cerenkov and scintillation processes in the crystal, the SiPMs are simply two G4Box made of Silicon. I count the number of optical photons produced in the crystal and the deposited energy in the crystal to see if they are proportional and everything seems to work. I count the number of photons in the SteppingAction in this way:
void SteppingAction::UserSteppingAction(const G4Step* step){
auto theTrack = step->GetTrack();
G4ParticleDefinition* particleType = theTrack->GetDefinition();
G4StepPoint *thePrePoint = step->GetPreStepPoint();
G4StepPoint *thePostPoint = step->GetPostStepPoint();
G4VPhysicalVolume *thePrePV = thePrePoint->GetPhysicalVolume();
G4VPhysicalVolume *thePostPV = thePostPoint->GetPhysicalVolume();
if (particleType == G4OpticalPhoton::OpticalPhotonDefinition()) {
if (nStep == 1 && G4StrUtil::contains(thePrePVName, "Calorimeter")) {
if (processName == "Scintillation") {
fEventAction->tot_phot_scint_calo += 1;
}
}
}
}
Here’s the plot of the energy deposit and the number of photons
Then I want to count the number of photons the reach the SiPMs on the bases of the crystal, and in this case I seem to get problems. Perhaps it’s important to say that the base of the crystal is 12 x 12 mm, while the SiPMs are 3 x 3 mm and 6 x 6 mm. I count the number of photons in this way (for example the 6 x 6 mm SiPM is called SiPM_C):
if (particleType == G4OpticalPhoton::OpticalPhotonDefinition()) {
if (G4StrUtil::contains(thePrePVName, "Calorimeter") && G4StrUtil::contains(thePostPVName, "SiPM_C")) {
fEventAction->tot_phot_scint_SiPM_C ++;
}
}
I expect to collect less photons than the total produced, but still to see a correlation with the deposited energy. Instead I get this:
The number of photons detected in each event follows this distribution that doesn’t make much sense to me:
All these results seem unphysical to me but I can’t understand where is the error in my code.
Edit: There are other collegues working with me on this so they can also provide details of the code in the replies if necessary.