Message: Getting Position of Particle Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Getting Position of Particle 

Keywords: Particle Position in Sensitive Volume
Forum: Event and Track Management
Date: 28 May, 2004
From: Andrew Wroe <>

I need to obtain the position of a particle within my sensitive volume in cartesian coordinates.In order to achieve this within detectorhit.hh I have a method called SetPos which is expecting a pointer to a G4ThreeVector object, i.e. the lines are:

void SetPos (G4ThreeVector xyz) { pos = xyz; };

G4ThreeVector GetPos() { return pos; };

The within detectorSD I have the lines:

G4ThreeVector* Pos = aStep->GetPostStepPoint()->GetPosition();


The within eventaction I have the lines:

Pos = (*detectorCollection)[x]->GetPos();

PosX = Pos->Getx(); 148

G4cout << PosX << G4endl;

I thought this would work, however I still get an error when I run this as the program states for line 148,

“Hep3Vector does not have an overlord member ‘ operator ->”

“left of Getx must point to class struct or union"

Pos is a G4ThreeVector which I think is correct and hence I am using the getx command to get the x coord from the threevector.


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

1 None: Re: Getting Position of Particle   (Makoto Asai - 29 May, 2004)
1 None: Re: Getting Position of Particle   (Andrew Wroe - 29 May, 2004)
(_ None: Re: Getting Position of Particle   (Makoto Asai - 29 May, 2004)
3 Idea: Re: Getting Position of Particle   ( - 16 Jun, 2004)
 Add Message Add Message
to: "Getting Position of 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 ]