Merged muonspin/musrfit/root6 into master

This commit is contained in:
Zaher Salman 2017-02-06 13:52:26 +01:00
commit ddfb845755
9 changed files with 84 additions and 16 deletions

View File

@ -62,6 +62,31 @@ PSubTextEdit::PSubTextEdit(PAdmin *admin, QWidget *parent) :
{ {
} }
//----------------------------------------------------------------------------------------------------
/**
* @brief PSubTextEdit::getFitType
* @return
*/
int PSubTextEdit::getFitType()
{
QString str = toPlainText();
int idx = str.indexOf("fittype");
if (idx == -1)
return -1;
bool ok;
for (int i=idx+7; i<str.length(); i++) {
if (str[i] != ' ') {
idx = QString(str[i]).toInt(&ok);
if (!ok)
idx = -1;
break;
}
}
return idx;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
/** /**
* <p>Starts the msr-title input dialog window. * <p>Starts the msr-title input dialog window.

View File

@ -46,6 +46,7 @@ class PSubTextEdit : public QPlainTextEdit
public: public:
PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0); PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0);
virtual ~PSubTextEdit() {} virtual ~PSubTextEdit() {}
int getFitType();
public slots: public slots:
void insertTitle(); void insertTitle();

View File

@ -1700,7 +1700,8 @@ void PTextEdit::musrCalcChisq()
return; return;
int result = 0; int result = 0;
if (fAdmin->getEstimateN0Flag()) int fittype = currentEditor()->getFitType();
if (fAdmin->getEstimateN0Flag() && ((fittype==0) || (fittype==4)))
result = QMessageBox::question(this, "Estimate N0 active", result = QMessageBox::question(this, "Estimate N0 active",
"Do you wish a chisq/mlh evaluation with an automatic N0 estimate?", "Do you wish a chisq/mlh evaluation with an automatic N0 estimate?",
QMessageBox::Yes, QMessageBox::No); QMessageBox::Yes, QMessageBox::No);
@ -1722,7 +1723,7 @@ void PTextEdit::musrCalcChisq()
cmd.append(str); cmd.append(str);
cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() );
cmd.append("--chisq-only"); cmd.append("--chisq-only");
if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes)) if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes) && ((fittype==0) || (fittype==4)))
cmd.append("--estimateN0"); cmd.append("--estimateN0");
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);

View File

@ -62,6 +62,31 @@ PSubTextEdit::PSubTextEdit(PAdmin *admin, QWidget *parent) :
{ {
} }
//----------------------------------------------------------------------------------------------------
/**
* @brief PSubTextEdit::getFitType
* @return
*/
int PSubTextEdit::getFitType()
{
QString str = toPlainText();
int idx = str.indexOf("fittype");
if (idx == -1)
return -1;
bool ok;
for (int i=idx+7; i<str.length(); i++) {
if (str[i] != ' ') {
idx = QString(str[i]).toInt(&ok);
if (!ok)
idx = -1;
break;
}
}
return idx;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
/** /**
* <p>Starts the msr-title input dialog window. * <p>Starts the msr-title input dialog window.

View File

@ -46,6 +46,7 @@ class PSubTextEdit : public QPlainTextEdit
public: public:
PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0); PSubTextEdit(PAdmin *admin = 0, QWidget *parent = 0);
virtual ~PSubTextEdit() {} virtual ~PSubTextEdit() {}
int getFitType();
public slots: public slots:
void insertTitle(); void insertTitle();

View File

@ -1727,7 +1727,8 @@ void PTextEdit::musrCalcChisq()
return; return;
int result = 0; int result = 0;
if (fAdmin->getEstimateN0Flag()) int fittype = currentEditor()->getFitType();
if (fAdmin->getEstimateN0Flag() && ((fittype==0) || (fittype==4)))
result = QMessageBox::question(this, "Estimate N0 active", result = QMessageBox::question(this, "Estimate N0 active",
"Do you wish a chisq/mlh evaluation with an automatic N0 estimate?"); "Do you wish a chisq/mlh evaluation with an automatic N0 estimate?");
@ -1748,7 +1749,7 @@ void PTextEdit::musrCalcChisq()
cmd.append(str); cmd.append(str);
cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() ); cmd.append(QFileInfo(*fFilenames.find( currentEditor())).fileName() );
cmd.append("--chisq-only"); cmd.append("--chisq-only");
if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes)) if (fAdmin->getEstimateN0Flag() && (result == QMessageBox::Yes) && ((fittype==0) || (fittype==4)))
cmd.append("--estimateN0"); cmd.append("--estimateN0");
PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd); PFitOutputHandler fitOutputHandler(QFileInfo(*fFilenames.find( currentEditor() )).absolutePath(), cmd);
fitOutputHandler.setModal(true); fitOutputHandler.setModal(true);

View File

@ -97,4 +97,6 @@ install: all
ifeq ($(OS),LINUX) ifeq ($(OS),LINUX)
cp -pv $(SHLIB) $(ROOTSYS)/lib cp -pv $(SHLIB) $(ROOTSYS)/lib
cp -pv PSimulateMuTransition.h $(ROOTSYS)/include cp -pv PSimulateMuTransition.h $(ROOTSYS)/include
# for root6
cp -pv PSimulateMuTransitionDict_rdict.pcm $(ROOTSYS)/lib
endif endif

View File

@ -28,7 +28,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#ifdef __CINT__ // changed for root6
#ifdef __CLING__
#pragma link off all globals; #pragma link off all globals;
#pragma link off all classes; #pragma link off all classes;

View File

@ -27,19 +27,27 @@
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
//
// either do
// root> .L runMuSimulation.C
// root> runMuSimulation()
//
// or
// root> .x runMuSimulation.C
//
#include "TMusrRunHeader.h"
#include "PSimulateMuTransition.h"
#include "/apps/cern/root-git/include/TMusrRunHeader.h"
#define NDECAYHISTS 2 #define NDECAYHISTS 2
void runMuSimulation() void runMuSimulation()
{ {
// load library // load libraries during root startup, defined in rootlogon.C
gSystem->Load("$ROOTSYS/lib/libPSimulateMuTransition");
// load TMusrRunHeader class if not already done during root startup // gSystem->Load("$ROOTSYS/lib/libPSimulateMuTransition");
if (!TClass::GetDict("TMusrRunHeader")) { // gSystem->Load("$ROOTSYS/lib/libTMusrRunHeader.so");
gROOT->LoadMacro("$(ROOTSYS)/lib/libTMusrRunHeader.so");
}
char titleStr[256]; char titleStr[256];
TFolder *histosFolder; TFolder *histosFolder;
@ -57,7 +65,7 @@ void runMuSimulation()
Double_t spinFlipRate = 0.01; //if spinFlipRate > 0.001 only spin-flip processes will be simulated 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.0001;//*sqrt(T/200.); //assume that capture rate varies as sqrt(T), capRate = sigma*v*p , v ~ sqrt(T)
Double_t ionRate; //assume Arrhenius behaviour ionRate = preFac*exp(-EA/kT) Double_t ionRate; //assume Arrhenius behaviour ionRate = preFac*exp(-EA/kT)
ionRate = 0.0001; //2.9e7 * exp(-EA/(0.08625*T)); // Ge: 2.9*10^7MHz "attempt" frequency; 1K = 0.08625 meV 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 B = 106.5; //field in G
Double_t Bvar = 0.; //field variance Double_t Bvar = 0.; //field variance
Double_t Freq12 = 40.433; //Mu freq of the 12 transition Double_t Freq12 = 40.433; //Mu freq of the 12 transition
@ -222,7 +230,10 @@ void runMuSimulation()
gRunHeader->Write(); gRunHeader->Write();
fout->Close(); fout->Close();
cout << "Histograms written to " << histogramFileName.Data() << endl; cout << "Histograms written to " << histogramFileName.Data() << endl;
delete fout;
delete [] histo; // delete fout;
// delete header;
// delete histo[0];
// delete histo[1];
// delete gRunHeader;
} }