Fixed bug

This commit is contained in:
nemu 2014-10-21 17:59:41 +02:00
parent 3440daafcc
commit c6aaabcc64

View File

@ -258,27 +258,27 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// Add the beam tilt, which depends on the distance from the beam centre. // Add the beam tilt, which depends on the distance from the beam centre.
// if (ySigma>0) {yangle += - pitch * (y-y0)/ySigma; } // if (ySigma>0) {yangle += - pitch * (y-y0)/ySigma; }
if (pitch!=0) {yangle += - pitch * (y-y0); } if (pitch!=0) {yangle += - pitch * (y-y0); }
} // end of the part specific for the muons generated by random rather then from TURTLE } // end of the part specific for the muons generated by random rather then from TURTLE
//------- Add new intial angle
G4double sinXangle, sinYangle, phi; //------- generate cos(Theta) distribution if zangleSigma < 0 and calculate final momentum
G4double px, py, pz; G4double sinXangle, sinYangle, phi;
if (zangleSigma<0) { G4double px, py, pz;
if (zangleSigma<0) {
sinXangle=sqrt(G4UniformRand()); sinXangle=sqrt(G4UniformRand());
phi=2*CLHEP::pi*G4UniformRand(); phi=2*CLHEP::pi*G4UniformRand();
// Calculate the final momentum
px = p*sinXangle*cos(phi); px = p*sinXangle*cos(phi);
py = p*sinXangle*sin(phi); py = p*sinXangle*sin(phi);
pz = std::sqrt(p*p - px*px - py*py); pz = std::sqrt(p*p - px*px - py*py);
} }
else {
if (zangleSigma> 0) {sinXangle=sin(xangle); sinYangle=sin(yangle); sinXangle=sin(xangle);
sinYangle=sin(yangle);
px = p*sinXangle; px = p*sinXangle;
py = p*sinYangle; py = p*sinYangle;
pz = std::sqrt(p*p - px*px - py*py); pz = std::sqrt(p*p - px*px - py*py);
// printf("px, py, pz = %f, %f, %f\n", px, py, pz); // printf("px, py, pz = %f, %f, %f\n", px, py, pz);
} }
// Calculate particle (muon) starting time // Calculate particle (muon) starting time
G4double ParticleTime; //P.B. 13 May 2009 G4double ParticleTime; //P.B. 13 May 2009