Implementation of initial beam direction command. For now works only for +-z direction.
This commit is contained in:
@@ -271,8 +271,8 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
G4double px, py, pz;
|
||||
px = p*sin(xangle);
|
||||
py = p*sin(yangle);
|
||||
pz = std::sqrt(p*p - px*px - py*py);
|
||||
|
||||
// works for beam along +-z only for now
|
||||
pz = zDirection * std::sqrt(p*p - px*px - py*py);
|
||||
|
||||
// Assign spin
|
||||
G4double xpolaris=0, ypolaris=0, zpolaris=0;
|
||||
@@ -381,6 +381,16 @@ void musrPrimaryGeneratorAction::SetInitialMuonPolariz(G4ThreeVector vIniPol)
|
||||
}
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
void musrPrimaryGeneratorAction::SetBeamDirection(G4ThreeVector vIniDir)
|
||||
{
|
||||
G4double magnitude=vIniDir.mag();
|
||||
xDirection=vIniDir(0)/magnitude;
|
||||
yDirection=vIniDir(1)/magnitude;
|
||||
zDirection=vIniDir(2)/magnitude;
|
||||
G4cout<< "Initial Beam Direction set to ("<<xDirection<<","<<yDirection<<","<<zDirection<<")"<<G4endl;
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
void musrPrimaryGeneratorAction::SetMuonDecayTimeLimits(G4ThreeVector decayTimeLimits) {
|
||||
muonDecayTimeMin = decayTimeLimits[0];
|
||||
|
||||
Reference in New Issue
Block a user