Message: primary and secondary protons? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question primary and secondary protons? 

Forum: Particles
Date: 20 Jun, 2006
From: Dan Fry <Dan Fry>

Sorry for a double post but perhaps this is a better place for my question?

I don't know if this is a problem but I suspect I may not be calling something in the right way. I see a strange dip in the mean proton energy as a function of depth in water when I turn the hadronics on. In other words it starts out at the entrance of the water phantom with close to the initial energy (200MeV) but does not decay monotonically to close to zero within the Bragg peak. Instead there is a dip to low energy near the phantom entrance (shallow depth) and increases again before decaying. I have thoroughly checked my binning method, not to mention that the mean proton energy decays monotonically if the hadronics is off. My suspicion is that I am somehow getting a mix between primary and secondary protons which would only happen when the hadronics is turned on. The lower energy secondaries which are more pronounced in number at shallow water depths would skew the energy distribution resulting in a lower mean energy.

The part of the code with UserSteppingAction is below. I am looking at whether the proton is primary or secondary by looking at fParentID. Is this correct? Also, do I need to have anything set a certain way in the TrackingAction or is it sufficient to use [const G4Track* currentTrack = aStep->GetTrack();]

Thanks for any help,


----Code snippet below----

if(particle_name == "proton")
 // Look to see if the proton is a secondary or primary.
 // Primary has a track ID, fTrackID = 1, fParentID = 0.

        G4int fParentID = currentTrack->GetParentID();
        if(fParentID == 1)  // This is secondary proton
             ptrVoxelData[pindex].spCount += 1;
	     ptrVoxelData[pindex].spEnergy += Ekin_PreStep/MeV;
	     ptrVoxelData[pindex].spDose += EdepStep/MeV;
             if(pindex != ptr_EvtAction->last_Voxel)
		ptrVoxelData[pindex].pfluxCount += 1;
		ptr_EvtAction->last_Voxel = pindex;
	 else if(fParentID == 0)  // This is primary proton
	     ptrVoxelData[pindex].pCount += 1;
	     ptrVoxelData[pindex].pEnergy += Ekin_PreStep/MeV;
	     ptrVoxelData[pindex].pDose += EdepStep/MeV;

	     //Output range here, based upon an energy threshold of 100keV

	     if(((Ekin_PostStep/keV) <= 10.) && (ptr_EvtAction->flag != false))
		int xint = (int)((position_post.x()/mm)/0.1);
		int yint = (int)((position_post.y()/mm)/0.1);
		int zint = (int)((position_post.z()/mm)/0.1);

		prangex[xint] += 1;
		prangey[yint] += 1;
	        prangez[zint] += 1;
		ptr_EvtAction->flag = false;

		if(pindex != ptr_EvtAction->last_Voxel)
		   ptrVoxelData[pindex].spfluxCount += 1;
		   ptr_EvtAction->last_Voxel = pindex;

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: primary and secondary protons?   (Vladimir IVANTCHENKO - 29 Jun, 2006)
(_ None: Re: primary and secondary protons?   (Dan Fry - 29 Jun, 2006)
 Add Message Add Message
to: "primary and secondary protons?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]