6.9.2010 - Kamil Sedlak

1) bug found and corrected in the field-map extrapolation of the electric 
     and magnetic fields for the spin-rotator (3DEOpera and 3D and 
     symmetryType=1 or 2). The documentation was updated.
  2) Some new variables added to the musrSimAna - the documentation has not
     been updated yet.
This commit is contained in:
2011-09-06 15:25:44 +00:00
parent 0e5bdb63f9
commit 7e6228aa10
6 changed files with 142 additions and 31 deletions

View File

@@ -366,9 +366,13 @@ void musrPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
// G4double decaytime = -muonMeanLife*log(1-randomVal);
//
// The following code is numerically more stable compared to the commented lines above:
G4double expMin = exp(-muonDecayTimeMin/muonMeanLife);
G4double expMax = exp(-muonDecayTimeMax/muonMeanLife);
G4double decaytime = -muonMeanLife * log(G4UniformRand()*(expMax-expMin)+expMin);
G4double decaytime;
if (muonDecayTimeMin==muonDecayTimeMax) {decaytime=muonDecayTimeMin;}
else {
G4double expMin = exp(-muonDecayTimeMin/muonMeanLife);
G4double expMax = exp(-muonDecayTimeMax/muonMeanLife);
decaytime = -muonMeanLife * log(G4UniformRand()*(expMax-expMin)+expMin);
}
// G4cout<<"decaytime="<<decaytime/ns<<"ns."<< G4endl;
generatedMuon->SetProperTime(decaytime);
}