# How to align simulation with experiment?

So far I finally set everything up for my simulation (at least I’m not aware of something I missed atm…) and I wonder how to verify the simulation.

The experiment is quite simple: I’m using a x-ray generator which irradiates 50x a specific dosimeter people are carrying for observation purposes. These devices provide a single so-called `H_T(10)` value in the end. I’m not sure about whether this is really the correct term here (actually I’ll get a Hp(10) value) but it is at least very similar to it.

Now I want to simulate this but I wonder especially about which values I have to take into account or to use to compare. E.g. I’m recording the the number of photons entering the detectors and since I know the energy each one deposits ( `G4double partEdep = aStep->GetTotalEnergyDeposit();` ?) I can sum these values up and then I’d have the deposited total energy. But this is, obviously, very prone to the number of photons I’m producing in the first place.

Any idea? I appreciate highly any input!

when you reference to photons per second, the number of simulated events/number of photons implies a certain (virtual) time interval that this number corresponds to.
this can be aligned to whatever rate you have in real life.

Thank you, but unfortunately I do not know this rate.

Would the other way around make sense: That I generate so many photons that the deposited energies match? Feels like this would only be a valid special case…?

yes, that is possible. maybe take a pencil and paper and do the math that you need.

and you don’t need to actually match the quantity 1:1, you can also calculate the scaling number for the first one, and scale the second accordingly. e.g. go for 1% if desired dose, or 0.1s instead of 1s, or…

… or throw N photons and see that your dose is 1/M of what you need, then you know it would be N x M photons that produce the full dose

1 Like

Thanks for the input, I will consider this!
I would like to use the thread to go into details according to my specific application:

The geometry consists only of two x-ray particle sources, three layers of specific material and three dosimeters/detectors on it. The layers are only a few mm thick in total and the detectors are also only 0.5 mm thick. Around the particle sources is a thin layer of aluminum (The yellow large box does not matter, it has no material assigned to it):

Now I simply wanna’ know how much energy is deposited within these dosimeters:

As I see these very discrete values I wonder whether these are physically correct? That the deposited mean energy is very similar makes at least sense to me, the amount itself I don’t know and I don’t know how to estimate it (from theory or reality…) but from my,… let’s say in this context naive knowledge I’d expect a continuous spectrum of deposited energy, or?

Are you recording the deposited energy, and summing it across all the steps within your detector? How thick is your detector?

in the other thread it was the total energy of the incident particle in one code block:

Thanks, I realized that this is not the summed deposited energy but the mean deposited energy per particle.
The detector is only 0.5 mm thick and out of BeO.

Yep, as far as I understand it correctly, the above plot shows the average deposited energy per particle, right?
When I sum up the energies from the `TTrees` it is much more (strongly dependent on how many photons I generate, as expected).

But the deposited energy per particle should be continuous, though, or?

, then no. it then shows the total energy of the incident particles, and with the first step into the SD, the track is killed. The plot shows the spectrum of your source (which also explains why the subplots are all so similar: it is just a histogram of your source energy distribution).

Sorry for the confusion. For the above plot I’m using `G4double partEdep = aStep->GetTotalEnergyDeposit();`. And when I sum up all these `partEdep`s, I’ll have the sum of deposited energy, right?

The spectrum of my source is continuous, btw.

I checked how the deposited energy depends on the thickness of the detector and for this I changed 0.5 mm to 4 mm which results in this:

The mean values are quite identical as when I use a detector with a thickness of 0.5 mm.
The total energy of the particles `GetTotalEnergy()` (respectively if I understand correctly, the remaining energy?) looks as:

which looks quite similar to the source spectrum. Is this reasonable?
Is there something I could or should have a closer look at? The detector material is `BeO`, btw.

I also noticed that the sum of the deposited energy increases with the detector thickness quite linear, which makes sense for me.