How can i reduce pileup errors?

Ive got an Xray simulation up and running which looks quite good for my expectations but i still got some weird hits recorded:
Bild_2023-09-21_155407736

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;
}

Have you confirmed it is pile up due to MT? You can turn off MT and see if it dissapears

i turned it off and it seems to still be occuring, but its less prevalent. im currently using only one detector, so maybe if i split it into several tinier ones and read out each detector independently it will fix the problem

update: that didnt work as well, the more stuff i try the less i have an idea what could actually cause it

If your initial particle is 40keV, I agree you should not expect x-rays above 40keV. You must be double counting. I would try to look at events where the total energy is >40keV and see if you can determine which values added up to 40keV. Track all of the depositions

ive found the problem: for some reason with the command
/process/em/setSecBiasing eBrem //region// 10 50 keV makes it weird… i thought with this syntax the cutoff is 50keV and anything above wont be biased but it seems that the opposite is the case…

edit: i just used /process/em/setBiasingFactor eBrem X true and it works fine now, apparently the other command generates multiple photons which are detected simultaneously

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.