Calculation the first 3mm energy deposit

System : Linux
REST version : v2.2.8
Hi everyone.
I have draw the 3 mm energy deposit after the initial energy deposit point . but there exist some question for me.

I have simlute a e- with energy equal 500kev.

I know in our TRestG4Event each Event have many tracks . but there only one main track which track ID = 1,in this track there many hit point with (x, y , z, Edep ) , I sum the energy deposit point in track id =1 which total energy equal 238.938. which means the rest energy( 500 – 238.938 =261.062) in the rest track(for example track ID = 2,3,4 ……)

At the begin I calculate the first 3mm energy deposit like this :

  1. Find the initial energy deposit point
  2. for the all tracks (for example track ID =1, 2,3,4……… ) calculate the distance between hits and initial energy deposit point
  3. if the distance less than 3mm add the energy deposit to the sum.
  4. output the first 3mm energy deposit

after I calucate the main track’s total energy. maybe I was wrong.

so I decide to re-calucate like this:

  1. Find the initial energy deposit point
  2. for the first track ( track ID =1 ) , calculate the distance between hits and initial energy deposit point
  3. if the distance less than 3mm add the energy deposit to the sum.

output the first 3mm energy deposit

I thought this way may be right . is it ture ? or both method are wrong ?
there also another question is that what is the sequence of hits point in main track ? that mean which hit point appear before another hit point ?
the third question is in our secondary track(track id =2,3…suppose the parent id =1) there must exist a origin point, is the secondary track’s origin point equal to one of the energy deposit point which in main track(track id = 1 ) ?

Best wishes to you!

yours lujian!

I believe the first method is the one it is right, because finally those tracks/hits are not distinguible in the real detector. But of course, it means really what you want to understand from the MC. But if you want to be closer to reality, then I think first method is what you want.

The hits in side a track from TRestG4Event are presented in order of interaction, i.e. the first hit corresponds to the start of the track, and the last hit to the end of the track.

No. Each secondary track has its own origin point. Take note that the origin point is not the same as the first interaction point. You can access the origin of the track, and the position of the first hit of the track. Actually, I think in your case you are interested on the position of the first hit of the main track, and not the origin of the track, although for an electron is very similar.

You can access the TVector3 storing the origin of the first track of the first event as follows

TRestRun *run = new TRestRun();
run->OpenInputFile("yourFile.root");
TRestG4Event *ev = new TRestG4Event();
run->SetInputEvent(ev);
run->GetEntry(0); // I just get the first entry
ev->GetTrack(0)->GetTrackOrigin().Print(); // I just get the first track, also possible to use method GetTrackByID( ID )
1 Like

hi Jgalan
Thanks for your help!
by the way ,Can I ask another question?
I have write a script to print the id (for all event )like this
TRestRun *run = new TRestRun();
OpenInputFile("yourFile.root");
int total_Event = run->GetEntries();
TRestG4Event *ev = new TRestG4Event();
for(int i=0; i<total_Event;i++) {
run->GetEntry ( i );
cout<<"ID is "<< ev->GetID() << endl;
}
but the output like this:
ID is 0
ID is 0
ID is 0
ID is 0
ID is 0
ID is 0
ID is 0
ID is 0
the result is all 0. so I get confused.because I want use the Event id in my process. how to solve this problem? can you help me?

I cannot reproduce this problem.

Could you checkout the latest development branch, recompile REST and restG4, regenerate your ROOT file, and check again?

If you are in a clean branch, this should do the trick

git fetch
git checkout v2.2.10_dev

use git status to make sure you are in v2.2.10_dev.

thanks for your kind help.I will do that:)