Hi.
I am really new at Geant4, so I apologize in advance that my knowledge is very limited, but I am trying very hard to understand how to use Geant4.
I have a simple geometry consisting of a thin silicon plate (my sensitive detector) in which I fire a collimated beam of 511 keV photons at it. I would like to select just the Compton scattered photons that have scattered once inside the sensitive detector.
I attempted to place a condition in my SensitiveDetector.cc (called SensitiveDetectorCPET03.cc) which would do this, but without success. I was hoping to use the aStep class to tell me if the primary photon was Compton scattered.
Here is the section of my code which I am attempting to apply this condition
G4bool SensitiveDetectorCPET03::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double TrackID = aStep->GetTrack()->GetTrackID();
G4String ParticleName = aStep->GetTrack()->GetParticleDefinition()->GetParticleName();
G4double KineticEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();
G4ThreeVector pos = aStep->GetPostStepPoint()->GetPosition();
if (KineticEnergy == 0.511) return false;
HitCPET03* newHit = new HitCPET03();
if( KineticEnergy < 0.511 && TrackID == 2)
// if( KineticEnergy < 0.511)
{
fHitsCollection->insert( newHit );
// get analysis manager
auto analysisManager = G4AnalysisManager::Instance();
G4double En = KineticEnergy/keV;
G4double theta = acos( 2- 511/En );
// fill ntuple
analysisManager->FillNtupleDColumn(0, KineticEnergy/keV);
analysisManager->FillNtupleDColumn(1, theta/deg);
analysisManager->FillNtupleDColumn(2, TrackID);
analysisManager->AddNtupleRow(0);
}
return true;
}
The graph I get when I plot counts verses scatering angle does not match the Klein-Nishina formula.
I thought I found a away to include a condition to select just compton scattering events in a set of slides I found here --> https://conferences.fnal.gov/g4tutorial/g4cd/Slides/IEEE/readout.pdf
In slide 12 it shows a line of code which reads
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
I thought that perhaps I could use this G4SetPoint to determine if the photon that collided with the detector was due to Compton scattering by writing something like this
G4StepPoint* process = aStep->GetPreStepPoint()->GetProcessDefinedStep();
then write something like
if (process == “compt”)
However, if I include
“G4StepPoint* process = aStep->GetPreStepPoint()->GetProcessDefinedStep();”
into my SensitiveDetectorCPET03.cc script my Visual Studio (running in Ubuntu virtual box) doesn’t like it and screams at me with the message
“a value of type “const G4VProcess *” cannot be used to initialize an entity of type “G4StepPoint *””
I do not know what this means.
I don’t know whether this may be of interest but at the top of my SensitiveDetectorCPET03.cc file I have the following header files included.
#include “AnalysisCPET03.hh”
#include “SensitiveDetectorCPET03.hh”
#include “Randomize.hh”
#include “G4SDManager.hh”
#include “G4RandomDirection.hh”
#include “G4SystemOfUnits.hh”
I would feel very grateful if someone out there could point me in the right direction in terms of finding a way to record just Compton scattering hits.
Thank you for your consideration.
Best regards
Peter