When a particle enters a volume, how can it be recorded without interaction,help!
Use a stepping action. There will always be a step at the entrance to the volume (where the PostStepPoint is your desired volume, and the step status is “fGeomBoundary”). There will also be a step at the exit of the volume, where the PreStepPoint is your desired volume.
Thank you, Sir, but I did it according to the method you said, and there is still no record of particles passing through the volume I need in the output file`if((aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary))
const G4String& name = aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetName(); Energy=(aStep->GetPostStepPoint()->GetKineticEnergy()); G4cout<<"==="<<EID<<G4endl; outfile1 << Pname << " " <<Energy << " " <<StepProcName<<" "<< name << " " <<" "<<NPS<<G4endl; }`
this is the volume code
`G4double qiu1C_x = -80.0*cm;
G4double qiu1C_y = 38.0*cm;
G4double qiu1C_z = -122.0*cm;
G4double qiu1R = 2.5cm;
G4Sphere qiu1 = new G4Sphere(“qiu1”,0.0cm, qiu1R, 0,360deg,0,360deg);
G4LogicalVolume logicqiu1 = new G4LogicalVolume(qiu1, Air_2, “qiu1”);
G4VPhysicalVolume* physicqiu1 = new G4PVPlacement(0, G4ThreeVector(qiu1C_x, qiu1C_y, qiu1C_z), logicqiu1, “qiu1”, logicWorld, false, 0);`