Histograms of dose profile and surface dose distribution

Hello everyone!

I have information about hits in the sensitive detector: position and deposited dose corresponding to each hit which are saved in a 3D weighted histogram (dose is the weight). I have two questions regarding histograms on ROOT.

  1. I want to plot a 2D dose distribution at several depths along Z-axis (see example below):

What I do is I select, for example, the first bin along the z-axis and I do a “yx” projection of my 3D histogram:

h1->GetZaxis()->SetRange(0,1)
TH2D* h2 = (TH2D*) h1->Project3D(“yx”)
h2->Draw(“colz”)

However, I am bothered by the fact that I do it in quite a cumbersome way. Is there a more nice and straightforward way to extract such 2D histogram (I am afraid I am doing it wrong selecting one bin along the z-axis etc…)

The other question is about dose profiles (see picture below). I need to get not a projection on the X axis (this is feasible) but rather a dose profile along two perpendicular lines. My idea is again select z- and y- bins in a small region around the x-axis and make a 1D projection, however, the results seem wrong to me… Is there a way to get such profiles through TH1 class commands?

Thank you very much in advance!

Kind regards,
Vasily


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


TH2::ProjectionX
TH2::ProjectionY
TH2::ProfileX
TH2::ProfileY

Hello Wile,

Thank you for the prompt reply, I appreciate it much. I also tried these functions, however, my issue is that my detector is quite elongated, meaning if I use just TH2 histograms I will then sum up all the bins along the z-axis. My goal is to analyze the data only within a first few bins and plot it. That is why I thought that it would be appropriate for me to use TH3 instead of TH2 in the first place, what do you think?

Also, regarding the ProfileX/ProfileY functions: as I understood, TH2::ProfileX show the average value of Y for each bin in X, however, I need to get the profile of dose (weight in my case) along central perpendicular axis as shown before. So, I assume I would also have to work with 3D histograms in the first place…

Thanks in advance!
Kind regards,
Vasily

Search for methods with names “Project*” in the TH3 Class Reference.

Hi Wile! Thanks a lot, I’ve found my way through with the 3D projection method.

I have one more question regarding the SetProjectionX method on the ROOT canvas. I have seen a tutorial where a black window of a selected bin width pops up and draws projections on a separate screen (see image below). In my case, nothing appears and I can just scroll up down with the arrow. Do you happen to know how it can be fixed?

Cheers,
Vasily

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