# How to get proton distribution by Geant4 Data

I want to get Proton Distribution in PMMA
So I use 100MeV Proton And My target is PMMA(10cm10cm10cm)
My Geant4 Data is stored by Root like this,

I have 40 branch

• EventID 模拟事件标号
• ParentID 当前粒子的父粒子编号（0表示粒子源发射的粒子）
• TrackID 在一个事件中的粒子编号（从 1 开始）
• CurrentStepNumber 当前step 在track中的编号（从1开始）
• PName 粒子名称
• TrackWeight 权重
• CreatorProcess 相互作用的名字
• EDep 当前step的能损
• TrackLength
• StepLength
• TrackStatus 状态
• Mass 粒子的质量
• Charge 粒子的电荷态
• MagneticMoment
• VolNamePre 所在逻辑体的名称
• VolNamePost
• GlobalTimePre 全局时间，事件开始为时间起点
• GlobalTimePost
• LocalTimePre
• LocalTimePost
• ProperTimePre
• ProperTimePost
• StepStatusPre
• StepStatusPost
• EkPre 动能
• EkPost
• xPre 位置x
• yPre 位置y
• zPre 位置z
• xPost
• yPost
• zPost
• xMomentumDirectionPre 动量方向x分量
• yMomentumDirectionPre
• zMomentumDirectionPre
• Velocitypre 速度
• xMomentumDirectionPost
• yMomentumDirectionPost
• zMomentumDirectionPost
• Velocitypost

I don’t know how to handle this . Thanks

PS: yesterday , I want to know the Proton Flow intensity. So I write a algorithm to get it. First, I create a hist TH3D nd = new TH3D(“nd”, “Neutron Distribution”, 200, -1000, 1000, 200, -1000, 1000, 550, -1000, 4500);
the volume is 1cm
1cm*1cm

When I get the (x,y,z) of particle (pre and post) So I build a vector to check whether the particle is in this volume. detail algorithm is here.(I check this algorithm the result is ok when I use fluka to do the same thing)(if you can help me find some bugs thank you very much)
main.cc (11.5 KB)

I want to know whether is a easier way to get the same things.

And geat4 may only give the PreStepPoint，PostStepPoint
How do we build the energy distribution or some other distribution.

Thank you

Also Great!

Thanks

What exactly are you looking for? You are saving way too much information, you should narrow it down and only save what you want.

Do you want the flux of protons through your PMMA? You can write conditions into your stepping action and only save information that you want:

You can use your PreStepPoint and PostStepPoint to get the energy of your particle, the momentum, which volume, energy deposited, etc

I want the the flux of protons through your PMMA. In Stepping action I use PreStepPoint and PostStepPoint to get these information. But if one step PrePosition is (0mm,0mm,0mm) to PostPosition(10mm,0mm,0mm) When I draw a 3D-Hist , the length of Volume is 1mm1mm1mm ， I need to let the count +1 at (0,0,0)(1,0,0),(2,0,0),(3,0,0)to (10,0,0)
If another way to get the same result. Thanks

The Proton Distribution is similar. Suppose I want to know the Proton Energy Distribution in 101010mm PMMA (Use 10MeV proton ) (the length of Volume is 1mm1mm1mm) So I create a TH3D(“pd”,“proton distribution”,10,0,10,10,0,10,10,0,10) . If I get the energy deposited in one step , how to do it to get the proton distribution.

thanks

What do you want to see? So far, it is not clear.

The generic distribution of particles is a function of 6 parameters (3 spatial and 3 momentum). I feel you wanted something else. Could you start not from what does not work but from where you want to be?

1 Like

My mistake. I want to get the energy dose in the detector like example B1
My detector is 101010 However I need 111 region dose
other people say I can construct a 1000 detectors to compition the whole detector

Is any other way to achive this goal ?
this is I want to know.

When I only use 101010 detector to simulate。 The steppingAction give me the PrePosition and the PostPosition may be have more than 1mm So I can’t use the position information to calculate the dose.

Thanks

If I understand correctly you want to map energy deposition in a 10x10x10 cm detector. However, often times when energy is deposited along a track in a single volume it is done in a single step, and it tells you the total energy deposited along the track. But you want to know the where the energy was deposited along the track in 1 mm segments.

I believe there may be a way to look at along track actions, but you may have a better time using parameterized volumes and checking the edep in each one.

1 Like

I would go for 1000 volumes. It is not much, as you need only one parameter per run. You can set up the volumes in GDML with a small loop if you want.

Thank you
I think this way is a better way to achive my goal.

Thank you
and “However, often times when energy is deposited along a track in a single volume it is done in a single step, and it tells you the total energy deposited along the track.” give a nice answer

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