diff --git a/src/musrPrimaryGeneratorAction.cc b/src/musrPrimaryGeneratorAction.cc index 6d79c57..a144e6a 100644 --- a/src/musrPrimaryGeneratorAction.cc +++ b/src/musrPrimaryGeneratorAction.cc @@ -274,6 +274,14 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) // works for beam along +-z only for now pz = zDirection * std::sqrt(p*p - px*px - py*py); + // Proper rotation of beam direction as follows: + // hat{n} is beam direction unit vecrot and vec{p} is momentum vector + // new momentum vector is vec{p'}=R vec{p} + // where R is a rotation matrix around (hat{z} x hat{n}) - cross product + // with an angle of acos(hat{z} dot hat{n}) - dot product + // i.e. R is a rotation around (-n_y, n_x, 0) with angle acos(n_z). + // G4RotationMatrix* R = new G4RotationMatrix(G4ThreeVector(-nx,ny,0),acos(nz)*deg); + // Assign spin G4double xpolaris=0, ypolaris=0, zpolaris=0; if (UnpolarisedMuonBeam) {