44{
45
46 G4String processName = aStep->GetPostStepPoint()->
47 GetProcessDefinedStep()->GetProcessName();
48
49 if(processName != "DecayWithSpin" ){
50
51 G4Track* aTrack= aStep->GetTrack();
52
53 G4String particleName = aStep->GetTrack()->
54 GetDefinition()->GetParticleName();
55
56 G4ThreeVector polDir = aTrack->GetPolarization();
57 G4ThreeVector momDir = aTrack->GetMomentumDirection();
58
59 if (particleName == "mu+") {
60 if (momDir * polDir < (1.-1.E-7)) {
61
62 G4double cos_theta = momDir * polDir;
63 G4double gTime = aTrack->GetGlobalTime();
64
65 G4cout << " *** ERROR - WARNING *** " << G4endl;
66 G4cout << "processName: " << processName << G4endl;
67 G4cout << "particleName " << particleName << G4endl;
68 G4cout << "Global Time: " << gTime/ns << "nsec" << G4endl;
69 G4cout << "Angle between spin and momentum:" << cos_theta << G4endl;
70 G4Exception("SteppingAction::UserSteppingAction","Error",
71 FatalException,
72 "Angle between spin and momentum too large");
73 }
74 }
75 }
76}