Placing a detector with 6 degrees of freedom

I am currently working with one detector. Below is a part of my SteppingAction, but I am not sure if what am doing is correct:

if (postStepPoint->GetPhysicalVolume()->GetName() == “Cryst”)
{
G4double Edep = step->GetTotalEnergyDeposit() / keV;
if(Edep > 0.) fEdepCryst += Edep;

 G4double K_energy = track->GetKineticEnergy();
 kinetic_energy = K_energy;

 G4ThreeVector Position = track->GetPosition();

 G4double xpos = Position.getX();
 XPos = xpos;

 G4double ypos = Position.getY();
 YPos = ypos;

 G4double zpos = Position.getZ();
 ZPos = zpos;

 G4ThreeVector momentum = track->GetMomentumDirection();
 G4double theta = momentum.getTheta();
 Theta = theta;
 G4double phi = momentum.getPhi();
 Phi = phi;

}

Thank you
Aliyu

The copyNumber of a physical volume is a value set by the user to identify the volume, please see:

G4VPhysicalVolume()::GetCopyNo()

Knowing the copy number of the current volume you can figure out any information that was used for its construction, for example:

G4int  k = postStepPoint->GetPhysicalVolume()->GetCopyNo();
G4double t = theta[k-1];
G4double p = phi[k-1];
1 Like

Thank you very much for your valuable suggestions.

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