diff --git a/ChangeLog b/ChangeLog
index ae0ece2b..2ce607c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,11 +4,18 @@
changes since 0.15.0
===================================
-CHANGED 2015-10-28 improved the CLEANFILES for ROOT6.
+FIXED 2015-10-29 TMusrRunHeader didn't map a double vector properly into a
+ string. The last element was a copy of the 2nd last instead
+ if the proper last. This is now fixed. Fixed also some
+ comment typo.
+FIXED 2015-11-11 Fixes the crash of Fourier if the maximal range given in the
+ Fourier block is larger than the available.
+CHANGED 2015-11-15 removed unnecessary check form musredit_qt5 msr2data interface.
changes since 0.14.0
===================================
-NEW 2015-10-26 added a first ported musredit version (Qt4 -> Qt5).
+NEW 2015-10-26 added a first ported musredit version (Qt4 -> Qt5). At the same
+ the version has been incremented to 0.15.0.
NEW 2015-09-24 adding a phase optimized real Fourier to musrFT. This is still VERY
experimental, and hence only available from within musrFT. Eventually
it should make its way into musrview as well. Furthermore the
diff --git a/src/classes/PFourier.cpp b/src/classes/PFourier.cpp
index ea08370b..bbfbf542 100644
--- a/src/classes/PFourier.cpp
+++ b/src/classes/PFourier.cpp
@@ -299,6 +299,10 @@ TH1F* PFourier::GetPhaseOptRealFourier(Double_t &phase, const Double_t scale, co
// check if maximum frequency is given. If yes, get the proper maxBin
if (max != -1.0) {
maxBin = (UInt_t)(max/fResolution);
+ if (maxBin >= noOfFourierBins) {
+ maxBin = noOfFourierBins;
+ cerr << "**WARNING** maximum frequency/field out of range. Will adopted it." << endl;
+ }
}
// copy the real/imag Fourier from min to max
diff --git a/src/external/MusrRoot/TMusrRunHeader.cpp b/src/external/MusrRoot/TMusrRunHeader.cpp
index 492808a2..1fbab84b 100644
--- a/src/external/MusrRoot/TMusrRunHeader.cpp
+++ b/src/external/MusrRoot/TMusrRunHeader.cpp
@@ -1437,14 +1437,14 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path)
// remove the first path element
if (!RemoveFirst(path, '/')) {
- cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't tokenize path!!" << endl;
+ cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't tokenize path!!" << endl;
return false;
}
if (!obj) { // required object not present, create it
TObjArray *oarray = new TObjArray();
if (!oarray) {
- cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't create header structure!!" << endl;
+ cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << endl;
return false;
}
// set the name of the new TObjArray
@@ -1636,7 +1636,7 @@ TObjString TMusrRunHeader::GetHeaderString(UInt_t idx)
str += subStr;
str += "; ";
}
- subStr.Form(fmt, dvec.size()-1);
+ subStr.Form(fmt, dvec[dvec.size()-1]);
str += subStr;
str += " -@";
str += MRH_DOUBLE_VECTOR;
diff --git a/src/musredit_qt5/PTextEdit.cpp b/src/musredit_qt5/PTextEdit.cpp
index eb9bdcb9..ede387e8 100644
--- a/src/musredit_qt5/PTextEdit.cpp
+++ b/src/musredit_qt5/PTextEdit.cpp
@@ -679,42 +679,6 @@ void PTextEdit::doConnections( PSubTextEdit *e )
connect( e, SIGNAL( cursorPositionChanged() ), this, SLOT( currentCursorPosition() ));
}
-//----------------------------------------------------------------------------------------------------
-/**
- *
Validates a given runlist.
- *
- * \param runList run list string which should be a space separated list of run numbers.
- */
-bool PTextEdit::validRunList(const QString runList)
-{
- bool success = true;
-
- int i = 0;
- QString subStr;
- bool done = false;
- int val = 0;
- bool ok;
- while (!done) {
- subStr = runList.section(' ', i, i, QString::SectionSkipEmpty);
- if (subStr.isEmpty()) {
- done = true;
- continue;
- }
- i++;
- val = subStr.toInt(&ok);
- if (!ok) {
- done = true;
- success = false;
- }
- }
-
- if (i == 0) { // no token found
- success = false;
- }
-
- return success;
-}
-
//----------------------------------------------------------------------------------------------------
/**
*
Start the dialog to enter a msr-file title. See also https://intranet.psi.ch/MUSR/MusrFit#4_1_The_Title
@@ -1892,12 +1856,6 @@ void PTextEdit::musrMsr2Data()
break;
case 1: // run list
runList = fMsr2DataParam->runList;
- if (!validRunList(runList)) {
- QMessageBox::critical(this, "**ERROR**",
- "Invalid Run List!\nThe run list needs to be a space separated list of run numbers.",
- QMessageBox::Ok, QMessageBox::NoButton);
- return;
- }
break;
case 2: // run list file name
runListFileName = fMsr2DataParam->runListFileName;
diff --git a/src/musredit_qt5/PTextEdit.h b/src/musredit_qt5/PTextEdit.h
index 149ab0bf..46a6e282 100644
--- a/src/musredit_qt5/PTextEdit.h
+++ b/src/musredit_qt5/PTextEdit.h
@@ -77,7 +77,6 @@ private:
void load( const QString &f, const int index=-1 );
PSubTextEdit *currentEditor() const;
void doConnections( PSubTextEdit *e );
- bool validRunList(const QString runList);
void fileSystemWatcherActivation();
private slots:
diff --git a/src/musredit_qt5/musredit_startup.xml.in b/src/musredit_qt5/musredit_startup.xml.in
index bdcf0b4e..34374e56 100644
--- a/src/musredit_qt5/musredit_startup.xml.in
+++ b/src/musredit_qt5/musredit_startup.xml.in
@@ -34,7 +34,7 @@
file://@DOCDIR@/html/user/MUSR/MusrFit.html#A_2.3_musrFT
- Courier New
+ Monospace
12
diff --git a/src/tests/analyticFakeData/analyticFakeData.C b/src/tests/analyticFakeData/analyticFakeData.C
index 76521726..2d80c0ac 100644
--- a/src/tests/analyticFakeData/analyticFakeData.C
+++ b/src/tests/analyticFakeData/analyticFakeData.C
@@ -8,7 +8,7 @@
***************************************************************************/
/***************************************************************************
- * Copyright (C) 2007-2012 by Andreas Suter *
+ * Copyright (C) 2007-2015 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -27,6 +27,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include
+#include
+using namespace std;
+
void analyticFakeData(const TString type, UInt_t runNo)
{
// load library
@@ -40,6 +44,10 @@ void analyticFakeData(const TString type, UInt_t runNo)
TFolder *runHeader;
TFolder *runInfo;
UInt_t offset = 0;
+ const UInt_t noOfHistos = 4;
+ const UInt_t noOfChannels = 426600;
+ const Double_t timeResolution = 0.025; // ns
+ TRandom3 rand;
histosFolder = gROOT->GetRootFolder()->AddFolder("histos", "Histograms");
gROOT->GetListOfBrowsables()->Add(histosFolder, "histos");
@@ -49,8 +57,12 @@ void analyticFakeData(const TString type, UInt_t runNo)
fileName.Form("0%d.root", (Int_t)runNo);
- Double_t t0[16] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+ cout << ">> define t0" << endl;
+ vector t0;
+ for (UInt_t i=0; i> define header" << endl;
if (!type.CompareTo("TLemRunHeader")) {
// feed run info header
runInfo = gROOT->GetRootFolder()->AddFolder("RunInfo", "LEM RunInfo");
@@ -67,8 +79,8 @@ void analyticFakeData(const TString type, UInt_t runNo)
header->SetImpEnergy(31.8);
header->SetSampleTemperature(0.2, 0.001);
header->SetSampleBField(-1.0, 0.1);
- header->SetTimeResolution(0.025);
- header->SetNChannels(66601);
+ header->SetTimeResolution(timeResolution);
+ header->SetNChannels(noOfChannels);
header->SetNHist(8);
header->SetCuts("none");
header->SetModerator("none");
@@ -107,17 +119,16 @@ void analyticFakeData(const TString type, UInt_t runNo)
prop.Set("Sample Magnetic Field", 40.0, "T");
header->Set("RunInfo/Sample Magnetic Field", prop);
prop.Set("Sample Temperature", 1.0, "mK");
- header->Set("RunInfo/No of Histos", 8);
- prop.Set("Time Resolution", 0.025, "ns");
+ header->Set("RunInfo/No of Histos", (Int_t)noOfHistos);
+ prop.Set("Time Resolution", timeResolution, "ns");
header->Set("RunInfo/Time Resolution", prop);
vector ivec;
ivec.push_back(0);
-// ivec.push_back(20);
header->Set("RunInfo/RedGreen Offsets", ivec);
offset = 1;
// 2nd write all the required DetectorInfo entries
- for (UInt_t i=0; i<16; i++) {
+ for (UInt_t i=0; i<4; i++) {
tstr.Form("DetectorInfo/Detector%03d/", i+offset);
label = tstr + TString("Name");
tstr1.Form("Detector%03d", (Int_t)(i+offset));
@@ -125,32 +136,14 @@ void analyticFakeData(const TString type, UInt_t runNo)
label = tstr + TString("Histo No");
header->Set(label, (Int_t)(i+offset));
label = tstr + TString("Histo Length");
- header->Set(label, 426600);
+ header->Set(label, (Int_t)noOfChannels);
label = tstr + TString("Time Zero Bin");
header->Set(label, t0[i]);
label = tstr + TString("First Good Bin");
header->Set(label, (Int_t)t0[i]);
label = tstr + TString("Last Good Bin");
- header->Set(label, 426600);
+ header->Set(label, (Int_t)noOfChannels);
}
-/*
- for (UInt_t i=0; i<8; i++) {
- tstr.Form("DetectorInfo/Detector%03d/", 20+i+offset);
- label = tstr + TString("Name");
- tstr1.Form("Detector%03d", (Int_t)(20+i+offset));
- header->Set(label, tstr1);
- label = tstr + TString("Histo No");
- header->Set(label, (Int_t)(20+i+offset));
- label = tstr + TString("Histo Length");
- header->Set(label, 66601);
- label = tstr + TString("Time Zero Bin");
- header->Set(label, t0[i]);
- label = tstr + TString("First Good Bin");
- header->Set(label, (Int_t)t0[i]);
- label = tstr + TString("Last Good Bin");
- header->Set(label, 66600);
- }
-*/
// 3rd write required SampleEnvironmentInfo entries
header->Set("SampleEnvironmentInfo/Cryo", "virtual");
@@ -162,41 +155,51 @@ void analyticFakeData(const TString type, UInt_t runNo)
}
// create histos
- Double_t n0[16] = {25.0, 24.8, 25.1, 25.0, 24.8, 24.9, 25.3, 25.0, 25.0, 24.8, 25.1, 25.0, 24.8, 24.9, 25.3, 25.0};
- Double_t bkg[16] = {0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05};
+ cout << ">> define n0" << endl;
+ vector n0;
+ for (UInt_t i=0; i> define bkg" << endl;
+ vector bkg;
+ for (UInt_t i=0; i> define a0" << endl;
+ vector a0;
+ for (UInt_t i=0; i> define phase" << endl;
+ vector phase;
+ for (UInt_t i=0; i> write fake header for TMusrRoot" << endl;
if (type.CompareTo("TLemRunHeader")) {
TDoubleVector dvec;
header->Set("FakeFct/Def", "N0 exp(-t/tau_mu) [1 + A exp(-1/2 (t sigma)^2) cos(gamma_mu B t + phi)] + bkg");
- for (UInt_t i=0; i<16; i++)
+ for (UInt_t i=0; iSet("FakeFct/N0", dvec);
dvec.clear();
- for (UInt_t i=0; i<16; i++)
+ for (UInt_t i=0; iSet("FakeFct/bkg", dvec);
dvec.clear();
- for (UInt_t i=0; i<16; i++)
+ for (UInt_t i=0; iSet("FakeFct/A", dvec);
dvec.clear();
- for (UInt_t i=0; i<16; i++)
+ for (UInt_t i=0; iSet("FakeFct/phase", dvec);
prop.Set("B", bb0, "G");
@@ -205,81 +208,66 @@ void analyticFakeData(const TString type, UInt_t runNo)
header->Set("FakeFct/lambda", prop);
}
- TH1F *histo[16];
+ cout << ">> create histo objects" << endl;
+ vector histo;
+ histo.resize(noOfHistos);
char str[128];
- for (UInt_t i=0; i<16; i++) {
+ for (UInt_t i=0; i> fill histos" << endl;
+ for (UInt_t i=0; iSetBinContent(j+1, bkg[i]);
} else {
time = (Double_t)(j-t0[i])*timeResolution;
-/*
- dval = (Double_t)n0[i]*TMath::Exp(-time/tau)*(1.0+a0[i]*TMath::Exp(-time*rate0)*TMath::Cos(TMath::TwoPi()*gamma*bb0*time+phase[i])+
- a1[i]*TMath::Exp(-time*rate1)*TMath::Cos(TMath::TwoPi()*gamma*bb1*time+phase[i]))+(Double_t)bkg[i];
-*/
dval = (Double_t)n0[i]*TMath::Exp(-time/tau)*(1.0+a0[i]*TMath::Exp(-0.5*TMath::Power(time*rate0,2))*TMath::Cos(TMath::TwoPi()*gamma*bb0*time+phase[i]))+(Double_t)bkg[i];
histo[i]->SetBinContent(j+1, dval);
}
}
}
-/*
+ cout << ">> add prompt peak" << endl;
// add a promp peak
- Double_t ampl = 0.0;
+ Double_t ampl = 50.0;
Double_t promptLambda = 500.0/1000.0; // Lorentzain in 1/ns
if (ampl != 0.0) {
- for (UInt_t i=0; i<8; i++) {
- for (UInt_t j=1; j<426601; j++) {
+ for (UInt_t i=0; iGetBinContent(j);
- dval1 = dval*0.9; // simulate a PPC
time = (Double_t)(j-t0[i])*timeResolution;
dval += ampl*TMath::Exp(-fabs(time)*promptLambda);
- dval1 += ampl*TMath::Exp(-fabs(time)*promptLambda);
histo[i]->SetBinContent(j, dval);
- histo[i+8]->SetBinContent(j, dval1);
}
}
}
-*/
// add Poisson noise
+ cout << ">> add Poisson noise" << endl;
PAddPoissonNoise *addNoise = new PAddPoissonNoise();
if (!addNoise->IsValid()) {
cerr << endl << "**ERROR** while invoking PAddPoissonNoise" << endl;
return;
}
- for (UInt_t i=0; i<16; i++) {
+ for (UInt_t i=0; iAddNoise(histo[i]);
}
delete addNoise;
addNoise = 0;
-/*
- for (UInt_t i=0; i<8; i++) {
- for (UInt_t j=1; jGetEntries(); j++) {
- histo[i+8]->SetBinContent(j, histo[i]->GetBinContent(j));
- }
- }
-*/
- for (UInt_t i=0; i<16; i++)
+
+ cout << ">> add histos to decayAnaModule" << endl;
+ for (UInt_t i=0; iAdd(histo[i]);
// write file
+ cout << ">> write file" << endl;
TFile *fout = new TFile(fileName.Data(), "RECREATE", "Midas Fake Histograms");
if (fout == 0) {
cout << endl << "**ERROR** Couldn't create ROOT file";
@@ -299,5 +287,10 @@ void analyticFakeData(const TString type, UInt_t runNo)
fout->Close();
delete fout;
- delete [] histo;
+/*
+ cout << ">> cleanup" << endl;
+ for (UInt_t i=0; i> done!" << endl;
}