From b7716938aeed122ddcb76293d47a22ec93ceeb38 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Thu, 19 Nov 2015 13:29:19 +0100 Subject: [PATCH 1/3] changed default font for musredit_qt5 from New Courier to Monospace --- src/musredit_qt5/musredit_startup.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4824937fa12b2c3de9fc812d30da15be2341ca62 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Fri, 20 Nov 2015 08:47:36 +0100 Subject: [PATCH 2/3] make it a bit more flexible --- src/tests/analyticFakeData/analyticFakeData.C | 153 +++++++++--------- 1 file changed, 73 insertions(+), 80 deletions(-) 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; } From 18c90fef998296387c2e4c6190c17698a677d4e8 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sun, 22 Nov 2015 18:57:24 +0100 Subject: [PATCH 3/3] adopted to qt5 Mac OS X --- src/musredit_qt5/PAdmin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/musredit_qt5/PAdmin.cpp b/src/musredit_qt5/PAdmin.cpp index 66f32955..d4d67ae7 100644 --- a/src/musredit_qt5/PAdmin.cpp +++ b/src/musredit_qt5/PAdmin.cpp @@ -643,7 +643,7 @@ PAdmin::PAdmin() : QObject() // XML Parser part QString fln = "musredit_startup.xml"; // check if it is a MacOSX -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX fln = "./musredit_startup.xml"; if (!QFile::exists(fln)) { fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml"; @@ -773,7 +773,7 @@ int PAdmin::savePrefs(QString pref_fln) QString str; QString fln = "musredit_startup.xml"; // check if it is a MacOSX -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX fln = "./musredit_startup.xml"; if (!QFile::exists(fln)) { fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml"; @@ -898,7 +898,7 @@ void PAdmin::saveRecentFiles() QString str; QString fln = "musredit_startup.xml"; // check if it is a MacOSX -#ifdef Q_WS_MAC +#ifdef Q_OS_OSX fln = "./musredit_startup.xml"; if (!QFile::exists(fln)) { fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";