alcap-org / g4sim

Simulation toolkit based on Geant4 and ROOT
http://wuchen1106.github.io/g4sim/
2 stars 2 forks source link

Odd gap in response matrix #52

Closed AndrewEdmonds11 closed 9 years ago

AndrewEdmonds11 commented 9 years ago

So I'm running a MC run where I generate protons based on the muon stopping distribution and when I create the response matrix I get this odd gap between the diagonal and the rest of the plot (this wasn't there a week or so ago):

sir_resonsematrix_oddgap

I think is somewhat related to issue #51 so I've tried the following things:

None have worked...

I don't think it's a problem with my script that creates the response matrix so I'm just wondering if anyone else has seen this or have any ideas about the cause might be?

benkrikler commented 9 years ago

It might be somewhat physical if you have some protons starting outside of the target. Since they'd only have vacuum before they reach the detectors, their energy will be much closer to the truer, original energy, and so give the diagonal line. Those that start in the target will lose energy inside it, and this loss will be greater for lower energy protons so the split will tend to grow for lower energies. How are you positioning primary protons and are you certain they're all starting in the target?

jrquirk commented 9 years ago

Also you could make a cut on the starting local z of the target. That would include Ben's point above maybe, and also since the front face collects all low energy muons, it might also point to that.

AndrewEdmonds11 commented 9 years ago

Thanks, guys. This is somewhat the road I ended up going down. If I look at left and right response matrices, there is a much "sharper" diagonal on the left hand side which makes sense since muons stop on the front face:

Left: sil_resonsematrix_oddgap

Right: sir_resonsematrix_oddgap

In addition, while debugging I see protons that have the exact same momentum components in the thin Si as they had initially.

I'm getting the starting positions for these protons from the muon stopping positions of a previous run. Local z looks like this and we can see the peak on the front face (Hang on, is it local positions I should be using...?): stopping_localz_explainoddgap

Maybe the MC isn't transporting the proton through the target and depositing energy if it's really close the face of the target... I'll have a look in this direction.

Does no-one else see this then?

benkrikler commented 9 years ago

The histo mode I added for primary input assumes you're giving the histrogram in global coordinates. If you're loading in a histogram that contains local coordinates of muons within the target, then this will be used centred on the global origin. I think the global origin happens to be the target position (or near to it), right? But the coordinate system is definitely rotated, so many or even most of the protons will be outside of the target. Could this be it?

AndrewEdmonds11 commented 9 years ago

Yep, I just saw that in the code and I'm running now to check.

AndrewEdmonds11 commented 9 years ago

Yep, that was the problem. I also had to make my histograms a bit more finely binned but now I get these: sil_resonsematrix_oddgap_fixed sir_resonsematrix_oddgap_fixed

Problem solved :)

benkrikler commented 9 years ago

Great! And there's also no entries with E_observed > E_target. Is this with the code from #51?

AndrewEdmonds11 commented 9 years ago

Yep :)