Message: Annihilation of primary particle Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Annihilation of primary particle 

Forum: Event and Track Management
Date: 01 Aug, 2013
From: Clara <Clara>

Hi all,

I am trying to determine the annihilation depth of my primary particle (antiproton) within the world, not just in my sensitive detector. I can see this information clearly for one event by using /tracking/verbose 2, however I'm not sure how to access and plot the same information for 1000s of events. I have tried accessing the track within SteppingAction.cc via:

void SteppingAction::UserSteppingAction(const G4Step* aStep) {

	G4StepPoint* point1 = aStep->GetPreStepPoint();
	G4StepPoint* point2 = aStep->GetPostStepPoint();

	G4ThreeVector pos1 = point1->GetPosition();
	G4ThreeVector pos2 = point2->GetPosition();

	G4Track* theTrack = aStep->GetTrack();
	G4ParticleDefinition* particleType = theTrack->GetDefinition();
	G4String particleName = particleType->GetParticleName();

	G4VPhysicalVolume* volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();	
	G4String name = volume->GetName();

	if (particleName = "anti_proton"){
		G4cout << particleName << ", " << name <<  ", Position: " << pos2 << G4endl;	
	}
	else {
		G4cout << particleName << ", " << name <<  ", Position: " << pos2 << G4endl;
	}	
}

but all of my output says "anti_proton". Should I be doing this somewhere else, or is this the right way, but I'm asking for the wrong values?

Thank you in advance! Clara

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

1 Feedback: Re: Annihilation of primary particle   (Gumplinger Peter - 01 Aug, 2013)
1 Ok: Re: Annihilation of primary particle   (Clara - 01 Aug, 2013)
2 Warning: Re: Annihilation of primary particle   (Michael H. Kelsey - 05 Aug, 2013)
1 Feedback: Re: Annihilation of primary particle   (Clara - 05 Aug, 2013)
 Add Message Add Message
to: "Annihilation of primary particle"

 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 ]