Can't generate X-ray in x-ray tube simualation

Hi @repan,

I am not sure I get the point. Are you showing the spectrum of what? Energy deposited inside the detector? If the detector contains Gd, you should also expect lines from the detector, or am I wrong?

If you care only about emission in Tungsten, you should change your way of scoring accordingly, e.g. you forget about your detector and you build the distribution of the energy of the gamma-rays leaving your Tungsten volume…

Ciao,
Luciano

Hi @pandola,
I get the energy deposite of the logicalVolume of detector through G4double edepStep=step->GetPreStepPoint()->GetTotalEnergy();. So I think what’s shown is the energy deposit inside the detector.
If I want to obtain the energy of gamma-rays just leaving tungsten target. How can I do it? Can I get it through G4double enegy_gamma=step->GetPostStepPoint()->GetTotalEnergy(); in the logicalVolume of the tungsten?

That’s not right. G4StepPoint::GetTotalEnergy() is (as specified in GetStepPoint.hh) the total energy of the track, not the amount of deposited energy. For the energy deposit, you should be using step->GetTotalEnergyDeposit(). If you are dealing with nuclear recoils, then you may also want step->GetNonIonizingEnergyDeposit().

1 Like

Hi @mkelsey, Is the total energy of the track just the energy of the particle in that track?

Yes. The particle is the track, in Geant4 language :slight_smile: This comes from a high-energy physics perspective: the “particle” is the hypothetical entity that is travelling through our detector; the “track” is the thing we reconstruct from the measurements in our detector.

Hi @mkelsey ,
I got it now. G4double edepStep=step->GetPreStepPoint()->GetTotalEnergy();this line code return the energy of the track. It seems that this is energy of x-ray after interacting with the detector material, because my obtained x-ray spectrum contains the characteristic peaks of detector material. How can I recond the energy of photons just after its generation in the tungstern target?

What was said above. If you want to collect the energy in the target, then you should have an SD (or scorer, or whatever) attached to the target. If you want to estimate what a real detector is going to tell you, that’s what you’re doing.

Hi,
I had a brief look at this eRosita example and as I want to perform studies on x-rays as well, I wonder about the entire different approach there. To be precise, so far, I’m using just:

RegisterPhysics(new G4EmStandardPhysics_option4());
RegisterPhysics(new G4EmLowEPPhysics());

to deal with physics whereas in the given example it looks like they care about every detail by defining it specificially.

Am I’m on a (total) wrong path or is it valid (but the same?)?

Dear Benjamin,

you can either use the pre-built Geant4 EM constructors or define the processes and models one by one as done in eRosita.

As you are doing, it seems to me you are activating the physics list twice. G4EmLowEPPhysics models the processes of polarised photons. Is that what you want? if not, please delete RegisterPhysics(new G4EmLowEPPhysics());

Cheers
Susanna

1 Like

Hi @BenjaminW,
You can use #include "G4EmLivermorePhysics.hh" or
#include "G4EmPenelopePhysics.hh" . Both of them can generate x-ray, but I noticed one literature claimed that the Penelope is more consistent with experiment.

1 Like

Hi @mkelsey and @guatelli,
I print the energy in PreStepPoint and PostStepPoint, and compare with the total energy deposite. The energy difference of PreStepPoint and PostStepPoint is not equal with the deposite energy. Why they are not equal? Even if the enery in PostStepPoint is zero, sometimes the depsotie energy is still small. Where is the energy of the incident particle going?

Are you getting secondary particles produced in the interactions? The energy that is transferred to secondaries is not included in “energy deposit.” Those secondaries themselves go off and have their own energy deposits, and you don’t want to double count.

Hi @mkelsey,
thanks. I got it now. there are secondary particles. I think I didn’t get the deposite energy of the secondary paritcles. I just apply codes and compare their output. G4double deposite=step->GetTotalEnergyDeposit(); G4double edepStep=step->GetPreStepPoint()>GetTotalEnergy(); G4double energy_PostStep=step->GetPostStepPoint()->GetTotalEnergy(); Now I am trying to get the energy spectrum of x-ray generated in x-ray tube simulation.

Hi repan,I am working a similar topic, would you share your code once more. It is not on github anymore.

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