merged root6

This commit is contained in:
2019-09-11 12:12:13 +02:00
99 changed files with 6983 additions and 19284 deletions

View File

@@ -2,35 +2,55 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${MUSRFIT_INC})
root_generate_dictionary(
PFourierCanvasDict
-I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PFourierCanvas.h
PFourierCanvas.h
OPTIONS
-I${MUSRFIT_INC}
-I${FFTW3_INCLUDE_DIR}
-inlineInputHeader
LINKDEF ${MUSRFIT_INC}/PFourierCanvasLinkDef.h
MODULE PFourierCanvas
)
root_generate_dictionary(
PMusrCanvasDict
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PMusrCanvas.h
PMusrCanvasDict
PMusrCanvas.h
LINKDEF ${MUSRFIT_INC}/PMusrCanvasLinkDef.h
OPTIONS
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PMusrCanvas
)
root_generate_dictionary(
PMusrT0Dict
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PMusrT0.h
PMusrT0.h
LINKDEF ${MUSRFIT_INC}/PMusrT0LinkDef.h
OPTIONS
-I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PMusrT0
)
root_generate_dictionary(
PStartupHandlerDict
-I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PStartupHandler.h
PStartupHandler.h
LINKDEF ${MUSRFIT_INC}/PStartupHandlerLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
-inlineInputHeader
MODULE PStartupHandler
)
root_generate_dictionary(
PUserFcnBaseDict
-I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PUserFcnBase.h
PUserFcnBaseDict
PUserFcnBase.h
LINKDEF ${MUSRFIT_INC}/PUserFcnBaseLinkDef.h
OPTIONS
-inlineInputHeader
-I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC}
MODULE PUserFcnBase
)
@@ -39,7 +59,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\$\{prefix\}")
set(libdir "\$\{exec_prefix\}/lib")
set(includedir "\$\{prefix\}/include")
set(MUSR_VERSION "1.2.0")
set(MUSR_VERSION "1.3.0")
set(MUSR_LIBRARY_NAME "PMusr")
configure_file("PMusr.pc.in" "PMusr.pc" @ONLY)
set(USERFCN_LIBRARY_NAME "PUserFcnBase")
@@ -66,6 +86,7 @@ add_library(PMusr SHARED
PMusrT0Dict.cxx
PPrepFourier.cpp
PRunAsymmetry.cpp
PRunAsymmetryBNMR.cpp
PRunAsymmetryRRF.cpp
PRunBase.cpp
PRunDataHandler.cpp
@@ -78,13 +99,6 @@ add_library(PMusr SHARED
PStartupHandlerDict.cxx
PTheory.cpp
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PMusr
PROPERTIES
VERSION ${MUSR_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PMusr BEFORE PRIVATE
@@ -106,11 +120,14 @@ add_library(PUserFcnBase SHARED
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PMusr
PROPERTIES
VERSION ${MUSR_VERSION}
)
set_target_properties(PUserFcnBase
PROPERTIES
VERSION ${MUSR_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PUserFcnBase BEFORE PRIVATE $<BUILD_INTERFACE:${MUSRFIT_INC}>
@@ -174,15 +191,31 @@ install(
)
#--- install headers ----------------------------------------------------------
#--- only install headers needed for classes with dictionary
install(
FILES ${MUSRFIT_INC}/PFourierCanvas.h
FILES ${MUSRFIT_INC}/PFitterFcn.h
${MUSRFIT_INC}/PFitter.h
${MUSRFIT_INC}/PFourierCanvas.h
${MUSRFIT_INC}/PFourier.h
${MUSRFIT_INC}/PFunctionGrammar.h
${MUSRFIT_INC}/PFunction.h
${MUSRFIT_INC}/PFunctionHandler.h
${MUSRFIT_INC}/PMsr2Data.h
${MUSRFIT_INC}/PMsrHandler.h
${MUSRFIT_INC}/PMusrCanvas.h
${MUSRFIT_INC}/PMusr.h
${MUSRFIT_INC}/PMusrT0.h
${MUSRFIT_INC}/PPrepFourier.h
${MUSRFIT_INC}/PRunAsymmetry.h
${MUSRFIT_INC}/PRunAsymmetryRRF.h
${MUSRFIT_INC}/PRunBase.h
${MUSRFIT_INC}/PRunDataHandler.h
${MUSRFIT_INC}/PRunListCollection.h
${MUSRFIT_INC}/PRunMuMinus.h
${MUSRFIT_INC}/PRunNonMusr.h
${MUSRFIT_INC}/PRunSingleHisto.h
${MUSRFIT_INC}/PRunSingleHistoRRF.h
${MUSRFIT_INC}/PStartupHandler.h
${MUSRFIT_INC}/PTheory.h
${MUSRFIT_INC}/PUserFcnBase.h
DESTINATION include
)

View File

@@ -45,8 +45,8 @@
#include <limits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <sys/time.h>
#include "Minuit2/FunctionMinimum.h"
#include "Minuit2/MnContours.h"

View File

@@ -75,6 +75,7 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
value += fRunListCollection->GetSingleHistoRRFChisq(par);
value += fRunListCollection->GetAsymmetryChisq(par);
value += fRunListCollection->GetAsymmetryRRFChisq(par);
value += fRunListCollection->GetAsymmetryBNMRChisq(par);
value += fRunListCollection->GetMuMinusChisq(par);
value += fRunListCollection->GetNonMusrChisq(par);
} else { // max likelihood
@@ -82,6 +83,7 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
value += fRunListCollection->GetSingleHistoRRFMaximumLikelihood(par);
value += fRunListCollection->GetAsymmetryMaximumLikelihood(par);
value += fRunListCollection->GetAsymmetryRRFMaximumLikelihood(par);
value += fRunListCollection->GetAsymmetryBNMRMaximumLikelihood(par);
value += fRunListCollection->GetMuMinusMaximumLikelihood(par);
value += fRunListCollection->GetNonMusrMaximumLikelihood(par);
}

View File

@@ -68,8 +68,6 @@ PMsrHandler::PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions
fFuncHandler = nullptr;
fNoOfMaps = -1;
// check if the file name given is a path-file-name, and if yes, split it into path and file name.
if (fFileName.Contains("/")) {
Int_t idx = -1;
@@ -164,9 +162,9 @@ Int_t PMsrHandler::ReadMsrFile()
continue;
}
// remove leading spaces
line.Remove(TString::kLeading, ' ');
// remove leading spaces
line.Remove(TString::kLeading, ' ');
if (!line.IsWhitespace()) { // if not an empty line, handle it
// check for a msr block
if (line_no == 1) { // title
@@ -642,6 +640,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
case MSR_FITTYPE_MU_MINUS:
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
break;
case MSR_FITTYPE_BNMR:
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
break;
case MSR_FITTYPE_NON_MUSR:
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
break;
@@ -806,6 +807,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
case MSR_FITTYPE_MU_MINUS:
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
break;
case MSR_FITTYPE_BNMR:
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
break;
case MSR_FITTYPE_NON_MUSR:
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
break;
@@ -1169,6 +1173,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
case MSR_PLOT_MU_MINUS:
fout << "PLOT " << fPlots[plotNo].fPlotType << " (mu minus plot)" << std::endl;
break;
case MSR_PLOT_BNMR:
fout << "PLOT " << fPlots[plotNo].fPlotType << " (beta-NMR asymmetry plot)" << std::endl;
break;
case MSR_PLOT_NON_MUSR:
fout << "PLOT " << fPlots[plotNo].fPlotType << " (non muSR plot)" << std::endl;
break;
@@ -1718,6 +1725,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
case MSR_FITTYPE_MU_MINUS:
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
break;
case MSR_FITTYPE_BNMR:
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
break;
case MSR_FITTYPE_NON_MUSR:
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
break;
@@ -1909,6 +1919,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
case MSR_FITTYPE_MU_MINUS:
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
break;
case MSR_FITTYPE_BNMR:
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
break;
case MSR_FITTYPE_NON_MUSR:
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
break;
@@ -2265,6 +2278,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
case MSR_PLOT_MU_MINUS:
fout << "PLOT " << fPlots[i].fPlotType << " (mu minus plot)" << std::endl;
break;
case MSR_PLOT_BNMR:
fout << "PLOT " << fPlots[i].fPlotType << " (beta-NMR asymmetry plot)" << std::endl;
break;
case MSR_PLOT_NON_MUSR:
fout << "PLOT " << fPlots[i].fPlotType << " (non muSR plot)" << std::endl;
break;
@@ -2321,6 +2337,11 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
fout << "logy" << std::endl;
}
// lifetimecorrection
if (fPlots[i].fLifeTimeCorrection) {
fout << "lifetimecorrection" << std::endl;
}
// rrf_packing
if (fPlots[i].fRRFPacking) {
fout << "rrf_packing " << fPlots[i].fRRFPacking << std::endl;
@@ -2983,6 +3004,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
(fittype == MSR_FITTYPE_ASYM) ||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
(fittype == MSR_FITTYPE_MU_MINUS) ||
(fittype == MSR_FITTYPE_BNMR) ||
(fittype == MSR_FITTYPE_NON_MUSR)) {
global.SetFitType(fittype);
} else {
@@ -3212,7 +3234,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
UInt_t addT0Counter = 0;
Int_t ival;
Double_t dval;
Double_t dval;
iter = lines.begin();
while ((iter != lines.end()) && !error) {
@@ -3324,6 +3346,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
(fittype == MSR_FITTYPE_ASYM) ||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
(fittype == MSR_FITTYPE_MU_MINUS) ||
(fittype == MSR_FITTYPE_BNMR) ||
(fittype == MSR_FITTYPE_NON_MUSR)) {
param.SetFitType(fittype);
} else {
@@ -4591,6 +4614,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13
case MSR_PLOT_SINGLE_HISTO_RRF:
case MSR_PLOT_ASYM:
case MSR_PLOT_BNMR:
case MSR_PLOT_ASYM_RRF:
case MSR_PLOT_NON_MUSR:
case MSR_PLOT_MU_MINUS:
@@ -4778,6 +4802,8 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
param.fLogX = true;
} else if (iter1->fLine.Contains("logy", TString::kIgnoreCase)) {
param.fLogY = true;
} else if (iter1->fLine.Contains("lifetimecorrection", TString::kIgnoreCase)) {
param.fLifeTimeCorrection = true;
} else if (iter1->fLine.Contains("view_packing", TString::kIgnoreCase)) {
tokens = iter1->fLine.Tokenize(" \t");
if (!tokens) {
@@ -5008,6 +5034,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
std::cerr << std::endl << ">> 2=forward-backward asym,";
std::cerr << std::endl << ">> 3=forward-backward RRF asym,";
std::cerr << std::endl << ">> 4=mu minus single histo,";
std::cerr << std::endl << ">> 5=forward-backward beta-NMR asym,";
std::cerr << std::endl << ">> 8=non muSR.";
std::cerr << std::endl << ">> <run_list> is the list of runs, e.g. runs 1 3";
std::cerr << std::endl << ">> range is optional";
@@ -5865,6 +5892,58 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
fRuns[i].SetPacking(1);
}
break;
case PRUN_ASYMMETRY_BNMR:
// check alpha
// if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
// std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
// std::cerr << std::endl << ">> alpha parameter number missing which is needed for an asymmetry fit.";
// std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl;
// return false;
// }
// check that there is a forward parameter number
if (fRuns[i].GetForwardHistoNo() == -1) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
std::cerr << std::endl << ">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
return false;
}
// check that there is a backward parameter number
if (fRuns[i].GetBackwardHistoNo() == -1) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
std::cerr << std::endl << ">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl;
return false;
}
// check fit range
if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec
if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) {
if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
std::cerr << std::endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
return false;
}
}
}
// check number of T0's provided
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) &&
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << std::endl;
std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl;
return false;
}
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) &&
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << std::endl;
std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << std::endl;
return false;
}
// check packing
if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) {
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
std::cerr << std::endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
fRuns[i].SetPacking(1);
}
break;
case PRUN_ASYMMETRY_RRF:
// check alpha
if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
@@ -6221,7 +6300,7 @@ Bool_t PMsrHandler::CheckHistoGrouping()
Bool_t result = true;
for (UInt_t i=0; i<fRuns.size(); i++) {
if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM) {
if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM || fRuns[i].GetFitType() == MSR_FITTYPE_BNMR) {
if (fRuns[i].GetForwardHistoNoSize() != fRuns[i].GetBackwardHistoNoSize()) {
std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **ERROR** # of forward histos != # of backward histos.";
std::cerr << std::endl << ">> Run #" << i+1;

View File

@@ -1878,6 +1878,19 @@ void PMsrRunBlock::SetMapGlobal(UInt_t idx, Int_t ival)
return;
}
//--------------------------------------------------------------------------
// SetEstimatedAlpha (public)
//--------------------------------------------------------------------------
/**
* <p> set the value of estimated alpha at position idx
*
* \param alpha is the estimated value
*/
void PMsrRunBlock::SetEstimatedAlpha(Double_t dval)
{
fAlpha = dval;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// implementation PStringNumberList
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@@ -712,6 +712,18 @@ void PMusrCanvas::UpdateDataTheoryPad()
// handle data
HandleDataSet(i, runNo, data);
break;
case MSR_FITTYPE_BNMR:
data = fRunList->GetAsymmetryBNMR(runNo, PRunListCollection::kRunNo);
if (!data) { // something wrong
fValid = false;
// error message
std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a beta-NMR asymmetry plot";
std::cerr << std::endl;
return;
}
// handle data
HandleDataSet(i, runNo, data);
break;
case MSR_FITTYPE_ASYM_RRF:
data = fRunList->GetAsymmetryRRF(runNo, PRunListCollection::kRunNo);
if (!data) { // something wrong
@@ -904,7 +916,8 @@ void PMusrCanvas::UpdateInfoPad()
tstr += grouping;
tstr += TString(",");
} else if ((runs[runNo].GetFitType() == MSR_FITTYPE_ASYM) ||
(runs[runNo].GetFitType() == MSR_FITTYPE_ASYM_RRF)) {
(runs[runNo].GetFitType() == MSR_FITTYPE_ASYM_RRF) ||
(runs[runNo].GetFitType() == MSR_FITTYPE_BNMR)) {
tstr += TString("h:");
TString grouping;
fMsrHandler->GetGroupingString(runNo, "forward", grouping);
@@ -1599,6 +1612,7 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
case MSR_PLOT_SINGLE_HISTO:
case MSR_PLOT_SINGLE_HISTO_RRF:
case MSR_PLOT_ASYM:
case MSR_PLOT_BNMR:
case MSR_PLOT_ASYM_RRF:
case MSR_PLOT_MU_MINUS:
if (fDifferenceView) { // difference view plot
@@ -1899,7 +1913,7 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fMultiGraphData->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fNonMusrData.size(); i++) { // go through all the histogramms
for (UInt_t i=0; i<fNonMusrData.size(); i++) { // go through all the graphs
// clean up dump
dump.dataX.clear();
dump.data.clear();
@@ -1917,6 +1931,15 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
// go through all theory bins
for (Int_t j=0; j<fNonMusrData[i].theory->GetN(); j++) {
// get x and y value
@@ -2758,7 +2781,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
size = data->GetValue()->size();
dataSet.dataRange->SetXRange(start, end); // full possible range
// make sure that for asymmetry the y-range is initialized reasonably
if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM)
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) || (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR))
dataSet.dataRange->SetYRange(-0.4, 0.4);
// extract necessary range information
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin.size() == 0) &&
@@ -2774,6 +2797,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
fXmax = end;
}
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) ||
(fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR) ||
(fMsrHandler->GetMsrRunList()->at(runNo).IsLifetimeCorrected())) {
fYRangePresent = true;
fYmin = -0.4;
@@ -2822,6 +2846,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
// make sure that for asymmetry the y-range is initialized reasonably
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) ||
(fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR) ||
(fMsrHandler->GetMsrRunList()->at(runNo).IsLifetimeCorrected())) {
dataSet.dataRange->SetYRange(-0.4, 0.4);
}
@@ -4686,7 +4711,13 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
fDataTheoryPad->SetLogy(1);
// set x-axis label
fHistoFrame->GetXaxis()->SetTitle("Time (#mus)");
if (fPlotType == MSR_PLOT_BNMR ) {
// For BNMR/BNQR runs use seconds
fHistoFrame->GetXaxis()->SetTitle("time (s)");
} else {
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
}
// set y-axis label
TString yAxisTitle;
PMsrRunList *runList = fMsrHandler->GetMsrRunList();
@@ -4708,6 +4739,9 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
case MSR_PLOT_ASYM:
yAxisTitle = "Asymmetry";
break;
case MSR_PLOT_BNMR:
yAxisTitle = "Asymmetry";
break;
case MSR_PLOT_MU_MINUS:
yAxisTitle = "N(t) per bin";
break;
@@ -4804,7 +4838,8 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
}
}
if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fLogY) {
dataYmin = 1.0e-4 * dataYmax;
if (dataYmin <= 0.0)
dataYmin = 1.0e-4 * dataYmax;
}
// create fMultiGraphData, and add all data and theory
@@ -4969,7 +5004,12 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom)
fHistoFrame->SetBins(noOfPoints, dataXmin, dataXmax);
// set x-axis label
if (fPlotType == MSR_PLOT_BNMR) {
// For BNMR/BNQR runs use seconds
fHistoFrame->GetXaxis()->SetTitle("time (s)");
} else {
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
}
// set y-axis label
fHistoFrame->GetYaxis()->SetTitleOffset(1.3);
fHistoFrame->GetYaxis()->SetTitle("data-theory");
@@ -6087,7 +6127,12 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom)
// define x-axis title
TString xAxisTitle("");
if (fCurrentPlotView == PV_DATA) {
if (fPlotType == MSR_PLOT_BNMR) {
// For BNMR/BNQR runs use seconds
xAxisTitle = TString("time (s)");
} else {
xAxisTitle = TString("time (#mus)");
}
} else { // all the Fourier
if (fFourier.fUnits == FOURIER_UNIT_GAUSS) {
xAxisTitle = TString("Field (G)");
@@ -6120,6 +6165,9 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom)
case MSR_PLOT_ASYM:
yAxisTitle = "<asymmetry>";
break;
case MSR_PLOT_BNMR:
yAxisTitle = "<asymmetry>";
break;
case MSR_PLOT_MU_MINUS:
yAxisTitle = "<N(t)> per bin";
break;
@@ -6476,8 +6524,8 @@ UInt_t PMusrCanvas::GetNeededAccuracy(PMsrParamStructure param)
// find last significant digit
for (Int_t i=strlen(str)-1; i>=0; i--) {
if (str[i] != '0') {
if ((i-decimalPoint) < precLimit)
accuracy = i-decimalPoint;
if (((UInt_t)i-decimalPoint) < precLimit)
accuracy = (UInt_t)i-decimalPoint;
else
accuracy = precLimit;
break;

View File

@@ -1776,7 +1776,7 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]
}
// 3rd check if end is within proper bounds
if (end[i] < 0) {
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin ("<< end[i] << ") doesn't make any sense!";
std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!";
std::cerr << std::endl;
return false;
}

File diff suppressed because it is too large Load Diff

View File

@@ -596,7 +596,7 @@ Bool_t PRunAsymmetryRRF::PrepareData()
for (UInt_t i=1; i<forwardHistoNo.size(); i++) { // loop over the groupings
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[i])->size(); j++) { // loop over the bin indices
// make sure that the index stays within proper range
if ((j+fT0s[2*i]-fT0s[0] >= 0) && (j+fT0s[2*i]-fT0s[0] < runData->GetDataBin(forwardHistoNo[i])->size())) {
if (((Int_t)j+fT0s[2*i]-fT0s[0] >= 0) && (j+fT0s[2*i]-fT0s[0] < runData->GetDataBin(forwardHistoNo[i])->size())) {
fForward[j] += forward[i][j+(Int_t)fT0s[2*i]-(Int_t)fT0s[0]];
}
}
@@ -770,7 +770,7 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg()
}
// check if start is within histogram bounds
if ((start[0] >= fForward.size()) || (start[1] >= fBackward.size())) {
if ((start[0] >= fForward.size()) || (start[1] >= fBackward.size())) {
std::cerr << std::endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
std::cerr << std::endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ").";

View File

@@ -34,11 +34,8 @@
#include <TString.h>
#include <TObjArray.h>
#include <TObjString.h>
//#include <TFile.h>
#include <TFolder.h>
#include "TLemRunHeader.h"
#include "PRunBase.h"
//--------------------------------------------------------------------------

View File

@@ -3045,8 +3045,9 @@ Bool_t PRunDataHandler::ReadMudFile()
setup += TString(str) + TString("/");
if (TString(str) == "BNQR" || TString(str) == "BNMR") {
std::cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** this run was performed on " << str << std::endl;
std::cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** apply correction to time resolution" << std::endl;
// identified BNMR/BNQR, correct time resolution.
timeResMultiplier = 1.0e15;
timeResMultiplier = 1.0e9;
}
}
success = MUD_getApparatus( fh, str, sizeof(str) );
@@ -3128,8 +3129,8 @@ Bool_t PRunDataHandler::ReadMudFile()
}
}
runData.SetTimeResolution(static_cast<Double_t>(timeResolution) * timeResMultiplier); // s -> ns
// An additional factor of 1e6 needed for bNMR
runData.SetTimeResolution(static_cast<Double_t>(timeResolution) * timeResMultiplier); // s -> ns or s -> ms for bNMR
// Other possibility:
// Check if it is a bNMR run and fix it or check if "timeres" line
// was introduced in the msr file

View File

@@ -76,6 +76,12 @@ PRunListCollection::~PRunListCollection()
}
fRunAsymmetryRRFList.clear();
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++) {
fRunAsymmetryBNMRList[i]->CleanUp();
fRunAsymmetryBNMRList[i]->~PRunAsymmetryBNMR();
}
fRunAsymmetryBNMRList.clear();
for (UInt_t i=0; i<fRunMuMinusList.size(); i++) {
fRunMuMinusList[i]->CleanUp();
fRunMuMinusList[i]->~PRunMuMinus();
@@ -133,6 +139,11 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag)
if (!fRunAsymmetryRRFList[fRunAsymmetryRRFList.size()-1]->IsValid())
success = false;
break;
case PRUN_ASYMMETRY_BNMR:
fRunAsymmetryBNMRList.push_back(new PRunAsymmetryBNMR(fMsrInfo, fData, runNo, tag));
if (!fRunAsymmetryBNMRList[fRunAsymmetryBNMRList.size()-1]->IsValid())
success = false;
break;
case PRUN_MU_MINUS:
fRunMuMinusList.push_back(new PRunMuMinus(fMsrInfo, fData, runNo, tag));
if (!fRunMuMinusList[fRunMuMinusList.size()-1]->IsValid())
@@ -175,6 +186,8 @@ void PRunListCollection::SetFitRange(const TString fitRange)
fRunAsymmetryList[i]->SetFitRangeBin(fitRange);
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
fRunAsymmetryRRFList[i]->SetFitRangeBin(fitRange);
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
fRunAsymmetryBNMRList[i]->SetFitRangeBin(fitRange);
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
fRunMuMinusList[i]->SetFitRangeBin(fitRange);
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
@@ -201,6 +214,8 @@ void PRunListCollection::SetFitRange(const PDoublePairVector fitRange)
fRunAsymmetryList[i]->SetFitRange(fitRange);
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
fRunAsymmetryRRFList[i]->SetFitRange(fitRange);
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
fRunAsymmetryBNMRList[i]->SetFitRange(fitRange);
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
fRunMuMinusList[i]->SetFitRange(fitRange);
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
@@ -291,6 +306,27 @@ Double_t PRunListCollection::GetAsymmetryRRFChisq(const std::vector<Double_t>& p
return chisq;
}
//--------------------------------------------------------------------------
// GetAsymmetryBNMRChisq (public)
//--------------------------------------------------------------------------
/**
* <p>Calculates chi-square of <em>all</em> asymmetry BNMR runs of a msr-file.
*
* <b>return:</b>
* - chi-square of all asymmetry BNMR runs of the msr-file
*
* \param par fit parameter vector
*/
Double_t PRunListCollection::GetAsymmetryBNMRChisq(const std::vector<Double_t>& par) const
{
Double_t chisq = 0.0;
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
chisq += fRunAsymmetryBNMRList[i]->CalcChiSquare(par);
return chisq;
}
//--------------------------------------------------------------------------
// GetMuMinusChisq (public)
//--------------------------------------------------------------------------
@@ -372,6 +408,18 @@ Double_t PRunListCollection::GetSingleRunChisqExpected(const std::vector<Double_
case PRUN_SINGLE_HISTO:
expectedChisq = fRunSingleHistoList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_SINGLE_HISTO_RRF:
expectedChisq = fRunSingleHistoRRFList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_ASYMMETRY:
expectedChisq = fRunAsymmetryList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_ASYMMETRY_RRF:
expectedChisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_ASYMMETRY_BNMR:
expectedChisq = fRunAsymmetryBNMRList[subIdx]->CalcChiSquareExpected(par);
break;
case PRUN_MU_MINUS:
expectedChisq = fRunMuMinusList[subIdx]->CalcChiSquareExpected(par);
break;
@@ -430,6 +478,9 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
case PRUN_ASYMMETRY_RRF:
chisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquare(par);
break;
case PRUN_ASYMMETRY_BNMR:
chisq = fRunAsymmetryBNMRList[subIdx]->CalcChiSquare(par);
break;
case PRUN_MU_MINUS:
chisq = fRunMuMinusList[subIdx]->CalcChiSquare(par);
break;
@@ -529,6 +580,28 @@ Double_t PRunListCollection::GetAsymmetryRRFMaximumLikelihood(const std::vector<
return mlh;
}
//--------------------------------------------------------------------------
// GetAsymmetryBNMRMaximumLikelihood (public)
//--------------------------------------------------------------------------
/**
* <p> Since it is not clear yet how to handle asymmetry fits with max likelihood
* the chi square will be used!
*
* <b>return:</b>
* - chi-square of all asymmetry BNMR runs of the msr-file
*
* \param par fit parameter vector
*/
Double_t PRunListCollection::GetAsymmetryBNMRMaximumLikelihood(const std::vector<Double_t>& par) const
{
Double_t mlh = 0.0;
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
mlh += fRunAsymmetryBNMRList[i]->CalcChiSquare(par);
return mlh;
}
//--------------------------------------------------------------------------
// GetMuMinusMaximumLikelihood (public)
//--------------------------------------------------------------------------
@@ -710,6 +783,9 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
case PRUN_ASYMMETRY_RRF:
result = fRunAsymmetryRRFList[subIdx]->GetNoOfFitBins();
break;
case PRUN_ASYMMETRY_BNMR:
result = fRunAsymmetryBNMRList[subIdx]->GetNoOfFitBins();
break;
case PRUN_MU_MINUS:
result = fRunMuMinusList[subIdx]->GetNoOfFitBins();
break;
@@ -749,6 +825,9 @@ UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
counts += fRunAsymmetryRRFList[i]->GetNoOfFitBins();
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
counts += fRunAsymmetryBNMRList[i]->GetNoOfFitBins();
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
counts += fRunMuMinusList[i]->GetNoOfFitBins();
@@ -887,6 +966,49 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
return data;
}
//--------------------------------------------------------------------------
// GetAsymmetryBNMR (public)
//--------------------------------------------------------------------------
/**
* <p>Get a processed asymmetry from beta-NMR data set.
*
* <b>return:</b>
* - pointer to the run data set (processed data) if data set is found
* - null pointer otherwise
*
* \param index msr-file run index
* \param tag kIndex -> data at index, kRunNo -> data of given run no
*/
PRunData* PRunListCollection::GetAsymmetryBNMR(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
switch (tag) {
case kIndex: // called from musrfit when dumping the data
if (index > fRunAsymmetryBNMRList.size()) {
std::cerr << std::endl << ">> PRunListCollection::GetAsymmetryBNMR(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return 0;
}
fRunAsymmetryBNMRList[index]->CalcTheory();
data = fRunAsymmetryBNMRList[index]->GetData();
break;
case kRunNo: // called from PMusrCanvas
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++) {
if (fRunAsymmetryBNMRList[i]->GetRunNo() == index) {
data = fRunAsymmetryBNMRList[i]->GetData();
break;
}
}
break;
default: // error
break;
}
return data;
}
//--------------------------------------------------------------------------
// GetAsymmetryRRF (public)
//--------------------------------------------------------------------------

View File

@@ -4,10 +4,17 @@
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(CUBA_INC ${CMAKE_SOURCE_DIR}/src/external/libCuba/src)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
BMWStartupHandlerDict
-I${MUSRFIT_INC}
BMWStartupHandler.h
OPTIONS
-I${MUSRFIT_INC}
-inlineInputHeader
LINKDEF BMWStartupHandlerLinkDef.h
MODULE BMWStartupHandler
)

View File

@@ -5,16 +5,22 @@ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
root_generate_dictionary(
PMagProximityFitterDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
PMagProximityFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PMagProximityFitterLinkDef.h
MODULE PMagProximityFitter
)
root_generate_dictionary(
PMPStartupHandlerDict
-I${MUSRFIT_INC}
PMPStartupHandler.h
OPTIONS
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PMPStartupHandlerLinkDef.h
MODULE PMPStartupHandler
)
@@ -36,13 +42,6 @@ add_library(PMagProximityFitter SHARED
PMPStartupHandler.cpp
PMPStartupHandlerDict.cxx
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PMagProximityFitter
PROPERTIES
VERSION ${P_MAG_PROXIMITY_FITTER_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PMagProximityFitter BEFORE PRIVATE

2141
src/external/MuSRFitGUI/MSR.pm vendored Executable file → Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,991 +0,0 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by theform's constructor and
** destructor.
*****************************************************************************/
# This file is part of MuSRFitGUI.
#
# MuSRFitGUI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MuSRFitGUI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2009 by Zaher Salman and the LEM Group.
# <zaher.salman@psi.ch>
void MuSRFitMenu::fileOpen()
{
my $file=Qt::FileDialog::getOpenFileName(
".",
"MSR Files (*.msr *.mlog)",
this,
"open file dialog",
"Choose a MSR file");
print "Selected file: $file\n";
# TODO: Possibly decipher the MSR file and setup the GUI accordingly
# Find run numbers, beamlines etc.
# Get theory block and understand it
# Get parameters list and update table
}
void MuSRFitMenu::fileSave()
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
"MSR Files (*.msr *.mlog)",
this,
"save file dialog",
"Choose a filename to save under");
# If the user gave a filename the copy to it
if ($file ne "") {
# TODO: check if the extension is correct, or add it.
if (-e $FILENAME) {
my $cmd="cp $FILENAME $file";
my $pid=system($cmd);
} else {
if ($file ne "") {
my $Warning = "Warning: No MSR file found yet!";
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
}
}
void MuSRFitMenu::fileChangeDir()
{
my $newdir=Qt::FileDialog::getExistingDirectory(
"",
this,
"get existing directory",
"Choose a directory",
1);
chdir ("$newdir");
}
void MuSRFitMenu::filePrint()
{
}
void MuSRFitMenu::fileExit()
{
my $Ans = Qt::MessageBox::question( this, "Quit?","Are you sure you want to quit?","&Yes","&No","",0,1);
if ($Ans==0) {
# Then quit
Qt::Application::exit( 0 );
}
# Otherwize go back
}
void MuSRFitMenu::parametersExport()
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=1;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
"Data Files (*.dat)",
this,
"export file dialog",
"Choose a filename to export to");
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>},"$file" );
print DATF $Text;
close(DATF);
}
}
void MuSRFitMenu::parametersAppend()
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=0;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getOpenFileName(
"./",
"Data Files (*.dat)",
this,
"append file dialog",
"Choose a filename to append to");
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>>},"$file" );
print DATF $Text;
close(DATF);
}
}
void MuSRFitMenu::editUndo()
{
}
void MuSRFitMenu::editRedo()
{
}
void MuSRFitMenu::editCut()
{
}
void MuSRFitMenu::editCopy()
{
}
void MuSRFitMenu::editPaste()
{
}
void MuSRFitMenu::helpIndex()
{
}
void MuSRFitMenu::helpContents()
{
}
void MuSRFitMenu::helpAbout()
{
my $AboutText="
This is a GUI that uses the musrfit binary, developed by Andreas Suter,
to fit muSR spectra.
MuSRFitGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MuSRFitGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009 by Zaher Salman and the LEM Group.
<zaher.salman\@psi.ch>
";
my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText);
}
void MuSRFitform::CreateAllInput()
{
my %All=();
# From RUNS Tab
# Run data file
$All{"RunNumbers"} = RunNumbers->text;
$All{"RunFiles"} = RunFiles->text;
$All{"BeamLine"} = BeamLine->currentText;
$All{"RUNSType"} = ManualFile->isOn();
$All{"optionsFourier"} = optionsFourier->isOn();
$All{"optionsT0"} = optionsT0->isOn();
$All{"YEAR"} =YEAR->currentText;
if ($All{"YEAR"} eq "") {
# If year combobox is empty fill it up from 2004 up to current year
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $current_year = 1900 + $yearOffset;
for (my $i=$current_year;$i>=2004;$i--) {
YEAR->insertItem($i,-1);
}
}
# Time range and BINS
$All{"Tis"} = Tis->text;
$All{"Tfs"} = Tfs->text;
$All{"BINS"} = BINS->text;
$All{"FitAsyType"} = FitAsyType->currentText;
$All{"LRBF"} = LRBF->text;
my @Hists = split(/,/, $All{"LRBF"} );
# Lifetime corrections in enabled/visible only for SingleHis fits
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
ltc->setHidden(1);
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
ltc->setHidden(0);
}
# From Fitting Tab
# Plot range
$All{"Xi"}=Xi->text;
$All{"Xf"}=Xf->text;
$All{"Yi"}=Yi->text;
$All{"Yf"}=Yf->text;
$All{"ViewBin"}=ViewBin->text;
# Life time correction
if (ltc->isChecked()) {
$All{"ltc"}="y";
} else {
$All{"ltc"}="n";
}
# Minuit commands
if ( $All{"go"} eq "" ) {
$All{"go"}="PLOT";
}
# Get minimization process
$All{"Minimization"} = Minimization->currentText();
$All{"go"}=$All{"Minimization"};
# Get Error calculation process
$All{"ErrorCalc"} = ErrorCalc->currentText();
$All{"go"}=$All{"ErrorCalc"};
RunSelectionToggle();
my @RUNS = ();
if ($All{"RUNSType"} ) {
@RUNS = split( /,/, $All{"RunFiles"});
} else {
$All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g;
@RUNS = split( /,/, $All{"RunNumbers"} );
}
# From MSR File Tab
$All{"TITLE"}= TITLE->text;
$All{"FILENAME"}= FILENAME->text;
# From Fourier Tab
$All{"FUNITS"}= FUnits->currentText;
$All{"FAPODIZATION"}= FApodization->currentText;
$All{"FPLOT"}= FPlot->currentText;
$All{"FPHASE"}=FPHASE->text;
# Fourier range
$All{"FrqMin"}=FrqMin->text;
$All{"FrqMax"}=FrqMax->text;
# Rotating reference frame parameters
$All{"RRFFrq"}=RRFFrq->text;
$All{"RRFPack"}=RRFPack->text;
$All{"RRFPhase"}=RRFPhase->text;
$All{"RRFUnits"}=RRFUnits->currentText;
# Get values of t0 and Bg/Data bins if given
my $NHist = 1;
foreach my $Hist (@Hists) {
foreach ("t0","Bg1","Bg2","Data1","Data2") {
my $Name = "$_$NHist";
$All{$Name}=child($Name)->text;
# TODO: If empty fill with defaults
if ($All{$Name} eq "") {
$All{$Name}=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
child($Name)->setText($All{$Name});
}
}
$NHist++;
}
# Construct fittypes that can be understood by MSR.pm
my %FTs=(0,"Exponential",
1,"Gaussian",
2,"Stretch",
3,"ExponentialCos",
4,"GaussianCos",
5,"StretchCos",
6,"LDKTLF",
7,"GDKTLF",
8,"Background",
9,"LLFExp",
10,"GLFExp",
11,"LLFSExp",
12,"GLFSExp",
13,"MolMag",
14,"Meissner",
15,"None"
);
my $FT1=FitType1->currentItem;
my $FT2=FitType2->currentItem;
my $FT3=FitType3->currentItem;
$All{"FitType1"} = $FTs{$FT1};
$All{"FitType2"} = $FTs{$FT2};
$All{"FitType3"} = $FTs{$FT3};
my @FitTypes =();
my $FitType="";
foreach $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Also theory block and paramets list
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
$All{"Full_T_Block"}=$Full_T_Block;
$All{"Paramcomp_ref"}=$Paramcomp_ref;
my @Paramcomp = @$Paramcomp_ref;
# Functions block
$All{"FunctionsBlock"}=FunctionsBlock->text;
# and the associated theory block
$All{"Func_T_Block"}=TheoryBlock->text;
# Shared settings are detected here
$All{"EnableSharing"} = buttonGroupSharing->isChecked();
my $Shared = 0;
my $PCount =0;
my $Component=1;
foreach $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# This is the counter for parameters of this component
my $NP=1;
$Shared = 0;
# Change state/label of parameters
foreach my $Param (@Params) {
my $Param_ORG = $Param;
# TODO: I need to take care of single hist fits here
if ( $All{"FitAsyType"} eq "SingleHist" ) {
$Param=$Param.$Hists[0];
}
if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "No" && $Param ne "NBg" ) ){
$Param = join( "", $Param, "_", $Component);
}
# Is there any point of sharing, multiple runs?
if ( $#RUNS == 0 && $All{"FitAsyType"} eq "Asymmetry") {
$Shared = 1;
}
elsif ( $#RUNS == 0 && $#Hists == 0 && $All{"FitAsyType"} eq "SingleHist" ) {
$Shared = 1;
} else {
# Check if shared or not, construct name of checkbox, find its handle and then
# check if it is checked
my $ChkName="ShParam_".$Component."_".$NP;
my $ChkBx = child($ChkName);
$Shared = $ChkBx->isChecked();
}
$All{"Sh_$Param"}=$Shared;
$NP++;
}
#Loop on parameters
$Component++;
}
# Loop on components
# Done with shared parameters detecting
# Construct a default filename if empty
if ( $All{"FILENAME"} eq "" && !$All{"RUNSType"}) {
$All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"};
if ($All{"BeamLine"} eq "LEM (PPC)") {
$All{"FILENAME"}=$RUNS[0]."_LEM_".$All{"YEAR"};
}
} else {
$All{"FILENAME"}="TMP";
}
# This has to be at the end of CreateAll
my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
# Read initial values of paramets from tabel
my $erradd = "d";
my $minadd = "_min";
my $maxadd = "_max";
my $Header=InitParamTable->verticalHeader();
# TODO: Should not go over all rows, only on parameters.
if ($NParam > 0) {
for (my $i=0;$i<$NParam;$i++) {
# Take label of row, i.e. name of parameter
my $Param=$Header->label($i);
# Then take the value, error, max and min (as numbers)
$All{"$Param"}=1.0*InitParamTable->text($i,0);
$All{"$erradd$Param"}=1.0*InitParamTable->text($i,1);
$All{"$Param$minadd"}=1.0*InitParamTable->text($i,2);
$All{"$Param$maxadd"}=1.0*InitParamTable->text($i,3);
}
}
# Return Hash with all important values
return %All;
}
void MuSRFitform::CallMSRCreate()
{
use MSR;
my %All=CreateAllInput();
# Check if the option for checking for existing files is selected
my $FileExistCheck= FileExistCheck->isOn();
my $FILENAME=$All{"FILENAME"}.".msr";
my $Answer=0;
if ($All{"RunNumbers"} ne "" || $All{"RunFiles"} ne "") {
if ( $FileExistCheck==1 ) {
if (-e $FILENAME) {
# Warning: MSR file exists
# my $Warning = "Warning: MSR file $FILENAME Already exists!\nIf you continue it will overwriten.";
my $Warning = "Warning: MSR file $FILENAME Already exists!\nDo you want to overwrite it?";
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
# $Answer =1,0 for yes and no
$Answer= Qt::MessageBox::warning( this, "Warning",$Warning, "&No", "&Yes", undef, 1,1);
}
} else {
# Just overwrite file
$Answer=1;
}
if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
}
UpdateMSRFileInitTable();
}
}
return $Answer;
}
void MuSRFitform::UpdateMSRFileInitTable()
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"};
open (MSRF,q{<},"$FILENAME.msr" );
my @lines = <MSRF>;
close(IFILE);
textMSROutput->setText("");
foreach my $line (@lines) {
textMSROutput->append("$line");
}
(my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
my @FPBloc = @$FPBlock_ref;
my $PCount=0;
foreach my $line (@FPBloc) {
$PCount++;
my @Param=split(/\s+/,$line);
# Depending on how many elements in @Param determine what they mean
# 0th element is empty (always)
# 1st element is the order (always)
# 2nd element is the name (always)
# 3rd element is the value (always)
# 4th element can be taken as step/error (always)
# 5th element can be
# if it is last element or there are two more = positive error, check $#Param=5/7
# if there is only one more = minimum, check $#Param=6
# To summarize, check the value of $#Param
my $value=1.0*$Param[3];
my $error = 1.0*$Param[4];
my $minvalue=0.0;
my $maxvalue=0.0;
if ($#Param == 4) {
$minvalue=0.0;
$maxvalue=0.0;
}
elsif ($#Param == 6) {
$minvalue=1.0*$Param[5];
$maxvalue=1.0*$Param[6];
}
elsif ($#Param == 5 || $#Param == 7) {
$minvalue=1.0*$Param[6];
$maxvalue=1.0*$Param[7];
}
# Now update the initialization tabel
InitParamTable->setText($PCount-1,0,$value);
InitParamTable->setText($PCount-1,1,$error);
InitParamTable->setText($PCount-1,2,$minvalue);
InitParamTable->setText($PCount-1,3,$maxvalue);
# Set bg color to mark different runs
}
return;
}
void MuSRFitform::ActivateT0Hists()
{
my %All=CreateAllInput();
my @Hists = split(/,/, $All{"LRBF"} );
my $HistBox = "";
for (my $iHist=1; $iHist<=4; $iHist++) {
$HistBox="groupHist$iHist";
my $HistBoxHandle = child($HistBox);
if ($iHist<=$#Hists+1) {
# Activate this histogram box
$HistBoxHandle->setHidden(0);
$HistBoxHandle->setEnabled(1);
$HistBoxHandle->setTitle("Hist # $Hists[$iHist-1]");
} else {
# Deactivate this histogram box
$HistBoxHandle->setHidden(1);
$HistBoxHandle->setEnabled(0);
}
}
# TODO: Set default values
}
void MuSRFitform::ActivateShComp()
{
my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} );
# Hide all sharing components
SharingComp1->setHidden(1);
SharingComp2->setHidden(1);
SharingComp3->setHidden(1);
SharingComp1->setEnabled(0);
SharingComp2->setEnabled(0);
SharingComp3->setEnabled(0);
my @FitTypes =();
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
# For now the line below does not work. Why?
# my $Paramcomp_ref=$All{"Paramcomp_ref"};
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
# Possible to share only if sharing is enabled altogether
my $EnableSharing = $All{"EnableSharing"};
if ($EnableSharing) {
my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# Make the component appear first (only if we have multiple runs)
my $ShCompG="SharingComp".$Component;
my $ShCG = child($ShCompG);
if ($#RUNS>0) {
$ShCG->setHidden(0);
$ShCG->setEnabled(1);
}
my $CompShLabel = "Comp".$Component."ShLabel";
my $CompShL = child($CompShLabel);
$CompShL->setText($All{"FitType$Component"});
# Change state/label of parameters
for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx);
if ($Params[$i-1] ne "") {
$ChkBx->setHidden(0);
$ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]);
} else {
$ChkBx->setHidden(1);
}
}
$Component++;
}
}
}
void MuSRFitform::InitializeTab()
{
my %All=CreateAllInput();
InitParamTable->setLeftMargin(100);
my $NRows = InitParamTable->numRows();
# Remove any rows in table
if ($NRows > 0) {
for (my $i=0;$i<$NRows;$i++) {
# TODO: Better remove the row rather than hide it.
InitParamTable->hideRow($i);
# InitParamTable->removeRow($i);
}
}
my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
if ($NParam>$NRows) {
InitParamTable->setNumRows($NParam);
}
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
# Now make sure we have no nans
if ($error eq "nan") { $error=0.1;}
# If you use this then reading the parameters from the table is a problem
# You need to extract the correct parameter name from the row label
# InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param");
InitParamTable->verticalHeader()->setLabel( $PCount,"$Param");
InitParamTable->showRow($PCount);
InitParamTable->setText($PCount,0,$value);
InitParamTable->setText($PCount,1,$error);
InitParamTable->setText($PCount,2,$minvalue);
InitParamTable->setText($PCount,3,$maxvalue);
}
}
void MuSRFitform::TabChanged()
{
# TODO: First check if there are some runs given, otherwise disbale
my %All=CreateAllInput();
# First make sure we have sharing initialized
ActivateShComp();
# Here we need to apply sharing if selected...
InitializeTab();
UpdateMSRFileInitTable();
# And also setup T0 and Bg bins
ActivateT0Hists();
# Initialize FUNCTIONS block only if it has not been initialized yet
if ($All{"Func_T_Block"} eq "" ) {
InitializeFunctions();
}
}
void MuSRFitform::GoFit()
{
my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrfit -t $FILENAME";
my $pid = open(FTO,"$cmd 2>&1 |");
while (<FTO>) {
FitTextOutput->append("$_");
}
close(FTO);
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
}
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
# update MSR File tab and initialization table
UpdateMSRFileInitTable();
}
}
return;
}
void MuSRFitform::GoPlot()
{
my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
my $Answer=CallMSRCreate();
my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) {
if (-e $FILENAME) {
my $cmd="musrview $FILENAME &";
my $pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
}
}
}
return;
}
void MuSRFitform::ShowMuSRT0()
{
my %All=CreateAllInput();
musrfit_tabs->setCurrentPage(6);
# Create MSR file and then run musrt0
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrt0 $FILENAME &";
my $pid = system($cmd);
t0Update->setEnabled(1)
} else {
print STDERR "Cannot find MSR file!\n";
}
}
return;
}
void MuSRFitform::T0Update()
{
my %All = CreateAllInput();
my @Hists = split(/,/, $All{"LRBF"} );
# Get values of t0 and Bg/Data bins if given
my $NHist = 1;
foreach my $Hist (@Hists) {
foreach ("t0","Bg1","Bg2","Data1","Data2") {
my $Name = "$_$NHist";
my $tmp=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
child($Name)->setText($tmp);
}
$NHist++
}
}
void MuSRFitform::RunSelectionToggle()
{
my $ManualFile= ManualFile->isOn();
if ($ManualFile) {
# Manual RUN selection
RUNSMan->setEnabled(1);
RUNSMan->setHidden(0);
RunNumbers->setText("");
RUNSAuto->setEnabled(0);
RUNSAuto->setHidden(1);
} else {
# Auto RUN selection
RUNSMan->setEnabled(0);
RUNSMan->setHidden(1);
RunFiles->setText("");
RUNSAuto->setEnabled(1);
RUNSAuto->setHidden(0);
}
# Also use this for other options
# Fourier toggle
my $Fourier=optionsFourier->isOn();
if ($Fourier) {
# Fourier tab visible
# musrfit_tabs->addTab(FourierPage,"Fourier");
# musrfit_tabs->showPage(FourierPage);
# FourierPage->hide();
} else {
# Fourier tab invisible
# musrfit_tabs->removePage(FourierPage);
# FourierPage->show();
}
}
void MuSRFitform::fileBrowse()
{
my $RunFiles=RunFiles->text();
print "Runs:$RunFiles\n";
my $files_ref=Qt::FileDialog::getOpenFileNames(
"Data files (*.root *.bin)",
"./",
this,
"open files dialog",
"Select one or more files to fit");
my @files = @$files_ref;
if ($RunFiles eq "") {
# We started with an empty list
$RunFiles=join(",",@files);
} else {
# Add files to existing list
$RunFiles=join(",",$RunFiles,@files);
}
RunFiles->setText($RunFiles);
}
void MuSRFitform::AppendToFunctions()
{
my $ParName=CParamsCombo->currentText();
my $Full_T_Block=TheoryBlock->text;
my $Constraint=ConstraintLine->text;
# Then clear the text
ConstraintLine->setText("");
# Check how many constraints (lines) in FUNCTIONS Block
my $i=FunctionsBlock->lines();
my $ConstLine="fun$i = $Constraint\n";
FunctionsBlock->append($ConstLine);
# Replace parameter in theory block with fun$i
$Full_T_Block=~ s/$ParName/fun$i/;
TheoryBlock->setText($Full_T_Block);
}
void MuSRFitform::InitializeFunctions()
{
my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} );
my @FitTypes =();
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
CParamsCombo->clear();
# Possibly use the parameters block to axtract names for the dropdown menu
# this makes sense if we can use fun in map line. Check!
my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
# Alpha, No and NBg are counted in the parameters
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# Add list to the constraints drop down menu
for (my $i=1; $i<=9;$i++) {
my $CParam = $Params[$i-1]."_".$Component;
if ($Params[$i-1] ne "" ) {
if ($Params[$i-1] ne "Alpha" && $Params[$i-1] ne "No" && $Params[$i-1] ne "NBg") {
CParamsCombo->insertItem($CParam,-1);
$Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
}
# also enumerate the parameters as should be used in the FUNCTIONS Block
$ParCount++;
$ParametersList=$ParametersList."$CParam \t is \t par$ParCount\n";
ParametersList->setText($ParametersList);
}
}
$Component++;
}
# Set theory block in Constraints
TheoryBlock->setText($Full_T_Block);
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
}
void MuSRFitform::optionConfigure()
{
use Customize;
my $Customize = Qt::Dialog(this);
my $w = Customize;
$w->setModal(1);
$w->exec();
# $Customize->setMainWidget($w);
# $w->show;
# exit $Customize->exec;
}
void MuSRFitform::t0UpdateClicked()
{
# Read MSR file and get new values of t0,Bg and Data
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"};
open (MSRF,q{<},"$FILENAME.msr" );
my @lines = <MSRF>;
close(IFILE);
my @T0s = grep {/t0 /} @lines;
my @Bgs = grep {/background /} @lines;
my @Datas = grep {/data /} @lines;
my @Hists = split(/,/, $All{"LRBF"} );
my $NHist = $#Hists+1;
print "Histograms: $NHist\n";
my $FinHist = 1;
# First T0s
while ($FinHist) {
my $counter=0;
(my $tmp,my @SplitT0) = split( /\s+/, $T0s[$counter]);
(my $tmp,my @SplitBg) = split( /\s+/, $Bgs[$counter]);
(my $tmp,my @SplitData) = split( /\s+/, $Datas[$counter]);
if ($#SplitBg>0) {
foreach (@SplitBg) {
print $_."\n";
}
}
$counter++;
if ($counter>=$#Bgs) {$FinHist=0;}
}
# Finally, disable the update button
t0Update->setEnabled(0);
# t0Update->setText("musrt0")
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -1,8 +1,19 @@
# - TMusrRunHeader library ----------------------------------------------------
#--- generate necessary dictionaries ------------------------------------------
set(MUSRROOT_INC ${CMAKE_SOURCE_DIR}/src/external/MusrRoot)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TMusrRunHeaderDict TMusrRunHeader.h LINKDEF TMusrRunHeaderLinkDef.h
TMusrRunHeaderDict
TMusrRunHeader.h
OPTIONS
-I${MUSRROOT_INC}
-inlineInputHeader
LINKDEF TMusrRunHeaderLinkDef.h
MODULE TMusrRunHeader
)
@@ -20,6 +31,10 @@ add_library(TMusrRunHeader SHARED
TMusrRunHeader.cpp
TMusrRunHeaderDict.cxx
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
TMusrRunHeader BEFORE PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(TMusrRunHeader
@@ -27,11 +42,6 @@ set_target_properties(TMusrRunHeader
VERSION ${MUSR_ROOT_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
TMusrRunHeader BEFORE PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(TMusrRunHeader ${ROOT_LIBRARIES})

View File

@@ -2,17 +2,32 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(NONLOCAL_INC ${CMAKE_SOURCE_DIR}/src/external/Nonlocal)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${MUSRFIT_INC} ${NONLOCAL_INC})
root_generate_dictionary(
PNL_PippardFitterDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
PNL_PippardFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${NONLOCAL_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PNL_PippardFitterLinkDef.h
MODULE PNL_PippardFitter
)
root_generate_dictionary(
PNL_StartupHandlerDict PNL_StartupHandler.h LINKDEF PNL_StartupHandlerLinkDef.h
PNL_StartupHandlerDict
PNL_StartupHandler.h
OPTIONS
-I${NONLOCAL_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PNL_StartupHandlerLinkDef.h
MODULE PNL_StartupHandler
)
@@ -33,19 +48,13 @@ add_library(PNL_PippardFitter SHARED
PNL_StartupHandler.cpp
PNL_StartupHandlerDict.cxx
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PNL_PippardFitter
PROPERTIES
VERSION ${PNL_PIPPARDFITTER_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PNL_PippardFitter BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
#--- set target properties, e.g. version --------------------------------------
@@ -71,7 +80,8 @@ install(
#--- install PNL_PippardFitter header -----------------------------------------
install(
FILES
FILES
PNonlocal.h
PNL_PippardFitter.h
PNL_RgeHandler.h
PNL_StartupHandler.h

View File

@@ -1,12 +1,27 @@
# -TLemRunHeader library ------------------------------------------------------
#--- generate necessary dictionaries ------------------------------------------
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TLemRunHeaderDict TLemRunHeader.h LINKDEF TLemRunHeaderLinkDef.h
TLemRunHeaderDict
TLemRunHeader.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TLemRunHeaderLinkDef.h
MODULE TLemRunHeader
)
root_generate_dictionary(
TLemStatsDict TLemStats.h LINKDEF TLemStatsLinkDef.h
TLemStatsDict
TLemStats.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TLemStatsLinkDef.h
MODULE TLemStats
)

Binary file not shown.

View File

@@ -1,96 +0,0 @@
DATA
592.75 0.0466642055 0.00075601151
693.25 0.042699595 0.0007136273
793.75 0.03943051 0.000679583922
894.25 0.0366291886 0.000652378784
994.75 0.0355316716 0.000664640277
1095.25 0.033304272 0.000610910492
1195.75 0.0322397741 0.000595454518
1296.25 0.0308209315 0.000581648459
1396.75 0.0301227967 0.000569861788
1497.25 0.0289808195 0.000559611024
1597.75 0.0284020831 0.000550685264
1698.25 0.0272996592 0.000542785334
1798.75 0.0259033059 0.000536112979
1899.25 0.0257421462 0.000529928146
1999.75 0.0252476607 0.000524276201
2100.25 0.0252439822 0.00049508141
2200.75 0.0244494569 0.000514789454
2301.25 0.0248826473 0.000510792766
2401.75 0.0252364689 0.000507093213
2502.25 0.024077753 0.000503959631
2602.75 0.0239705744 0.000501170092
2703.25 0.023648613 0.000498351823
2803.75 0.0236132062 0.000496113677
2904.25 0.0232728359 0.000494038794
3004.75 0.0229806315 0.00049216698
3105.25 0.0226408705 0.000490122174
3205.75 0.022949639 0.000488517677
3306.25 0.0236152274 0.000487206227
3406.75 0.022514855 0.000485776619
3507.25 0.0232919509 0.000484617162
3607.75 0.0227762445 0.000483435077
3708.25 0.0225740091 0.000482352785
3808.75 0.0217810425 0.000481423643
3909.25 0.0210459719 0.000480488676
4009.75 0.0200829485 0.0004835672
4110.25 0.0144273479 0.000480165881
4210.75 0.0104726937 0.000526210282
4311.25 0.00977670745 0.000548717033
4411.75 0.00734786823 0.000572069626
4512.25 0.0071749696 0.000596458669
4612.75 0.0061713664 0.000621795033
4713.25 0.00457656715 0.000648552578
4813.75 0.00253947053 0.000676064828
4914.25 0.00298436429 0.000705158693
5014.75 0.00520775648 0.000735097152
5115.25 0.00372267868 0.000766213043
5215.75 0.00284020846 0.000798853062
5316.25 0.00158717036 0.000832862333
5416.75 0.00200819085 0.000868342561
5517.25 0.0044706107 0.000905327348
5617.75 0.00135523051 0.000943421323
5718.25 0.000261760966 0.000983714257
5818.75 0.000210009562 0.00102515713
5919.25 -0.000157024642 0.00106890614
6019.75 0.000611697915 0.00111378026
6120.25 0.000353532075 0.00111004546
6220.75 0.00120570511 0.00121565301
6321.25 -0.00126499964 0.00126730997
6421.75 0.0029594966 0.00132005144
6522.25 -0.00180278144 0.00137777581
6622.75 0.00154819637 0.00143478041
6723.25 0.00137296473 0.00149757271
6823.75 -0.000271202669 0.00155948172
6924.25 -0.00306837271 0.00162568622
7024.75 0.00346602562 0.00169188976
7125.25 -8.40576554E-05 0.00176525436
7225.75 0.00141055893 0.00183909095
7326.25 -0.00170315946 0.00191744238
7426.75 0.00399357243 0.00199844555
7527.25 0.00378603394 0.00208493839
7627.75 -0.0015303158 0.00216992033
7728.25 -0.000931658073 0.00226567509
7828.75 0.0011671311 0.00235924947
7929.25 0.00147725609 0.00245769641
8029.75 -0.00100983925 0.00256942322
8130.25 -0.00329542124 0.00255286858
8230.75 0.000636890228 0.00279597795
8331.25 -0.000814018633 0.00291290155
8431.75 0.000101912547 0.00303673191
8532.25 0.00311038784 0.0031603991
8632.75 0.000473049572 0.00329964113
8733.25 8.36732E-05 0.00343974064
8833.75 0.000275585165 0.00358184548
8934.25 0.0059381551 0.00373021006
9034.75 -0.0014588358 0.0038926573
9135.25 -0.00158156038 0.00405870998
9235.75 -0.00125287442 0.00422594705
9336.25 -0.00212622165 0.00439704849
9436.75 -0.00477056006 0.0045911195
9537.25 -0.00229735693 0.00479087708
9637.75 0.00575469607 0.00498561109
9738.25 -7.52893075E-05 0.00519483122
9838.75 -0.00368605583 0.0054198485
9939.25 -0.00862419517 0.00564201231
10039.75 -0.0323936833 0.0181186246

View File

@@ -5,12 +5,18 @@ add_subdirectory(libLineProfile)
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
root_generate_dictionary(
TBNMRDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
TBNMR.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-inlineInputHeader
LINKDEF TBNMRLinkDef.h
MODULE TBNMR
)

View File

@@ -1,76 +0,0 @@
# Run Numbers: 1111
###############################################################
FITPARAMETER
###############################################################
# No Name Value Err Min Max
1 Alpha 1.11587 0.00038 none
2 Asy 0.0570 0.0011 none
3 T 1 0 none
4 Rlx 1.015 0.023 none
5 One 1 0 none
6 Bet -1.052 0.027 none
###############################################################
THEORY
###############################################################
asymmetry fun1
userFcn .libs/libBNMR.so ExpRlx 3 4
###############################################################
FUNCTIONS
###############################################################
fun1 = 0.5 * map1 * map2
###############################################################
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
forward 3
backward 4
data 11 800 11 800
#backgr.fix 0
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
t0 10.0 10.0
map 2 5 0 0 0 0 0 0 0 0
fit 0.5 8
packing 5
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
forward 5
backward 6
data 11 800 11 800
#backgr.fix 0
background 1 9 1 9 # estimated bkg: 11.6250 / 15.6250
t0 10.0 10.0
map 2 6 0 0 0 0 0 0 0 0
fit 0.5 8
packing 5
###############################################################
COMMANDS
MINIMIZE
HESSE
SAVE
###############################################################
PLOT 2 (asymmetry plot)
runs 1 2
use_fit_ranges
view_packing 10
###############################################################
FOURIER
units MHz # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2015-04-14 11:00:19
chisq = 399.5, NDF = 290, chisq/NDF = 1.377736

View File

@@ -1,45 +0,0 @@
Title
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 Asy1 0.0812706 0.00149848 none 0 none
2 T 4000 0 none 0 none
3 Lam1 0.00239816 6.05947e-05 none 0 none
###############################################################
THEORY
asymmetry 1
userFcn /usr/local/lib/libBNMR.so ExpRlx 2 3
###############################################################
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
fittype 8 (non muSR fit)
map 0 0 0 0 0 0 0 0 0 0
xy-data 1 2
fit 0.00 8000.00
packing 1
###############################################################
COMMANDS
STRATEGY 1
MINIMIZE
#MINOS
SAVE
END RETURN
###############################################################
PLOT 8 (non muSR plot)
runs 1
range 0.00 8000.00
###############################################################
FOURIER
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2010-09-02 17:44:20
chisq = 186.322493286053, NDF = 72, chisq/NDF = 2.5878124067507362

View File

@@ -1,46 +0,0 @@
Title
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 Asy1 0.262789 0.0465582 none 0 none
2 T 4000 0 none 0 none
3 Lam1 0.0233569 0.0094885 none 0 none
4 Bet1 0.399259 0.0353915 none 0 none
###############################################################
THEORY
asymmetry 1
userFcn /usr/local/lib/libBNMR.so SExpRlx 2 3 4
###############################################################
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
fittype 8 (non muSR fit)
map 0 0 0 0 0 0 0 0 0 0
xy-data 1 2
fit 0.00 8000.00
packing 1
###############################################################
COMMANDS
STRATEGY 1
MINIMIZE
#MINOS
SAVE
END RETURN
###############################################################
PLOT 8 (non muSR plot)
runs 1
range 0.00 8000.00
###############################################################
FOURIER
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2010-09-02 17:51:10
chisq = 93.71265965991455, NDF = 71, chisq/NDF = 1.319896614928374

View File

@@ -31,55 +31,50 @@
#include "TBNMR.h"
#define tau_Li 1210
#define gamma_Li 6.3018 // In units kHz/mT
#define PI 3.14159265358979323846
#define TWOPI 6.28318530717958647692
ClassImp(ExpRlx) // for the ROOT-dictionary
ClassImp(SExpRlx)
double ExpRlx::operator()(double x, const std::vector<double> &par) const {
assert(par.size()==2); // make sure the number of parameters handed to the function is correct
// par[0] time of beam off
// par[1] is the relaxation rate
// par[0] time of beam on (pulse length) in seconds
// par[1] is the relaxation rate in 1/s
double tau_p;
double y;
tau_p = (tau_Li/(1.+par[1]*tau_Li));
// x should be in seconds, otherwise it should be rescaled here
if ( x <= par[0] && x >= 0) {
y=(tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
return (tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
} else if ( x > par[0] ){
y=(tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
} else {
y = 0;
}
return y;
return (tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
}
return 0;
}
//initialize Integrators
TF1 SExpRlx::sexp1=TF1("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
TF1 SExpRlx::sexp2=TF1("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
double SExpRlx::operator()(double x, const std::vector<double> &par) const {
assert(par.size()==3); // make sure the number of parameters handed to the function is correct
// par[0] time of beam off
// par[1] is the relaxation rate
// par[0] beam of beam on (pulse length) in seconds
// par[1] is the relaxation rate in 1/s
// par[2] is the exponent
// x should be in seconds, otherwise it should be rescaled here
if ( x >= 0 && x <= par[0] ) {
TF1 sexp1("sexp1", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
sexp1.SetParameters(x, par[1], par[2],tau_Li);
sexp1.SetNpx(1000);
return sexp1.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
} else if ( x > par[0] ) {
TF1 sexp2("sexp2", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
sexp2.SetParameters(x, par[1], par[2], par[0],tau_Li);
sexp2.SetNpx(1000);
return sexp2.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
}
}
return 0;
}

View File

@@ -41,6 +41,10 @@
#ifndef LIBBNMRH
#define LIBBNMRH
#define tau_Li 1.210 // In seconds
#define PI 3.14159265358979323846
#define TWOPI 6.28318530717958647692
using namespace std;

View File

@@ -2,12 +2,17 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
root_generate_dictionary(
LineProfileDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
LineProfile.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
LINKDEF LineProfileLinkDef.h
MODULE LineProfile
)

View File

@@ -4,14 +4,20 @@
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TCalcMeanFieldsLEMDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
TCalcMeanFieldsLEM.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-inlineInputHeader
LINKDEF TCalcMeanFieldsLEMLinkDef.h
MODULE TCalcMeanFieldsLEM
)

View File

@@ -3,39 +3,47 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include)
set(FIT_P_OF_B_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${FIT_P_OF_B_INC})
root_generate_dictionary(
TLondon1DDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TLondon1D.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TLondon1DLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TLondon1DLinkDef.h
MODULE TLondon1D
)
root_generate_dictionary(
TVortexDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TVortex.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TVortexLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TVortexLinkDef.h
MODULE TVortex
)
root_generate_dictionary(
TSkewedGssDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TSkewedGss.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TSkewedGssLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TSkewedGssLinkDef.h
MODULE TSkewedGss
)

View File

@@ -3,13 +3,20 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TGapIntegralsDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
TGapIntegrals.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TGapIntegralsLinkDef.h
MODULE TGapIntegrals
)

View File

@@ -2,18 +2,20 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(GBGLF_INC ${CMAKE_SOURCE_DIR}/src/external/libGbGLF)
set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
PGbGLFDict
-I${GBGLF_INC}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${PREFIX_INC}
PGbGLF.h
OPTIONS
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PGbGLFLinkDef.h
OPTIONS -inlineInputHeader
MODULE PGbGLF
)

View File

@@ -3,13 +3,19 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TLFRelaxationDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
TLFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
LINKDEF TLFRelaxationLinkDef.h
MODULE TLFRelaxation
)

View File

@@ -2,24 +2,33 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(PHOTO_MEISSNER_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${PHOTO_MEISSNER_INC})
root_generate_dictionary(
PPhotoMeissnerDict
-I${FFTW3_INCLUDE_DIR}
-I${GSL_INCLUDE_DIRS}
-I${ROOT_INCLUDE_DIRS}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PPhotoMeissner.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PPhotoMeissnerLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${GSL_INCLUDE_DIRS}
-I${ROOT_INCLUDE_DIRS}
-I${MUSRFIT_INC}
-I${PHOTO_MEISSNER_INC}
-inlineInputHeader
LINKDEF ${PHOTO_MEISSNER_INC}/PPhotoMeissnerLinkDef.h
MODULE PPhotoMeissner
)
root_generate_dictionary(
PStartupHandler_PMDict
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PStartupHandler_PM.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_PMLinkDef.h
OPTIONS
-I${MUSRFIT_INC}
-I${PHOTO_MEISSNER_INC}
-inlineInputHeader
LINKDEF ${PHOTO_MEISSNER_INC}/PStartupHandler_PMLinkDef.h
MODULE PStartupHandler_PM
)

View File

@@ -2,21 +2,30 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(SPIN_VALVE_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${SPIN_VALVE_INC})
root_generate_dictionary(
PSkewedLorentzianDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PSkewedLorentzian.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PSkewedLorentzianLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${SPIN_VALVE_INC}
-inlineInputHeader
LINKDEF ${SPIN_VALVE_INC}/PSkewedLorentzianLinkDef.h
MODULE PSkewedLorentzian
)
root_generate_dictionary(
PStartupHandler_SVDict
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PStartupHandler_SV.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_SVLinkDef.h
OPTIONS
-I${SPIN_VALVE_INC}
-inlineInputHeader
LINKDEF ${SPIN_VALVE_INC}/PStartupHandler_SVLinkDef.h
MODULE PStartupHandler_SV
)

View File

@@ -3,13 +3,19 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
ZFRelaxationDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
ZFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
LINKDEF ZFRelaxationLinkDef.h
MODULE ZFRelaxation
)

View File

@@ -30,9 +30,7 @@
#ifndef _PFOURIER_H_
#define _PFOURIER_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <vector>
#ifndef HAVE_DKS
#include <vector>
@@ -45,6 +43,8 @@
#include <TH1F.h>
#include <TH1F.h>
#include "Minuit2/FCNBase.h"
#include "PMusr.h"

View File

@@ -58,6 +58,7 @@
#define PRUN_ASYMMETRY 2
#define PRUN_ASYMMETRY_RRF 3
#define PRUN_MU_MINUS 4
#define PRUN_ASYMMETRY_BNMR 5
#define PRUN_NON_MUSR 8
// muon life time in (us), see PRL99, 032001 (2007)
@@ -100,6 +101,7 @@
#define MSR_FITTYPE_ASYM 2
#define MSR_FITTYPE_ASYM_RRF 3
#define MSR_FITTYPE_MU_MINUS 4
#define MSR_FITTYPE_BNMR 5
#define MSR_FITTYPE_NON_MUSR 8
//-------------------------------------------------------------
@@ -109,6 +111,7 @@
#define MSR_PLOT_ASYM 2
#define MSR_PLOT_ASYM_RRF 3
#define MSR_PLOT_MU_MINUS 4
#define MSR_PLOT_BNMR 5
#define MSR_PLOT_NON_MUSR 8
//-------------------------------------------------------------
@@ -575,6 +578,7 @@ class PMsrGlobalBlock {
virtual Double_t GetFitRange(UInt_t idx);
virtual Int_t GetFitRangeOffset(UInt_t idx);
virtual Int_t GetPacking() { return fPacking; }
virtual Double_t GetEstimatedAlpha() { return fAlpha; }
virtual void SetGlobalPresent(Bool_t bval) { fGlobalPresent = bval; }
virtual void SetRRFFreq(Double_t freq, const char *unit);
@@ -603,6 +607,7 @@ class PMsrGlobalBlock {
Double_t fFitRange[2]; ///< fit range in (us)
Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1.
Int_t fPacking; ///< packing/rebinning
Double_t fAlpha; ///< estimated alpha value from F/B counts
};
//-------------------------------------------------------------
@@ -650,6 +655,7 @@ class PMsrRunBlock {
virtual Double_t GetFitRange(UInt_t idx);
virtual Int_t GetFitRangeOffset(UInt_t idx);
virtual Int_t GetPacking() { return fPacking; }
virtual Double_t GetEstimatedAlpha() { return fAlpha; }
virtual Int_t GetXDataIndex() { return fXYDataIndex[0]; }
virtual Int_t GetYDataIndex() { return fXYDataIndex[1]; }
virtual TString* GetXDataLabel() { return &fXYDataLabel[0]; }
@@ -672,6 +678,7 @@ class PMsrRunBlock {
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void SetBkgEstimated(Double_t dval, Int_t idx);
virtual void SetEstimatedAlpha(Double_t dval);
virtual void SetBkgFix(Double_t dval, Int_t idx);
virtual void SetBkgRange(Int_t ival, Int_t idx);
virtual void SetDataRange(Int_t ival, Int_t idx);
@@ -712,6 +719,7 @@ class PMsrRunBlock {
Bool_t fFitRangeInBins; ///< flag telling if fit range is given in time or in bins
Double_t fFitRange[2]; ///< fit range in (us)
Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1.
Double_t fAlpha; ///< estimated alpha value from F/B counts
Int_t fPacking; ///< packing/rebinning
Int_t fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8)

View File

@@ -247,7 +247,7 @@ class PMusrCanvas : public TObject, public TQObject
Bool_t fDifferenceView; ///< tag showing that the shown data, fourier, are the difference between data and theory
Int_t fCurrentPlotView; ///< tag showing what the current plot view is: data, fourier, ...
Int_t fPreviousPlotView; ///< tag showing the previous plot view
Int_t fPlotType; ///< plot type tag: -1 == undefined, MSR_PLOT_SINGLE_HISTO == single histogram, MSR_PLOT_ASYM == asymmetry, MSR_PLOT_MU_MINUS == mu minus (not yet implemented), MSR_PLOT_NON_MUSR == non-muSR
Int_t fPlotType; ///< plot type tag: -1 == undefined, MSR_PLOT_SINGLE_HISTO == single histogram, MSR_PLOT_ASYM == asymmetry, MSR_PLOT_BNMR == beta-NMR asymmetry, MSR_PLOT_MU_MINUS == mu minus (not yet implemented), MSR_PLOT_NON_MUSR == non-muSR
Int_t fPlotNumber; ///< plot number
Bool_t fXRangePresent, fYRangePresent; ///< flag indicating if x-/y-range is present

View File

@@ -0,0 +1,94 @@
/***************************************************************************
PRunAsymmetryBNMR.h
Author: Zaher Salman
Based on PRunAsymmetry.h by Andreas Suter
e-mail: zaher.salman@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2018-2019 by Zaher Salman *
* zaher.salman@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PRUNASYMMETRYBNMR_H_
#define _PRUNASYMMETRYBNMR_H_
#include "PRunBase.h"
//---------------------------------------------------------------------------
/**
* <p>Class handling the asymmetry fit.
*/
class PRunAsymmetryBNMR : public PRunBase
{
public:
PRunAsymmetryBNMR();
PRunAsymmetryBNMR(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
virtual ~PRunAsymmetryBNMR();
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
virtual Double_t CalcChiSquareExpected(const std::vector<Double_t>& par);
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
virtual void CalcTheory();
virtual UInt_t GetNoOfFitBins();
virtual void SetFitRangeBin(const TString fitRange);
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
virtual Int_t GetPacking() { return fPacking; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
virtual Bool_t PrepareFitData();
virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]);
private:
UInt_t fAlphaBetaTag; ///< \f$ 1 \to \alpha = \beta = 1\f$; \f$ 2 \to \alpha \neq 1, \beta = 1\f$; \f$ 3 \to \alpha = 1, \beta \neq 1\f$; \f$ 4 \to \alpha \neq 1, \beta \neq 1\f$.
UInt_t fNoOfFitBins; ///< number of bins to be be fitted
Int_t fPacking; ///< packing for this particular run. Either given in the RUN- or GLOBAL-block.
PDoubleVector fForwardp; ///< pos hel forward histo data
PDoubleVector fForwardpErr; ///< pos hel forward histo errors
PDoubleVector fBackwardp; ///< pos hel backward histo data
PDoubleVector fBackwardpErr; ///< pos hel backward histo errors
PDoubleVector fForwardm; ///< neg hel forward histo data
PDoubleVector fForwardmErr; ///< neg hel forward histo errors
PDoubleVector fBackwardm; ///< neg hel backward histo data
PDoubleVector fBackwardmErr; ///< neg hel backward histo errors
Int_t fGoodBins[4]; ///< keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
Bool_t SubtractFixBkg();
Bool_t SubtractEstimatedBkg();
virtual Bool_t GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlock, PUIntVector &forwardHisto, PUIntVector &backwardHistoNo);
virtual Bool_t GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]);
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock);
virtual Double_t EstimateAlpha();
};
#endif // _PRUNASYMMETRYBNMR_H_

View File

@@ -39,6 +39,7 @@
#include "PRunSingleHistoRRF.h"
#include "PRunAsymmetry.h"
#include "PRunAsymmetryRRF.h"
#include "PRunAsymmetryBNMR.h"
#include "PRunMuMinus.h"
#include "PRunNonMusr.h"
@@ -81,6 +82,7 @@ class PRunListCollection
virtual Double_t GetSingleHistoRRFChisq(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryChisq(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryRRFChisq(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryBNMRChisq(const std::vector<Double_t>& par) const;
virtual Double_t GetMuMinusChisq(const std::vector<Double_t>& par) const;
virtual Double_t GetNonMusrChisq(const std::vector<Double_t>& par) const;
@@ -91,6 +93,7 @@ class PRunListCollection
virtual Double_t GetSingleHistoRRFMaximumLikelihood(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryMaximumLikelihood(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryRRFMaximumLikelihood(const std::vector<Double_t>& par) const;
virtual Double_t GetAsymmetryBNMRMaximumLikelihood(const std::vector<Double_t>& par) const;
virtual Double_t GetMuMinusMaximumLikelihood(const std::vector<Double_t>& par) const;
virtual Double_t GetNonMusrMaximumLikelihood(const std::vector<Double_t>& par) const;
@@ -104,6 +107,7 @@ class PRunListCollection
virtual UInt_t GetNoOfSingleHistoRRF() const { return fRunSingleHistoRRFList.size(); } ///< returns the number of single histogram RRF data sets present in the msr-file
virtual UInt_t GetNoOfAsymmetry() const { return fRunAsymmetryList.size(); } ///< returns the number of asymmetry data sets present in the msr-file
virtual UInt_t GetNoOfAsymmetryRRF() const { return fRunAsymmetryRRFList.size(); } ///< returns the number of asymmetry RRF data sets present in the msr-file
virtual UInt_t GetNoOfAsymmetryBNMR() const { return fRunAsymmetryBNMRList.size(); } ///< returns the number of asymmetry BNMR data sets present in the msr-file
virtual UInt_t GetNoOfMuMinus() const { return fRunMuMinusList.size(); } ///< returns the number of mu minus data sets present in the msr-file
virtual UInt_t GetNoOfNonMusr() const { return fRunNonMusrList.size(); } ///< returns the number of non-muSR data sets present in the msr-file
@@ -111,6 +115,7 @@ class PRunListCollection
virtual PRunData* GetSingleHistoRRF(UInt_t index, EDataSwitch tag=kIndex);
virtual PRunData* GetAsymmetry(UInt_t index, EDataSwitch tag=kIndex);
virtual PRunData* GetAsymmetryRRF(UInt_t index, EDataSwitch tag=kIndex);
virtual PRunData* GetAsymmetryBNMR(UInt_t index, EDataSwitch tag=kIndex);
virtual PRunData* GetMuMinus(UInt_t index, EDataSwitch tag=kIndex);
virtual PRunData* GetNonMusr(UInt_t index, EDataSwitch tag=kIndex);
@@ -138,6 +143,7 @@ class PRunListCollection
std::vector<PRunSingleHistoRRF*> fRunSingleHistoRRFList; ///< stores all processed single histogram RRF data
std::vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all processed asymmetry data
std::vector<PRunAsymmetryRRF*> fRunAsymmetryRRFList; ///< stores all processed asymmetry RRF data
std::vector<PRunAsymmetryBNMR*> fRunAsymmetryBNMRList; ///< stores all processed asymmetry BNMR data
std::vector<PRunMuMinus*> fRunMuMinusList; ///< stores all processed mu-minus data
std::vector<PRunNonMusr*> fRunNonMusrList; ///< stores all processed non-muSR data

View File

@@ -369,6 +369,10 @@ PmuppGui::PmuppGui( QStringList fln, QWidget *parent, Qt::WindowFlags f )
fCentralWidget->setLayout(fBoxLayout_Main);
setCentralWidget(fCentralWidget);
// in case there is no db/dat file list given open the db/dat file open menu automatically.
if (fln.size() == 0)
fileOpen();
}
//----------------------------------------------------------------------------------------------------

View File

@@ -24,21 +24,29 @@ set(SOURCE
set ( PLOT_DIR
${CMAKE_CURRENT_BINARY_DIR}
)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${PLOT_DIR})
#--- generate necessary dictionaries ------------------------------------------
root_generate_dictionary(
PMuppCanvasDict
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/..
PMuppCanvas.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/..
-inlineInputHeader
LINKDEF PMuppCanvasLinkDef.h
MODULE PMuppCanvas
)
root_generate_dictionary(
PMuppStartupHandlerDict
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/..
PMuppStartupHandler.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/..
-inlineInputHeader
LINKDEF PMuppStartupHandlerLinkDef.h
MODULE PMuppStartupHandler
)
@@ -71,3 +79,22 @@ if (APPLE)
else (APPLE)
install(TARGETS mupp_plot DESTINATION bin)
endif (APPLE)
#--- install root pcm's and rootmaps ------------------------------------------
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libPMuppCanvas_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/libPMuppCanvas.rootmap
${CMAKE_CURRENT_BINARY_DIR}/libPMuppStartupHandler_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/libPMuppStartupHandler.rootmap
DESTINATION lib
)
#--- install headers ----------------------------------------------------------
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/../mupp.h
${CMAKE_CURRENT_SOURCE_DIR}/mupp_plot.h
${CMAKE_CURRENT_SOURCE_DIR}/PMuppCanvas.h
${CMAKE_CURRENT_SOURCE_DIR}/PMuppStartupHandler.h
DESTINATION include
)

View File

@@ -54,11 +54,11 @@
<lgb>63000</lgb>
<asym_bkg_range>200 1500</asym_bkg_range>
<logic_detector name="L" rel_phase="0.0" forward="1 5"/>
<logic_detector name="T" rel_phase="90.0" forward="2 6"/>
<logic_detector name="T" rel_phase="-90.0" forward="2 6"/>
<logic_detector name="R" rel_phase="180.0" forward="3 7"/>
<logic_detector name="B" rel_phase="270.0" forward="4 8"/>
<logic_detector name="B" rel_phase="90.0" forward="4 8"/>
<logic_asym_detector name="LR" rel_phase="0.0" forward="1 5" backward="3 7" alpha="1.0"/>
<logic_asym_detector name="TB" rel_phase="90.0" forward="2 6" backward="4 8" alpha="1.0"/>
<logic_asym_detector name="TB" rel_phase="-90.0" forward="2 6" backward="4 8" alpha="1.0"/>
</tf>
<tf name="WEW PPC">
<no_of_detectors>8</no_of_detectors>
@@ -66,11 +66,11 @@
<lgb>63000</lgb>
<asym_bkg_range>200 1500</asym_bkg_range>
<logic_detector name="L" rel_phase="0.0" forward="21 25"/>
<logic_detector name="T" rel_phase="90.0" forward="22 26"/>
<logic_detector name="T" rel_phase="-90.0" forward="22 26"/>
<logic_detector name="R" rel_phase="180.0" forward="23 27"/>
<logic_detector name="B" rel_phase="270.0" forward="24 28"/>
<logic_detector name="B" rel_phase="90.0" forward="24 28"/>
<logic_asym_detector name="LR" rel_phase="0.0" forward="21 25" backward="23 27" alpha="1.0"/>
<logic_asym_detector name="TB" rel_phase="90.0" forward="22 26" backward="24 28" alpha="1.0"/>
<logic_asym_detector name="TB" rel_phase="-90.0" forward="22 26" backward="24 28" alpha="1.0"/>
</tf>
<tf name="Bpar NPP">
<no_of_detectors>4</no_of_detectors>

View File

@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
std::cout << std::endl << "musrWiz - alpha - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
std::cout << std::endl << "musrWiz - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
return 0;
} else if (!strcmp(argv[1], "--help")) {
musrWiz_syntax();

View File

@@ -951,7 +951,7 @@ void PTextEdit::setupHelpActions()
menu->addAction(a);
a = new QAction(tr( "Author(s) ..." ), this );
a->setStatusTip( tr("Author(s)") );
a->setStatusTip( tr("Help About") );
connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ));
menu->addAction(a);
@@ -2547,8 +2547,8 @@ void PTextEdit::musrView()
// make sure that the system environment variables are properly set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir);
@@ -2620,8 +2620,8 @@ void PTextEdit::musrT0()
// make sure that the system environment variables are properly set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env);
proc->setWorkingDirectory(workDir);
@@ -2659,8 +2659,8 @@ void PTextEdit::musrFT()
proc->setStandardErrorFile("musrFT.log");
QString cmd = fAdmin->getExecPath() + "/musrFT";
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.insert("LD_LIBRARY_PATH", env.value("ROOTSYS") + "/lib:" +
env.value("DKS") + "/lib:" +
env.value("LD_LIBRARY_PATH"));
proc->setProcessEnvironment(env);
proc->start(cmd, fMusrFTPrevCmd);

View File

@@ -1,10 +1,14 @@
#---------------------------------------------------------------------
# README
# Andreas Suter, 2010/10/06
# Andreas Suter, 2018/05/22
#---------------------------------------------------------------------
musrgui requires >= Qt 3.3.x and < Qt 4. If you have Qt 4.6.y or newer,
use musredit instead.
use musredit instead. If you have Qt 5.x, use musredit_qt5 instead.
musrgui by now should be considered as not only outdated, but it will
be hard to find a platform on which it is still compiling. So, if there
is no urgent need: don't use it!
#---------------------------------------------------------------------
# this is the end ...

View File

@@ -645,6 +645,169 @@ Int_t main(Int_t argc, Char_t *argv[])
}
}
}
break;
case MSR_FITTYPE_BNMR:
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
// handle forward histo
// get histo number
histoNo = runList->at(i).GetForwardHistoNo();
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 0);
// set data range as well if firstGoodBinOffset is given
if (firstGoodBinOffsetPresent) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 0);
runList->at(i).SetDataRange(end, 1);
}
// handle backward histo
// get histo number
histoNo = runList->at(i).GetBackwardHistoNo();
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 1);
// set data range as well if firstGoodBinOffset is given
if (firstGoodBinOffsetPresent) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 2);
runList->at(i).SetDataRange(end, 3);
}
} else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // addruns / no grouping
// handle forward histo
// get histo number
histoNo = runList->at(i).GetForwardHistoNo();
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 0);
// set data range as well if firstGoodBinOffset is given
if (firstGoodBinOffsetPresent) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 0);
runList->at(i).SetDataRange(end, 1);
}
// handle addruns
for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
runName = runList->at(i).GetRunName(j);
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetAddT0Bin(t0Bin, j-1, 0);
}
// handle backward histo
// get histo number
histoNo = runList->at(i).GetBackwardHistoNo();
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 1);
// set data range as well if firstGoodBinOffset is given
if (firstGoodBinOffsetPresent) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 2);
runList->at(i).SetDataRange(end, 3);
}
// handle addruns
for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
runName = runList->at(i).GetRunName(j);
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetAddT0Bin(t0Bin, j-1, 1);
}
} else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) { // no addruns / grouping
// handle forward histo
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
// get histo number
histoNo = runList->at(i).GetForwardHistoNo(j);
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 2*j);
if (firstGoodBinOffsetPresent && (j==0)) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 0);
runList->at(i).SetDataRange(end, 1);
}
}
// handle backward histo
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
// get histo number
histoNo = runList->at(i).GetBackwardHistoNo(j);
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 2*j+1);
if (firstGoodBinOffsetPresent && (j==0)) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 2);
runList->at(i).SetDataRange(end, 3);
}
}
} else { // addruns / grouping
// handle forward histo
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
// get histo number
histoNo = runList->at(i).GetForwardHistoNo(j);
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 2*j);
if (firstGoodBinOffsetPresent && (j==0)) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 0);
runList->at(i).SetDataRange(end, 1);
}
// handle addruns
for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
runName = runList->at(i).GetRunName(k);
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j);
}
}
// handle backward histo
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
// get histo number
histoNo = runList->at(i).GetBackwardHistoNo(j);
runName = runList->at(i).GetRunName();
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetT0Bin(t0Bin, 2*j+1);
if (firstGoodBinOffsetPresent && (j==0)) {
start = t0Bin + firstGoodBinOffset;
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
runList->at(i).SetDataRange(start, 2);
runList->at(i).SetDataRange(end, 3);
}
// handle addruns
for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
runName = runList->at(i).GetRunName(k);
// get bin position of maximal data
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
// set t0 to maximum data position
runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j+1);
}
}
}
break;
default:
break;
@@ -806,6 +969,7 @@ Int_t main(Int_t argc, Char_t *argv[])
}
break;
case MSR_FITTYPE_ASYM:
case MSR_FITTYPE_BNMR:
case MSR_FITTYPE_ASYM_RRF:
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
// feed necessary data forward

View File

@@ -100,10 +100,13 @@ PSimulateMuTransition::PSimulateMuTransition(UInt_t seed)
}
fNmuons = 100; // number of muons to simulate
fNshowProgress = 100; // print progress on screen every fNshowProgress events
fMuPrecFreq34 = 4463.; // vacuum Mu hyperfine coupling constant
fMuPrecFreq12 = 0.; // Mu precession frequency of a 12 transition
fMuPrecFreq23 = 0.; // Mu precession frequency of a 23 transition
fMuPrecFreq14 = 0.; // Mu precession frequency of a 14 transition
fMuPrecFreq13 = 0.; // Mu precession frequency of a 13 transition
fMuPrecFreq24 = 0.; // Mu precession frequency of a 24 transition
fMuonPrecFreq = 0.; // muon precession frequency
fBfield = 0.01; // magnetic field (T)
fCaptureRate = 0.01; // Mu+ capture rate (MHz)
@@ -118,6 +121,9 @@ PSimulateMuTransition::PSimulateMuTransition(UInt_t seed)
fMuFractionState34 = 0.25;
fMuFractionState23 = 0.25;
fMuFractionState14 = 0.25;
fMuFractionState13 = 0.;
fMuFractionState24 = 0.;
fDebugFlag = kFALSE;
}
@@ -147,6 +153,8 @@ void PSimulateMuTransition::PrintSettings() const
cout << endl << "Mu0 precession frequency 34 (MHz) = " << fMuPrecFreq34;
cout << endl << "Mu0 precession frequency 23 (MHz) = " << fMuPrecFreq23;
cout << endl << "Mu0 precession frequency 14 (MHz) = " << fMuPrecFreq14;
cout << endl << "Mu0 precession frequency 13 (MHz) = " << fMuPrecFreq13;
cout << endl << "Mu0 precession frequency 24 (MHz) = " << fMuPrecFreq24;
cout << endl << "Mu+ precession frequency (MHz) = " << fMuonGyroRatio * fBfield;
cout << endl << "B field (T) = " << fBfield;
cout << endl << "Mu+ electron capture rate (MHz) = " << fCaptureRate;
@@ -164,7 +172,10 @@ void PSimulateMuTransition::PrintSettings() const
cout << endl << "Muonium fraction state34 = " << fMuFractionState34;
cout << endl << "Muonium fraction state23 = " << fMuFractionState23;
cout << endl << "Muonium fraction state14 = " << fMuFractionState14;
cout << endl << "Muonium fraction state13 = " << fMuFractionState13;
cout << endl << "Muonium fraction state24 = " << fMuFractionState24;
cout << endl << "Number of particles to simulate = " << fNmuons;
cout << endl << "Print progress on screen frequency = " << fNshowProgress;
cout << endl << "Initial muon spin phase (degree) = " << fInitialPhase;
cout << endl << "Debug flag = " << fDebugFlag;
cout << endl << endl;
@@ -224,7 +235,7 @@ void PSimulateMuTransition::Run(TH1F *histoForward, TH1F *histoBackward)
else
histoBackward->Fill(fMuonDecayTime*1000., 1. - fAsymmetry*TMath::Cos(fMuonPhase));
if ( (i%100000) == 0) cout << "number of events processed: " << i << endl;
if ( (i%fNshowProgress) == 0) cout << "number of events processed: " << i << endl;
}
cout << "number of events processed: " << i << endl;
return;
@@ -291,11 +302,14 @@ TComplex PSimulateMuTransition::GTFunction(const Double_t &time, const TString c
complexPol = TComplex::Exp(-TComplex::I()*twoPi*fMuonPrecFreq*time);
else{
complexPol =
(fMuFractionState12 * TComplex::Exp(TComplex::I()*twoPi*fMuPrecFreq12*time) +
(fMuFractionState12 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq12*time) +
fMuFractionState34 * TComplex::Exp(-TComplex::I()*twoPi*fMuPrecFreq34*time))
+
(fMuFractionState23 * TComplex::Exp(TComplex::I()*twoPi*fMuPrecFreq23*time) +
fMuFractionState14 * TComplex::Exp(TComplex::I()*twoPi*fMuPrecFreq14*time));
(fMuFractionState23 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq23*time) +
fMuFractionState14 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq14*time))
+
(fMuFractionState13 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq13*time) +
fMuFractionState24 * TComplex::Exp(+TComplex::I()*twoPi*fMuPrecFreq24*time));
}
return complexPol;
@@ -354,9 +368,6 @@ Double_t PSimulateMuTransition::GTSpinFlip(const Double_t &time)
* after ionization process is given by Px(t_i+1)*Px(t_i).
* 4) get the next electron capture time, continue until t_d is reached.
*
* <p> For isotropic muonium, TF:
* nu_12 and nu_34 with equal probabilities, probability for both states fMuFractionState12
* ni_23 and nu_14 with equal probabilities, probability for both states fMuFractionState23
*
* <p>Calculates Mu0 polarization in x direction during cyclic charge exchange.
* See M. Senba, J.Phys. B23, 1545 (1990), equations (9), (11)

View File

@@ -47,13 +47,16 @@ class PSimulateMuTransition : public TObject
virtual ~PSimulateMuTransition();
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 SetNmuons(Int_t value) { fNmuons = value; } //!< number of muons
virtual void SetNshowProgress(Int_t value) { fNshowProgress = value; } //!< frequency of output on screen how many muons have been processed
virtual void SetDebugFlag(Bool_t value) { fDebugFlag = value; } //!< debug flag
virtual void SetBfield(Double_t value) { fBfield = value; } //!< sets magnetic field (T)
virtual void SetMuPrecFreq12(Double_t value) { fMuPrecFreq12 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq34(Double_t value) { fMuPrecFreq34 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq23(Double_t value) { fMuPrecFreq23 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq14(Double_t value) { fMuPrecFreq14 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq13(Double_t value) { fMuPrecFreq13 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetMuPrecFreq24(Double_t value) { fMuPrecFreq24 = value; } //!< sets Mu transition frequency (MHz)
virtual void SetCaptureRate(Double_t value){ fCaptureRate = value; } //!< sets Mu+ electron capture rate (MHz)
virtual void SetIonizationRate(Double_t value){ fIonizationRate = value; } //!< sets Mu0 ionization rate (MHz)
virtual void SetSpinFlipRate(Double_t value){ fSpinFlipRate = value; } //!< sets Mu0 spin flip rate (MHz)
@@ -63,6 +66,8 @@ class PSimulateMuTransition : public TObject
virtual void SetMuFractionState34(Double_t value){ fMuFractionState34 = value; }
virtual void SetMuFractionState23(Double_t value){ fMuFractionState23 = value; }
virtual void SetMuFractionState14(Double_t value){ fMuFractionState14 = value; }
virtual void SetMuFractionState13(Double_t value){ fMuFractionState13 = value; }
virtual void SetMuFractionState24(Double_t value){ fMuFractionState24 = value; }
virtual Bool_t IsValid() { return fValid; }
virtual void SetSeed(UInt_t seed);
@@ -81,6 +86,8 @@ class PSimulateMuTransition : public TObject
Double_t fMuPrecFreq34; //!< Mu transition frequency 34 (MHz)
Double_t fMuPrecFreq23; //!< Mu transition frequency 23 (MHz)
Double_t fMuPrecFreq14; //!< Mu transition frequency 14 (MHz)
Double_t fMuPrecFreq13; //!< Mu transition frequency 13 (MHz)
Double_t fMuPrecFreq24; //!< Mu transition frequency 24 (MHz)
Double_t fMuonPrecFreq; //!< muon precession frequency (MHz)
Double_t fCaptureRate; //!< Mu+ electron capture rate (MHz)
Double_t fIonizationRate; //!< Mu0 ionization rate (MHz)
@@ -94,8 +101,11 @@ class PSimulateMuTransition : public TObject
Double_t fMuFractionState34; //!< fraction of Mu in state 34
Double_t fMuFractionState23; //!< fraction of Mu in state 23
Double_t fMuFractionState14; //!< fraction of Mu in state 14
Int_t fNmuons; //!< number of muons to simulate
Bool_t fDebugFlag; //!< debug flag
Double_t fMuFractionState13; //!< fraction of Mu in state 13
Double_t fMuFractionState24; //!< fraction of Mu in state 24
Int_t fNmuons; //!< number of muons to simulate
Int_t fNshowProgress; //!< output on screen how many muons have been processed
Bool_t fDebugFlag; //!< debug flag
virtual Double_t NextEventTime(const Double_t &EventRate);
// virtual Double_t PrecessionPhase(const Double_t &time, const TString chargeState);

View File

@@ -63,32 +63,47 @@ void runMuSimulation()
Double_t T = 300.; //temperature
Double_t EA = 100; //activation energy (meV)
Double_t spinFlipRate = 0.01; //if spinFlipRate > 0.001 only spin-flip processes will be simulated
Double_t capRate = 0.0001;//*sqrt(T/200.); //assume that capture rate varies as sqrt(T), capRate = sigma*v*p , v ~ sqrt(T)
Double_t capRate = 0.001;//*sqrt(T/200.); //assume that capture rate varies as sqrt(T), capRate = sigma*v*p , v ~ sqrt(T)
Double_t preFac = 6.7e7;
Double_t ionRate; //assume Arrhenius behaviour ionRate = preFac*exp(-EA/kT)
ionRate = 0.1; //2.9e7 * exp(-EA/(0.08625*T)); // Ge: 2.9*10^7MHz "attempt" frequency; 1K = 0.08625 meV
Double_t B = 106.5; //field in G
Double_t Bvar = 0.; //field variance
Double_t Freq12 = 40.433; //Mu freq of the 12 transition
Double_t Freq34 = 59.567; //Mu freq of the 34 transition
Double_t Freq23 = 256.245; //Mu freq of the 23 transition
Double_t Freq14 = 356.245; //Mu freq of the 14 transition
Double_t MuFrac = 1.0; //total Mu fraction
Double_t MuFrac12 = 0.487; //weight of transition 12
Double_t MuFrac34 = 0.487; //weight of transition 34
Double_t MuFrac23 = 0.013; //weight of transition 23
Double_t MuFrac14 = 0.013; //weight of transition 14
Int_t Nmuons = 5e6; //number of muons
Double_t Asym = 0.27; //muon decay asymmetry
Int_t debugFlag = 0; //print debug information on screen
ionRate = 0.001; //preFac * exp(-EA/(0.08625*T)); // Ge: 2.9*10^7MHz "attempt" frequency; 1K = 0.08625 meV
Double_t B = 100.0; //field in G
Double_t Bvar = 0.; //field variance
Double_t Freq12 = 40.023; //Mu freq of the 12 transition
Double_t Freq34 = 59.977; //Mu freq of the 34 transition
Double_t Freq23 = 238.549; //Mu freq of the 23 transition
Double_t Freq14 = 338.549; //Mu freq of the 14 transition
Double_t Freq13 = 278.571; //Mu freq of the 23 transition
Double_t Freq24 = 325.165; //Mu freq of the 14 transition
Double_t MuFrac = 1.0; //total Mu fraction
Double_t MuFrac12 = 0.486; //weight of transition 12
Double_t MuFrac34 = 0.486; //weight of transition 34
Double_t MuFrac23 = 0.014; //weight of transition 23
Double_t MuFrac14 = 0.014; //weight of transition 14
Double_t MuFrac13 = 0.0; //weight of transition 13
Double_t MuFrac24 = 0.0; //weight of transition 24
Int_t Nmuons = 5e6; //number of muons
Int_t NshowProgress = 1e4; //frequency to show progress on screen
Double_t Asym = 0.27; //muon decay asymmetry
Int_t debugFlag = 0; //print debug information on screen
TTimeStamp *timeStampStart = new TTimeStamp();
cout << endl << "Simulation started on:" << endl;
timeStampStart->Print("l");
cout << endl;
histogramFileName = TString("0");
histogramFileName += runNo;
histogramFileName += TString(".root");
sprintf(titleStr,"- complexMuPol, A0 100MHz, Mu-frac %3.2f, Mu12 %6.2f MHz(%3.2f), Mu23 %6.2f MHz(%3.2f), ionRate %8.3f MHz, capRate %6.3f MHz, SF rate %6.3f MHz, %5.1f G", MuFrac, Freq12, MuFrac12/2, Freq23, MuFrac23/2, ionRate, capRate, spinFlipRate, B);
sprintf(titleStr,"- complexMuPol, A0 100MHz, Mu-frac %3.2f, Mu12 %6.2f MHz(%3.2f), Mu23 %6.2f MHz(%3.2f), ionRate %8.3f MHz, capRate %6.3f MHz, SF rate %6.3f MHz, %5.1f G", MuFrac, Freq12, MuFrac12, Freq23, MuFrac23, ionRate, capRate, spinFlipRate, B);
runTitle = TString("0");
runTitle += runNo;
runTitle += TString(titleStr);
cout << runTitle << endl << endl;
PSimulateMuTransition *simulateMuTransition = new PSimulateMuTransition();
if (!simulateMuTransition->IsValid()){
@@ -99,15 +114,20 @@ void runMuSimulation()
simulateMuTransition->SetMuPrecFreq34(Freq34); // MHz
simulateMuTransition->SetMuPrecFreq23(Freq23); // MHz
simulateMuTransition->SetMuPrecFreq14(Freq14); // MHz
simulateMuTransition->SetMuPrecFreq13(Freq13); // MHz
simulateMuTransition->SetMuPrecFreq24(Freq24); // MHz
simulateMuTransition->SetMuFraction(MuFrac); // initial Mu fraction
simulateMuTransition->SetMuFractionState12(MuFrac12);
simulateMuTransition->SetMuFractionState34(MuFrac34);
simulateMuTransition->SetMuFractionState23(MuFrac23);
simulateMuTransition->SetMuFractionState14(MuFrac14);
simulateMuTransition->SetMuFractionState14(MuFrac14);
simulateMuTransition->SetMuFractionState13(MuFrac13);
simulateMuTransition->SetMuFractionState24(MuFrac24);
simulateMuTransition->SetBfield(B/10000.); // Tesla
simulateMuTransition->SetCaptureRate(capRate); // MHz
simulateMuTransition->SetIonizationRate(ionRate); // MHz
simulateMuTransition->SetSpinFlipRate(spinFlipRate); // MHz
simulateMuTransition->SetNshowProgress(NshowProgress);
simulateMuTransition->SetNmuons(Nmuons);
simulateMuTransition->SetDecayAsymmetry(Asym);
simulateMuTransition->SetDebugFlag(debugFlag); // to print time and phase during charge-changing cycle
@@ -179,12 +199,18 @@ void runMuSimulation()
header->Set("Simulation/Mu0 Precession frequency 34", Freq34);
header->Set("Simulation/Mu0 Precession frequency 23", Freq23);
header->Set("Simulation/Mu0 Precession frequency 14", Freq14);
header->Set("Simulation/Mu0 Precession frequency 13", Freq13);
header->Set("Simulation/Mu0 Precession frequency 24", Freq24);
header->Set("Simulation/Mu0 Fraction", MuFrac);
header->Set("Simulation/Mu0 Fraction 12", MuFrac12);
header->Set("Simulation/Mu0 Fraction 34", MuFrac34);
header->Set("Simulation/Mu0 Fraction 23", MuFrac23);
header->Set("Simulation/Mu0 Fraction 14", MuFrac14);
header->Set("Simulation/muon Capture Rate", capRate);
header->Set("Simulation/Mu0 Fraction 13", MuFrac13);
header->Set("Simulation/Mu0 Fraction 24", MuFrac24);
header->Set("Simulation/Mu0 Activation Energy", EA);
header->Set("Simulation/Mu0 Activation PreFactor", preFac);
header->Set("Simulation/Mux Capture Rate", capRate);
header->Set("Simulation/Mu0 Ionization Rate", ionRate);
header->Set("Simulation/Mu0 Spin Flip Rate", spinFlipRate);
header->Set("Simulation/Number of Muons", Nmuons);
@@ -206,7 +232,7 @@ void runMuSimulation()
histo[i] = new TH1F(str, str, 18001, -0.5, 18000.5);
}
for (i=0; i<NDECAYHISTS; i++)
for (UInt_t i=0; i<NDECAYHISTS; i++)
decayAnaModule->Add(histo[i]);
// run simulation
@@ -230,6 +256,11 @@ void runMuSimulation()
gRunHeader->Write();
fout->Close();
cout << "Histograms written to " << histogramFileName.Data() << endl;
cout << endl << "Simulation stopped on:" << endl;
TTimeStamp *timeStampEnd = new TTimeStamp();
timeStampEnd->Print("l");
cout << endl;
// delete fout;
// delete header;