Added debug flag.
This commit is contained in:
parent
a5e89b2070
commit
12db37213c
@ -63,6 +63,7 @@ PSimulateMuTransition::PSimulateMuTransition(UInt_t seed)
|
||||
fMuonPhase = fInitialPhase;
|
||||
fMuonDecayTime = 0.;
|
||||
fAsymmetry = 0.27;
|
||||
fDebugFlag = kFALSE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -167,7 +168,6 @@ Double_t PSimulateMuTransition::NextEventTime(const Double_t &EventRate)
|
||||
*
|
||||
* \param time duration of precession (us);
|
||||
* \param frequency muon spin precession frequency (MHz);
|
||||
* \param phase initial muon phase (degree);
|
||||
*/
|
||||
Double_t PSimulateMuTransition::PrecessionPhase(const Double_t &time, const Double_t &frequency)
|
||||
{
|
||||
@ -197,10 +197,12 @@ void PSimulateMuTransition::Event()
|
||||
// charge-exchange loop until muon decay
|
||||
eventTime = 0.;
|
||||
eventDiffTime = 0.;
|
||||
if (fDebugFlag) cout << "Decay time = " << fMuonDecayTime << endl;
|
||||
while (1) {
|
||||
// assume Mu+ as initial state; get next electron capture time
|
||||
captureTime = NextEventTime(fCaptureRate);
|
||||
eventTime += captureTime;
|
||||
if (fDebugFlag) cout << "Capture time = " << captureTime << " Phase = " << fMuonPhase << endl;
|
||||
if (eventTime < fMuonDecayTime)
|
||||
fMuonPhase += PrecessionPhase(captureTime, muonPrecessionFreq);
|
||||
else{ //muon decays; handle precession prior to muon decay
|
||||
@ -212,6 +214,7 @@ void PSimulateMuTransition::Event()
|
||||
// now, we have Mu0; get next ionization time
|
||||
ionizationTime = NextEventTime(fIonizationRate);
|
||||
eventTime += ionizationTime;
|
||||
if (fDebugFlag) cout << "Ioniza. time = " << ionizationTime << " Phase = " << fMuonPhase << endl;
|
||||
if (eventTime < fMuonDecayTime)
|
||||
fMuonPhase += PrecessionPhase(ionizationTime, fMuCoupling);
|
||||
else{ //muon decays; handle precession prior to muon decay
|
||||
@ -220,6 +223,8 @@ void PSimulateMuTransition::Event()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fDebugFlag) cout << " Final Phase = " << fMuonPhase << endl;
|
||||
//fMuonPhase = TMath::ACos(TMath::Cos(fMuonPhase))*360./TMath::TwoPi(); //transform back to [0, 180] degree interval
|
||||
return;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ class PSimulateMuTransition : public TObject
|
||||
|
||||
virtual void PrintSettings() const;
|
||||
virtual void SetNmuons(Int_t value) { fNmuons = value; } //!< number of muons
|
||||
virtual void SetDebugFlag(Bool_t value) { fDebugFlag = value; } //!< debug flag
|
||||
virtual void SetBfield(Double_t value) { fBfield = value; } //!< sets magnetic field (T)
|
||||
virtual void SetMuCoupling(Double_t value) { fMuCoupling = value; } //!< sets Mu hyperfine coupling (MHz)
|
||||
virtual void SetCaptureRate(Double_t value){ fCaptureRate = value; } //!< sets Mu+ electron capture rate (MHz)
|
||||
@ -75,6 +76,7 @@ class PSimulateMuTransition : public TObject
|
||||
Double_t fMuonPhase; //!< phase of muon spin
|
||||
Double_t fAsymmetry; //!< muon decay asymmetry
|
||||
Int_t fNmuons; //!< number of muons to simulate
|
||||
Bool_t fDebugFlag; //!< debug flag
|
||||
|
||||
virtual Double_t NextEventTime(const Double_t &EventRate);
|
||||
virtual Double_t PrecessionPhase(const Double_t &time, const Double_t &frequency);
|
||||
|
@ -43,7 +43,7 @@ void runMuSimulation()
|
||||
decayAnaModule = histosFolder->AddFolder("DecayAnaModule", "muSR decay histograms");
|
||||
|
||||
// feed run info header
|
||||
UInt_t runNo = 9010;
|
||||
UInt_t runNo = 9015;
|
||||
TString tstr;
|
||||
runInfo = gROOT->GetRootFolder()->AddFolder("RunInfo", "LEM RunInfo");
|
||||
gROOT->GetListOfBrowsables()->Add(runInfo, "RunInfo");
|
||||
@ -86,12 +86,13 @@ void runMuSimulation()
|
||||
}
|
||||
|
||||
//prepare to run simulation
|
||||
simulateMuTransition->SetMuCoupling(100.); // MHz
|
||||
simulateMuTransition->SetBfield(0.01); // Tesla
|
||||
simulateMuTransition->SetMuCoupling(35.); // MHz
|
||||
simulateMuTransition->SetBfield(0.1); // Tesla
|
||||
simulateMuTransition->SetCaptureRate(1.0); // MHz
|
||||
simulateMuTransition->SetIonizationRate(500.0); // MHz
|
||||
simulateMuTransition->SetIonizationRate(250.0); // MHz
|
||||
simulateMuTransition->SetNmuons(1e6);
|
||||
simulateMuTransition->SetDecayAsymmetry(0.27);
|
||||
simulateMuTransition->SetDebugFlag(kFALSE); // to print time and phase during charge-changing cycle
|
||||
|
||||
simulateMuTransition->PrintSettings();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user