Good day @All,
i modified the TestEm5 Example and integrated the GPS. I let electrons with a certain angle and energy hit an absorber. To make sure everything is as intendend i also record the energy and angle (theta) of the primary electrons. Strangely i found that the /maxtheta and /mintheta did’nt work as intended. In principle the distribution is there but <1% of all events are outside of the angular window i specified with matheta/mintheta.
In this example i used:
/gps/ang/mintheta 23.0739 deg
/gps/ang/maxtheta 28.3576 deg
And i recorded the primary events in TrackingAction.cc:
void TrackingAction::PreUserTrackingAction(const G4Track* aTrack )
{
// few initialisations
//
if (aTrack->GetTrackID() == 1) {
fXstartAbs = fDetector->GetxstartAbs();
fXendAbs = fDetector->GetxendAbs();
fPrimaryCharge = aTrack->GetDefinition()->GetPDGCharge();
fDirX = aTrack->GetMomentumDirection().x();
fEnergy = aTrack->GetKineticEnergy();
G4ThreeVector direction = aTrack->GetMomentumDirection();
fTheta =(direction.x()/std::sqrt((direction.x()*direction.x())+(direction.y()*direction.y())+(direction.z()*direction.z())));
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH2(0,fTheta,fEnergy*1000000); //energy over cos(theta) matrix
analysisManager->FillH1(70,std::acos(fDirX)); //record angular distribution
}
}
As you can see in the matrix enclosed and in the zoomed in histogramm, there are events outside of the specified angle range. Is the way i record the events somehow wrong or does the GPS actually produce an output like this? Strangely, all the events are within the specified energy range. So this seems to be okay.
Thanks for any hints where to find the problem here!
I put a circle around the outliers, since i am not sure they are visible otherwise.