Ive got an Xray simulation up and running which looks quite good for my expectations but i still got some weird hits recorded:
this for example is a silver target at 40keV
im wondering why there is no cutoff at 40keV (scale is in MeV) and im suspecting its because im running in multithread where several events are recorded at the same time and the variable which is getting used to count up the energy deposition in my detector gets used by more than one thread at once
at the start i thought it could be because of scattering effects inside my detector, where scattered electrons deposit energy as well, adding up to my total energy (which of course wouldnt be desired) but after disabling these processes the pileup at higher energies still occurred
have any of you enocuntered a similar problem or know how to solve it ?
this is my user stepping action:
void MySteppingAction::UserSteppingAction(const G4Step *step)
{
G4double edep = 0.;
G4LogicalVolume *volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume();
const construction detectorConstruction = static_cast<const construction>(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
G4LogicalVolume *fScoringVolume =detectorConstruction->GetScoringVolume();
if (volume!= fScoringVolume)
return;
edep = step → GetTotalEnergyDeposit();
fEventAction->AddfEdep(edep); //defined as fEdep += edep in my event header
}
and my event action:
MyEventAction::MyEventAction(RunAction*)
{
}
MyEventAction::~MyEventAction()
{}
void MyEventAction::BeginOfEventAction(const G4Event*)
{
fEdep = 0;
++Eventcounter;
}
void MyEventAction::EndOfEventAction(const G4Event*)
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
if (fEdep>0 && Eventcounter==1)
{
man->FillNtupleDColumn(1,0,fEdep);
man->AddNtupleRow(1);
}
Eventcounter=0;
}