changed variables to comply with the ROOT standards. Error messages now sent to stderr rather than stdout
This commit is contained in:
parent
e14feae99d
commit
2a03bb7f61
@ -65,7 +65,7 @@ using namespace std;
|
||||
* \param runListCollection
|
||||
* \param chisq_only
|
||||
*/
|
||||
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, bool chisq_only) :
|
||||
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only) :
|
||||
fChisqOnly(chisq_only), fRunInfo(runInfo)
|
||||
{
|
||||
fConverged = false;
|
||||
@ -128,22 +128,22 @@ PFitter::~PFitter()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::DoFit()
|
||||
Bool_t PFitter::DoFit()
|
||||
{
|
||||
// feed minuit parameters
|
||||
SetParameters();
|
||||
|
||||
// check if only chisq/maxLH shall be calculated once
|
||||
if (fChisqOnly) {
|
||||
std::vector<double> param = fMnUserParams.Params();
|
||||
std::vector<double> error = fMnUserParams.Errors();
|
||||
int usedParams = 0;
|
||||
for (unsigned int i=0; i<error.size(); i++) {
|
||||
std::vector<Double_t> param = fMnUserParams.Params();
|
||||
std::vector<Double_t> error = fMnUserParams.Errors();
|
||||
Int_t usedParams = 0;
|
||||
for (UInt_t i=0; i<error.size(); i++) {
|
||||
if (error[i] != 0.0)
|
||||
usedParams++;
|
||||
}
|
||||
int ndf = fFitterFcn->GetTotalNoOfFittedBins() - usedParams;
|
||||
double val = (*fFitterFcn)(param);
|
||||
Int_t ndf = fFitterFcn->GetTotalNoOfFittedBins() - usedParams;
|
||||
Double_t val = (*fFitterFcn)(param);
|
||||
if (fUseChi2) {
|
||||
cout << endl << endl << ">> chisq = " << val << ", NDF = " << ndf << ", chisq/NDF = " << val/ndf;
|
||||
} else { // max. log likelihood
|
||||
@ -159,32 +159,32 @@ bool PFitter::DoFit()
|
||||
else
|
||||
cout << endl << "Maximum Likelihood fit will be executed" << endl;
|
||||
|
||||
bool status = true;
|
||||
Bool_t status = true;
|
||||
// init positive errors to default false, if minos is called, it will be set true there
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, false);
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i<fCmdList.size(); i++) {
|
||||
for (UInt_t i=0; i<fCmdList.size(); i++) {
|
||||
switch (fCmdList[i]) {
|
||||
case PMN_INTERACTIVE:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command INTERACTIVE is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command INTERACTIVE is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_CONTOURS:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command CONTOURS is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command CONTOURS is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_EIGEN:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command EIGEN is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command EIGEN is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_HESSE:
|
||||
status = ExecuteHesse();
|
||||
break;
|
||||
case PMN_MACHINE_PRECISION:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command MACHINE_PRECISION is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command MACHINE_PRECISION is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_MIGRAD:
|
||||
status = ExecuteMigrad();
|
||||
@ -196,14 +196,14 @@ bool PFitter::DoFit()
|
||||
status = ExecuteMinos();
|
||||
// set positive errors true if minos has been successfull
|
||||
if (status) {
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PMN_PLOT:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command PLOT is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command PLOT is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_SAVE:
|
||||
status = ExecuteSave();
|
||||
@ -214,19 +214,20 @@ bool PFitter::DoFit()
|
||||
status = ExecuteSimplex();
|
||||
break;
|
||||
case PMN_USER_COVARIANCE:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command USER_COVARIANCE is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command USER_COVARIANCE is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_USER_PARAM_STATE:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command USER_PARAM_STATE is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command USER_PARAM_STATE is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
case PMN_PRINT:
|
||||
cout << endl << "**WARNING** from PFitter::DoFit() : the command PRINT is not yet implemented.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** from PFitter::DoFit() : the command PRINT is not yet implemented.";
|
||||
cerr << endl;
|
||||
break;
|
||||
default:
|
||||
cout << endl << "**PANIC ERROR**: PFitter::DoFit(): You should never have reached this point" << endl;
|
||||
cerr << endl << "**PANIC ERROR**: PFitter::DoFit(): You should never have reached this point";
|
||||
cerr << endl;
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
@ -252,7 +253,7 @@ bool PFitter::DoFit()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::CheckCommands()
|
||||
Bool_t PFitter::CheckCommands()
|
||||
{
|
||||
fIsValid = true;
|
||||
|
||||
@ -328,11 +329,11 @@ bool PFitter::CheckCommands()
|
||||
} else if (it->fLine.Contains("PRINT")) {
|
||||
fCmdList.push_back(PMN_PRINT);
|
||||
} else { // unkown command
|
||||
cout << endl << "FATAL ERROR:";
|
||||
cout << endl << "PFitter::CheckCommands(): In line " << it->fLineNo << " an unkown command is found:";
|
||||
cout << endl << " " << it->fLine.Data();
|
||||
cout << endl << "Will stop ...";
|
||||
cout << endl;
|
||||
cerr << endl << "**FATAL ERROR**";
|
||||
cerr << endl << "PFitter::CheckCommands(): In line " << it->fLineNo << " an unkown command is found:";
|
||||
cerr << endl << " " << it->fLine.Data();
|
||||
cerr << endl << "Will stop ...";
|
||||
cerr << endl;
|
||||
fIsValid = false;
|
||||
}
|
||||
}
|
||||
@ -347,9 +348,9 @@ bool PFitter::CheckCommands()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::SetParameters()
|
||||
Bool_t PFitter::SetParameters()
|
||||
{
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
// check if parameter is fixed
|
||||
if (fParams[i].fStep == 0.0) { // add fixed parameter
|
||||
fMnUserParams.Add(fParams[i].fName.Data(), fParams[i].fValue);
|
||||
@ -380,11 +381,12 @@ bool PFitter::SetParameters()
|
||||
//cout << endl;
|
||||
|
||||
// check if there is an unused parameter, if so, fix it
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
// parameter not used in the whole theory and not already fixed!!
|
||||
if ((fRunInfo->ParameterInUse(i) == 0) && (fParams[i].fStep != 0.0)) {
|
||||
fMnUserParams.Fix(i); // fix the unused parameter so that minuit will not vary it
|
||||
cout << endl << "**WARNING** : Parameter No " << i+1 << " is not used at all, will fix it" << endl;
|
||||
cerr << endl << "**WARNING** : Parameter No " << i+1 << " is not used at all, will fix it";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,7 +400,7 @@ bool PFitter::SetParameters()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteHesse()
|
||||
Bool_t PFitter::ExecuteHesse()
|
||||
{
|
||||
cout << "PFitter::ExecuteHesse(): will call hesse ..." << endl;
|
||||
|
||||
@ -410,14 +412,14 @@ bool PFitter::ExecuteHesse()
|
||||
ROOT::Minuit2::MnHesse hesse;
|
||||
|
||||
// specify maximal number of function calls
|
||||
unsigned int maxfcn = numeric_limits<unsigned int>::max();
|
||||
UInt_t maxfcn = numeric_limits<UInt_t>::max();
|
||||
|
||||
// call hesse
|
||||
ROOT::Minuit2::MnUserParameterState mnState = hesse((*fFitterFcn), fMnUserParams, maxfcn);
|
||||
|
||||
if (!mnState.IsValid()) {
|
||||
cout << endl << "**WARNING** PFitter::ExecuteHesse(): Hesse encountered some problems!";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** PFitter::ExecuteHesse(): Hesse encountered some problems!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -428,7 +430,7 @@ bool PFitter::ExecuteHesse()
|
||||
fMnUserParamState = new ROOT::Minuit2::MnUserParameterState(mnState);
|
||||
|
||||
// fill parabolic errors
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamStep(i, mnState.Error(i));
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, false);
|
||||
}
|
||||
@ -443,7 +445,7 @@ bool PFitter::ExecuteHesse()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteMigrad()
|
||||
Bool_t PFitter::ExecuteMigrad()
|
||||
{
|
||||
cout << "PFitter::ExecuteMigrad(): will call migrad ..." << endl;
|
||||
|
||||
@ -457,12 +459,13 @@ bool PFitter::ExecuteMigrad()
|
||||
|
||||
// minimize
|
||||
// maxfcn is MINUIT2 Default maxfcn
|
||||
unsigned int maxfcn = numeric_limits<unsigned int>::max();
|
||||
UInt_t maxfcn = numeric_limits<UInt_t>::max();
|
||||
// tolerance = MINUIT2 Default tolerance
|
||||
double tolerance = 0.1;
|
||||
Double_t tolerance = 0.1;
|
||||
ROOT::Minuit2::FunctionMinimum min = migrad(maxfcn, tolerance);
|
||||
if (!min.IsValid()) {
|
||||
cout << endl << "**WARNING**: PFitter::ExecuteMigrad(): Fit did not converge, sorry ...";
|
||||
cerr << endl << "**WARNING**: PFitter::ExecuteMigrad(): Fit did not converge, sorry ...";
|
||||
cerr << endl;
|
||||
fIsValid = false;
|
||||
return false;
|
||||
}
|
||||
@ -480,17 +483,17 @@ bool PFitter::ExecuteMigrad()
|
||||
fMnUserParamState = new ROOT::Minuit2::MnUserParameterState(min.UserState());
|
||||
|
||||
// fill run info
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
|
||||
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, false);
|
||||
}
|
||||
|
||||
// handle statistics
|
||||
double minVal = min.Fval();
|
||||
unsigned int ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
Double_t minVal = min.Fval();
|
||||
UInt_t ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
// subtract number of varied parameters from total no of fitted bins -> ndf
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
if (min.UserState().Error(i) != 0.0)
|
||||
ndf -= 1;
|
||||
}
|
||||
@ -511,7 +514,7 @@ bool PFitter::ExecuteMigrad()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteMinimize()
|
||||
Bool_t PFitter::ExecuteMinimize()
|
||||
{
|
||||
cout << "PFitter::ExecuteMinimize(): will call minimize ..." << endl;
|
||||
|
||||
@ -525,13 +528,14 @@ bool PFitter::ExecuteMinimize()
|
||||
|
||||
// minimize
|
||||
// maxfcn is MINUIT2 Default maxfcn
|
||||
unsigned int maxfcn = numeric_limits<unsigned int>::max();
|
||||
UInt_t maxfcn = numeric_limits<UInt_t>::max();
|
||||
//cout << endl << "maxfcn=" << maxfcn << endl;
|
||||
// tolerance = MINUIT2 Default tolerance
|
||||
double tolerance = 0.1;
|
||||
Double_t tolerance = 0.1;
|
||||
ROOT::Minuit2::FunctionMinimum min = minimize(maxfcn, tolerance);
|
||||
if (!min.IsValid()) {
|
||||
cout << endl << "**WARNING**: PFitter::ExecuteMinimize(): Fit did not converge, sorry ...";
|
||||
cerr << endl << "**WARNING**: PFitter::ExecuteMinimize(): Fit did not converge, sorry ...";
|
||||
cerr << endl;
|
||||
fIsValid = false;
|
||||
return false;
|
||||
}
|
||||
@ -549,17 +553,17 @@ bool PFitter::ExecuteMinimize()
|
||||
fMnUserParamState = new ROOT::Minuit2::MnUserParameterState(min.UserState());
|
||||
|
||||
// fill run info
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
|
||||
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, false);
|
||||
}
|
||||
|
||||
// handle statistics
|
||||
double minVal = min.Fval();
|
||||
unsigned int ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
Double_t minVal = min.Fval();
|
||||
UInt_t ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
// subtract number of varied parameters from total no of fitted bins -> ndf
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
if (min.UserState().Error(i) != 0.0)
|
||||
ndf -= 1;
|
||||
}
|
||||
@ -580,21 +584,21 @@ bool PFitter::ExecuteMinimize()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteMinos()
|
||||
Bool_t PFitter::ExecuteMinos()
|
||||
{
|
||||
cout << "PFitter::ExecuteMinos(): will call minos ..." << endl;
|
||||
|
||||
// if already some minimization is done use the minuit2 output as input
|
||||
if (!fFcnMin) {
|
||||
cout << endl << "**ERROR**: MINOS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!";
|
||||
cout << endl;
|
||||
cerr << endl << "**ERROR**: MINOS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if minimum was valid
|
||||
if (!fFcnMin->IsValid()) {
|
||||
cout << endl << "**ERROR**: MINOS cannot started since the previous minimization failed :-(";
|
||||
cout << endl;
|
||||
cerr << endl << "**ERROR**: MINOS cannot started since the previous minimization failed :-(";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -603,7 +607,7 @@ bool PFitter::ExecuteMinos()
|
||||
// make minos analysis
|
||||
ROOT::Minuit2::MnMinos minos((*fFitterFcn), (*fFcnMin));
|
||||
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
// only try to call minos if the parameter is not fixed!!
|
||||
// the 1st condition is from an user fixed variable,
|
||||
// the 2nd condition is from an all together unused variable
|
||||
@ -631,7 +635,7 @@ bool PFitter::ExecuteMinos()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteSave()
|
||||
Bool_t PFitter::ExecuteSave()
|
||||
{
|
||||
// if any minimization was done, otherwise get out immediately
|
||||
if (!fFcnMin) {
|
||||
@ -643,8 +647,8 @@ bool PFitter::ExecuteSave()
|
||||
|
||||
// check if the user parameter state is valid
|
||||
if (!mnState.IsValid()) {
|
||||
cout << endl << "**WARNING** Minuit2 User Parameter State is not valid, i.e. nothing to be saved";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING** Minuit2 User Parameter State is not valid, i.e. nothing to be saved";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -655,8 +659,8 @@ bool PFitter::ExecuteSave()
|
||||
// open minuit2 output file
|
||||
fout.open("MINUIT2.OUTPUT", iostream::out);
|
||||
if (!fout.is_open()) {
|
||||
cout << endl << "**ERROR** PFitter::ExecuteSave() couldn't open MINUIT2.OUTPUT file";
|
||||
cout << endl;
|
||||
cerr << endl << "**ERROR** PFitter::ExecuteSave() couldn't open MINUIT2.OUTPUT file";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -678,14 +682,14 @@ bool PFitter::ExecuteSave()
|
||||
fout << endl << "-------------------------------------------------------------------------";
|
||||
fout << endl << " Parabolic Minos";
|
||||
fout << endl << " No Name Value Error Negative Positive Limits";
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
// write no
|
||||
fout.setf(ios::right, ios::adjustfield);
|
||||
fout.width(3);
|
||||
fout << endl << i+1 << " ";
|
||||
// write name
|
||||
fout << fParams[i].fName.Data();
|
||||
for (int j=0; j<10-fParams[i].fName.Length(); j++)
|
||||
for (Int_t j=0; j<10-fParams[i].fName.Length(); j++)
|
||||
fout << " ";
|
||||
// write value
|
||||
fout.setf(ios::left, ios::adjustfield);
|
||||
@ -750,9 +754,9 @@ bool PFitter::ExecuteSave()
|
||||
if (mnState.HasCovariance()) {
|
||||
ROOT::Minuit2::MnUserCovariance cov = mnState.Covariance();
|
||||
fout << endl << "from " << cov.Nrow() << " free parameters";
|
||||
for (unsigned int i=0; i<cov.Nrow(); i++) {
|
||||
for (UInt_t i=0; i<cov.Nrow(); i++) {
|
||||
fout << endl;
|
||||
for (unsigned int j=0; j<i; j++) {
|
||||
for (UInt_t j=0; j<i; j++) {
|
||||
fout.setf(ios::left, ios::adjustfield);
|
||||
fout.precision(6);
|
||||
if (cov(i,j) > 0.0) {
|
||||
@ -778,7 +782,7 @@ bool PFitter::ExecuteSave()
|
||||
ROOT::Minuit2::MnUserCovariance cov = mnState.Covariance();
|
||||
PIntVector parNo;
|
||||
fout << endl << " No Global ";
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
// only free parameters, i.e. not fixed, and not unsed ones!
|
||||
if ((fParams[i].fStep != 0) && fRunInfo->ParameterInUse(i) > 0) {
|
||||
fout.setf(ios::left, ios::adjustfield);
|
||||
@ -789,8 +793,8 @@ bool PFitter::ExecuteSave()
|
||||
}
|
||||
// check that there is a correspondens between minuit2 and musrfit book keeping
|
||||
if (parNo.size() != cov.Nrow()) {
|
||||
cout << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): minuit2 and musrfit book keeping to not correspond! Unable to write correlation matrix.";
|
||||
cout << endl;
|
||||
cerr << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): minuit2 and musrfit book keeping to not correspond! Unable to write correlation matrix.";
|
||||
cerr << endl;
|
||||
} else { // book keeping is OK
|
||||
TString title("Minuit2 Output Correlation Matrix for ");
|
||||
title += fRunInfo->GetFileName();
|
||||
@ -798,8 +802,8 @@ bool PFitter::ExecuteSave()
|
||||
title += dt.AsSQLString();
|
||||
TCanvas *ccorr = new TCanvas("ccorr", "title", 500, 500);
|
||||
TH2D *hcorr = new TH2D("hcorr", title, cov.Nrow(), 0.0, cov.Nrow(), cov.Nrow(), 0.0, cov.Nrow());
|
||||
double dval;
|
||||
for (unsigned int i=0; i<cov.Nrow(); i++) {
|
||||
Double_t dval;
|
||||
for (UInt_t i=0; i<cov.Nrow(); i++) {
|
||||
// parameter number
|
||||
fout << endl << " ";
|
||||
fout.setf(ios::left, ios::adjustfield);
|
||||
@ -811,27 +815,27 @@ bool PFitter::ExecuteSave()
|
||||
fout.width(12);
|
||||
fout << corr.GlobalCC()[i];
|
||||
// correlations matrix
|
||||
for (unsigned int j=0; j<cov.Nrow(); j++) {
|
||||
for (UInt_t j=0; j<cov.Nrow(); j++) {
|
||||
fout.setf(ios::left, ios::adjustfield);
|
||||
// fout.precision(4);
|
||||
if (i==j) {
|
||||
fout.width(9);
|
||||
fout << " 1.0 ";
|
||||
hcorr->Fill((double)i,(double)i,1.0);
|
||||
hcorr->Fill((Double_t)i,(Double_t)i,1.0);
|
||||
} else {
|
||||
// check that errors are none zero
|
||||
if (fMnUserParams.Error(parNo[i]) == 0.0) {
|
||||
cout << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): parameter no " << parNo[i]+1 << " has an error == 0. Cannot correctly handle the correlation matrix.";
|
||||
cout << endl;
|
||||
cerr << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): parameter no " << parNo[i]+1 << " has an error == 0. Cannot correctly handle the correlation matrix.";
|
||||
cerr << endl;
|
||||
dval = 0.0;
|
||||
} else if (fMnUserParams.Error(parNo[j]) == 0.0) {
|
||||
cout << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): parameter no " << parNo[j]+1 << " has an error == 0. Cannot correctly handle the correlation matrix.";
|
||||
cout << endl;
|
||||
cerr << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): parameter no " << parNo[j]+1 << " has an error == 0. Cannot correctly handle the correlation matrix.";
|
||||
cerr << endl;
|
||||
dval = 0.0;
|
||||
} else {
|
||||
dval = cov(i,j)/(fMnUserParams.Error(parNo[i])*fMnUserParams.Error(parNo[j]));
|
||||
}
|
||||
hcorr->Fill((double)i,(double)j,dval);
|
||||
hcorr->Fill((Double_t)i,(Double_t)j,dval);
|
||||
// handle precision, ugly but ...
|
||||
if (dval < 1.0e-2) {
|
||||
fout.precision(2);
|
||||
@ -886,7 +890,7 @@ bool PFitter::ExecuteSave()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFitter::ExecuteSimplex()
|
||||
Bool_t PFitter::ExecuteSimplex()
|
||||
{
|
||||
cout << "PFitter::ExecuteSimplex(): will call simplex ..." << endl;
|
||||
|
||||
@ -900,12 +904,13 @@ bool PFitter::ExecuteSimplex()
|
||||
|
||||
// minimize
|
||||
// maxfcn is 10*MINUIT2 Default maxfcn
|
||||
unsigned int maxfcn = numeric_limits<unsigned int>::max();
|
||||
UInt_t maxfcn = numeric_limits<UInt_t>::max();
|
||||
// tolerance = MINUIT2 Default tolerance
|
||||
double tolerance = 0.1;
|
||||
Double_t tolerance = 0.1;
|
||||
ROOT::Minuit2::FunctionMinimum min = simplex(maxfcn, tolerance);
|
||||
if (!min.IsValid()) {
|
||||
cout << endl << "**WARNING**: PFitter::ExecuteSimplex(): Fit did not converge, sorry ...";
|
||||
cerr << endl << "**WARNING**: PFitter::ExecuteSimplex(): Fit did not converge, sorry ...";
|
||||
cerr << endl;
|
||||
fIsValid = false;
|
||||
return false;
|
||||
}
|
||||
@ -917,17 +922,17 @@ bool PFitter::ExecuteSimplex()
|
||||
fFcnMin = new ROOT::Minuit2::FunctionMinimum(min);
|
||||
|
||||
// fill run info
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
fRunInfo->SetMsrParamValue(i, min.UserState().Value(i));
|
||||
fRunInfo->SetMsrParamStep(i, min.UserState().Error(i));
|
||||
fRunInfo->SetMsrParamPosErrorPresent(i, false);
|
||||
}
|
||||
|
||||
// handle statistics
|
||||
double minVal = min.Fval();
|
||||
unsigned int ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
Double_t minVal = min.Fval();
|
||||
UInt_t ndf = fFitterFcn->GetTotalNoOfFittedBins();
|
||||
// subtract number of varied parameters from total no of fitted bins -> ndf
|
||||
for (unsigned int i=0; i<fParams.size(); i++) {
|
||||
for (UInt_t i=0; i<fParams.size(); i++) {
|
||||
if (min.UserState().Error(i) != 0.0)
|
||||
ndf -= 1;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ using namespace std;
|
||||
* \param runList
|
||||
* \param fitType
|
||||
*/
|
||||
PFitterFcn::PFitterFcn(PRunListCollection *runList, bool useChi2)
|
||||
PFitterFcn::PFitterFcn(PRunListCollection *runList, Bool_t useChi2)
|
||||
{
|
||||
fUseChi2 = useChi2;
|
||||
|
||||
@ -61,9 +61,9 @@ PFitterFcn::PFitterFcn(PRunListCollection *runList, bool useChi2)
|
||||
if ((fRunListCollection->GetNoOfAsymmetry() > 0) ||
|
||||
(fRunListCollection->GetNoOfRRF() > 0) ||
|
||||
(fRunListCollection->GetNoOfNonMusr() > 0)) {
|
||||
cout << endl << "**WARNING**: Maximum Log Likelihood Fit is only implemented for Single Histogram Fit";
|
||||
cout << endl << " Will fall back to Chi Square Fit.";
|
||||
cout << endl;
|
||||
cerr << endl << "**WARNING**: Maximum Log Likelihood Fit is only implemented for Single Histogram Fit";
|
||||
cerr << endl << " Will fall back to Chi Square Fit.";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,9 +84,9 @@ PFitterFcn::~PFitterFcn()
|
||||
*
|
||||
* \param par
|
||||
*/
|
||||
double PFitterFcn::operator()(const std::vector<double>& par) const
|
||||
Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double value = 0.0;
|
||||
Double_t value = 0.0;
|
||||
|
||||
if (fUseChi2) { // chi square
|
||||
value += fRunListCollection->GetSingleHistoChisq(par);
|
||||
@ -101,7 +101,7 @@ double PFitterFcn::operator()(const std::vector<double>& par) const
|
||||
}
|
||||
|
||||
// cout << endl;
|
||||
// for (unsigned int i=0; i<par.size(); i++) {
|
||||
// for (UInt_t i=0; i<par.size(); i++) {
|
||||
// cout << par[i] << ", ";
|
||||
// }
|
||||
//cout << endl << "chisq = " << value;
|
||||
|
@ -52,20 +52,20 @@ using namespace std;
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
PFourier::PFourier(TH1F *data, int unitTag, double startTime, double endTime, unsigned int zeroPaddingPower) :
|
||||
PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTime, UInt_t zeroPaddingPower) :
|
||||
fData(data), fUnitTag(unitTag), fStartTime(startTime), fEndTime(endTime),
|
||||
fZeroPaddingPower(zeroPaddingPower)
|
||||
{
|
||||
// some necessary checks and initialization
|
||||
if (fData == 0) {
|
||||
cout << endl << "**ERROR** PFourier::PFourier: no valid data" << endl << endl;
|
||||
cerr << endl << "**ERROR** PFourier::PFourier: no valid data" << endl << endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//cout << endl << "PFourier::PFourier: fData = " << fData;
|
||||
/*
|
||||
for (unsigned int i=0; i<10; i++) {
|
||||
for (UInt_t i=0; i<10; i++) {
|
||||
cout << endl << "PFourier::PFourier: i=" << i << ", t=" << fData->GetBinCenter(i) << ", value=" << fData->GetBinContent(i);
|
||||
}
|
||||
*/
|
||||
@ -83,14 +83,14 @@ for (unsigned int i=0; i<10; i++) {
|
||||
|
||||
// if endTime == 0 set it to the last time slot
|
||||
if (fEndTime == 0.0) {
|
||||
int last = fData->GetNbinsX()-1;
|
||||
Int_t last = fData->GetNbinsX()-1;
|
||||
fEndTime = fData->GetBinCenter(last);
|
||||
//cout << endl << ">> fEndTime = " << fEndTime;
|
||||
}
|
||||
|
||||
// swap start and end time if necessary
|
||||
if (fStartTime > fEndTime) {
|
||||
double keep = fStartTime;
|
||||
Double_t keep = fStartTime;
|
||||
fStartTime = fEndTime;
|
||||
fEndTime = keep;
|
||||
}
|
||||
@ -98,15 +98,15 @@ for (unsigned int i=0; i<10; i++) {
|
||||
//cout << endl << "start time = " << fStartTime << endl;
|
||||
|
||||
// calculate start and end bin
|
||||
unsigned int start = (unsigned int)(fStartTime/fTimeResolution);
|
||||
unsigned int end = (unsigned int)(fEndTime/fTimeResolution);
|
||||
UInt_t start = (UInt_t)(fStartTime/fTimeResolution);
|
||||
UInt_t end = (UInt_t)(fEndTime/fTimeResolution);
|
||||
fNoOfData = end-start;
|
||||
|
||||
//cout << endl << ">> fNoOfData = " << fNoOfData;
|
||||
|
||||
// check if zero padding is whished
|
||||
if (fZeroPaddingPower > 0) {
|
||||
unsigned int noOfBins = static_cast<unsigned int>(pow(2.0, static_cast<double>(fZeroPaddingPower)));
|
||||
UInt_t noOfBins = static_cast<UInt_t>(pow(2.0, static_cast<Double_t>(fZeroPaddingPower)));
|
||||
if (noOfBins > fNoOfData)
|
||||
fNoOfBins = noOfBins;
|
||||
else
|
||||
@ -118,7 +118,7 @@ for (unsigned int i=0; i<10; i++) {
|
||||
//cout << endl << ">> fNoOfBins = " << fNoOfBins;
|
||||
|
||||
// calculate fourier resolution
|
||||
double resolution = 1.0/(fTimeResolution*fNoOfBins); // in MHz
|
||||
Double_t resolution = 1.0/(fTimeResolution*fNoOfBins); // in MHz
|
||||
switch (fUnitTag) {
|
||||
case FOURIER_UNIT_FIELD:
|
||||
fResolution = resolution/F_GAMMA_BAR_MUON;
|
||||
@ -186,7 +186,7 @@ PFourier::~PFourier()
|
||||
*
|
||||
* \param apodizationTag 0=no apod., 1=weak apod., 2=medium apod., 3=strong apod.
|
||||
*/
|
||||
void PFourier::Transform(unsigned int apodizationTag)
|
||||
void PFourier::Transform(UInt_t apodizationTag)
|
||||
{
|
||||
if (!fValid)
|
||||
return;
|
||||
@ -196,8 +196,8 @@ void PFourier::Transform(unsigned int apodizationTag)
|
||||
fftw_execute(fFFTwPlan);
|
||||
|
||||
// correct the phase for tstart != 0.0
|
||||
double phase, re, im;
|
||||
for (unsigned int i=0; i<fNoOfBins; i++) {
|
||||
Double_t phase, re, im;
|
||||
for (UInt_t i=0; i<fNoOfBins; i++) {
|
||||
phase = 2.0*PI/(fTimeResolution*fNoOfBins) * i * fStartTime;
|
||||
re = fOut[i][0] * cos(phase) + fOut[i][1] * sin(phase);
|
||||
im = -fOut[i][0] * sin(phase) + fOut[i][1] * cos(phase);
|
||||
@ -214,27 +214,27 @@ void PFourier::Transform(unsigned int apodizationTag)
|
||||
*
|
||||
* \param scale
|
||||
*/
|
||||
TH1F* PFourier::GetRealFourier(const double scale)
|
||||
TH1F* PFourier::GetRealFourier(const Double_t scale)
|
||||
{
|
||||
// check if valid flag is set
|
||||
if (!fValid)
|
||||
return 0;
|
||||
|
||||
// invoke realFourier
|
||||
char name[256];
|
||||
char title[256];
|
||||
Char_t name[256];
|
||||
Char_t title[256];
|
||||
snprintf(name, sizeof(name), "%s_Fourier_Re", fData->GetName());
|
||||
snprintf(title, sizeof(title), "%s_Fourier_Re", fData->GetTitle());
|
||||
|
||||
TH1F *realFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (double)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
TH1F *realFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (Double_t)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
if (realFourier == 0) {
|
||||
fValid = false;
|
||||
cout << endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << endl;
|
||||
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fill realFourier vector
|
||||
for (unsigned int i=0; i<fNoOfBins/2; i++) {
|
||||
for (UInt_t i=0; i<fNoOfBins/2; i++) {
|
||||
realFourier->SetBinContent(i+1, scale*fOut[i][0]);
|
||||
realFourier->SetBinError(i+1, 0.0);
|
||||
}
|
||||
@ -250,27 +250,27 @@ TH1F* PFourier::GetRealFourier(const double scale)
|
||||
*
|
||||
* \param scale
|
||||
*/
|
||||
TH1F* PFourier::GetImaginaryFourier(const double scale)
|
||||
TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
|
||||
{
|
||||
// check if valid flag is set
|
||||
if (!fValid)
|
||||
return 0;
|
||||
|
||||
// invoke imaginaryFourier
|
||||
char name[256];
|
||||
char title[256];
|
||||
Char_t name[256];
|
||||
Char_t title[256];
|
||||
snprintf(name, sizeof(name), "%s_Fourier_Im", fData->GetName());
|
||||
snprintf(title, sizeof(title), "%s_Fourier_Im", fData->GetTitle());
|
||||
|
||||
TH1F* imaginaryFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (double)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
TH1F* imaginaryFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (Double_t)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
if (imaginaryFourier == 0) {
|
||||
fValid = false;
|
||||
cout << endl << "**SEVERE ERROR** couldn't allocate memory for the imaginary part of the Fourier transform." << endl;
|
||||
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the imaginary part of the Fourier transform." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fill imaginaryFourier vector
|
||||
for (unsigned int i=0; i<fNoOfBins/2; i++) {
|
||||
for (UInt_t i=0; i<fNoOfBins/2; i++) {
|
||||
imaginaryFourier->SetBinContent(i+1, scale*fOut[i][1]);
|
||||
imaginaryFourier->SetBinError(i+1, 0.0);
|
||||
}
|
||||
@ -286,27 +286,27 @@ TH1F* PFourier::GetImaginaryFourier(const double scale)
|
||||
*
|
||||
* \param scale
|
||||
*/
|
||||
TH1F* PFourier::GetPowerFourier(const double scale)
|
||||
TH1F* PFourier::GetPowerFourier(const Double_t scale)
|
||||
{
|
||||
// check if valid flag is set
|
||||
if (!fValid)
|
||||
return 0;
|
||||
|
||||
// invoke powerFourier
|
||||
char name[256];
|
||||
char title[256];
|
||||
Char_t name[256];
|
||||
Char_t title[256];
|
||||
snprintf(name, sizeof(name), "%s_Fourier_Pwr", fData->GetName());
|
||||
snprintf(title, sizeof(title), "%s_Fourier_Pwr", fData->GetTitle());
|
||||
|
||||
TH1F* pwrFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (double)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
TH1F* pwrFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (Double_t)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
if (pwrFourier == 0) {
|
||||
fValid = false;
|
||||
cout << endl << "**SEVERE ERROR** couldn't allocate memory for the power part of the Fourier transform." << endl;
|
||||
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the power part of the Fourier transform." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fill powerFourier vector
|
||||
for (unsigned int i=0; i<fNoOfBins/2; i++) {
|
||||
for (UInt_t i=0; i<fNoOfBins/2; i++) {
|
||||
pwrFourier->SetBinContent(i+1, scale*sqrt(fOut[i][0]*fOut[i][0]+fOut[i][1]*fOut[i][1]));
|
||||
pwrFourier->SetBinError(i+1, 0.0);
|
||||
}
|
||||
@ -322,28 +322,28 @@ TH1F* PFourier::GetPowerFourier(const double scale)
|
||||
*
|
||||
* \param scale
|
||||
*/
|
||||
TH1F* PFourier::GetPhaseFourier(const double scale)
|
||||
TH1F* PFourier::GetPhaseFourier(const Double_t scale)
|
||||
{
|
||||
// check if valid flag is set
|
||||
if (!fValid)
|
||||
return 0;
|
||||
|
||||
// invoke phaseFourier
|
||||
char name[256];
|
||||
char title[256];
|
||||
Char_t name[256];
|
||||
Char_t title[256];
|
||||
snprintf(name, sizeof(name), "%s_Fourier_Phase", fData->GetName());
|
||||
snprintf(title, sizeof(title), "%s_Fourier_Phase", fData->GetTitle());
|
||||
|
||||
TH1F* phaseFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (double)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
TH1F* phaseFourier = new TH1F(name, title, fNoOfBins/2, -fResolution/2.0, (Double_t)fNoOfBins/2.0*fResolution+fResolution/2.0);
|
||||
if (phaseFourier == 0) {
|
||||
fValid = false;
|
||||
cout << endl << "**SEVERE ERROR** couldn't allocate memory for the phase part of the Fourier transform." << endl;
|
||||
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the phase part of the Fourier transform." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fill phaseFourier vector
|
||||
double value = 0.0;
|
||||
for (unsigned int i=0; i<fNoOfBins/2; i++) {
|
||||
Double_t value = 0.0;
|
||||
for (UInt_t i=0; i<fNoOfBins/2; i++) {
|
||||
// calculate the phase
|
||||
if (fOut[i][0] == 0) {
|
||||
if (fOut[i][1] >= 0.0)
|
||||
@ -374,12 +374,12 @@ TH1F* PFourier::GetPhaseFourier(const double scale)
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
void PFourier::PrepareFFTwInputData(unsigned int apodizationTag)
|
||||
void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
|
||||
{
|
||||
// 1st find t==0. fData start at times t<0!!
|
||||
int t0bin = -1;
|
||||
Int_t t0bin = -1;
|
||||
//cout << ">> PFourier::PrepareFFTwInputData: fData=" << fData << ", fData->GetNbinsX() = " << fData->GetNbinsX();
|
||||
for (int i=1; i<fData->GetNbinsX(); i++) {
|
||||
for (Int_t i=1; i<fData->GetNbinsX(); i++) {
|
||||
//if (i<20) cout << endl << ">> PFourier::PrepareFFTwInputData: i=" << i << ", fData->GetBinCenter(i)=" << fData->GetBinCenter(i);
|
||||
if (fData->GetBinCenter(i) >= 0.0) {
|
||||
t0bin = i;
|
||||
@ -389,13 +389,13 @@ void PFourier::PrepareFFTwInputData(unsigned int apodizationTag)
|
||||
//cout << endl << "t0bin = " << t0bin << endl;
|
||||
|
||||
// 2nd fill fIn
|
||||
unsigned int start = (unsigned int)(fStartTime/fTimeResolution) + t0bin;
|
||||
UInt_t start = (UInt_t)(fStartTime/fTimeResolution) + t0bin;
|
||||
//cout << endl << "start = " << start << endl;
|
||||
for (unsigned int i=0; i<fNoOfData; i++) {
|
||||
for (UInt_t i=0; i<fNoOfData; i++) {
|
||||
fIn[i][0] = fData->GetBinContent(i+start);
|
||||
fIn[i][1] = 0.0;
|
||||
}
|
||||
for (unsigned int i=fNoOfData; i<fNoOfBins; i++) {
|
||||
for (UInt_t i=fNoOfData; i<fNoOfBins; i++) {
|
||||
fIn[i][0] = 0.0;
|
||||
fIn[i][1] = 0.0;
|
||||
}
|
||||
@ -406,7 +406,7 @@ void PFourier::PrepareFFTwInputData(unsigned int apodizationTag)
|
||||
|
||||
/*
|
||||
cout << ">> PFourier::PrepareFFTwInputData: fNoOfData = " << fNoOfData << ", fNoOfBins = " << fNoOfBins << endl;
|
||||
for (unsigned int i=0; i<10; i++) {
|
||||
for (UInt_t i=0; i<10; i++) {
|
||||
cout << endl << ">> PFourier::PrepareFFTwInputData: " << i << ": fIn[i][0] = " << fIn[i][0];
|
||||
}
|
||||
cout << endl;
|
||||
@ -421,14 +421,14 @@ cout << endl;
|
||||
*
|
||||
* \param apodizationTag
|
||||
*/
|
||||
void PFourier::ApodizeData(int apodizationTag) {
|
||||
void PFourier::ApodizeData(Int_t apodizationTag) {
|
||||
|
||||
const double cweak[3] = { 0.384093, -0.087577, 0.703484 };
|
||||
const double cmedium[3] = { 0.152442, -0.136176, 0.983734 };
|
||||
const double cstrong[3] = { 0.045335, 0.554883, 0.399782 };
|
||||
const Double_t cweak[3] = { 0.384093, -0.087577, 0.703484 };
|
||||
const Double_t cmedium[3] = { 0.152442, -0.136176, 0.983734 };
|
||||
const Double_t cstrong[3] = { 0.045335, 0.554883, 0.399782 };
|
||||
|
||||
double c[5];
|
||||
for (unsigned int i=0; i<5; i++) {
|
||||
Double_t c[5];
|
||||
for (UInt_t i=0; i<5; i++) {
|
||||
c[i] = 0.0;
|
||||
}
|
||||
|
||||
@ -454,15 +454,15 @@ void PFourier::ApodizeData(int apodizationTag) {
|
||||
c[4] = cstrong[2];
|
||||
break;
|
||||
default:
|
||||
cout << endl << ">> **ERROR** User Apodization tag " << apodizationTag << " unknown, sorry ..." << endl;
|
||||
cerr << endl << ">> **ERROR** User Apodization tag " << apodizationTag << " unknown, sorry ..." << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
double q;
|
||||
for (unsigned int i=0; i<fNoOfData; i++) {
|
||||
Double_t q;
|
||||
for (UInt_t i=0; i<fNoOfData; i++) {
|
||||
q = c[0];
|
||||
for (unsigned int j=1; j<5; j++) {
|
||||
q += c[j] * pow((double)i/(double)fNoOfData, 2.0*(double)j);
|
||||
for (UInt_t j=1; j<5; j++) {
|
||||
q += c[j] * pow((Double_t)i/(Double_t)fNoOfData, 2.0*(Double_t)j);
|
||||
}
|
||||
fIn[i][0] *= q;
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ PFunction::~PFunction()
|
||||
*
|
||||
* \param i
|
||||
*/
|
||||
bool PFunction::SetFuncNo()
|
||||
Bool_t PFunction::SetFuncNo()
|
||||
{
|
||||
int funNo = -1;
|
||||
int status;
|
||||
bool success = true;
|
||||
Int_t funNo = -1;
|
||||
Int_t status;
|
||||
Bool_t success = true;
|
||||
|
||||
// get root
|
||||
iter_t i = fInfo.trees.begin(); // assignement
|
||||
@ -117,7 +117,7 @@ bool PFunction::SetFuncNo()
|
||||
// extract function number from string
|
||||
status = sscanf(str.c_str(), "FUN%d", &funNo);
|
||||
//cout << endl << "SetFuncNo: status = " << status << ", funNo = " << funNo;
|
||||
if (status == 1) { // found 1 int
|
||||
if (status == 1) { // found 1 Int_t
|
||||
fFuncNo = funNo;
|
||||
} else { // wrong string
|
||||
success = false;
|
||||
@ -133,7 +133,7 @@ bool PFunction::SetFuncNo()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFunction::GenerateFuncEvalTree()
|
||||
Bool_t PFunction::GenerateFuncEvalTree()
|
||||
{
|
||||
FillFuncEvalTree(fInfo.trees.begin(), fFunc);
|
||||
|
||||
@ -149,15 +149,15 @@ bool PFunction::GenerateFuncEvalTree()
|
||||
*/
|
||||
void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
|
||||
{
|
||||
double dvalue;
|
||||
int ivalue;
|
||||
int status;
|
||||
Double_t dvalue;
|
||||
Int_t ivalue;
|
||||
Int_t status;
|
||||
string str;
|
||||
PFuncTreeNode child;
|
||||
|
||||
if (i->value.id() == PFunctionGrammar::realID) { // handle number
|
||||
str = string(i->value.begin(), i->value.end()); // get string
|
||||
status = sscanf(str.c_str(), "%lf", &dvalue); // convert string to double
|
||||
status = sscanf(str.c_str(), "%lf", &dvalue); // convert string to Double_t
|
||||
node.fID = PFunctionGrammar::realID; // keep the ID
|
||||
node.fDvalue = dvalue; // keep the value
|
||||
// cout << endl << ">> realID: value = " << dvalue;
|
||||
@ -216,7 +216,8 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
|
||||
else if (!strcmp(str.c_str(), "EXP"))
|
||||
node.fFunctionTag = FUN_EXP;
|
||||
else {
|
||||
cout << endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
|
||||
cerr << endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
// add node
|
||||
@ -286,7 +287,7 @@ else
|
||||
* \param mapSize
|
||||
* \param paramSize
|
||||
*/
|
||||
bool PFunction::CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSize)
|
||||
Bool_t PFunction::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
|
||||
{
|
||||
return FindAndCheckMapAndParamRange(fFunc, mapSize, paramSize);
|
||||
}
|
||||
@ -301,7 +302,7 @@ bool PFunction::CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSi
|
||||
* \param mapSize
|
||||
* \param paramSize
|
||||
*/
|
||||
bool PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, unsigned int mapSize, unsigned int paramSize)
|
||||
Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSize, UInt_t paramSize)
|
||||
{
|
||||
if (node.fID == PFunctionGrammar::realID) {
|
||||
return true;
|
||||
@ -310,12 +311,12 @@ bool PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, unsigned int m
|
||||
} else if (node.fID == PFunctionGrammar::constGammaMuID) {
|
||||
return true;
|
||||
} else if (node.fID == PFunctionGrammar::parameterID) {
|
||||
if (node.fIvalue <= (int) paramSize)
|
||||
if (node.fIvalue <= (Int_t) paramSize)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
} else if (node.fID == PFunctionGrammar::mapID) {
|
||||
if (node.fIvalue <= (int) mapSize)
|
||||
if (node.fIvalue <= (Int_t) mapSize)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@ -334,7 +335,8 @@ bool PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, unsigned int m
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
cout << endl << "**PANIC ERROR**: PFunction::FindAndCheckMapAndParamRange: you never should have reached this point!" << endl;
|
||||
cerr << endl << "**PANIC ERROR**: PFunction::FindAndCheckMapAndParamRange: you never should have reached this point!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
return true;
|
||||
@ -347,7 +349,7 @@ bool PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, unsigned int m
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
double PFunction::Eval(vector<double> param)
|
||||
Double_t PFunction::Eval(vector<Double_t> param)
|
||||
{
|
||||
fParam = param;
|
||||
|
||||
@ -362,7 +364,7 @@ double PFunction::Eval(vector<double> param)
|
||||
*
|
||||
* \param node
|
||||
*/
|
||||
double PFunction::EvalNode(PFuncTreeNode &node)
|
||||
Double_t PFunction::EvalNode(PFuncTreeNode &node)
|
||||
{
|
||||
if (node.fID == PFunctionGrammar::realID) {
|
||||
return node.fDvalue;
|
||||
@ -409,7 +411,8 @@ double PFunction::EvalNode(PFuncTreeNode &node)
|
||||
} else if (node.fFunctionTag == FUN_EXP) {
|
||||
return exp(EvalNode(node.children[0]));
|
||||
} else {
|
||||
cout << endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::functionID: you never should have reached this point!" << endl;
|
||||
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::functionID: you never should have reached this point!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
} else if (node.fID == PFunctionGrammar::factorID) {
|
||||
@ -418,9 +421,10 @@ double PFunction::EvalNode(PFuncTreeNode &node)
|
||||
if (node.fOperatorTag == OP_MUL) {
|
||||
return EvalNode(node.children[0]) * EvalNode(node.children[1]);
|
||||
} else {
|
||||
double denominator = EvalNode(node.children[1]);
|
||||
Double_t denominator = EvalNode(node.children[1]);
|
||||
if (denominator == 0.0) {
|
||||
cout << endl << "**PANIC ERROR**: PFunction::EvalNode: division by 0.0" << endl;
|
||||
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: division by 0.0";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
return EvalNode(node.children[0]) / denominator;
|
||||
@ -432,7 +436,8 @@ double PFunction::EvalNode(PFuncTreeNode &node)
|
||||
return EvalNode(node.children[0]) - EvalNode(node.children[1]);
|
||||
}
|
||||
} else {
|
||||
cout << endl << "**PANIC ERROR**: PFunction::EvalNode: you never should have reached this point!" << endl;
|
||||
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: you never should have reached this point!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
return 0.0;
|
||||
@ -462,7 +467,7 @@ void PFunction::CleanupFuncEvalTree()
|
||||
void PFunction::CleanupNode(PFuncTreeNode &node)
|
||||
{
|
||||
if (node.children.size() != 0) {
|
||||
for (unsigned int i=0; i<node.children.size(); i++) {
|
||||
for (UInt_t i=0; i<node.children.size(); i++) {
|
||||
CleanupNode(node.children[i]);
|
||||
}
|
||||
node.children.clear();
|
||||
@ -493,7 +498,7 @@ void PFunction::EvalTreeForString(tree_parse_info<> info)
|
||||
*/
|
||||
void PFunction::EvalTreeForStringExpression(iter_t const& i)
|
||||
{
|
||||
static int termOp = 0;
|
||||
static Int_t termOp = 0;
|
||||
|
||||
if (i->value.id() == PFunctionGrammar::realID) {
|
||||
assert(i->children.size() == 0);
|
||||
|
@ -72,16 +72,16 @@ PFunctionHandler::~PFunctionHandler()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PFunctionHandler::DoParse()
|
||||
Bool_t PFunctionHandler::DoParse()
|
||||
{
|
||||
// cout << endl << "in PFunctionHandler::DoParse() ...";
|
||||
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
PFunctionGrammar function;
|
||||
TString line;
|
||||
|
||||
// feed the function block into the parser. Start with i=1, since i=0 is FUNCTIONS
|
||||
for (unsigned int i=1; i<fLines.size(); i++) {
|
||||
for (UInt_t i=1; i<fLines.size(); i++) {
|
||||
// cout << endl << "fLines[" << i << "] = '" << fLines[i].fLine.Data() << "'";
|
||||
|
||||
// function line to upper case
|
||||
@ -96,7 +96,7 @@ bool PFunctionHandler::DoParse()
|
||||
PFunction func(info);
|
||||
fFuncs.push_back(func);
|
||||
} else {
|
||||
cout << endl << "**ERROR**: FUNCTIONS parse failed in line " << fLines[i].fLineNo << endl;
|
||||
cerr << endl << "**ERROR**: FUNCTIONS parse failed in line " << fLines[i].fLineNo << endl;
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
@ -104,11 +104,12 @@ bool PFunctionHandler::DoParse()
|
||||
|
||||
// check that the function numbers are unique
|
||||
if (success) {
|
||||
for (unsigned int i=0; i<fFuncs.size(); i++) {
|
||||
for (unsigned int j=i+1; j<fFuncs.size(); j++) {
|
||||
for (UInt_t i=0; i<fFuncs.size(); i++) {
|
||||
for (UInt_t j=i+1; j<fFuncs.size(); j++) {
|
||||
if (fFuncs[i].GetFuncNo() == fFuncs[j].GetFuncNo()) {
|
||||
cout << endl << "**ERROR**: function number " << fFuncs[i].GetFuncNo();
|
||||
cout << " is at least twice present! Fix this first.";
|
||||
cerr << endl << "**ERROR**: function number " << fFuncs[i].GetFuncNo();
|
||||
cerr << " is at least twice present! Fix this first.";
|
||||
cerr << endl;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@ -116,7 +117,7 @@ bool PFunctionHandler::DoParse()
|
||||
}
|
||||
|
||||
// if (success) {
|
||||
// for (unsigned int i=0; i<fFuncs.size(); i++)
|
||||
// for (UInt_t i=0; i<fFuncs.size(); i++)
|
||||
// cout << endl << "func number = " << fFuncs[i].GetFuncNo();
|
||||
// }
|
||||
|
||||
@ -132,11 +133,11 @@ bool PFunctionHandler::DoParse()
|
||||
* \param mapSize
|
||||
* \param paramSize
|
||||
*/
|
||||
bool PFunctionHandler::CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSize)
|
||||
Bool_t PFunctionHandler::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
for (unsigned int i=0; i<fFuncs.size(); i++) {
|
||||
for (UInt_t i=0; i<fFuncs.size(); i++) {
|
||||
success = fFuncs[i].CheckMapAndParamRange(mapSize, paramSize);
|
||||
if (!success)
|
||||
break;
|
||||
@ -153,10 +154,11 @@ bool PFunctionHandler::CheckMapAndParamRange(unsigned int mapSize, unsigned int
|
||||
*
|
||||
* \param funNo
|
||||
*/
|
||||
double PFunctionHandler::Eval(int funNo, vector<int> map, vector<double> param)
|
||||
Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<Double_t> param)
|
||||
{
|
||||
if (GetFuncIndex(funNo) == -1) {
|
||||
cout << endl << "**ERROR**: Couldn't find FUN" << funNo << " for evaluation";
|
||||
cerr << endl << "**ERROR**: Couldn't find FUN" << funNo << " for evaluation";
|
||||
cerr << endl;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@ -178,7 +180,7 @@ double PFunctionHandler::Eval(int funNo, vector<int> map, vector<double> param)
|
||||
*
|
||||
* \param idx
|
||||
*/
|
||||
int PFunctionHandler::GetFuncNo(unsigned int idx)
|
||||
Int_t PFunctionHandler::GetFuncNo(UInt_t idx)
|
||||
{
|
||||
if (idx > fFuncs.size())
|
||||
return -1;
|
||||
@ -194,11 +196,11 @@ int PFunctionHandler::GetFuncNo(unsigned int idx)
|
||||
*
|
||||
* \param funcNo
|
||||
*/
|
||||
int PFunctionHandler::GetFuncIndex(int funcNo)
|
||||
Int_t PFunctionHandler::GetFuncIndex(Int_t funcNo)
|
||||
{
|
||||
int index = -1;
|
||||
Int_t index = -1;
|
||||
|
||||
for (unsigned int i=0; i<fFuncs.size(); i++) {
|
||||
for (UInt_t i=0; i<fFuncs.size(); i++) {
|
||||
if (fFuncs[i].GetFuncNo() == funcNo) {
|
||||
index = i;
|
||||
break;
|
||||
@ -216,7 +218,7 @@ int PFunctionHandler::GetFuncIndex(int funcNo)
|
||||
*
|
||||
* \param idx
|
||||
*/
|
||||
TString* PFunctionHandler::GetFuncString(unsigned int idx)
|
||||
TString* PFunctionHandler::GetFuncString(UInt_t idx)
|
||||
{
|
||||
if (idx > fFuncs.size())
|
||||
return 0;
|
||||
|
@ -184,8 +184,8 @@ int PMsr2Data::SetRunNumbers(const string &runListFile)
|
||||
|
||||
ifstream in(runListFile.c_str());
|
||||
if (!in) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The runlist file " << runListFile << " cannot be opened! Please check!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The runlist file " << runListFile << " cannot be opened! Please check!";
|
||||
cerr << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -211,8 +211,8 @@ int PMsr2Data::SetRunNumbers(const string &runListFile)
|
||||
strLine.str(splitVec[0]);
|
||||
strLine >> indvar; // "RUN"
|
||||
if (indvar.compare("RUN")) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The format of the runlist file " << runListFile << " is not correct! Please check!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The format of the runlist file " << runListFile << " is not correct! Please check!";
|
||||
cerr << endl;
|
||||
}
|
||||
while (strLine >> indvar)
|
||||
fIndVar.push_back(indvar);
|
||||
@ -251,7 +251,7 @@ int PMsr2Data::ParseXmlStartupFile()
|
||||
status = fSaxParser->ParseFile(startup_path_name.c_str());
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cout << endl << ">> msr2data: **WARNING** reading/parsing musrfit_startup.xml." << endl;
|
||||
cerr << endl << ">> msr2data: **WARNING** reading/parsing musrfit_startup.xml." << endl;
|
||||
// clean up
|
||||
if (fSaxParser) {
|
||||
delete fSaxParser;
|
||||
@ -277,13 +277,13 @@ int PMsr2Data::ReadMsrFile(const string &infile)
|
||||
if (status != PMUSR_SUCCESS) {
|
||||
switch (status) {
|
||||
case PMUSR_MSR_FILE_NOT_FOUND:
|
||||
cout << endl << ">> msr2data: **ERROR** Could not find " << infile << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** Could not find " << infile << endl;
|
||||
break;
|
||||
case PMUSR_MSR_SYNTAX_ERROR:
|
||||
cout << endl << ">> msr2data: **SYNTAX ERROR** in file " << infile << ", full stop here." << endl;
|
||||
cerr << endl << ">> msr2data: **SYNTAX ERROR** in file " << infile << ", full stop here." << endl;
|
||||
break;
|
||||
default:
|
||||
cout << endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << endl;
|
||||
cerr << endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool PMsr2Data::ReadRunDataFile()
|
||||
|
||||
bool success = fDataHandler->IsAllDataAvailable();
|
||||
if (!success) {
|
||||
cout << endl << ">> msr2data: **WARNING** Could not read all data files, will continue without the data file information..." << endl;
|
||||
cerr << endl << ">> msr2data: **WARNING** Could not read all data files, will continue without the data file information..." << endl;
|
||||
delete fDataHandler;
|
||||
fDataHandler = 0;
|
||||
}
|
||||
@ -328,16 +328,16 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun) const
|
||||
strInfile << tempRun << fFileExtension << ".msr";
|
||||
ifstream in(strInfile.str().c_str());
|
||||
if (!in) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The template msr-file " << strInfile.str() << " cannot be opened! Please check!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The template msr-file " << strInfile.str() << " cannot be opened! Please check!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
ostringstream strOutfile;
|
||||
strOutfile << *fRunVectorIter << fFileExtension << ".msr";
|
||||
ofstream out(strOutfile.str().c_str());
|
||||
if (!out) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The new msr file " << strOutfile.str() << " cannot be opened! Please check!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The new msr file " << strOutfile.str() << " cannot be opened! Please check!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -378,9 +378,9 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun) const
|
||||
if ( loc != string::npos ) {
|
||||
line.replace(loc, N, newRunNumber.str());
|
||||
} else {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **WARNING** The template run file number does not match the \"file index\"" << endl;
|
||||
cout << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)" << endl;
|
||||
cerr << endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\"";
|
||||
cerr << endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
out << line << endl;
|
||||
@ -494,9 +494,9 @@ void PMsr2Data::WriteOutput(const string &outfile, bool db, bool withHeader) con
|
||||
strLine.str(splitVec[0]);
|
||||
strLine >> runNo;
|
||||
if (runNo != *fRunVectorIter) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The run number in the runlist file does not match the one which should be processed..." << endl;
|
||||
cout << ">> msr2data: **ERROR** Something is very strange... Please report this bug!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The run number in the runlist file does not match the one which should be processed...";
|
||||
cerr << endl << ">> msr2data: **ERROR** Something is very strange... Please report this bug!";
|
||||
cerr << endl;
|
||||
fRunVectorIter = fRunVector.end();
|
||||
return;
|
||||
}
|
||||
@ -504,9 +504,9 @@ void PMsr2Data::WriteOutput(const string &outfile, bool db, bool withHeader) con
|
||||
indVarValues.push_back(val);
|
||||
}
|
||||
if (indVarValues.size() != fIndVar.size()) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **ERROR** The number of data entries in the runlist file for the run number " << runNo << endl;
|
||||
cout << ">> msr2data: **ERROR** does not match the number of labels given in the RUN-line! Please check the file!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The number of data entries in the runlist file for the run number " << runNo;
|
||||
cerr << endl << ">> msr2data: **ERROR** does not match the number of labels given in the RUN-line! Please check the file!";
|
||||
cerr << endl;
|
||||
fRunVectorIter = fRunVector.end();
|
||||
return;
|
||||
}
|
||||
@ -518,9 +518,9 @@ void PMsr2Data::WriteOutput(const string &outfile, bool db, bool withHeader) con
|
||||
// The RUNLIST file stream and the run vector iterator might get out of synchronization, if the following check is placed before the above block...
|
||||
PMsrStatisticStructure *msrStatistic(fMsrHandler->GetMsrStatistic());
|
||||
if (!msrStatistic->fValid) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: **WARNING** The fit of run " << *fRunVectorIter << " has not converged!" << endl;
|
||||
cout << ">> msr2data: **WARNING** Its parameter data have not been appended to the output file " << outfile << endl;
|
||||
cerr << endl << ">> msr2data: **WARNING** The fit of run " << *fRunVectorIter << " has not converged!";
|
||||
cerr << endl << ">> msr2data: **WARNING** Its parameter data have not been appended to the output file " << outfile;
|
||||
cerr << endl;
|
||||
fRunVectorIter++;
|
||||
|
||||
delete fMsrHandler;
|
||||
@ -545,8 +545,8 @@ void PMsr2Data::WriteOutput(const string &outfile, bool db, bool withHeader) con
|
||||
|
||||
ofstream outFile(outfile.c_str(), ios::app);
|
||||
if (!outFile) {
|
||||
cout << endl;
|
||||
cout << ">> msr2data: The output file " << outfile << " cannot be opened! Please check!" << endl;
|
||||
cerr << endl << ">> msr2data: **ERROR** The output file " << outfile << " cannot be opened! Please check!";
|
||||
cerr << endl;
|
||||
fRunVectorIter = fRunVector.end();
|
||||
return;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -84,7 +84,7 @@ PMusrT0::PMusrT0()
|
||||
* \param rawRunData
|
||||
* \param histoNo
|
||||
*/
|
||||
PMusrT0::PMusrT0(PRawRunData *rawRunData, int runNo, int histoNo, int detectorTag, int addRunNo) :
|
||||
PMusrT0::PMusrT0(PRawRunData *rawRunData, Int_t runNo, Int_t histoNo, Int_t detectorTag, Int_t addRunNo) :
|
||||
fRunNo(runNo), fDetectorTag(detectorTag), fAddRunNo(addRunNo)
|
||||
{
|
||||
cout << endl << "run Name = " << rawRunData->GetRunName()->Data() << ", runNo = " << fRunNo << ", histoNo = " << histoNo << endl;
|
||||
@ -107,7 +107,7 @@ cout << endl << "run Name = " << rawRunData->GetRunName()->Data() << ", runNo =
|
||||
fHisto->SetMarkerSize(0.5);
|
||||
fHisto->SetMarkerColor(TColor::GetColor(0,0,0)); // black
|
||||
|
||||
for (unsigned int i=0; i<rawRunData->GetDataBin(histoNo-1)->size(); i++) {
|
||||
for (UInt_t i=0; i<rawRunData->GetDataBin(histoNo-1)->size(); i++) {
|
||||
fHisto->SetBinContent(i+1, rawRunData->GetDataBin(histoNo-1)->at(i));
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
|
||||
void PMusrT0::InitDataAndBkg()
|
||||
{
|
||||
// get addRun offset which depends on the fit type
|
||||
int fitType = fMsrHandler->GetMsrRunList()->at(fRunNo).fFitType;
|
||||
Int_t fitType = fMsrHandler->GetMsrRunList()->at(fRunNo).fFitType;
|
||||
if (fitType == MSR_FITTYPE_SINGLE_HISTO) {
|
||||
fAddRunOffset = 2;
|
||||
} else if (fitType == MSR_FITTYPE_ASYM) {
|
||||
@ -281,7 +281,7 @@ void PMusrT0::InitDataAndBkg()
|
||||
fData->SetMarkerSize(0.5);
|
||||
fData->SetMarkerColor(TColor::GetColor(0,0,255)); // blue
|
||||
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fData->SetBinContent(i+1, fHisto->GetBinContent(fDataRange[0]+i+1));
|
||||
}
|
||||
fData->Draw("p0 9 hist same");
|
||||
@ -315,7 +315,7 @@ void PMusrT0::InitDataAndBkg()
|
||||
fBkg->SetMarkerSize(0.5);
|
||||
fBkg->SetMarkerColor(TColor::GetColor(255,0,0)); // red
|
||||
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fBkg->SetBinContent(i+1, fHisto->GetBinContent(fBkgRange[0]+i+1));
|
||||
}
|
||||
fBkg->Draw("p0 9 hist same");
|
||||
@ -341,33 +341,33 @@ void PMusrT0::InitDataAndBkg()
|
||||
break;
|
||||
}
|
||||
Double_t max = fHisto->GetMaximum();
|
||||
fT0Line = new TLine((double)t0Bin, 0.0, (double)t0Bin, max);
|
||||
fT0Line = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
|
||||
fT0Line->SetLineStyle(1); // solid
|
||||
fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green
|
||||
fT0Line->SetLineWidth(2);
|
||||
fT0Line->Draw();
|
||||
|
||||
// data lines
|
||||
fFirstDataLine = new TLine((double)fDataRange[0], 0.0, (double)fDataRange[0], max);
|
||||
fFirstDataLine = new TLine((Double_t)fDataRange[0], 0.0, (Double_t)fDataRange[0], max);
|
||||
fFirstDataLine->SetLineStyle(3); // doted
|
||||
fFirstDataLine->SetLineColor(TColor::GetColor(0,0,255)); // blue
|
||||
fFirstDataLine->SetLineWidth(2);
|
||||
fFirstDataLine->Draw();
|
||||
|
||||
fLastDataLine = new TLine((double)fDataRange[1], 0.0, (double)fDataRange[1], max);
|
||||
fLastDataLine = new TLine((Double_t)fDataRange[1], 0.0, (Double_t)fDataRange[1], max);
|
||||
fLastDataLine->SetLineStyle(3); // doted
|
||||
fLastDataLine->SetLineColor(TColor::GetColor(0,0,255)); // blue
|
||||
fLastDataLine->SetLineWidth(2);
|
||||
fLastDataLine->Draw();
|
||||
|
||||
// bkg lines
|
||||
fFirstBkgLine = new TLine((double)fBkgRange[0], 0.0, (double)fBkgRange[0], max);
|
||||
fFirstBkgLine = new TLine((Double_t)fBkgRange[0], 0.0, (Double_t)fBkgRange[0], max);
|
||||
fFirstBkgLine->SetLineStyle(6); // _..._...
|
||||
fFirstBkgLine->SetLineColor(TColor::GetColor(255,0,0)); // red
|
||||
fFirstBkgLine->SetLineWidth(2);
|
||||
fFirstBkgLine->Draw();
|
||||
|
||||
fLastBkgLine = new TLine((double)fBkgRange[1], 0.0, (double)fBkgRange[1], max);
|
||||
fLastBkgLine = new TLine((Double_t)fBkgRange[1], 0.0, (Double_t)fBkgRange[1], max);
|
||||
fLastBkgLine->SetLineStyle(6); // _..._...
|
||||
fLastBkgLine->SetLineColor(TColor::GetColor(255,0,0)); // red
|
||||
fLastBkgLine->SetLineWidth(2);
|
||||
@ -385,7 +385,7 @@ void PMusrT0::InitDataAndBkg()
|
||||
*/
|
||||
void PMusrT0::SetT0Channel()
|
||||
{
|
||||
double x=0, y=0;
|
||||
Double_t x=0, y=0;
|
||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||
|
||||
// get binx to set t0 corresponding to fPx
|
||||
@ -394,7 +394,7 @@ void PMusrT0::SetT0Channel()
|
||||
cout << endl << ">> PMusrT0::SetT0Channel(): binx = " << binx << endl;
|
||||
|
||||
// set t0 bin in msr-Handler
|
||||
unsigned int idx = 0;
|
||||
UInt_t idx = 0;
|
||||
switch(fDetectorTag) {
|
||||
case DETECTOR_TAG_FORWARD:
|
||||
idx = fAddRunNo * fAddRunOffset / 2;
|
||||
@ -430,7 +430,7 @@ cout << endl << ">> PMusrT0::SetT0Channel(): binx = " << binx << endl;
|
||||
*/
|
||||
void PMusrT0::SetDataFirstChannel()
|
||||
{
|
||||
double x=0, y=0;
|
||||
Double_t x=0, y=0;
|
||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||
|
||||
// get binx to set the data first channel corresponding to fPx
|
||||
@ -439,7 +439,7 @@ void PMusrT0::SetDataFirstChannel()
|
||||
cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRange[0] << endl;
|
||||
|
||||
// set the data first bin in msr-Handler
|
||||
unsigned int idx = 0;
|
||||
UInt_t idx = 0;
|
||||
switch(fDetectorTag) {
|
||||
case DETECTOR_TAG_FORWARD:
|
||||
idx = fAddRunNo * fAddRunOffset;
|
||||
@ -474,7 +474,7 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa
|
||||
fData->SetMarkerStyle(21);
|
||||
fData->SetMarkerSize(0.5);
|
||||
fData->SetMarkerColor(TColor::GetColor(0,0,255)); // blue
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fData->SetBinContent(i+1, fHisto->GetBinContent(fDataRange[0]+i+1));
|
||||
}
|
||||
fData->Draw("p0 9 hist same");
|
||||
@ -492,7 +492,7 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa
|
||||
*/
|
||||
void PMusrT0::SetDataLastChannel()
|
||||
{
|
||||
double x=0, y=0;
|
||||
Double_t x=0, y=0;
|
||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||
|
||||
// get binx to set the data last channel corresponding to fPx
|
||||
@ -501,7 +501,7 @@ void PMusrT0::SetDataLastChannel()
|
||||
cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl;
|
||||
|
||||
// set the data first bin in msr-Handler
|
||||
unsigned int idx = 0;
|
||||
UInt_t idx = 0;
|
||||
switch(fDetectorTag) {
|
||||
case DETECTOR_TAG_FORWARD:
|
||||
idx = 1 + fAddRunNo * fAddRunOffset;
|
||||
@ -536,7 +536,7 @@ cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRan
|
||||
fData->SetMarkerStyle(21);
|
||||
fData->SetMarkerSize(0.5);
|
||||
fData->SetMarkerColor(TColor::GetColor(0,0,255)); // blue
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fData->SetBinContent(i+1, fHisto->GetBinContent(fDataRange[0]+i+1));
|
||||
}
|
||||
fData->Draw("p0 9 hist same");
|
||||
@ -554,7 +554,7 @@ cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRan
|
||||
*/
|
||||
void PMusrT0::SetBkgFirstChannel()
|
||||
{
|
||||
double x=0, y=0;
|
||||
Double_t x=0, y=0;
|
||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||
|
||||
// get binx to set the background first channel corresponding to fPx
|
||||
@ -563,7 +563,7 @@ void PMusrT0::SetBkgFirstChannel()
|
||||
cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange[0] << endl;
|
||||
|
||||
// set the background first bin in msr-Handler
|
||||
unsigned int idx = 0;
|
||||
UInt_t idx = 0;
|
||||
switch(fDetectorTag) {
|
||||
case DETECTOR_TAG_FORWARD:
|
||||
idx = fAddRunNo * fAddRunOffset;
|
||||
@ -598,7 +598,7 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange
|
||||
fBkg->SetMarkerStyle(21);
|
||||
fBkg->SetMarkerSize(0.5);
|
||||
fBkg->SetMarkerColor(TColor::GetColor(255,0,0)); // red
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fBkg->SetBinContent(i+1, fHisto->GetBinContent(fBkgRange[0]+i+1));
|
||||
}
|
||||
fBkg->Draw("p0 9 hist same");
|
||||
@ -616,7 +616,7 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange
|
||||
*/
|
||||
void PMusrT0::SetBkgLastChannel()
|
||||
{
|
||||
double x=0, y=0;
|
||||
Double_t x=0, y=0;
|
||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||
|
||||
// get binx to set the background last channel corresponding to fPx
|
||||
@ -625,7 +625,7 @@ void PMusrT0::SetBkgLastChannel()
|
||||
cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl;
|
||||
|
||||
// set the background first bin in msr-Handler
|
||||
unsigned int idx = 0;
|
||||
UInt_t idx = 0;
|
||||
switch(fDetectorTag) {
|
||||
case DETECTOR_TAG_FORWARD:
|
||||
idx = 1 + fAddRunNo * fAddRunOffset;
|
||||
@ -660,7 +660,7 @@ cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[
|
||||
fBkg->SetMarkerStyle(21);
|
||||
fBkg->SetMarkerSize(0.5);
|
||||
fBkg->SetMarkerColor(TColor::GetColor(255,0,0)); // red
|
||||
for (int i=0; i<noOfBins; i++) {
|
||||
for (Int_t i=0; i<noOfBins; i++) {
|
||||
fBkg->SetBinContent(i+1, fHisto->GetBinContent(fBkgRange[0]+i+1));
|
||||
}
|
||||
fBkg->Draw("p0 9 hist same");
|
||||
|
@ -59,7 +59,7 @@ PRunAsymmetry::PRunAsymmetry() : PRunBase()
|
||||
* \param msrInfo pointer to the msr info structure
|
||||
* \param runNo number of the run of the msr-file
|
||||
*/
|
||||
PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
{
|
||||
// check if alpha and/or beta is fixed --------------------
|
||||
|
||||
@ -67,31 +67,34 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, uns
|
||||
|
||||
// check if alpha is given
|
||||
if (fRunInfo->fAlphaParamNo == -1) { // no alpha given
|
||||
cout << endl << "PRunAsymmetry::PRunAsymmetry(): no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
// check if alpha parameter is within proper bounds
|
||||
if ((fRunInfo->fAlphaParamNo < 0) || (fRunInfo->fAlphaParamNo > (int)param->size())) {
|
||||
cout << endl << "PRunAsymmetry::PRunAsymmetry(): alpha parameter no = " << fRunInfo->fAlphaParamNo;
|
||||
cout << endl << " This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
if ((fRunInfo->fAlphaParamNo < 0) || (fRunInfo->fAlphaParamNo > (Int_t)param->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->fAlphaParamNo;
|
||||
cerr << endl << " This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
// check if alpha is fixed
|
||||
bool alphaFixedToOne = false;
|
||||
Bool_t alphaFixedToOne = false;
|
||||
//cout << endl << ">> alpha = " << (*param)[fRunInfo->fAlphaParamNo-1].fValue << ", " << (*param)[fRunInfo->fAlphaParamNo-1].fStep;
|
||||
if (((*param)[fRunInfo->fAlphaParamNo-1].fStep == 0.0) &&
|
||||
((*param)[fRunInfo->fAlphaParamNo-1].fValue == 1.0))
|
||||
alphaFixedToOne = true;
|
||||
|
||||
// check if beta is given
|
||||
bool betaFixedToOne = false;
|
||||
Bool_t betaFixedToOne = false;
|
||||
if (fRunInfo->fBetaParamNo == -1) { // no beta given hence assuming beta == 1
|
||||
betaFixedToOne = true;
|
||||
} else if ((fRunInfo->fBetaParamNo < 0) || (fRunInfo->fBetaParamNo > (int)param->size())) { // check if beta parameter is within proper bounds
|
||||
cout << endl << "PRunAsymmetry::PRunAsymmetry(): beta parameter no = " << fRunInfo->fBetaParamNo;
|
||||
cout << endl << " This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
} else if ((fRunInfo->fBetaParamNo < 0) || (fRunInfo->fBetaParamNo > (Int_t)param->size())) { // check if beta parameter is within proper bounds
|
||||
cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->fBetaParamNo;
|
||||
cerr << endl << " This is out of bound, since there are only " << param->size() << " parameters.";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
return;
|
||||
} else { // check if beta is fixed
|
||||
@ -140,22 +143,22 @@ PRunAsymmetry::~PRunAsymmetry()
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunAsymmetry::CalcChiSquare(const std::vector<double>& par)
|
||||
Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
{
|
||||
double chisq = 0.0;
|
||||
double diff = 0.0;
|
||||
double asymFcnValue = 0.0;
|
||||
double a, b, f;
|
||||
Double_t chisq = 0.0;
|
||||
Double_t diff = 0.0;
|
||||
Double_t asymFcnValue = 0.0;
|
||||
Double_t a, b, f;
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate chisq
|
||||
double time;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time>=fFitStartTime) && (time<=fFitStopTime)) {
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
@ -199,7 +202,7 @@ double PRunAsymmetry::CalcChiSquare(const std::vector<double>& par)
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunAsymmetry::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
Double_t PRunAsymmetry::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
cout << endl << "PRunSingleHisto::CalcMaxLikelihood(): not implemented yet ..." << endl;
|
||||
|
||||
@ -216,22 +219,22 @@ double PRunAsymmetry::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
void PRunAsymmetry::CalcTheory()
|
||||
{
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate asymmetry
|
||||
double asymFcnValue = 0.0;
|
||||
double a, b, f;
|
||||
double time;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
Double_t asymFcnValue = 0.0;
|
||||
Double_t a, b, f;
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
switch (fAlphaBetaTag) {
|
||||
case 1: // alpha == 1, beta == 1
|
||||
asymFcnValue = fTheory->Func(time, par, fFuncValues);
|
||||
@ -274,7 +277,7 @@ void PRunAsymmetry::CalcTheory()
|
||||
* (b_i^{\rm c})^2 (\Delta f_i^{\rm c})^2 +
|
||||
* (\Delta b_i^{\rm c})^2 (f_i^{\rm c})^2\right]^{1/2}\f]
|
||||
*/
|
||||
bool PRunAsymmetry::PrepareData()
|
||||
Bool_t PRunAsymmetry::PrepareData()
|
||||
{
|
||||
//cout << endl << "in PRunAsymmetry::PrepareData(): will feed fData" << endl;
|
||||
|
||||
@ -282,7 +285,8 @@ bool PRunAsymmetry::PrepareData()
|
||||
// get the correct run
|
||||
PRawRunData *runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
|
||||
if (!runData) { // run not found
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -304,7 +308,8 @@ bool PRunAsymmetry::PrepareData()
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->fForwardHistoNo-1)); // forward t0
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->fBackwardHistoNo-1)); // backward t0
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
@ -312,18 +317,18 @@ bool PRunAsymmetry::PrepareData()
|
||||
if (runData->GetT0s().size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->fT0[0]-runData->GetT0(fRunInfo->fForwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
|
||||
cout << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
|
||||
cerr << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
if (fabs(fRunInfo->fT0[1]-runData->GetT0(fRunInfo->fBackwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[1];
|
||||
cout << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fBackwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[1];
|
||||
cerr << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fBackwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
fT0s.push_back(fRunInfo->fT0[0]); // forward t0
|
||||
@ -331,17 +336,17 @@ bool PRunAsymmetry::PrepareData()
|
||||
}
|
||||
|
||||
// check if post pile up data shall be used
|
||||
unsigned int histoNo[2]; // forward/backward
|
||||
UInt_t histoNo[2]; // forward/backward
|
||||
histoNo[0] = fRunInfo->fForwardHistoNo-1;
|
||||
histoNo[1] = fRunInfo->fBackwardHistoNo-1;
|
||||
// first check if forward/backward given in the msr-file are valid
|
||||
if ((runData->GetNoOfHistos() < histoNo[0]+1) || (histoNo[0] < 0) ||
|
||||
(runData->GetNoOfHistos() < histoNo[1]+1) || (histoNo[1] < 0)) {
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cout << endl << " forward/backward histo no found = " << histoNo[0]+1;
|
||||
cout << ", " << histoNo[1]+1 << ", but there are only " << runData->GetNoOfHistos() << " histo sets!?!?";
|
||||
cout << endl << " Will quit :-(";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << " forward/backward histo no found = " << histoNo[0]+1;
|
||||
cerr << ", " << histoNo[1]+1 << ", but there are only " << runData->GetNoOfHistos() << " histo sets!?!?";
|
||||
cerr << endl << " Will quit :-(";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -355,16 +360,17 @@ bool PRunAsymmetry::PrepareData()
|
||||
// check if there are runs to be added to the current one
|
||||
if (fRunInfo->fRunName.size() > 1) { // runs to be added present
|
||||
PRawRunData *addRunData;
|
||||
for (unsigned int i=1; i<fRunInfo->fRunName.size(); i++) {
|
||||
for (UInt_t i=1; i<fRunInfo->fRunName.size(); i++) {
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(fRunInfo->fRunName[i]);
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// get T0's of the to be added run
|
||||
int t0Add[2] = {0, 0};
|
||||
Int_t t0Add[2] = {0, 0};
|
||||
// check if the t0's are given in the msr-file
|
||||
if (2*i+1 >= fRunInfo->fT0.size()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
@ -374,7 +380,8 @@ bool PRunAsymmetry::PrepareData()
|
||||
t0Add[0] = addRunData->GetT0(fRunInfo->fForwardHistoNo-1); // forward t0
|
||||
t0Add[1] = addRunData->GetT0(fRunInfo->fBackwardHistoNo-1); // backward t0
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): NO t0's found, neither in the addrun (" << fRunInfo->fRunName[i].Data() << ") data nor in the msr-file!";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** NO t0's found, neither in the addrun (" << fRunInfo->fRunName[i].Data() << ") data nor in the msr-file!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
@ -383,38 +390,38 @@ bool PRunAsymmetry::PrepareData()
|
||||
t0Add[0] = fRunInfo->fT0[2*i];
|
||||
t0Add[1] = fRunInfo->fT0[2*i+1];
|
||||
} else {
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cout << fRunInfo->fRunName[i].Data();
|
||||
cout << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cout << fRunInfo->fRunName[i].Data();
|
||||
cout << ") without any warranty!";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cerr << fRunInfo->fRunName[i].Data();
|
||||
cerr << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cerr << fRunInfo->fRunName[i].Data();
|
||||
cerr << ") without any warranty!";
|
||||
t0Add[0] = fRunInfo->fT0[0];
|
||||
t0Add[1] = fRunInfo->fT0[1];
|
||||
}
|
||||
if (addRunData->GetT0s().size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(t0Add[0]-addRunData->GetT0(fRunInfo->fForwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i];
|
||||
cout << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cout << endl;
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i];
|
||||
cerr << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cerr << endl;
|
||||
}
|
||||
if (fabs(t0Add[1]-addRunData->GetT0(fRunInfo->fBackwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i+1];
|
||||
cout << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fBackwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cout << endl;
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i+1];
|
||||
cerr << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fBackwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add forward run
|
||||
UInt_t addRunSize = addRunData->GetDataBin(histoNo[0])->size();
|
||||
for (unsigned int j=0; j<runData->GetDataBin(histoNo[0])->size(); j++) {
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[0])->size(); j++) {
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j-t0Add[0]+fT0s[0] >= 0) && (j-t0Add[0]+fT0s[0] < addRunSize)) {
|
||||
fForward[j] += addRunData->GetDataBin(histoNo[0])->at(j-t0Add[0]+fT0s[0]);
|
||||
@ -423,7 +430,7 @@ bool PRunAsymmetry::PrepareData()
|
||||
|
||||
// add backward run
|
||||
addRunSize = addRunData->GetDataBin(histoNo[1])->size();
|
||||
for (unsigned int j=0; j<runData->GetDataBin(histoNo[1])->size(); j++) {
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[1])->size(); j++) {
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j-t0Add[1]+fT0s[1] >= 0) && (j-t0Add[1]+fT0s[1] < addRunSize)) {
|
||||
fBackward[j] += addRunData->GetDataBin(histoNo[1])->at(j-t0Add[1]+fT0s[1]);
|
||||
@ -438,8 +445,8 @@ bool PRunAsymmetry::PrepareData()
|
||||
if (!SubtractEstimatedBkg())
|
||||
return false;
|
||||
} else { // no background given to do the job
|
||||
cout << endl << "PRunAsymmetry::PrepareData(): Neither fix background nor background bins are given!";
|
||||
cout << endl << "One of the two is needed! Will quit ...";
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** Neither fix background nor background bins are given!";
|
||||
cerr << endl << "One of the two is needed! Will quit ...";
|
||||
return false;
|
||||
}
|
||||
} else { // fixed background given
|
||||
@ -448,7 +455,7 @@ bool PRunAsymmetry::PrepareData()
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
bool status;
|
||||
Bool_t status;
|
||||
switch(fHandleTag) {
|
||||
case kFit:
|
||||
status = PrepareFitData(runData, histoNo);
|
||||
@ -479,9 +486,9 @@ bool PRunAsymmetry::PrepareData()
|
||||
* where \f$ f_i^{\rm c} \f$ is the background corrected histogram, \f$ f_i \f$ the raw histogram
|
||||
* and \f$ \mathrm{bkg} \f$ the fix given background.
|
||||
*/
|
||||
bool PRunAsymmetry::SubtractFixBkg()
|
||||
Bool_t PRunAsymmetry::SubtractFixBkg()
|
||||
{
|
||||
for (unsigned int i=0; i<fForward.size(); i++) {
|
||||
for (UInt_t i=0; i<fForward.size(); i++) {
|
||||
fForwardErr.push_back(TMath::Sqrt(fForward[i]+fRunInfo->fBkgFix[0] * fTimeResolution * 1.0e3));
|
||||
fForward[i] -= fRunInfo->fBkgFix[0] * fTimeResolution * 1.0e3; // bkg per ns -> bkg per bin; 1.0e3: us -> ns
|
||||
fBackwardErr.push_back(TMath::Sqrt(fBackward[i]+fRunInfo->fBkgFix[1] * fTimeResolution * 1.0e3));
|
||||
@ -508,9 +515,9 @@ bool PRunAsymmetry::SubtractFixBkg()
|
||||
* \pm\frac{1}{N}\left[\sum_{i=0}^N f_i \right]^{1/2},\f]
|
||||
* where \f$N\f$ is the number of bins over which the background is formed.
|
||||
*/
|
||||
bool PRunAsymmetry::SubtractEstimatedBkg()
|
||||
Bool_t PRunAsymmetry::SubtractEstimatedBkg()
|
||||
{
|
||||
double beamPeriod = 0.0;
|
||||
Double_t beamPeriod = 0.0;
|
||||
|
||||
// check if data are from PSI, RAL, or TRIUMF
|
||||
if (fRunInfo->fInstitute[0].Contains("psi"))
|
||||
@ -523,23 +530,23 @@ bool PRunAsymmetry::SubtractEstimatedBkg()
|
||||
beamPeriod = 0.0;
|
||||
|
||||
// check if start and end are in proper order
|
||||
unsigned int start[2] = {fRunInfo->fBkgRange[0], fRunInfo->fBkgRange[2]};
|
||||
unsigned int end[2] = {fRunInfo->fBkgRange[1], fRunInfo->fBkgRange[3]};
|
||||
for (unsigned int i=0; i<2; i++) {
|
||||
UInt_t start[2] = {fRunInfo->fBkgRange[0], fRunInfo->fBkgRange[2]};
|
||||
UInt_t end[2] = {fRunInfo->fBkgRange[1], fRunInfo->fBkgRange[3]};
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (end[i] < start[i]) {
|
||||
cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!";
|
||||
unsigned int keep = end[i];
|
||||
UInt_t keep = end[i];
|
||||
end[i] = start[i];
|
||||
start[i] = keep;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate proper background range
|
||||
for (unsigned int i=0; i<2; i++) {
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (beamPeriod != 0.0) {
|
||||
double beamPeriodBins = beamPeriod/fRunInfo->fPacking;
|
||||
unsigned int periods = (unsigned int)((double)(end[i] - start[i] + 1) / beamPeriodBins);
|
||||
end[i] = start[i] + (unsigned int)round((double)periods*beamPeriodBins);
|
||||
Double_t beamPeriodBins = beamPeriod/fRunInfo->fPacking;
|
||||
UInt_t periods = (UInt_t)((Double_t)(end[i] - start[i] + 1) / beamPeriodBins);
|
||||
end[i] = start[i] + (UInt_t)round((Double_t)periods*beamPeriodBins);
|
||||
cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl;
|
||||
if (end[i] == start[i])
|
||||
end[i] = fRunInfo->fBkgRange[2*i+1];
|
||||
@ -549,47 +556,47 @@ bool PRunAsymmetry::SubtractEstimatedBkg()
|
||||
// check if start is within histogram bounds
|
||||
if ((start[0] < 0) || (start[0] >= fForward.size()) ||
|
||||
(start[1] < 0) || (start[1] >= fBackward.size())) {
|
||||
cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): background bin values out of bound!";
|
||||
cout << endl << " histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cout << endl << " background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
cerr << endl << "PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << " histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << " background start (f/b) = (" << start[0] << "/" << start[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if ((end[0] < 0) || (end[0] >= fForward.size()) ||
|
||||
(end[1] < 0) || (end[1] >= fBackward.size())) {
|
||||
cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): background bin values out of bound!";
|
||||
cout << endl << " histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cout << endl << " background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
cerr << endl << "PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << " histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ").";
|
||||
cerr << endl << " background end (f/b) = (" << end[0] << "/" << end[1] << ").";
|
||||
return false;
|
||||
}
|
||||
|
||||
// calculate background
|
||||
double bkg[2] = {0.0, 0.0};
|
||||
double errBkg[2] = {0.0, 0.0};
|
||||
Double_t bkg[2] = {0.0, 0.0};
|
||||
Double_t errBkg[2] = {0.0, 0.0};
|
||||
|
||||
// forward
|
||||
for (unsigned int i=start[0]; i<end[0]; i++)
|
||||
for (UInt_t i=start[0]; i<end[0]; i++)
|
||||
bkg[0] += fForward[i];
|
||||
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
|
||||
bkg[0] /= static_cast<double>(end[0] - start[0] + 1);
|
||||
bkg[0] /= static_cast<Double_t>(end[0] - start[0] + 1);
|
||||
//cout << endl << ">> bkg[0] = " << bkg[0];
|
||||
|
||||
// backward
|
||||
for (unsigned int i=start[1]; i<end[1]; i++)
|
||||
for (UInt_t i=start[1]; i<end[1]; i++)
|
||||
bkg[1] += fBackward[i];
|
||||
errBkg[1] = TMath::Sqrt(bkg[1])/(end[0] - start[0] + 1);
|
||||
bkg[1] /= static_cast<double>(end[1] - start[1] + 1);
|
||||
bkg[1] /= static_cast<Double_t>(end[1] - start[1] + 1);
|
||||
//cout << endl << ">> bkg[1] = " << bkg[1] << endl;
|
||||
|
||||
// correct error for forward, backward
|
||||
for (unsigned int i=0; i<fForward.size(); i++) {
|
||||
for (UInt_t i=0; i<fForward.size(); i++) {
|
||||
fForwardErr.push_back(TMath::Sqrt(fForward[i]+errBkg[0]*errBkg[0]));
|
||||
fBackwardErr.push_back(TMath::Sqrt(fBackward[i]+errBkg[1]*errBkg[1]));
|
||||
}
|
||||
|
||||
// subtract background from data
|
||||
for (unsigned int i=0; i<fForward.size(); i++) {
|
||||
for (UInt_t i=0; i<fForward.size(); i++) {
|
||||
fForward[i] -= bkg[0];
|
||||
fBackward[i] -= bkg[1];
|
||||
}
|
||||
@ -604,35 +611,38 @@ bool PRunAsymmetry::SubtractEstimatedBkg()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2])
|
||||
Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
{
|
||||
// transform raw histo data. This is done the following way (for details see the manual):
|
||||
// first rebin the data, than calculate the asymmetry
|
||||
// first get start data, end data, and t0
|
||||
int start[2] = {fRunInfo->fDataRange[0], fRunInfo->fDataRange[2]};
|
||||
int end[2] = {fRunInfo->fDataRange[1], fRunInfo->fDataRange[3]};
|
||||
double t0[2] = {fT0s[0], fT0s[1]};
|
||||
Int_t start[2] = {fRunInfo->fDataRange[0], fRunInfo->fDataRange[2]};
|
||||
Int_t end[2] = {fRunInfo->fDataRange[1], fRunInfo->fDataRange[3]};
|
||||
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
for (unsigned int i=0; i<2; i++) {
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (end[i] < start[i]) { // need to swap them
|
||||
int keep = end[i];
|
||||
Int_t keep = end[i];
|
||||
end[i] = start[i];
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** start data bin doesn't make any sense!";
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end[i] < 0) || (end[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
|
||||
if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareFitData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -640,10 +650,10 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
|
||||
// everything looks fine, hence fill packed forward and backward histo
|
||||
PRunData forwardPacked;
|
||||
PRunData backwardPacked;
|
||||
double value = 0.0;
|
||||
double error = 0.0;
|
||||
Double_t value = 0.0;
|
||||
Double_t error = 0.0;
|
||||
// forward
|
||||
for (int i=start[0]; i<end[0]; i++) {
|
||||
for (Int_t i=start[0]; i<end[0]; i++) {
|
||||
if (fRunInfo->fPacking == 1) {
|
||||
forwardPacked.AppendValue(fForward[i]);
|
||||
forwardPacked.AppendErrorValue(fForwardErr[i]);
|
||||
@ -665,7 +675,7 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
|
||||
}
|
||||
}
|
||||
// backward
|
||||
for (int i=start[1]; i<end[1]; i++) {
|
||||
for (Int_t i=start[1]; i<end[1]; i++) {
|
||||
if (fRunInfo->fPacking == 1) {
|
||||
backwardPacked.AppendValue(fBackward[i]);
|
||||
backwardPacked.AppendErrorValue(fBackwardErr[i]);
|
||||
@ -688,20 +698,20 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
|
||||
}
|
||||
|
||||
// check if packed forward and backward hist have the same size, otherwise take the minimum size
|
||||
unsigned int noOfBins = forwardPacked.GetValue()->size();
|
||||
UInt_t noOfBins = forwardPacked.GetValue()->size();
|
||||
if (forwardPacked.GetValue()->size() != backwardPacked.GetValue()->size()) {
|
||||
if (forwardPacked.GetValue()->size() > backwardPacked.GetValue()->size())
|
||||
noOfBins = backwardPacked.GetValue()->size();
|
||||
}
|
||||
|
||||
// form asymmetry including error propagation
|
||||
double asym;
|
||||
double f, b, ef, eb;
|
||||
Double_t asym;
|
||||
Double_t f, b, ef, eb;
|
||||
// fill data time start, and step
|
||||
// data start at data_start-t0 shifted by (pack-1)/2
|
||||
fData.SetDataTimeStart(fTimeResolution*((double)start[0]-t0[0]+(double)(fRunInfo->fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(double)fRunInfo->fPacking);
|
||||
for (unsigned int i=0; i<noOfBins; i++) {
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(fRunInfo->fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)fRunInfo->fPacking);
|
||||
for (UInt_t i=0; i<noOfBins; i++) {
|
||||
// to make the formulae more readable
|
||||
f = forwardPacked.GetValue()->at(i);
|
||||
b = backwardPacked.GetValue()->at(i);
|
||||
@ -722,10 +732,10 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
|
||||
}
|
||||
|
||||
// count the number of bins to be fitted
|
||||
double time;
|
||||
Double_t time;
|
||||
fNoOfFitBins=0;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i * fData.GetDataTimeStep();
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i * fData.GetDataTimeStep();
|
||||
if ((time >= fFitStartTime) && (time <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
}
|
||||
@ -746,32 +756,32 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunAsymmetry::PrepareViewData(PRawRunData* runData, unsigned int histoNo[2])
|
||||
Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
{
|
||||
// check if view_packing is wished
|
||||
int packing = fRunInfo->fPacking;
|
||||
Int_t packing = fRunInfo->fPacking;
|
||||
if (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0) {
|
||||
packing = fMsrInfo->GetMsrPlotList()->at(0).fViewPacking;
|
||||
}
|
||||
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
|
||||
// transform raw histo data. This is done the following way (for details see the manual):
|
||||
// first rebin the data, than calculate the asymmetry
|
||||
// first get start data, end data, and t0
|
||||
int val = fRunInfo->fDataRange[0]-packing*(fRunInfo->fDataRange[0]/packing);
|
||||
Int_t val = fRunInfo->fDataRange[0]-packing*(fRunInfo->fDataRange[0]/packing);
|
||||
do {
|
||||
if (fRunInfo->fDataRange[2] - fRunInfo->fDataRange[0] < 0)
|
||||
val += packing;
|
||||
} while (val + fRunInfo->fDataRange[2] - fRunInfo->fDataRange[0] < 0);
|
||||
|
||||
int start[2] = {val, val + fRunInfo->fDataRange[2] - fRunInfo->fDataRange[0]};
|
||||
int end[2];
|
||||
double t0[2] = {fT0s[0], fT0s[1]};
|
||||
Int_t start[2] = {val, val + fRunInfo->fDataRange[2] - fRunInfo->fDataRange[0]};
|
||||
Int_t end[2];
|
||||
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
||||
|
||||
/*
|
||||
cout << endl << ">> start[0]=" << start[0] << ", end[0]=" << end[0];
|
||||
@ -780,8 +790,8 @@ cout << endl;
|
||||
*/
|
||||
|
||||
// make sure that there are equal number of rebinned bins in forward and backward
|
||||
unsigned int noOfBins0 = (runData->GetDataBin(histoNo[0])->size()-start[0])/packing;
|
||||
unsigned int noOfBins1 = (runData->GetDataBin(histoNo[1])->size()-start[1])/packing;
|
||||
UInt_t noOfBins0 = (runData->GetDataBin(histoNo[0])->size()-start[0])/packing;
|
||||
UInt_t noOfBins1 = (runData->GetDataBin(histoNo[1])->size()-start[1])/packing;
|
||||
if (noOfBins0 > noOfBins1)
|
||||
noOfBins0 = noOfBins1;
|
||||
end[0] = start[0] + noOfBins0 * packing;
|
||||
@ -789,25 +799,28 @@ cout << endl;
|
||||
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
for (unsigned int i=0; i<2; i++) {
|
||||
for (UInt_t i=0; i<2; i++) {
|
||||
if (end[i] < start[i]) { // need to swap them
|
||||
int keep = end[i];
|
||||
Int_t keep = end[i];
|
||||
end[i] = start[i];
|
||||
start[i] = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start[i] < 0) || (start[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end[i] < 0) || (end[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 4th check if t0 is within proper bounds
|
||||
if ((t0[i] < 0) || (t0[i] > (int)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cout << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << "PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -815,10 +828,10 @@ cout << endl;
|
||||
// everything looks fine, hence fill packed forward and backward histo
|
||||
PRunData forwardPacked;
|
||||
PRunData backwardPacked;
|
||||
double value = 0.0;
|
||||
double error = 0.0;
|
||||
Double_t value = 0.0;
|
||||
Double_t error = 0.0;
|
||||
// forward
|
||||
for (int i=start[0]; i<end[0]; i++) {
|
||||
for (Int_t i=start[0]; i<end[0]; i++) {
|
||||
if (packing == 1) {
|
||||
forwardPacked.AppendValue(fForward[i]);
|
||||
forwardPacked.AppendErrorValue(fForwardErr[i]);
|
||||
@ -840,7 +853,7 @@ cout << endl;
|
||||
error += fForwardErr[i]*fForwardErr[i];
|
||||
}
|
||||
// backward
|
||||
for (int i=start[1]; i<end[1]; i++) {
|
||||
for (Int_t i=start[1]; i<end[1]; i++) {
|
||||
if (packing == 1) {
|
||||
backwardPacked.AppendValue(fBackward[i]);
|
||||
backwardPacked.AppendErrorValue(fBackwardErr[i]);
|
||||
@ -863,19 +876,19 @@ cout << endl;
|
||||
}
|
||||
|
||||
// check if packed forward and backward hist have the same size, otherwise take the minimum size
|
||||
unsigned int noOfBins = forwardPacked.GetValue()->size();
|
||||
UInt_t noOfBins = forwardPacked.GetValue()->size();
|
||||
if (forwardPacked.GetValue()->size() != backwardPacked.GetValue()->size()) {
|
||||
if (forwardPacked.GetValue()->size() > backwardPacked.GetValue()->size())
|
||||
noOfBins = backwardPacked.GetValue()->size();
|
||||
}
|
||||
|
||||
// form asymmetry including error propagation
|
||||
double asym;
|
||||
double f, b, ef, eb, alpha = 1.0, beta = 1.0;
|
||||
Double_t asym;
|
||||
Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
|
||||
// fill data time start, and step
|
||||
// data start at data_start-t0
|
||||
fData.SetDataTimeStart(fTimeResolution*((double)start[0]-t0[0]+(double)(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(double)packing);
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*(Double_t)packing);
|
||||
|
||||
/*
|
||||
cout << endl << ">> start time = " << fData.GetDataTimeStart() << ", step = " << fData.GetDataTimeStep();
|
||||
@ -905,7 +918,7 @@ cout << endl << "--------------------------------" << endl;
|
||||
}
|
||||
//cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
|
||||
|
||||
for (unsigned int i=0; i<forwardPacked.GetValue()->size(); i++) {
|
||||
for (UInt_t i=0; i<forwardPacked.GetValue()->size(); i++) {
|
||||
// to make the formulae more readable
|
||||
f = forwardPacked.GetValue()->at(i);
|
||||
b = backwardPacked.GetValue()->at(i);
|
||||
@ -926,10 +939,10 @@ cout << endl << "--------------------------------" << endl;
|
||||
}
|
||||
|
||||
// count the number of bins to be fitted
|
||||
double time;
|
||||
Double_t time;
|
||||
fNoOfFitBins=0;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i * fData.GetDataTimeStep();
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i * fData.GetDataTimeStep();
|
||||
if ((time >= fFitStartTime) && (time <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
}
|
||||
@ -942,22 +955,22 @@ cout << endl << "--------------------------------" << endl;
|
||||
|
||||
// fill theory vector for kView
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate theory
|
||||
unsigned int size = runData->GetDataBin(histoNo[0])->size();
|
||||
double factor = 1.0;
|
||||
UInt_t size = runData->GetDataBin(histoNo[0])->size();
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo[0])->size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (double)runData->GetDataBin(histoNo[0])->size() / (double)size;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size;
|
||||
}
|
||||
//cout << endl << ">> runData->fDataBin[histoNo[0]].size() = " << runData->fDataBin[histoNo[0]].size() << ", fData.GetValue()->size() * 10 = " << fData.GetValue()->size() * 10 << ", size = " << size << ", factor = " << factor << endl;
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (double)i*fTimeResolution*factor;
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fTimeResolution*factor;
|
||||
value = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(value) > 10.0) { // dirty hack needs to be fixed!!
|
||||
value = 0.0;
|
||||
|
@ -72,12 +72,12 @@ PRunBase::PRunBase()
|
||||
* \param runNo
|
||||
* \param tag
|
||||
*/
|
||||
PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag)
|
||||
PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag)
|
||||
{
|
||||
fValid = true;
|
||||
fHandleTag = tag;
|
||||
|
||||
fRunNo = static_cast<int>(runNo);
|
||||
fRunNo = static_cast<Int_t>(runNo);
|
||||
if ((runNo < 0) || (runNo > msrInfo->GetMsrRunList()->size())) {
|
||||
fRunInfo = 0;
|
||||
return;
|
||||
@ -91,7 +91,7 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int
|
||||
|
||||
// check the parameter and map range of the functions
|
||||
if (!fMsrInfo->CheckMapAndParamRange(fRunInfo->fMap.size(), fMsrInfo->GetNoOfParams())) {
|
||||
cout << endl << "**SEVERE ERROR** PRunBase::PRunBase: map and/or parameter out of range in FUNCTIONS." << endl;
|
||||
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: map and/or parameter out of range in FUNCTIONS." << endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -100,17 +100,17 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int
|
||||
|
||||
// init private variables
|
||||
fTimeResolution = -1.0;
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++)
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++)
|
||||
fFuncValues.push_back(0.0);
|
||||
|
||||
// generate theory
|
||||
fTheory = new PTheory(msrInfo, runNo);
|
||||
if (fTheory == 0) {
|
||||
cout << endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << endl;
|
||||
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << endl;
|
||||
exit(0);
|
||||
}
|
||||
if (!fTheory->IsValid()) {
|
||||
cout << endl << "**SEVERE ERROR** PRunBase::PRunBase: Theory is not valid :-(, will quit" << endl;
|
||||
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: Theory is not valid :-(, will quit" << endl;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,8 @@ Bool_t PRunDataHandler::ReadFile()
|
||||
PMsrRunList *runList = 0;
|
||||
runList = fMsrInfo->GetMsrRunList();
|
||||
if (runList == 0) {
|
||||
cout << endl << "PRunDataHandler::ReadFile(): Couldn't obtain run list from PMsrHandler: something VERY fishy";
|
||||
cerr << endl << "PRunDataHandler::ReadFile(): **ERROR** Couldn't obtain run list from PMsrHandler: something VERY fishy";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -253,18 +254,18 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const UInt_t
|
||||
if (!success) {
|
||||
str = runInfo.fFileFormat[idx];
|
||||
str.ToUpper();
|
||||
cout << endl << "File Format '" << str.Data() << "' unsupported.";
|
||||
cout << endl << " support file formats are:";
|
||||
cout << endl << " ROOT-NPP -> root not post pileup corrected for lem";
|
||||
cout << endl << " ROOT-PPC -> root post pileup corrected for lem";
|
||||
cout << endl << " NEXUS -> nexus file format";
|
||||
cout << endl << " PSI-BIN -> psi bin file format";
|
||||
cout << endl << " MUD -> triumf mud file format";
|
||||
cout << endl << " WKM -> wkm ascii file format";
|
||||
cout << endl << " MDU-ASCII -> psi mdu ascii file format";
|
||||
cout << endl << " ASCII -> column like file format";
|
||||
cout << endl << " DB -> triumf db file \"format\"";
|
||||
cout << endl;
|
||||
cerr << endl << "**ERROR** File Format '" << str.Data() << "' unsupported.";
|
||||
cerr << endl << " support file formats are:";
|
||||
cerr << endl << " ROOT-NPP -> root not post pileup corrected for lem";
|
||||
cerr << endl << " ROOT-PPC -> root post pileup corrected for lem";
|
||||
cerr << endl << " NEXUS -> nexus file format";
|
||||
cerr << endl << " PSI-BIN -> psi bin file format";
|
||||
cerr << endl << " MUD -> triumf mud file format";
|
||||
cerr << endl << " WKM -> wkm ascii file format";
|
||||
cerr << endl << " MDU-ASCII -> psi mdu ascii file format";
|
||||
cerr << endl << " ASCII -> column like file format";
|
||||
cerr << endl << " DB -> triumf db file \"format\"";
|
||||
cerr << endl;
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -376,7 +377,7 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
TFolder *folder;
|
||||
f.GetObject("RunInfo", folder);
|
||||
if (!folder) {
|
||||
cout << endl << "Couldn't obtain RunInfo from " << fRunPathName.Data() << endl;
|
||||
cerr << endl << "PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain RunInfo from " << fRunPathName.Data() << endl;
|
||||
f.Close();
|
||||
return false;
|
||||
}
|
||||
@ -386,7 +387,7 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
|
||||
// check if run header is valid
|
||||
if (!runHeader) {
|
||||
cout << endl << "Couldn't obtain run header info from ROOT file " << fRunPathName.Data() << endl;
|
||||
cerr << endl << "PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain run header info from ROOT file " << fRunPathName.Data() << endl;
|
||||
f.Close();
|
||||
return false;
|
||||
}
|
||||
@ -520,7 +521,7 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
// check if histos folder is found
|
||||
f.GetObject("histos", folder);
|
||||
if (!folder) {
|
||||
cout << endl << "Couldn't obtain histos from " << fRunPathName.Data() << endl;
|
||||
cerr << endl << "PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain histos from " << fRunPathName.Data() << endl;
|
||||
f.Close();
|
||||
return false;
|
||||
}
|
||||
@ -531,7 +532,8 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
sprintf(histoName, "hDecay%02d", i);
|
||||
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
|
||||
if (!histo) {
|
||||
cout << endl << "PRunDataHandler::ReadRootFile: Couldn't get histo " << histoName;
|
||||
cerr << endl << "PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// fill data
|
||||
@ -547,7 +549,8 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
sprintf(histoName, "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
|
||||
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
|
||||
if (!histo) {
|
||||
cout << endl << "PRunDataHandler::ReadRootFile: Couldn't get histo " << histoName;
|
||||
cerr << endl << "PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// fill data
|
||||
@ -606,8 +609,8 @@ Bool_t PRunDataHandler::ReadWkmFile()
|
||||
// open wkm-file
|
||||
f.open(fRunPathName.Data(), ifstream::in);
|
||||
if (!f.is_open()) {
|
||||
cout << endl << "Couldn't open run data (" << fRunPathName.Data() << ") file for reading, sorry ...";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile: **ERROR** Couldn't open run data (" << fRunPathName.Data() << ") file for reading, sorry ...";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -58,28 +58,28 @@ PRunListCollection::~PRunListCollection()
|
||||
{
|
||||
//cout << endl << "in ~PRunListCollection() ..." << endl;
|
||||
//cout << endl << ">> fRunSingleHistoList.size() = " << fRunSingleHistoList.size();
|
||||
for (unsigned int i=0; i<fRunSingleHistoList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++) {
|
||||
fRunSingleHistoList[i]->CleanUp();
|
||||
fRunSingleHistoList[i]->~PRunSingleHisto();
|
||||
}
|
||||
fRunSingleHistoList.clear();
|
||||
|
||||
//cout << endl << ">> fRunAsymmetryList.size() = " << fRunAsymmetryList.size();
|
||||
for (unsigned int i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
fRunAsymmetryList[i]->CleanUp();
|
||||
fRunAsymmetryList[i]->~PRunAsymmetry();
|
||||
}
|
||||
fRunAsymmetryList.clear();
|
||||
|
||||
//cout << endl << ">> fRunRRFList.size() = " << fRunRRFList.size();
|
||||
for (unsigned int i=0; i<fRunRRFList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunRRFList.size(); i++) {
|
||||
fRunRRFList[i]->CleanUp();
|
||||
fRunRRFList[i]->~PRunRRF();
|
||||
}
|
||||
fRunRRFList.clear();
|
||||
|
||||
//cout << endl << ">> fRunNonMusrList.size() = " << fRunNonMusrList.size();
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++) {
|
||||
fRunNonMusrList[i]->CleanUp();
|
||||
fRunNonMusrList[i]->~PRunNonMusr();
|
||||
}
|
||||
@ -95,9 +95,9 @@ PRunListCollection::~PRunListCollection()
|
||||
* \param runNo
|
||||
* \param tag
|
||||
*/
|
||||
bool PRunListCollection::Add(int runNo, EPMusrHandleTag tag)
|
||||
Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag)
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// PMsrRunStructure *runList = &(*fMsrInfo->GetMsrRunList())[runNo];
|
||||
|
||||
@ -105,7 +105,7 @@ bool PRunListCollection::Add(int runNo, EPMusrHandleTag tag)
|
||||
// cout << ", name = " << runList->fRunName.Data();
|
||||
// cout << ", type = " << runList->fFitType;
|
||||
|
||||
int fitType = (*fMsrInfo->GetMsrRunList())[runNo].fFitType;
|
||||
Int_t fitType = (*fMsrInfo->GetMsrRunList())[runNo].fFitType;
|
||||
|
||||
switch (fitType) {
|
||||
case PRUN_SINGLE_HISTO:
|
||||
@ -142,11 +142,11 @@ bool PRunListCollection::Add(int runNo, EPMusrHandleTag tag)
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
double PRunListCollection::GetSingleHistoChisq(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetSingleHistoChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double chisq = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunSingleHistoList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
chisq += fRunSingleHistoList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
@ -158,11 +158,11 @@ double PRunListCollection::GetSingleHistoChisq(const std::vector<double>& par) c
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
double PRunListCollection::GetAsymmetryChisq(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetAsymmetryChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double chisq = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunAsymmetryList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
chisq += fRunAsymmetryList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
@ -174,11 +174,11 @@ double PRunListCollection::GetAsymmetryChisq(const std::vector<double>& par) con
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
double PRunListCollection::GetRRFChisq(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetRRFChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double chisq = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunRRFList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunRRFList.size(); i++)
|
||||
chisq += fRunRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
@ -190,11 +190,11 @@ double PRunListCollection::GetRRFChisq(const std::vector<double>& par) const
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
double PRunListCollection::GetNonMusrChisq(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetNonMusrChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double chisq = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
chisq += fRunNonMusrList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
@ -206,11 +206,11 @@ double PRunListCollection::GetNonMusrChisq(const std::vector<double>& par) const
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
double PRunListCollection::GetSingleHistoMaximumLikelihood(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetSingleHistoMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double mlh = 0.0;
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunSingleHistoList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
mlh += fRunSingleHistoList[i]->CalcMaxLikelihood(par);
|
||||
|
||||
return mlh;
|
||||
@ -223,11 +223,11 @@ double PRunListCollection::GetSingleHistoMaximumLikelihood(const std::vector<dou
|
||||
* <p> Since it is not clear yet how to handle asymmetry fits with max likelihood
|
||||
* the chi square will be used!
|
||||
*/
|
||||
double PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double mlh = 0.0;
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunAsymmetryList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
mlh += fRunAsymmetryList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
@ -240,11 +240,11 @@ double PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<doubl
|
||||
* <p> Since it is not clear yet how to handle RRF fits with max likelihood
|
||||
* the chi square will be used!
|
||||
*/
|
||||
double PRunListCollection::GetRRFMaximumLikelihood(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetRRFMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double mlh = 0.0;
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunRRFList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunRRFList.size(); i++)
|
||||
mlh += fRunRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
@ -257,11 +257,11 @@ double PRunListCollection::GetRRFMaximumLikelihood(const std::vector<double>& pa
|
||||
* <p> Since it is not clear yet how to handle non musr fits with max likelihood
|
||||
* the chi square will be used!
|
||||
*/
|
||||
double PRunListCollection::GetNonMusrMaximumLikelihood(const std::vector<double>& par) const
|
||||
Double_t PRunListCollection::GetNonMusrMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
double mlh = 0.0;
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
mlh += fRunNonMusrList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
@ -273,20 +273,20 @@ double PRunListCollection::GetNonMusrMaximumLikelihood(const std::vector<double>
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
unsigned int PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
{
|
||||
unsigned int counts = 0;
|
||||
UInt_t counts = 0;
|
||||
|
||||
for (unsigned int i=0; i<fRunSingleHistoList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
counts += fRunSingleHistoList[i]->GetNoOfFitBins();
|
||||
|
||||
for (unsigned int i=0; i<fRunAsymmetryList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
counts += fRunAsymmetryList[i]->GetNoOfFitBins();
|
||||
|
||||
for (unsigned int i=0; i<fRunRRFList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunRRFList.size(); i++)
|
||||
counts += fRunRRFList[i]->GetNoOfFitBins();
|
||||
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++)
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
counts += fRunNonMusrList[i]->GetNoOfFitBins();
|
||||
|
||||
// cout << endl << "Total No of Bins Fitted = " << counts;
|
||||
@ -302,14 +302,15 @@ unsigned int PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
* \param index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetSingleHisto(unsigned int index, EDataSwitch tag)
|
||||
PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunSingleHistoList.size())) {
|
||||
cout << endl << "PRunListCollection::GetSingleHisto: index = " << index << " out of bounds";
|
||||
cerr << endl << "PRunListCollection::GetSingleHisto: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -317,7 +318,7 @@ PRunData* PRunListCollection::GetSingleHisto(unsigned int index, EDataSwitch tag
|
||||
data = fRunSingleHistoList[index]->GetData();
|
||||
break;
|
||||
case kRunNo:
|
||||
for (unsigned int i=0; i<fRunSingleHistoList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++) {
|
||||
if (fRunSingleHistoList[i]->GetRunNo() == index) {
|
||||
data = fRunSingleHistoList[i]->GetData();
|
||||
break;
|
||||
@ -340,14 +341,15 @@ PRunData* PRunListCollection::GetSingleHisto(unsigned int index, EDataSwitch tag
|
||||
* \param index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetAsymmetry(unsigned int index, EDataSwitch tag)
|
||||
PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if ((index < 0) || (index > fRunAsymmetryList.size())) {
|
||||
cout << endl << "PRunListCollection::GetAsymmetry: index = " << index << " out of bounds";
|
||||
cerr << endl << "PRunListCollection::GetAsymmetry: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -355,7 +357,7 @@ PRunData* PRunListCollection::GetAsymmetry(unsigned int index, EDataSwitch tag)
|
||||
data = fRunAsymmetryList[index]->GetData();
|
||||
break;
|
||||
case kRunNo: // called from PMusrCanvas
|
||||
for (unsigned int i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
if (fRunAsymmetryList[i]->GetRunNo() == index) {
|
||||
data = fRunAsymmetryList[i]->GetData();
|
||||
break;
|
||||
@ -378,14 +380,15 @@ PRunData* PRunListCollection::GetAsymmetry(unsigned int index, EDataSwitch tag)
|
||||
* \param index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetRRF(unsigned int index, EDataSwitch tag)
|
||||
PRunData* PRunListCollection::GetRRF(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunRRFList.size())) {
|
||||
cout << endl << "PRunListCollection::GetRRF: index = " << index << " out of bounds";
|
||||
cerr << endl << "PRunListCollection::GetRRF: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -407,19 +410,20 @@ PRunData* PRunListCollection::GetRRF(unsigned int index, EDataSwitch tag)
|
||||
* \param index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetNonMusr(unsigned int index, EDataSwitch tag)
|
||||
PRunData* PRunListCollection::GetNonMusr(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunNonMusrList.size())) {
|
||||
cout << endl << "PRunListCollection::GetNonMusr: index = " << index << " out of bounds";
|
||||
cerr << endl << "PRunListCollection::GetNonMusr: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case kRunNo:
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++) {
|
||||
if (fRunNonMusrList[i]->GetRunNo() == index) {
|
||||
data = fRunNonMusrList[i]->GetData();
|
||||
break;
|
||||
@ -454,7 +458,7 @@ PDoublePairVector PRunListCollection::GetTemp(const TString &runName) const
|
||||
*
|
||||
* \param runName
|
||||
*/
|
||||
double PRunListCollection::GetField(const TString &runName) const
|
||||
Double_t PRunListCollection::GetField(const TString &runName) const
|
||||
{
|
||||
return fData->GetRunData(runName)->GetField();
|
||||
}
|
||||
@ -467,7 +471,7 @@ double PRunListCollection::GetField(const TString &runName) const
|
||||
*
|
||||
* \param runName
|
||||
*/
|
||||
double PRunListCollection::GetEnergy(const TString &runName) const
|
||||
Double_t PRunListCollection::GetEnergy(const TString &runName) const
|
||||
{
|
||||
return fData->GetRunData(runName)->GetEnergy();
|
||||
}
|
||||
@ -480,7 +484,7 @@ double PRunListCollection::GetEnergy(const TString &runName) const
|
||||
*
|
||||
* \param runName
|
||||
*/
|
||||
const char* PRunListCollection::GetSetup(const TString &runName) const
|
||||
const Char_t* PRunListCollection::GetSetup(const TString &runName) const
|
||||
{
|
||||
return fData->GetRunData(runName)->GetSetup()->Data();
|
||||
}
|
||||
@ -494,7 +498,7 @@ const char* PRunListCollection::GetSetup(const TString &runName) const
|
||||
* \param runName name of the run file
|
||||
* \param idx msr-file run index
|
||||
*/
|
||||
const char* PRunListCollection::GetXAxisTitle(const TString &runName, const unsigned int idx) const
|
||||
const Char_t* PRunListCollection::GetXAxisTitle(const TString &runName, const UInt_t idx) const
|
||||
{
|
||||
//cout << endl << ">> PRunListCollection::GetXAxisTitle: runName = " << runName.Data() << ", idx = " << idx;
|
||||
//cout << endl << ">> PRunListCollection::GetXAxisTitle: fRunNonMusrList.size() = " << fRunNonMusrList.size();
|
||||
@ -502,14 +506,14 @@ const char* PRunListCollection::GetXAxisTitle(const TString &runName, const unsi
|
||||
|
||||
PRawRunData *runData = fData->GetRunData(runName);
|
||||
|
||||
const char *result = 0;
|
||||
const Char_t *result = 0;
|
||||
|
||||
if (runData->fDataNonMusr.FromAscii()) {
|
||||
result = runData->fDataNonMusr.GetLabels()->at(0).Data();
|
||||
} else {
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++) {
|
||||
if (fRunNonMusrList[i]->GetRunNo() == idx) {
|
||||
int index = fRunNonMusrList[i]->GetXIndex();
|
||||
Int_t index = fRunNonMusrList[i]->GetXIndex();
|
||||
result = runData->fDataNonMusr.GetLabels()->at(index).Data();
|
||||
break;
|
||||
}
|
||||
@ -528,21 +532,21 @@ const char* PRunListCollection::GetXAxisTitle(const TString &runName, const unsi
|
||||
* \param runName name of the run file
|
||||
* \param idx msr-file run index
|
||||
*/
|
||||
const char* PRunListCollection::GetYAxisTitle(const TString &runName, const unsigned int idx) const
|
||||
const Char_t* PRunListCollection::GetYAxisTitle(const TString &runName, const UInt_t idx) const
|
||||
{
|
||||
//cout << endl << ">> PRunListCollection::GetYAxisTitle: runName = " << runName.Data() << ", idx = " << idx;
|
||||
//cout << endl;
|
||||
|
||||
PRawRunData *runData = fData->GetRunData(runName);
|
||||
|
||||
const char *result = 0;
|
||||
const Char_t *result = 0;
|
||||
|
||||
if (runData->fDataNonMusr.FromAscii()) {
|
||||
result = runData->fDataNonMusr.GetLabels()->at(1).Data();
|
||||
} else {
|
||||
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++) {
|
||||
if (fRunNonMusrList[i]->GetRunNo() == idx) {
|
||||
int index = fRunNonMusrList[i]->GetYIndex();
|
||||
Int_t index = fRunNonMusrList[i]->GetYIndex();
|
||||
result = runData->fDataNonMusr.GetLabels()->at(index).Data();
|
||||
break;
|
||||
}
|
||||
|
@ -60,12 +60,13 @@ PRunNonMusr::PRunNonMusr() : PRunBase()
|
||||
* \param msrInfo pointer to the msr info structure
|
||||
* \param runNo number of the run of the msr-file
|
||||
*/
|
||||
PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
{
|
||||
// get the proper run
|
||||
fRawRunData = fRawData->GetRunData(fRunInfo->fRunName[0]);
|
||||
if (!fRawRunData) { // couldn't get run
|
||||
cout << endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!";
|
||||
cerr << endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
}
|
||||
|
||||
@ -93,19 +94,19 @@ PRunNonMusr::~PRunNonMusr()
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunNonMusr::CalcChiSquare(const std::vector<double>& par)
|
||||
Double_t PRunNonMusr::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
{
|
||||
double chisq = 0.0;
|
||||
double diff = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
Double_t diff = 0.0;
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate chi square
|
||||
double x;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
Double_t x;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
x = fData.GetX()->at(i);
|
||||
if ((x>=fFitStartTime) && (x<=fFitStopTime)) {
|
||||
diff = fData.GetValue()->at(i) - fTheory->Func(x, par, fFuncValues);
|
||||
@ -126,7 +127,7 @@ double PRunNonMusr::CalcChiSquare(const std::vector<double>& par)
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunNonMusr::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
Double_t PRunNonMusr::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
cout << endl << "PRunSingleHisto::CalcMaxLikelihood(): not implemented yet ..." << endl;
|
||||
|
||||
@ -151,14 +152,14 @@ void PRunNonMusr::CalcTheory()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunNonMusr::PrepareData()
|
||||
Bool_t PRunNonMusr::PrepareData()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
//cout << endl << "in PRunNonMusr::PrepareData(): will feed fFitData";
|
||||
|
||||
if (fRunInfo->fRunName.size() > 1) { // ADDRUN present which is not supported for NonMusr
|
||||
cout << endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << endl;
|
||||
cerr << endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << endl;
|
||||
}
|
||||
|
||||
if (fHandleTag == kFit)
|
||||
@ -178,24 +179,24 @@ bool PRunNonMusr::PrepareData()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunNonMusr::PrepareFitData()
|
||||
Bool_t PRunNonMusr::PrepareFitData()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// keep start/stop time for fit: here the meaning is of course start x, stop x
|
||||
fFitStartTime = fRunInfo->fFitRange[0];
|
||||
fFitStopTime = fRunInfo->fFitRange[1];
|
||||
|
||||
// get x-, y-index
|
||||
unsigned int xIndex = GetXIndex();
|
||||
unsigned int yIndex = GetYIndex();
|
||||
UInt_t xIndex = GetXIndex();
|
||||
UInt_t yIndex = GetYIndex();
|
||||
// cout << endl << ">> xIndex=" << xIndex << ", yIndex=" << yIndex;
|
||||
|
||||
// pack the raw data
|
||||
double value = 0.0;
|
||||
double err = 0.0;
|
||||
Double_t value = 0.0;
|
||||
Double_t err = 0.0;
|
||||
// cout << endl << ">> fRawRunData->fDataNonMusr.fData[" << xIndex << "].size()=" << fRawRunData->fDataNonMusr.fData[xIndex].size();
|
||||
for (unsigned int i=0; i<fRawRunData->fDataNonMusr.GetData()->at(xIndex).size(); i++) {
|
||||
for (UInt_t i=0; i<fRawRunData->fDataNonMusr.GetData()->at(xIndex).size(); i++) {
|
||||
// cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
|
||||
if (fRunInfo->fPacking == 1) {
|
||||
fData.AppendXValue(fRawRunData->fDataNonMusr.GetData()->at(xIndex).at(i));
|
||||
@ -219,8 +220,8 @@ bool PRunNonMusr::PrepareFitData()
|
||||
|
||||
// count the number of bins to be fitted
|
||||
fNoOfFitBins=0;
|
||||
double x;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
Double_t x;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
x = fData.GetX()->at(i);
|
||||
if ((x >= fFitStartTime) && (x <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
@ -237,23 +238,23 @@ bool PRunNonMusr::PrepareFitData()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunNonMusr::PrepareViewData()
|
||||
Bool_t PRunNonMusr::PrepareViewData()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// cout << endl << ">> fRunInfo->fRunName = " << fRunInfo->fRunName[0].Data();
|
||||
|
||||
// get x-, y-index
|
||||
unsigned int xIndex = GetXIndex();
|
||||
unsigned int yIndex = GetYIndex();
|
||||
UInt_t xIndex = GetXIndex();
|
||||
UInt_t yIndex = GetYIndex();
|
||||
// cout << endl << "PRunNonMusr::PrepareViewData: xIndex=" << xIndex << ", yIndex=" << yIndex << endl;
|
||||
|
||||
// fill data histo
|
||||
// pack the raw data
|
||||
double value = 0.0;
|
||||
double err = 0.0;
|
||||
Double_t value = 0.0;
|
||||
Double_t err = 0.0;
|
||||
// cout << endl << ">> fRawRunData->fDataNonMusr.fData[" << xIndex << "].size()=" << fRawRunData->fDataNonMusr.fData[xIndex].size();
|
||||
for (unsigned int i=0; i<fRawRunData->fDataNonMusr.GetData()->at(xIndex).size(); i++) {
|
||||
for (UInt_t i=0; i<fRawRunData->fDataNonMusr.GetData()->at(xIndex).size(); i++) {
|
||||
// cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
|
||||
if (fRunInfo->fPacking == 1) {
|
||||
fData.AppendXValue(fRawRunData->fDataNonMusr.GetData()->at(xIndex).at(i));
|
||||
@ -281,12 +282,12 @@ bool PRunNonMusr::PrepareViewData()
|
||||
|
||||
// fill theory histo
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
@ -304,12 +305,12 @@ bool PRunNonMusr::PrepareViewData()
|
||||
// xmin found up to the largest xmax found.
|
||||
Double_t xMin = 0.0, xMax = 0.0;
|
||||
Double_t xAbsMin = 0.0, xAbsMax = 0.0;
|
||||
bool first = true;
|
||||
Bool_t first = true;
|
||||
// cout << endl << ">> plotList->size()=" << plotList->size();
|
||||
for (unsigned int i=0; i<plotList->size(); i++) {
|
||||
for (UInt_t i=0; i<plotList->size(); i++) {
|
||||
plotBlock = plotList->at(i);
|
||||
// cout << endl << ">> plotBlock.fRuns.size()=" << plotBlock.fRuns.size() << endl;
|
||||
for (unsigned int j=0; j<plotBlock.fRuns.size(); j++) {
|
||||
for (UInt_t j=0; j<plotBlock.fRuns.size(); j++) {
|
||||
// cout << endl << ">> j=" << j;
|
||||
// cout << endl << ">> fRunNo=" << fRunNo;
|
||||
// cout << endl << ">> plotBlock.fRuns[j].Re()=" << plotBlock.fRuns[j].Re();
|
||||
@ -340,13 +341,13 @@ bool PRunNonMusr::PrepareViewData()
|
||||
// cout << endl << ">> after the xmin/xmax loop." << endl;
|
||||
|
||||
// typically take 1000 points to calculate the theory, except if there are more data points, than take that number
|
||||
double xStep;
|
||||
Double_t xStep;
|
||||
if (fData.GetX()->size() > 1000.0)
|
||||
xStep = (xMax-xMin)/fData.GetX()->size();
|
||||
else
|
||||
xStep = (xMax-xMin)/1000.0;
|
||||
|
||||
double xx = xAbsMin;
|
||||
Double_t xx = xAbsMin;
|
||||
do {
|
||||
// fill x-vector
|
||||
fData.AppendXTheoryValue(xx);
|
||||
@ -369,10 +370,10 @@ bool PRunNonMusr::PrepareViewData()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
unsigned int PRunNonMusr::GetXIndex()
|
||||
UInt_t PRunNonMusr::GetXIndex()
|
||||
{
|
||||
unsigned int index = 0;
|
||||
bool found = false;
|
||||
UInt_t index = 0;
|
||||
Bool_t found = false;
|
||||
|
||||
//cout << endl << ">> PRunNonMusr::GetXIndex: fRawRunData->fDataNonMusr.fFromAscii = " << fRawRunData->fDataNonMusr.fFromAscii;
|
||||
if (fRawRunData->fDataNonMusr.FromAscii()) { // ascii-file format
|
||||
@ -387,7 +388,7 @@ unsigned int PRunNonMusr::GetXIndex()
|
||||
found = true;
|
||||
} else { // xy-data data tags which needs to be converted to an index
|
||||
//cout << endl << ">> fDataTags.size()=" << fRawRunData->fDataNonMusr.fDataTags.size();
|
||||
for (unsigned int i=0; i<fRawRunData->fDataNonMusr.GetDataTags()->size(); i++) {
|
||||
for (UInt_t i=0; i<fRawRunData->fDataNonMusr.GetDataTags()->size(); i++) {
|
||||
if (fRawRunData->fDataNonMusr.GetDataTags()->at(i).CompareTo(fRunInfo->fXYDataLabel[0]) == 0) {
|
||||
//cout << endl << ">> i=" << i << ", fRawRunData->fDataNonMusr.fDataTags[i]=" << fRawRunData->fDataNonMusr.fDataTags[i].Data();
|
||||
//cout << endl << ">> fRunInfo->fXYDataLabel[0]=" << fRunInfo->fXYDataLabel[0].Data();
|
||||
@ -400,8 +401,8 @@ unsigned int PRunNonMusr::GetXIndex()
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
cout << endl << "PRunNonMusr::GetXIndex(): **ERROR** Couldn't obtain x-data index!";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunNonMusr::GetXIndex(): **ERROR** Couldn't obtain x-data index!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@ -415,10 +416,10 @@ unsigned int PRunNonMusr::GetXIndex()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
unsigned int PRunNonMusr::GetYIndex()
|
||||
UInt_t PRunNonMusr::GetYIndex()
|
||||
{
|
||||
unsigned int index = 0;
|
||||
bool found = false;
|
||||
UInt_t index = 0;
|
||||
Bool_t found = false;
|
||||
|
||||
// cout << endl << ">> PRunNonMusr::GetYIndex:";
|
||||
if (fRawRunData->fDataNonMusr.FromAscii()) { // ascii-file format
|
||||
@ -429,7 +430,7 @@ unsigned int PRunNonMusr::GetYIndex()
|
||||
index = fRunInfo->fXYDataIndex[1]-1; // since xy-data start with 1 ...
|
||||
found = true;
|
||||
} else { // xy-data data tags which needs to be converted to an index
|
||||
for (unsigned int i=0; i<fRawRunData->fDataNonMusr.GetDataTags()->size(); i++) {
|
||||
for (UInt_t i=0; i<fRawRunData->fDataNonMusr.GetDataTags()->size(); i++) {
|
||||
if (fRawRunData->fDataNonMusr.GetDataTags()->at(i).CompareTo(fRunInfo->fXYDataLabel[1]) == 0) {
|
||||
// cout << endl << ">> i=" << i << ", fRawRunData->fDataNonMusr.fDataTags[i]=" << fRawRunData->fDataNonMusr.fDataTags[i].Data();
|
||||
// cout << endl << ">> fRunInfo->fXYDataLabel[1]=" << fRunInfo->fXYDataLabel[1].Data();
|
||||
@ -442,8 +443,8 @@ unsigned int PRunNonMusr::GetYIndex()
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
cout << endl << "PRunNonMusr::GetYIndex(): **ERROR** Couldn't obtain y-data index!";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunNonMusr::GetYIndex(): **ERROR** Couldn't obtain y-data index!";
|
||||
cerr << endl;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,9 @@ PRunRRF::PRunRRF() : PRunBase()
|
||||
* \param msrInfo pointer to the msr info structure
|
||||
* \param runNo number of the run of the msr-file
|
||||
*/
|
||||
PRunRRF::PRunRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
PRunRRF::PRunRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
{
|
||||
bool success;
|
||||
Bool_t success;
|
||||
|
||||
// calculate fFitData
|
||||
if (success) {
|
||||
@ -87,10 +87,10 @@ PRunRRF::~PRunRRF()
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunRRF::CalcChiSquare(const std::vector<double>& par)
|
||||
Double_t PRunRRF::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
{
|
||||
double chisq = 0.0;
|
||||
double diff = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
Double_t diff = 0.0;
|
||||
|
||||
return chisq;
|
||||
}
|
||||
@ -103,7 +103,7 @@ double PRunRRF::CalcChiSquare(const std::vector<double>& par)
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunRRF::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
Double_t PRunRRF::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
cout << endl << "PRunSingleHisto::CalcMaxLikelihood(): not implemented yet ..." << endl;
|
||||
|
||||
@ -128,9 +128,9 @@ void PRunRRF::CalcTheory()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunRRF::PrepareData()
|
||||
Bool_t PRunRRF::PrepareData()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
cout << endl << "in PRunRRF::PrepareData(): will feed fData";
|
||||
|
||||
|
@ -58,11 +58,12 @@ PRunSingleHisto::PRunSingleHisto() : PRunBase()
|
||||
* \param msrInfo pointer to the msr info structure
|
||||
* \param runNo number of the run of the msr-file
|
||||
*/
|
||||
PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
|
||||
{
|
||||
if (!PrepareData()) {
|
||||
cout << endl << "**SEVERE ERROR**: PRunSingleHisto::PRunSingleHisto: Couldn't prepare data for fitting!";
|
||||
cout << endl << " This is very bad :-(, will quit ...";
|
||||
cerr << endl << "**SEVERE ERROR**: PRunSingleHisto::PRunSingleHisto: Couldn't prepare data for fitting!";
|
||||
cerr << endl << " This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
}
|
||||
}
|
||||
@ -92,32 +93,32 @@ PRunSingleHisto::~PRunSingleHisto()
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunSingleHisto::CalcChiSquare(const std::vector<double>& par)
|
||||
Double_t PRunSingleHisto::CalcChiSquare(const std::vector<Double_t>& par)
|
||||
{
|
||||
double chisq = 0.0;
|
||||
double diff = 0.0;
|
||||
Double_t chisq = 0.0;
|
||||
Double_t diff = 0.0;
|
||||
|
||||
double N0;
|
||||
Double_t N0;
|
||||
|
||||
// check if norm is a parameter or a function
|
||||
if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
|
||||
N0 = par[fRunInfo->fNormParamNo-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
unsigned int funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||
}
|
||||
|
||||
// get tau
|
||||
double tau;
|
||||
Double_t tau;
|
||||
if (fRunInfo->fLifetimeParamNo != -1)
|
||||
tau = par[fRunInfo->fLifetimeParamNo-1];
|
||||
else
|
||||
tau = PMUON_LIFETIME;
|
||||
|
||||
// get background
|
||||
double bkg;
|
||||
Double_t bkg;
|
||||
if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted
|
||||
if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval)
|
||||
bkg = fBackground;
|
||||
@ -129,16 +130,16 @@ double PRunSingleHisto::CalcChiSquare(const std::vector<double>& par)
|
||||
}
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
int funcNo = fMsrInfo->GetFuncNo(i);
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
//cout << ">> i = " << i << ", funcNo = " << funcNo << endl;
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate chi square
|
||||
double time;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time>=fFitStartTime) && (time<=fFitStopTime)) {
|
||||
diff = fData.GetValue()->at(i) -
|
||||
(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg);
|
||||
@ -147,7 +148,7 @@ double PRunSingleHisto::CalcChiSquare(const std::vector<double>& par)
|
||||
}
|
||||
|
||||
/*
|
||||
static int firstTime = 0;
|
||||
static Int_t firstTime = 0;
|
||||
if (firstTime < 4) {
|
||||
firstTime++;
|
||||
cout << endl << "size=" << fData.GetValue()->size() << ", fDataTimeStart=" << fData.GetDataTimeStart() << ", fDataTimeStep=" << fData.GetDataTimeStep() << ", fFitStartTime=" << fFitStartTime << ", fFitStopTime=" << fFitStopTime;
|
||||
@ -167,31 +168,31 @@ cout << endl << "----";
|
||||
*
|
||||
* \param par parameter vector iterated by minuit
|
||||
*/
|
||||
double PRunSingleHisto::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
|
||||
{
|
||||
double mllh = 0.0; // maximum log likelihood assuming poisson distribution for the single bin
|
||||
Double_t mllh = 0.0; // maximum log likelihood assuming poisson distribution for the single bin
|
||||
|
||||
double N0;
|
||||
Double_t N0;
|
||||
|
||||
// check if norm is a parameter or a function
|
||||
if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
|
||||
N0 = par[fRunInfo->fNormParamNo-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
unsigned int funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||
}
|
||||
|
||||
// get tau
|
||||
double tau;
|
||||
Double_t tau;
|
||||
if (fRunInfo->fLifetimeParamNo != -1)
|
||||
tau = par[fRunInfo->fLifetimeParamNo-1];
|
||||
else
|
||||
tau = PMUON_LIFETIME;
|
||||
|
||||
// get background
|
||||
double bkg;
|
||||
Double_t bkg;
|
||||
if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted
|
||||
if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval)
|
||||
bkg = fBackground;
|
||||
@ -203,17 +204,17 @@ double PRunSingleHisto::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
}
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
int funcNo = fMsrInfo->GetFuncNo(i);
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
Int_t funcNo = fMsrInfo->GetFuncNo(i);
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate maximum log likelihood
|
||||
double theo;
|
||||
double data;
|
||||
double time;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
Double_t theo;
|
||||
Double_t data;
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time>=fFitStartTime) && (time<=fFitStopTime)) {
|
||||
// calculate theory for the given parameter set
|
||||
theo = N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg;
|
||||
@ -240,32 +241,32 @@ double PRunSingleHisto::CalcMaxLikelihood(const std::vector<double>& par)
|
||||
void PRunSingleHisto::CalcTheory()
|
||||
{
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
|
||||
// calculate asymmetry
|
||||
double N0;
|
||||
Double_t N0;
|
||||
// check if norm is a parameter or a function
|
||||
if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
|
||||
N0 = par[fRunInfo->fNormParamNo-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
unsigned int funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||
}
|
||||
|
||||
// get tau
|
||||
double tau;
|
||||
Double_t tau;
|
||||
if (fRunInfo->fLifetimeParamNo != -1)
|
||||
tau = par[fRunInfo->fLifetimeParamNo-1];
|
||||
else
|
||||
tau = PMUON_LIFETIME;
|
||||
|
||||
// get background
|
||||
double bkg;
|
||||
Double_t bkg;
|
||||
if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted
|
||||
if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval)
|
||||
bkg = fBackground;
|
||||
@ -277,17 +278,17 @@ void PRunSingleHisto::CalcTheory()
|
||||
}
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate theory
|
||||
unsigned int size = fData.GetValue()->size();
|
||||
double start = fData.GetDataTimeStart();
|
||||
double resolution = fData.GetDataTimeStep();
|
||||
double time;
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
time = start + (double)i*resolution;
|
||||
UInt_t size = fData.GetValue()->size();
|
||||
Double_t start = fData.GetDataTimeStart();
|
||||
Double_t resolution = fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = start + (Double_t)i*resolution;
|
||||
fData.AppendTheoryValue(N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg);
|
||||
}
|
||||
|
||||
@ -302,27 +303,28 @@ void PRunSingleHisto::CalcTheory()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunSingleHisto::PrepareData()
|
||||
Bool_t PRunSingleHisto::PrepareData()
|
||||
{
|
||||
// cout << endl << "in PRunSingleHisto::PrepareData(): will feed fData";
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// get the proper run
|
||||
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
|
||||
if (!runData) { // couldn't get run
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if post pile up data shall be used
|
||||
unsigned int histoNo;
|
||||
UInt_t histoNo;
|
||||
histoNo = fRunInfo->fForwardHistoNo-1;
|
||||
|
||||
if ((runData->GetNoOfHistos() < histoNo) || (histoNo < 0)) {
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
|
||||
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?";
|
||||
cout << endl << " Will quite :-(";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << " histoNo found = " << histoNo << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?";
|
||||
cerr << endl << " Will quite :-(";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -334,8 +336,9 @@ bool PRunSingleHisto::PrepareData()
|
||||
// fForwardHistoNo starts with 1 not with 0 ;-)
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->fForwardHistoNo-1));
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cout << endl << " run: " << fRunInfo->fRunName[0].Data();
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << " run: " << fRunInfo->fRunName[0].Data();
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
@ -343,37 +346,39 @@ bool PRunSingleHisto::PrepareData()
|
||||
if (runData->GetT0s().size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->fT0[0]-runData->GetT0(fRunInfo->fForwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
|
||||
cout << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl;
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
|
||||
cerr << endl << " t0 from the data file is " << runData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
fT0s.push_back(fRunInfo->fT0[0]);
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
int t0 = fT0s[0];
|
||||
if ((t0 < 0) || (t0 > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
Int_t t0 = fT0s[0];
|
||||
if ((t0 < 0) || (t0 > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if there are runs to be added to the current one
|
||||
if (fRunInfo->fRunName.size() > 1) { // runs to be added present
|
||||
PRawRunData *addRunData;
|
||||
for (unsigned int i=1; i<fRunInfo->fRunName.size(); i++) {
|
||||
for (UInt_t i=1; i<fRunInfo->fRunName.size(); i++) {
|
||||
|
||||
// get run to be added to the main one
|
||||
addRunData = fRawData->GetRunData(fRunInfo->fRunName[i]);
|
||||
if (addRunData == 0) { // couldn't get run
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// get T0's of the to be added run
|
||||
int t0Add;
|
||||
Int_t t0Add;
|
||||
// check if the t0's are given in the msr-file
|
||||
if (i >= fRunInfo->fT0.size()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
@ -382,8 +387,9 @@ bool PRunSingleHisto::PrepareData()
|
||||
// fForwardHistoNo starts with 1 not with 0 ;-)
|
||||
t0Add = addRunData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the addrun data nor in the msr-file!";
|
||||
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the addrun data nor in the msr-file!";
|
||||
cerr << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
@ -391,28 +397,29 @@ bool PRunSingleHisto::PrepareData()
|
||||
if (addRunData->GetT0s().size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->fT0[i]-addRunData->GetT0(fRunInfo->fForwardHistoNo-1))>5.0) { // given in bins!!
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[i];
|
||||
cout << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cout << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cout << endl;
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cerr << endl << " t0 from the msr-file is " << fRunInfo->fT0[i];
|
||||
cerr << endl << " t0 from the data file is " << addRunData->GetT0(fRunInfo->fForwardHistoNo-1);
|
||||
cerr << endl << " This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << " addrun: " << fRunInfo->fRunName[i].Data();
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
if (i < fRunInfo->fT0.size()) {
|
||||
t0Add = fRunInfo->fT0[i];
|
||||
} else {
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cout << fRunInfo->fRunName[i].Data();
|
||||
cout << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cout << fRunInfo->fRunName[i].Data();
|
||||
cout << ") without any warranty!";
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cerr << fRunInfo->fRunName[i].Data();
|
||||
cerr << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cerr << fRunInfo->fRunName[i].Data();
|
||||
cerr << ") without any warranty!";
|
||||
cerr << endl;
|
||||
t0Add = fRunInfo->fT0[0];
|
||||
}
|
||||
}
|
||||
|
||||
// add run
|
||||
for (unsigned int j=0; j<runData->GetDataBin(histoNo)->size(); j++) {
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo)->size(); j++) {
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j-t0Add+t0 >= 0) && (j-t0Add+t0 < addRunData->GetDataBin(histoNo)->size())) {
|
||||
runData->AddDataBin(histoNo, j, addRunData->GetDataBin(histoNo)->at(j-t0Add+t0));
|
||||
@ -443,7 +450,7 @@ bool PRunSingleHisto::PrepareData()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int histoNo)
|
||||
Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoNo)
|
||||
{
|
||||
// keep start/stop time for fit
|
||||
fFitStartTime = fRunInfo->fFitRange[0];
|
||||
@ -454,25 +461,27 @@ bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int hi
|
||||
// for the single histo fit, just the rebinned raw data are copied
|
||||
|
||||
// first get start data, end data, and t0
|
||||
int start;
|
||||
int end;
|
||||
Int_t start;
|
||||
Int_t end;
|
||||
start = fRunInfo->fDataRange[0];
|
||||
end = fRunInfo->fDataRange[1];
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
if (end < start) { // need to swap them
|
||||
int keep = end;
|
||||
Int_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** start data bin doesn't make any sense!";
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
|
||||
if ((end < 0) || (end > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -484,22 +493,23 @@ bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int hi
|
||||
if (!EstimateBkg(histoNo))
|
||||
return false;
|
||||
} else { // no background given to do the job
|
||||
cout << endl << "PRunSingleHisto::PrepareData(): Neither fix background nor background bins are given!";
|
||||
cout << endl << "One of the two is needed! Will quit ...";
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Neither fix background nor background bins are given!";
|
||||
cerr << endl << "One of the two is needed! Will quit ...";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
int t0 = fT0s[0];
|
||||
double value = 0.0;
|
||||
double normalizer = 1.0;
|
||||
Int_t t0 = fT0s[0];
|
||||
Double_t value = 0.0;
|
||||
Double_t normalizer = 1.0;
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((double)start-(double)t0+(double)(fRunInfo->fPacking-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(fRunInfo->fPacking-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*fRunInfo->fPacking);
|
||||
for (int i=start; i<end; i++) {
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
if (fRunInfo->fPacking == 1) {
|
||||
value = runData->GetDataBin(histoNo)->at(i);
|
||||
normalizer = fRunInfo->fPacking * (fTimeResolution * 1e3); // fTimeResolution us->ns
|
||||
@ -529,10 +539,10 @@ bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int hi
|
||||
|
||||
// count the number of bins to be fitted
|
||||
fNoOfFitBins=0;
|
||||
double time;
|
||||
Double_t time;
|
||||
//cout << endl << ">> size=" << fData.GetValue()->size() << ", fDataTimeStart=" << fData.GetDataTimeStart() << ", fDataTimeStep=" << fData.GetDataTimeStep() << ", fFitStartTime=" << fFitStartTime << ", fFitStopTime=" << fFitStopTime;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time >= fFitStartTime) && (time <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
}
|
||||
@ -547,43 +557,45 @@ bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int hi
|
||||
* <p> Muon raw data
|
||||
*
|
||||
*/
|
||||
bool PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const unsigned int histoNo)
|
||||
Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t histoNo)
|
||||
{
|
||||
// check if view_packing is wished
|
||||
int packing = fRunInfo->fPacking;
|
||||
Int_t packing = fRunInfo->fPacking;
|
||||
if (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0) {
|
||||
packing = fMsrInfo->GetMsrPlotList()->at(0).fViewPacking;
|
||||
}
|
||||
|
||||
// raw data, since PMusrCanvas is doing ranging etc.
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
int start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/packing)*packing;
|
||||
Int_t start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/packing)*packing;
|
||||
// end = last bin starting from start which is a multipl of packing and still within the data
|
||||
int end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
if (end < start) { // need to swap them
|
||||
int keep = end;
|
||||
Int_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
if ((end < 0) || (end > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
int t0 = fT0s[0];
|
||||
double value = 0.0;
|
||||
Int_t t0 = fT0s[0];
|
||||
Double_t value = 0.0;
|
||||
// data start at data_start-t0
|
||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||
fData.SetDataTimeStart(fTimeResolution*((double)start-(double)t0+(double)(packing-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*packing);
|
||||
|
||||
/*
|
||||
@ -592,8 +604,8 @@ cout << endl << ">> start = " << start << ", t0 = " << t0 << ", packing = " << p
|
||||
cout << endl << ">> data start time = " << fData.GetDataTimeStart();
|
||||
*/
|
||||
|
||||
double normalizer = 1.0;
|
||||
for (int i=start; i<end; i++) {
|
||||
Double_t normalizer = 1.0;
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
if (((i-start) % packing == 0) && (i != start)) { // fill data
|
||||
// in order that after rebinning the fit does not need to be redone (important for plots)
|
||||
// the value is normalize to per 1 nsec
|
||||
@ -613,41 +625,41 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart();
|
||||
// count the number of bins
|
||||
fNoOfFitBins=0;
|
||||
|
||||
double time;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
Double_t time;
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time >= fFitStartTime) && (time <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
}
|
||||
|
||||
// fill theory vector for kView
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
|
||||
// calculate asymmetry
|
||||
double N0;
|
||||
Double_t N0;
|
||||
// check if norm is a parameter or a function
|
||||
if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
|
||||
N0 = par[fRunInfo->fNormParamNo-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
unsigned int funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||
}
|
||||
|
||||
// get tau
|
||||
double tau;
|
||||
Double_t tau;
|
||||
if (fRunInfo->fLifetimeParamNo != -1)
|
||||
tau = par[fRunInfo->fLifetimeParamNo-1];
|
||||
else
|
||||
tau = PMUON_LIFETIME;
|
||||
|
||||
// get background
|
||||
double bkg;
|
||||
Double_t bkg;
|
||||
if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted
|
||||
if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval)
|
||||
if (!EstimateBkg(histoNo))
|
||||
@ -661,22 +673,22 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart();
|
||||
}
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate theory
|
||||
unsigned int size = runData->GetDataBin(histoNo)->size();
|
||||
double factor = 1.0;
|
||||
UInt_t size = runData->GetDataBin(histoNo)->size();
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo)->size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (double)runData->GetDataBin(histoNo)->size() / (double)size;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo)->size() / (Double_t)size;
|
||||
}
|
||||
//cout << endl << ">> runData->GetDataBin(histoNo).size() = " << runData->GetDataBin(histoNo)->size() << ", fData.GetValue()->size() * 10 = " << fData.GetValue()->size() * 10 << ", size = " << size << ", factor = " << factor << endl;
|
||||
double theoryValue;
|
||||
Double_t theoryValue;
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + i*fData.GetTheoryTimeStep();
|
||||
theoryValue = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(theoryValue) > 10.0) { // dirty hack needs to be fixed!!
|
||||
@ -705,10 +717,10 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart();
|
||||
* \f[ N(t_i) = \frac{1}{p}\, \sum_{j=i}^{i+p} n_j \f]
|
||||
* with \f$ n_j \f$ the raw histogram data bins.
|
||||
*/
|
||||
bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int histoNo)
|
||||
Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histoNo)
|
||||
{
|
||||
// check if view_packing is wished
|
||||
int packing = fRunInfo->fPacking;
|
||||
Int_t packing = fRunInfo->fPacking;
|
||||
if (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0) {
|
||||
packing = fMsrInfo->GetMsrPlotList()->at(0).fViewPacking;
|
||||
}
|
||||
@ -716,53 +728,55 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h
|
||||
// transform raw histo data. This is done the following way (for details see the manual):
|
||||
// for the single histo fit, just the rebinned raw data are copied
|
||||
// first get start data, end data, and t0
|
||||
int t0 = fT0s[0];
|
||||
Int_t t0 = fT0s[0];
|
||||
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
int start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/packing)*packing;
|
||||
Int_t start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/packing)*packing;
|
||||
// end = last bin starting from start which is a multiple of packing and still within the data
|
||||
int end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
|
||||
// check if start, end, and t0 make any sense
|
||||
// 1st check if start and end are in proper order
|
||||
if (end < start) { // need to swap them
|
||||
int keep = end;
|
||||
Int_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
// 3rd check if end is within proper bounds
|
||||
if ((end < 0) || (end > (int)runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
if ((end < 0) || (end > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
cerr << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// everything looks fine, hence fill data set
|
||||
|
||||
// feed the parameter vector
|
||||
std::vector<double> par;
|
||||
std::vector<Double_t> par;
|
||||
PMsrParamList *paramList = fMsrInfo->GetMsrParamList();
|
||||
for (unsigned int i=0; i<paramList->size(); i++)
|
||||
for (UInt_t i=0; i<paramList->size(); i++)
|
||||
par.push_back((*paramList)[i].fValue);
|
||||
|
||||
// calculate asymmetry
|
||||
double N0;
|
||||
Double_t N0;
|
||||
// check if norm is a parameter or a function
|
||||
if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter
|
||||
N0 = par[fRunInfo->fNormParamNo-1];
|
||||
} else { // norm is a function
|
||||
// get function number
|
||||
unsigned int funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET;
|
||||
// evaluate function
|
||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||
}
|
||||
|
||||
// get tau
|
||||
double tau;
|
||||
Double_t tau;
|
||||
if (fRunInfo->fLifetimeParamNo != -1)
|
||||
tau = par[fRunInfo->fLifetimeParamNo-1];
|
||||
else
|
||||
@ -770,7 +784,7 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h
|
||||
//cout << endl << ">> tau = " << tau;
|
||||
|
||||
// get background
|
||||
double bkg;
|
||||
Double_t bkg;
|
||||
if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted
|
||||
if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval)
|
||||
if (!EstimateBkg(histoNo))
|
||||
@ -783,12 +797,12 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h
|
||||
bkg = par[fRunInfo->fBkgFitParamNo-1];
|
||||
}
|
||||
|
||||
double value = 0.0;
|
||||
double expval;
|
||||
double time;
|
||||
Double_t value = 0.0;
|
||||
Double_t expval;
|
||||
Double_t time;
|
||||
|
||||
// data start at data_start-t0 shifted by (pack-1)/2
|
||||
fData.SetDataTimeStart(fTimeResolution*((double)start-(double)t0+(double)(packing-1)/2.0));
|
||||
fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0));
|
||||
fData.SetDataTimeStep(fTimeResolution*packing);
|
||||
|
||||
/*
|
||||
@ -797,14 +811,14 @@ cout << endl << ">> start = " << start << ", end = " << end;
|
||||
cout << endl << "--------------------------------" << endl;
|
||||
*/
|
||||
|
||||
double normalizer = 1.0;
|
||||
for (int i=start; i<end; i++) {
|
||||
Double_t normalizer = 1.0;
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
if (((i-start) % packing == 0) && (i != start)) { // fill data
|
||||
// in order that after rebinning the fit does not need to be redone (important for plots)
|
||||
// the value is normalize to per 1 nsec
|
||||
normalizer = packing * (fTimeResolution * 1.0e3); // fTimeResolution us->ns
|
||||
value /= normalizer;
|
||||
time = (((double)i-(double)(packing-1)/2.0)-t0)*fTimeResolution;
|
||||
time = (((Double_t)i-(Double_t)(packing-1)/2.0)-t0)*fTimeResolution;
|
||||
expval = TMath::Exp(+time/tau)/N0;
|
||||
fData.AppendValue(-1.0+expval*(value-bkg));
|
||||
//cout << endl << ">> i=" << i << ",t0=" << t0 << ",time=" << time << ",expval=" << expval << ",value=" << value << ",bkg=" << bkg << ",expval*(value-bkg)-1=" << expval*(value-bkg)-1.0;
|
||||
@ -817,31 +831,31 @@ cout << endl << "--------------------------------" << endl;
|
||||
|
||||
// count the number of bins to be fitted
|
||||
fNoOfFitBins=0;
|
||||
for (unsigned int i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (double)i*fData.GetDataTimeStep();
|
||||
for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
|
||||
if ((time >= fFitStartTime) && (time <= fFitStopTime))
|
||||
fNoOfFitBins++;
|
||||
}
|
||||
|
||||
// calculate functions
|
||||
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
for (Int_t i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||
}
|
||||
|
||||
// calculate theory
|
||||
double theoryValue;
|
||||
unsigned int size = runData->GetDataBin(histoNo)->size();
|
||||
double factor = 1.0;
|
||||
Double_t theoryValue;
|
||||
UInt_t size = runData->GetDataBin(histoNo)->size();
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo)->size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (double)runData->GetDataBin(histoNo)->size() / (double)size;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo)->size() / (Double_t)size;
|
||||
}
|
||||
//cout << endl << ">> runData->GetDataBin(histoNo).size() = " << runData->GetDataBin(histoNo).size() << ", fData.GetValue()->size() * 10 = " << fData.GetValue()->size() * 10 << ", size = " << size << ", factor = " << factor << endl;
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
//cout << endl << ">> size=" << size << ", startTime=" << startTime << ", fTimeResolution=" << fTimeResolution;
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (double)i*fData.GetTheoryTimeStep();
|
||||
for (UInt_t i=0; i<size; i++) {
|
||||
time = fData.GetTheoryTimeStart() + (Double_t)i*fData.GetTheoryTimeStep();
|
||||
theoryValue = fTheory->Func(time, par, fFuncValues);
|
||||
if (fabs(theoryValue) > 10.0) { // dirty hack needs to be fixed!!
|
||||
theoryValue = 0.0;
|
||||
@ -861,9 +875,9 @@ cout << endl << "--------------------------------" << endl;
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
|
||||
Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo)
|
||||
{
|
||||
double beamPeriod = 0.0;
|
||||
Double_t beamPeriod = 0.0;
|
||||
|
||||
// check if data are from PSI, RAL, or TRIUMF
|
||||
if (fRunInfo->fInstitute[0].Contains("psi"))
|
||||
@ -876,20 +890,20 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
|
||||
beamPeriod = 0.0;
|
||||
|
||||
// check if start and end are in proper order
|
||||
unsigned int start = fRunInfo->fBkgRange[0];
|
||||
unsigned int end = fRunInfo->fBkgRange[1];
|
||||
UInt_t start = fRunInfo->fBkgRange[0];
|
||||
UInt_t end = fRunInfo->fBkgRange[1];
|
||||
if (end < start) {
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!";
|
||||
unsigned int keep = end;
|
||||
UInt_t keep = end;
|
||||
end = start;
|
||||
start = keep;
|
||||
}
|
||||
|
||||
// calculate proper background range
|
||||
if (beamPeriod != 0.0) {
|
||||
double beamPeriodBins = beamPeriod/fRunInfo->fPacking;
|
||||
unsigned int periods = (unsigned int)((double)(end - start + 1) / beamPeriodBins);
|
||||
end = start + (unsigned int)round((double)periods*beamPeriodBins);
|
||||
Double_t beamPeriodBins = beamPeriod/fRunInfo->fPacking;
|
||||
UInt_t periods = (UInt_t)((Double_t)(end - start + 1) / beamPeriodBins);
|
||||
end = start + (UInt_t)round((Double_t)periods*beamPeriodBins);
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end;
|
||||
if (end == start)
|
||||
end = fRunInfo->fBkgRange[1];
|
||||
@ -900,28 +914,30 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
|
||||
|
||||
// check if start is within histogram bounds
|
||||
if ((start < 0) || (start >= runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): background bin values out of bound!";
|
||||
cout << endl << " histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cout << endl << " background start = " << start;
|
||||
cerr << endl << "PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << " histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cerr << endl << " background start = " << start;
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if end is within histogram bounds
|
||||
if ((end < 0) || (end >= runData->GetDataBin(histoNo)->size())) {
|
||||
cout << endl << "PRunSingleHisto::EstimatBkg(): background bin values out of bound!";
|
||||
cout << endl << " histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cout << endl << " background end = " << end;
|
||||
cerr << endl << "PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << " histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cerr << endl << " background end = " << end;
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// calculate background
|
||||
double bkg = 0.0;
|
||||
Double_t bkg = 0.0;
|
||||
|
||||
// forward
|
||||
//cout << endl << ">> bkg start=" << start << ", end=" << end;
|
||||
for (unsigned int i=start; i<end; i++)
|
||||
for (UInt_t i=start; i<end; i++)
|
||||
bkg += runData->GetDataBin(histoNo)->at(i);
|
||||
bkg /= static_cast<double>(end - start + 1);
|
||||
bkg /= static_cast<Double_t>(end - start + 1);
|
||||
|
||||
fBackground = bkg / (fTimeResolution * 1e3); // keep background (per 1 nsec) for chisq, max.log.likelihood, fTimeResolution us->ns
|
||||
|
||||
|
@ -53,10 +53,10 @@ PStartupHandler::PStartupHandler()
|
||||
fStartupFilePath = "";
|
||||
|
||||
// get default path (for the moment only linux like)
|
||||
char *pmusrpath;
|
||||
char *home;
|
||||
char musrpath[128];
|
||||
char startup_path_name[128];
|
||||
Char_t *pmusrpath;
|
||||
Char_t *home;
|
||||
Char_t musrpath[128];
|
||||
Char_t startup_path_name[128];
|
||||
|
||||
// check if the startup file is found in the current directory
|
||||
strcpy(startup_path_name, "./musrfit_startup.xml");
|
||||
@ -69,7 +69,7 @@ PStartupHandler::PStartupHandler()
|
||||
if (pmusrpath == 0) { // not set, will try default one
|
||||
home = getenv("ROOTSYS");
|
||||
sprintf(musrpath, "%s/bin", home);
|
||||
cout << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
|
||||
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
|
||||
} else {
|
||||
strncpy(musrpath, pmusrpath, sizeof(musrpath));
|
||||
}
|
||||
@ -140,7 +140,7 @@ void PStartupHandler::OnEndDocument()
|
||||
* \param str
|
||||
* \param attributes
|
||||
*/
|
||||
void PStartupHandler::OnStartElement(const char *str, const TList *attributes)
|
||||
void PStartupHandler::OnStartElement(const Char_t *str, const TList *attributes)
|
||||
{
|
||||
if (!strcmp(str, "data_path")) {
|
||||
fKey = eDataPath;
|
||||
@ -171,7 +171,7 @@ void PStartupHandler::OnStartElement(const char *str, const TList *attributes)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnEndElement(const char *str)
|
||||
void PStartupHandler::OnEndElement(const Char_t *str)
|
||||
{
|
||||
fKey = eEmpty;
|
||||
}
|
||||
@ -184,7 +184,7 @@ void PStartupHandler::OnEndElement(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnCharacters(const char *str)
|
||||
void PStartupHandler::OnCharacters(const Char_t *str)
|
||||
{
|
||||
TObjArray *tokens;
|
||||
TObjString *ostr;
|
||||
@ -204,8 +204,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
// add converted str to the marker list
|
||||
fMarkerList.push_back(tstr.Atoi());
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a number, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a number, will ignore it";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case eColor:
|
||||
@ -214,14 +214,14 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
tokens = tstr.Tokenize(",");
|
||||
// check that there any tokens
|
||||
if (!tokens) {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
// check there is the right number of tokens
|
||||
if (tokens->GetEntries() != 3) {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
// get r
|
||||
@ -230,8 +230,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if (tstr.IsDigit()) {
|
||||
r = tstr.Atoi();
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** r within the rgb code is not a number, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** r within the rgb code is not a number, will ignore it";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
// get g
|
||||
@ -240,8 +240,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if (tstr.IsDigit()) {
|
||||
g = tstr.Atoi();
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** g within the rgb code is not a number, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** g within the rgb code is not a number, will ignore it";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
// get b
|
||||
@ -250,8 +250,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if (tstr.IsDigit()) {
|
||||
b = tstr.Atoi();
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** b within the rgb code is not a number, will ignore it";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** b within the rgb code is not a number, will ignore it";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
// clean up tokens
|
||||
@ -273,8 +273,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
} else if (!tstr.CompareTo("mc/s", TString::kIgnoreCase)) {
|
||||
fFourierDefaults.fUnits = FOURIER_UNIT_CYCLES;
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid unit, will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid unit, will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case eFourierPower:
|
||||
@ -284,12 +284,12 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if ((ival >= 0) && (ival <= 20)) {
|
||||
fFourierDefaults.fFourierPower = ival;
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case eApodization:
|
||||
@ -303,8 +303,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
} else if (!tstr.CompareTo("strong", TString::kIgnoreCase)) {
|
||||
fFourierDefaults.fApodization = FOURIER_APOD_STRONG;
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid apodization, will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid apodization, will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case ePlot:
|
||||
@ -320,8 +320,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
} else if (!tstr.CompareTo("phase", TString::kIgnoreCase)) {
|
||||
fFourierDefaults.fPlotTag = FOURIER_PLOT_PHASE;
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid plot option, will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid plot option, will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case ePhase:
|
||||
@ -329,8 +329,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if (tstr.IsFloat()) {
|
||||
fFourierDefaults.fPhase = tstr.Atof();
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase, will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase, will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
case ePhaseIncrement:
|
||||
@ -338,8 +338,8 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
if (tstr.IsFloat()) {
|
||||
fFourierDefaults.fPhaseIncrement = tstr.Atof();
|
||||
} else {
|
||||
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase increment, will ignore it.";
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase increment, will ignore it.";
|
||||
cerr << endl;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -355,7 +355,7 @@ void PStartupHandler::OnCharacters(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnComment(const char *str)
|
||||
void PStartupHandler::OnComment(const Char_t *str)
|
||||
{
|
||||
// nothing to be done for now
|
||||
}
|
||||
@ -368,10 +368,10 @@ void PStartupHandler::OnComment(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnWarning(const char *str)
|
||||
void PStartupHandler::OnWarning(const Char_t *str)
|
||||
{
|
||||
cout << endl << "PStartupHandler **WARNING** " << str;
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **WARNING** " << str;
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -382,10 +382,10 @@ void PStartupHandler::OnWarning(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnError(const char *str)
|
||||
void PStartupHandler::OnError(const Char_t *str)
|
||||
{
|
||||
cout << endl << "PStartupHandler **ERROR** " << str;
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **ERROR** " << str;
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -396,10 +396,10 @@ void PStartupHandler::OnError(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnFatalError(const char *str)
|
||||
void PStartupHandler::OnFatalError(const Char_t *str)
|
||||
{
|
||||
cout << endl << "PStartupHandler **FATAL ERROR** " << str;
|
||||
cout << endl;
|
||||
cerr << endl << "PStartupHandler **FATAL ERROR** " << str;
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -410,7 +410,7 @@ void PStartupHandler::OnFatalError(const char *str)
|
||||
*
|
||||
* \param str
|
||||
*/
|
||||
void PStartupHandler::OnCdataBlock(const char *str, Int_t len)
|
||||
void PStartupHandler::OnCdataBlock(const Char_t *str, Int_t len)
|
||||
{
|
||||
// nothing to be done for now
|
||||
}
|
||||
@ -427,7 +427,7 @@ void PStartupHandler::CheckLists()
|
||||
// check if anything was set, and if not set some default stuff
|
||||
|
||||
// check if any data path is given
|
||||
//cout << endl << ">> check data path list ...";
|
||||
//cout << endl << ">> check data path list ...";
|
||||
if (fDataPathList.size() == 0) {
|
||||
//cout << endl << ">> data path list empty, will set default ones";
|
||||
fDataPathList.push_back(TString("/mnt/data/nemu/his"));
|
||||
@ -478,9 +478,9 @@ void PStartupHandler::CheckLists()
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
bool PStartupHandler::StartupFileExists(char *fln)
|
||||
Bool_t PStartupHandler::StartupFileExists(Char_t *fln)
|
||||
{
|
||||
bool result = false;
|
||||
Bool_t result = false;
|
||||
|
||||
ifstream ifile(fln);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,20 +63,20 @@ Will handle all the possible minuit commands and actually do things ...
|
||||
class PFitter
|
||||
{
|
||||
public:
|
||||
PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, bool chisq_only = false);
|
||||
PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only = false);
|
||||
virtual ~PFitter();
|
||||
|
||||
bool IsValid() { return fIsValid; }
|
||||
bool HasConverged() { return fConverged; }
|
||||
bool DoFit();
|
||||
Bool_t IsValid() { return fIsValid; }
|
||||
Bool_t HasConverged() { return fConverged; }
|
||||
Bool_t DoFit();
|
||||
|
||||
private:
|
||||
bool fIsValid;
|
||||
bool fConverged;
|
||||
bool fChisqOnly;
|
||||
bool fUseChi2;
|
||||
Bool_t fIsValid;
|
||||
Bool_t fConverged;
|
||||
Bool_t fChisqOnly;
|
||||
Bool_t fUseChi2;
|
||||
|
||||
unsigned int fStrategy;
|
||||
UInt_t fStrategy;
|
||||
|
||||
PMsrHandler *fRunInfo;
|
||||
|
||||
@ -90,15 +90,15 @@ class PFitter
|
||||
ROOT::Minuit2::FunctionMinimum *fFcnMin; ///< function minimum object
|
||||
ROOT::Minuit2::MnUserParameterState *fMnUserParamState; ///< keeps the current user parameter state
|
||||
|
||||
bool CheckCommands();
|
||||
bool SetParameters();
|
||||
Bool_t CheckCommands();
|
||||
Bool_t SetParameters();
|
||||
|
||||
bool ExecuteHesse();
|
||||
bool ExecuteMigrad();
|
||||
bool ExecuteMinimize();
|
||||
bool ExecuteMinos();
|
||||
bool ExecuteSave();
|
||||
bool ExecuteSimplex();
|
||||
Bool_t ExecuteHesse();
|
||||
Bool_t ExecuteMigrad();
|
||||
Bool_t ExecuteMinimize();
|
||||
Bool_t ExecuteMinos();
|
||||
Bool_t ExecuteSave();
|
||||
Bool_t ExecuteSimplex();
|
||||
};
|
||||
|
||||
#endif // _PFITTER_H_
|
||||
|
@ -41,17 +41,17 @@
|
||||
class PFitterFcn : public ROOT::Minuit2::FCNBase
|
||||
{
|
||||
public:
|
||||
PFitterFcn(PRunListCollection *runList, bool useChi2);
|
||||
PFitterFcn(PRunListCollection *runList, Bool_t useChi2);
|
||||
~PFitterFcn();
|
||||
|
||||
double Up() const { return fUp; }
|
||||
double operator()(const std::vector<double>&) const;
|
||||
Double_t Up() const { return fUp; }
|
||||
Double_t operator()(const std::vector<Double_t>&) const;
|
||||
|
||||
unsigned int GetTotalNoOfFittedBins() { return fRunListCollection->GetTotalNoOfBinsFitted(); }
|
||||
UInt_t GetTotalNoOfFittedBins() { return fRunListCollection->GetTotalNoOfBinsFitted(); }
|
||||
|
||||
private:
|
||||
double fUp;
|
||||
bool fUseChi2;
|
||||
Double_t fUp;
|
||||
Bool_t fUseChi2;
|
||||
PRunListCollection *fRunListCollection;
|
||||
};
|
||||
|
||||
|
@ -45,43 +45,43 @@
|
||||
class PFourier
|
||||
{
|
||||
public:
|
||||
PFourier(TH1F *data, int unitTag,
|
||||
double startTime = 0.0, double endTime = 0.0,
|
||||
unsigned int zeroPaddingPower = 0);
|
||||
PFourier(TH1F *data, Int_t unitTag,
|
||||
Double_t startTime = 0.0, Double_t endTime = 0.0,
|
||||
UInt_t zeroPaddingPower = 0);
|
||||
virtual ~PFourier();
|
||||
|
||||
virtual void Transform(unsigned int apodizationTag = 0);
|
||||
virtual void Transform(UInt_t apodizationTag = 0);
|
||||
|
||||
virtual double GetResolution() { return fResolution; }
|
||||
virtual TH1F* GetRealFourier(const double scale = 1.0);
|
||||
virtual TH1F* GetImaginaryFourier(const double scale = 1.0);
|
||||
virtual TH1F* GetPowerFourier(const double scale = 1.0);
|
||||
virtual TH1F* GetPhaseFourier(const double scale = 1.0);
|
||||
virtual Double_t GetResolution() { return fResolution; }
|
||||
virtual TH1F* GetRealFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetPowerFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetPhaseFourier(const Double_t scale = 1.0);
|
||||
|
||||
virtual bool IsValid() { return fValid; }
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
|
||||
private:
|
||||
TH1F *fData;
|
||||
|
||||
bool fValid;
|
||||
int fUnitTag; ///< 1=Field Units (G), 2=Frequency Units (MHz), 3=Angular Frequency Units (Mc/s)
|
||||
Bool_t fValid;
|
||||
Int_t fUnitTag; ///< 1=Field Units (G), 2=Frequency Units (MHz), 3=Angular Frequency Units (Mc/s)
|
||||
|
||||
int fApodization; ///< 0=none, 1=weak, 2=medium, 3=strong
|
||||
Int_t fApodization; ///< 0=none, 1=weak, 2=medium, 3=strong
|
||||
|
||||
double fTimeResolution;
|
||||
double fStartTime;
|
||||
double fEndTime;
|
||||
unsigned int fZeroPaddingPower;
|
||||
double fResolution;
|
||||
Double_t fTimeResolution;
|
||||
Double_t fStartTime;
|
||||
Double_t fEndTime;
|
||||
UInt_t fZeroPaddingPower;
|
||||
Double_t fResolution;
|
||||
|
||||
unsigned int fNoOfData;
|
||||
unsigned int fNoOfBins;
|
||||
UInt_t fNoOfData;
|
||||
UInt_t fNoOfBins;
|
||||
fftw_plan fFFTwPlan;
|
||||
fftw_complex *fIn;
|
||||
fftw_complex *fOut;
|
||||
|
||||
virtual void PrepareFFTwInputData(unsigned int apodizationTag);
|
||||
virtual void ApodizeData(int apodizationTag);
|
||||
virtual void PrepareFFTwInputData(UInt_t apodizationTag);
|
||||
virtual void ApodizeData(Int_t apodizationTag);
|
||||
};
|
||||
|
||||
#endif // _PFOURIER_H_
|
||||
|
@ -65,11 +65,11 @@ using namespace boost::spirit;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
typedef struct func_tree_node {
|
||||
int fID; ///< tag showing what tree element this is
|
||||
int fOperatorTag; ///< tag for '+', '-', '*', '/'
|
||||
int fFunctionTag; ///< tag got "cos", "sin", ...
|
||||
int fIvalue; ///< for parameter numbers and maps
|
||||
double fDvalue; ///< for numbers
|
||||
Int_t fID; ///< tag showing what tree element this is
|
||||
Int_t fOperatorTag; ///< tag for '+', '-', '*', '/'
|
||||
Int_t fFunctionTag; ///< tag got "cos", "sin", ...
|
||||
Int_t fIvalue; ///< for parameter numbers and maps
|
||||
Double_t fDvalue; ///< for numbers
|
||||
vector<func_tree_node> children; ///< holding sub-tree
|
||||
} PFuncTreeNode;
|
||||
|
||||
@ -79,32 +79,32 @@ class PFunction {
|
||||
PFunction(tree_parse_info<> info);
|
||||
virtual ~PFunction();
|
||||
|
||||
virtual bool IsValid() { return fValid; }
|
||||
virtual int GetFuncNo() { return fFuncNo; }
|
||||
virtual bool CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSize);
|
||||
virtual double Eval(vector<double> param);
|
||||
virtual void SetMap(vector<int> map) { fMap = map; }
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
virtual Int_t GetFuncNo() { return fFuncNo; }
|
||||
virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize);
|
||||
virtual Double_t Eval(vector<Double_t> param);
|
||||
virtual void SetMap(vector<Int_t> map) { fMap = map; }
|
||||
|
||||
virtual TString* GetFuncString() { return &fFuncString; }
|
||||
|
||||
protected:
|
||||
virtual bool SetFuncNo();
|
||||
virtual Bool_t SetFuncNo();
|
||||
|
||||
virtual bool FindAndCheckMapAndParamRange(PFuncTreeNode &node, unsigned int mapSize, unsigned int paramSize);
|
||||
virtual bool GenerateFuncEvalTree();
|
||||
virtual Bool_t FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSize, UInt_t paramSize);
|
||||
virtual Bool_t GenerateFuncEvalTree();
|
||||
virtual void FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node);
|
||||
virtual double EvalNode(PFuncTreeNode &node);
|
||||
virtual Double_t EvalNode(PFuncTreeNode &node);
|
||||
virtual void CleanupFuncEvalTree();
|
||||
virtual void CleanupNode(PFuncTreeNode &node);
|
||||
|
||||
private:
|
||||
tree_parse_info<> fInfo;
|
||||
vector<double> fParam;
|
||||
vector<int> fMap;
|
||||
vector<Double_t> fParam;
|
||||
vector<Int_t> fMap;
|
||||
PFuncTreeNode fFunc;
|
||||
|
||||
bool fValid; ///< flag showing if the function is valid
|
||||
int fFuncNo; ///< function number, i.e. FUNx with x the function number
|
||||
Bool_t fValid; ///< flag showing if the function is valid
|
||||
Int_t fFuncNo; ///< function number, i.e. FUNx with x the function number
|
||||
|
||||
virtual void EvalTreeForString(tree_parse_info<> info);
|
||||
virtual void EvalTreeForStringExpression(iter_t const& i);
|
||||
|
@ -48,17 +48,17 @@ class PFunctionHandler
|
||||
PFunctionHandler(PMsrLines lines);
|
||||
virtual ~PFunctionHandler();
|
||||
|
||||
virtual bool IsValid() { return fValid; }
|
||||
virtual bool DoParse();
|
||||
virtual bool CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSize);
|
||||
virtual double Eval(int funNo, vector<int> map, vector<double> param);
|
||||
virtual int GetFuncNo(unsigned int idx);
|
||||
virtual int GetFuncIndex(int funcNo);
|
||||
virtual unsigned int GetNoOfFuncs() { return fFuncs.size(); }
|
||||
virtual TString* GetFuncString(unsigned int idx);
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
virtual Bool_t DoParse();
|
||||
virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize);
|
||||
virtual double Eval(Int_t funNo, vector<Int_t> map, vector<double> param);
|
||||
virtual Int_t GetFuncNo(UInt_t idx);
|
||||
virtual Int_t GetFuncIndex(Int_t funcNo);
|
||||
virtual UInt_t GetNoOfFuncs() { return fFuncs.size(); }
|
||||
virtual TString* GetFuncString(UInt_t idx);
|
||||
|
||||
private:
|
||||
bool fValid;
|
||||
Bool_t fValid;
|
||||
|
||||
PMsrLines fLines;
|
||||
vector<PFunction> fFuncs;
|
||||
|
@ -47,11 +47,11 @@
|
||||
class PMsrHandler
|
||||
{
|
||||
public:
|
||||
PMsrHandler(const char *fileName);
|
||||
PMsrHandler(const Char_t *fileName);
|
||||
virtual ~PMsrHandler();
|
||||
|
||||
virtual int ReadMsrFile();
|
||||
virtual int WriteMsrLogFile(const bool messages = true);
|
||||
virtual Int_t ReadMsrFile();
|
||||
virtual Int_t WriteMsrLogFile(const Bool_t messages = true);
|
||||
|
||||
virtual TString* GetMsrTitle() { return &fTitle; }
|
||||
virtual PMsrParamList* GetMsrParamList() { return &fParam; }
|
||||
@ -65,37 +65,37 @@ class PMsrHandler
|
||||
|
||||
virtual TString* GetMsrFileDirectoryPath() { return &fMsrFileDirectoryPath; }
|
||||
|
||||
virtual unsigned int GetNoOfParams() { return fParam.size(); }
|
||||
virtual UInt_t GetNoOfParams() { return fParam.size(); }
|
||||
virtual const TString& GetFileName() const { return fFileName; }
|
||||
|
||||
virtual void SetMsrTitle(const TString &title) { fTitle = title; }
|
||||
|
||||
virtual bool SetMsrParamValue(unsigned int i, double value);
|
||||
virtual bool SetMsrParamStep(unsigned int i, double value);
|
||||
virtual bool SetMsrParamPosErrorPresent(unsigned int i, bool value);
|
||||
virtual bool SetMsrParamPosError(unsigned int i, double value);
|
||||
virtual Bool_t SetMsrParamValue(UInt_t i, Double_t value);
|
||||
virtual Bool_t SetMsrParamStep(UInt_t i, Double_t value);
|
||||
virtual Bool_t SetMsrParamPosErrorPresent(UInt_t i, Bool_t value);
|
||||
virtual Bool_t SetMsrParamPosError(UInt_t i, Double_t value);
|
||||
|
||||
virtual void SetMsrT0Entry(unsigned int runNo, unsigned int idx, int bin);
|
||||
virtual void SetMsrDataRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
||||
virtual void SetMsrBkgRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
||||
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||
|
||||
virtual void CopyMsrStatisticBlock() { fCopyStatisticsBlock = true; }
|
||||
virtual void SetMsrStatisticConverged(bool converged) { fStatistic.fValid = converged; }
|
||||
virtual void SetMsrStatisticMin(double min) { fStatistic.fMin = min; }
|
||||
virtual void SetMsrStatisticNdf(unsigned int ndf) { fStatistic.fNdf = ndf; }
|
||||
virtual void SetMsrStatisticConverged(Bool_t converged) { fStatistic.fValid = converged; }
|
||||
virtual void SetMsrStatisticMin(Double_t min) { fStatistic.fMin = min; }
|
||||
virtual void SetMsrStatisticNdf(UInt_t ndf) { fStatistic.fNdf = ndf; }
|
||||
|
||||
virtual int GetNoOfFuncs() { return fFuncHandler->GetNoOfFuncs(); }
|
||||
virtual unsigned int GetFuncNo(int idx) { return fFuncHandler->GetFuncNo(idx); }
|
||||
virtual unsigned int GetFuncIndex(int funNo) { return fFuncHandler->GetFuncIndex(funNo); }
|
||||
virtual bool CheckMapAndParamRange(unsigned int mapSize, unsigned int paramSize)
|
||||
virtual Int_t GetNoOfFuncs() { return fFuncHandler->GetNoOfFuncs(); }
|
||||
virtual UInt_t GetFuncNo(Int_t idx) { return fFuncHandler->GetFuncNo(idx); }
|
||||
virtual UInt_t GetFuncIndex(Int_t funNo) { return fFuncHandler->GetFuncIndex(funNo); }
|
||||
virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
|
||||
{ return fFuncHandler->CheckMapAndParamRange(mapSize, paramSize); }
|
||||
virtual double EvalFunc(unsigned int i, vector<int> map, vector<double> param)
|
||||
virtual Double_t EvalFunc(UInt_t i, vector<Int_t> map, vector<Double_t> param)
|
||||
{ return fFuncHandler->Eval(i,map,param); }
|
||||
|
||||
virtual int ParameterInUse(unsigned int paramNo);
|
||||
virtual bool CheckUniquenessOfParamNames(unsigned int &parX, unsigned int &parY);
|
||||
virtual bool CheckMaps();
|
||||
virtual bool CheckFuncs();
|
||||
virtual Int_t ParameterInUse(UInt_t paramNo);
|
||||
virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY);
|
||||
virtual Bool_t CheckMaps();
|
||||
virtual Bool_t CheckFuncs();
|
||||
|
||||
private:
|
||||
TString fFileName; ///< file name of the msr-file
|
||||
@ -110,29 +110,29 @@ class PMsrHandler
|
||||
PMsrPlotList fPlots; ///< holds a list of the plot input parameters
|
||||
PMsrStatisticStructure fStatistic; ///< holds the statistic info
|
||||
|
||||
int fMsrBlockCounter; ///< used to select the proper msr-block
|
||||
Int_t fMsrBlockCounter; ///< used to select the proper msr-block
|
||||
|
||||
PFunctionHandler *fFuncHandler; ///< needed to parse functions
|
||||
|
||||
PIntVector fParamInUse; ///< array holding the information if a particular parameter is used at all, i.e. if the theory is using it (perhaps via maps or functions)
|
||||
|
||||
bool fCopyStatisticsBlock; ///< flag, if true: just copy to old statistics block (musrt0), otherwise write a new one (musrfit)
|
||||
Bool_t fCopyStatisticsBlock; ///< flag, if true: just copy to old statistics block (musrt0), otherwise write a new one (musrfit)
|
||||
|
||||
virtual bool HandleFitParameterEntry(PMsrLines &line);
|
||||
virtual bool HandleTheoryEntry(PMsrLines &line);
|
||||
virtual bool HandleFunctionsEntry(PMsrLines &line);
|
||||
virtual bool HandleRunEntry(PMsrLines &line);
|
||||
virtual bool HandleCommandsEntry(PMsrLines &line);
|
||||
virtual bool HandleFourierEntry(PMsrLines &line);
|
||||
virtual bool HandlePlotEntry(PMsrLines &line);
|
||||
virtual bool HandleStatisticEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleFitParameterEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleTheoryEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleFunctionsEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleRunEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleCommandsEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleFourierEntry(PMsrLines &line);
|
||||
virtual Bool_t HandlePlotEntry(PMsrLines &line);
|
||||
virtual Bool_t HandleStatisticEntry(PMsrLines &line);
|
||||
|
||||
virtual void FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLines &run);
|
||||
|
||||
virtual void InitRunParameterStructure(PMsrRunStructure ¶m);
|
||||
virtual void InitFourierParameterStructure(PMsrFourierStructure &fourier);
|
||||
|
||||
virtual bool FilterNumber(TString str, const char *filter, int offset, int &no);
|
||||
virtual Bool_t FilterNumber(TString str, const Char_t *filter, Int_t offset, Int_t &no);
|
||||
};
|
||||
|
||||
#endif // _PMSRHANDLER_H_
|
||||
|
@ -147,9 +147,9 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
{
|
||||
public:
|
||||
PMusrCanvas();
|
||||
PMusrCanvas(const int number, const char* title,
|
||||
PMusrCanvas(const Int_t number, const Char_t* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch);
|
||||
PMusrCanvas(const int number, const char* title,
|
||||
PMusrCanvas(const Int_t number, const Char_t* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
|
||||
PMsrFourierStructure fourierDefault,
|
||||
const PIntVector markerList, const PIntVector colorList, const Bool_t batch);
|
||||
@ -171,7 +171,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void HandleMenuPopup(Int_t id); // SLOT
|
||||
virtual void LastCanvasClosed(); // SLOT
|
||||
|
||||
virtual void SaveGraphicsAndQuit(char *fileName, char *graphicsFormat);
|
||||
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
|
||||
|
||||
private:
|
||||
Bool_t fBatchMode; /// musrview in ROOT batch mode
|
||||
@ -222,27 +222,27 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
|
||||
virtual void CreateStyle();
|
||||
virtual void InitFourier();
|
||||
virtual void InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
|
||||
virtual void InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
|
||||
virtual void InitDataSet(PMusrCanvasDataSet &dataSet);
|
||||
virtual void InitDataSet(PMusrCanvasNonMusrDataSet &dataSet);
|
||||
virtual void CleanupDataSet(PMusrCanvasDataSet &dataSet);
|
||||
virtual void CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet);
|
||||
virtual void HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunData *data);
|
||||
virtual void HandleNonMusrDataSet(unsigned int plotNo, unsigned int runNo, PRunData *data);
|
||||
virtual void HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data);
|
||||
virtual void HandleNonMusrDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data);
|
||||
virtual void HandleDifference();
|
||||
virtual void HandleFourier();
|
||||
virtual void HandleFourierDifference();
|
||||
virtual double FindOptimalFourierPhase();
|
||||
virtual Double_t FindOptimalFourierPhase();
|
||||
virtual void CleanupDifference();
|
||||
virtual void CleanupFourier();
|
||||
virtual void CleanupFourierDifference();
|
||||
|
||||
virtual double CalculateDiff(const double x, const double y, TH1F *theo);
|
||||
virtual double CalculateDiff(const double x, const double y, TGraphErrors *theo);
|
||||
virtual Int_t FindBin(const double x, TGraphErrors *graph);
|
||||
virtual Double_t CalculateDiff(const Double_t x, const Double_t y, TH1F *theo);
|
||||
virtual Double_t CalculateDiff(const Double_t x, const Double_t y, TGraphErrors *theo);
|
||||
virtual Int_t FindBin(const Double_t x, TGraphErrors *graph);
|
||||
|
||||
virtual double GetGlobalMaximum(TH1F* histo);
|
||||
virtual double GetGlobalMinimum(TH1F* histo);
|
||||
virtual Double_t GetGlobalMaximum(TH1F* histo);
|
||||
virtual Double_t GetGlobalMinimum(TH1F* histo);
|
||||
|
||||
virtual void PlotData();
|
||||
virtual void PlotDifference();
|
||||
|
@ -55,7 +55,7 @@ class PMusrT0 : public TObject, public TQObject
|
||||
{
|
||||
public:
|
||||
PMusrT0();
|
||||
PMusrT0(PRawRunData *rawRunData, int runNo, int histoNo, int detectorTag, int addRunNo);
|
||||
PMusrT0(PRawRunData *rawRunData, Int_t runNo, Int_t histoNo, Int_t detectorTag, Int_t addRunNo);
|
||||
|
||||
virtual ~PMusrT0();
|
||||
|
||||
@ -73,12 +73,12 @@ class PMusrT0 : public TObject, public TQObject
|
||||
PMsrHandler *fMsrHandler;
|
||||
#endif // __MAKECINT__
|
||||
|
||||
int fStatus;
|
||||
Int_t fStatus;
|
||||
|
||||
int fRunNo;
|
||||
int fDetectorTag;
|
||||
int fAddRunNo;
|
||||
int fAddRunOffset;
|
||||
Int_t fRunNo;
|
||||
Int_t fDetectorTag;
|
||||
Int_t fAddRunNo;
|
||||
Int_t fAddRunOffset;
|
||||
|
||||
// canvas related variables
|
||||
TCanvas *fMainCanvas;
|
||||
|
@ -38,34 +38,34 @@ class PRunAsymmetry : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunAsymmetry();
|
||||
PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag);
|
||||
PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunAsymmetry();
|
||||
|
||||
virtual double CalcChiSquare(const std::vector<double>& par);
|
||||
virtual double CalcMaxLikelihood(const std::vector<double>& par);
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual unsigned int GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
|
||||
protected:
|
||||
virtual bool PrepareData();
|
||||
virtual bool PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]);
|
||||
virtual bool PrepareViewData(PRawRunData* runData, unsigned int histoNo[2]);
|
||||
virtual Bool_t PrepareData();
|
||||
virtual Bool_t PrepareFitData(PRawRunData* runData, UInt_t histoNo[2]);
|
||||
virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]);
|
||||
|
||||
private:
|
||||
unsigned int fAlphaBetaTag; ///< 1-> alpha = beta = 1; 2-> alpha != 1, beta = 1; 3-> alpha = 1, beta != 1; 4-> alpha != 1, beta != 1
|
||||
UInt_t fAlphaBetaTag; ///< 1-> alpha = beta = 1; 2-> alpha != 1, beta = 1; 3-> alpha = 1, beta != 1; 4-> alpha != 1, beta != 1
|
||||
|
||||
double fFitStartTime;
|
||||
double fFitStopTime;
|
||||
unsigned int fNoOfFitBins;
|
||||
Double_t fFitStartTime;
|
||||
Double_t fFitStopTime;
|
||||
UInt_t fNoOfFitBins;
|
||||
|
||||
PDoubleVector fForward; ///< forward histo data
|
||||
PDoubleVector fForwardErr; ///< forward histo errors
|
||||
PDoubleVector fBackward; ///< backward histo data
|
||||
PDoubleVector fBackwardErr; ///< backward histo errors
|
||||
|
||||
bool SubtractFixBkg();
|
||||
bool SubtractEstimatedBkg();
|
||||
Bool_t SubtractFixBkg();
|
||||
Bool_t SubtractEstimatedBkg();
|
||||
};
|
||||
|
||||
#endif // _PRUNASYMMETRY_H_
|
||||
|
@ -44,42 +44,31 @@ using namespace std;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* brauche ich eine base class um zwischen den verschiedenen run-modi unterscheiden zu können?
|
||||
* Ich meine:
|
||||
* - single histogram
|
||||
* - asymmetry
|
||||
* - RRF
|
||||
* - non muSR
|
||||
*
|
||||
* --> JA
|
||||
*
|
||||
* PTheory and PFunctions werden direkt für jeden run generiert, da man dann maps und functions
|
||||
* direkt für den spezifischen run umsetzen kann (da man eliminiert alle maps und functions). Dies
|
||||
* garantiert effiziente theory-Aufrufe da diese in chisq/maxlikelyhood x-fach aufgerufen werden.
|
||||
* <p>
|
||||
*/
|
||||
class PRunBase
|
||||
{
|
||||
public:
|
||||
PRunBase();
|
||||
PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag);
|
||||
PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunBase();
|
||||
|
||||
virtual double CalcChiSquare(const vector<double>& par) = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
virtual double CalcMaxLikelihood(const vector<double>& par) = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
virtual Double_t CalcChiSquare(const vector<Double_t>& par) = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
virtual Double_t CalcMaxLikelihood(const vector<Double_t>& par) = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
|
||||
virtual void CalcTheory() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
|
||||
virtual unsigned int GetRunNo() { return fRunNo; }
|
||||
virtual UInt_t GetRunNo() { return fRunNo; }
|
||||
virtual PRunData* GetData() { return &fData; }
|
||||
virtual void CleanUp();
|
||||
virtual bool IsValid() { return fValid; }
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
|
||||
protected:
|
||||
bool fValid;
|
||||
Bool_t fValid;
|
||||
|
||||
EPMusrHandleTag fHandleTag; ///< tag telling whether this is used for fit, view, ...
|
||||
|
||||
int fRunNo; ///< number of the run within the msr file
|
||||
Int_t fRunNo; ///< number of the run within the msr file
|
||||
PMsrHandler *fMsrInfo; ///< msr-file handler
|
||||
PMsrRunStructure *fRunInfo; ///< run info used to filter out needed infos for the run
|
||||
PRunDataHandler *fRawData; ///< holds the raw run data
|
||||
@ -87,10 +76,10 @@ class PRunBase
|
||||
PIntVector fParamNo; ///< vector of parameter numbers for the specifc run
|
||||
|
||||
PRunData fData; ///< data to be fitted, viewed, i.e. binned data
|
||||
double fTimeResolution; ///< time resolution in (us)
|
||||
Double_t fTimeResolution; ///< time resolution in (us)
|
||||
PIntVector fT0s; ///< all t0's of a run! The derived classes will handle it
|
||||
|
||||
virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
virtual Bool_t PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||
|
||||
PDoubleVector fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block
|
||||
PTheory *fTheory; ///< theory needed to calculate chi-square
|
||||
|
@ -51,36 +51,36 @@ class PRunListCollection
|
||||
|
||||
enum EDataSwitch { kIndex, kRunNo };
|
||||
|
||||
virtual bool Add(int runNo, EPMusrHandleTag tag);
|
||||
virtual Bool_t Add(Int_t runNo, EPMusrHandleTag tag);
|
||||
|
||||
virtual double GetSingleHistoChisq(const std::vector<double>& par) const;
|
||||
virtual double GetAsymmetryChisq(const std::vector<double>& par) const;
|
||||
virtual double GetRRFChisq(const std::vector<double>& par) const;
|
||||
virtual double GetNonMusrChisq(const std::vector<double>& par) const;
|
||||
virtual Double_t GetSingleHistoChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetRRFChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrChisq(const std::vector<Double_t>& par) const;
|
||||
|
||||
virtual double GetSingleHistoMaximumLikelihood(const std::vector<double>& par) const;
|
||||
virtual double GetAsymmetryMaximumLikelihood(const std::vector<double>& par) const;
|
||||
virtual double GetRRFMaximumLikelihood(const std::vector<double>& par) const;
|
||||
virtual double GetNonMusrMaximumLikelihood(const std::vector<double>& par) const;
|
||||
virtual Double_t GetSingleHistoMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetRRFMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
|
||||
virtual unsigned int GetTotalNoOfBinsFitted() const;
|
||||
virtual UInt_t GetTotalNoOfBinsFitted() const;
|
||||
|
||||
virtual unsigned int GetNoOfSingleHisto() const { return fRunSingleHistoList.size(); }
|
||||
virtual unsigned int GetNoOfAsymmetry() const { return fRunAsymmetryList.size(); }
|
||||
virtual unsigned int GetNoOfRRF() const { return fRunRRFList.size(); }
|
||||
virtual unsigned int GetNoOfNonMusr() const { return fRunNonMusrList.size(); }
|
||||
virtual UInt_t GetNoOfSingleHisto() const { return fRunSingleHistoList.size(); }
|
||||
virtual UInt_t GetNoOfAsymmetry() const { return fRunAsymmetryList.size(); }
|
||||
virtual UInt_t GetNoOfRRF() const { return fRunRRFList.size(); }
|
||||
virtual UInt_t GetNoOfNonMusr() const { return fRunNonMusrList.size(); }
|
||||
|
||||
virtual PRunData* GetSingleHisto(unsigned int index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetAsymmetry(unsigned int index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetRRF(unsigned int index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetNonMusr(unsigned int index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetSingleHisto(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetAsymmetry(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetRRF(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetNonMusr(UInt_t index, EDataSwitch tag=kIndex);
|
||||
|
||||
virtual vector< pair<double, double> > GetTemp(const TString &runName) const;
|
||||
virtual double GetField(const TString &runName) const;
|
||||
virtual double GetEnergy(const TString &runName) const;
|
||||
virtual const char* GetSetup(const TString &runName) const;
|
||||
virtual const char* GetXAxisTitle(const TString &runName, const unsigned int idx) const;
|
||||
virtual const char* GetYAxisTitle(const TString &runName, const unsigned int idx) const;
|
||||
virtual vector< pair<Double_t, Double_t> > GetTemp(const TString &runName) const;
|
||||
virtual Double_t GetField(const TString &runName) const;
|
||||
virtual Double_t GetEnergy(const TString &runName) const;
|
||||
virtual const Char_t* GetSetup(const TString &runName) const;
|
||||
virtual const Char_t* GetXAxisTitle(const TString &runName, const UInt_t idx) const;
|
||||
virtual const Char_t* GetYAxisTitle(const TString &runName, const UInt_t idx) const;
|
||||
|
||||
private:
|
||||
PMsrHandler *fMsrInfo; ///< keeps all msr file info
|
||||
|
@ -39,29 +39,29 @@ class PRunNonMusr : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunNonMusr();
|
||||
PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag);
|
||||
PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunNonMusr();
|
||||
|
||||
virtual double CalcChiSquare(const std::vector<double>& par);
|
||||
virtual double CalcMaxLikelihood(const std::vector<double>& par);
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual unsigned int GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
|
||||
virtual unsigned int GetXIndex();
|
||||
virtual unsigned int GetYIndex();
|
||||
virtual UInt_t GetXIndex();
|
||||
virtual UInt_t GetYIndex();
|
||||
|
||||
protected:
|
||||
virtual bool PrepareData();
|
||||
virtual bool PrepareFitData();
|
||||
virtual bool PrepareViewData();
|
||||
virtual Bool_t PrepareData();
|
||||
virtual Bool_t PrepareFitData();
|
||||
virtual Bool_t PrepareViewData();
|
||||
|
||||
private:
|
||||
PRawRunData *fRawRunData;
|
||||
|
||||
double fFitStartTime;
|
||||
double fFitStopTime;
|
||||
unsigned int fNoOfFitBins;
|
||||
Double_t fFitStartTime;
|
||||
Double_t fFitStopTime;
|
||||
UInt_t fNoOfFitBins;
|
||||
};
|
||||
|
||||
#endif // _PRUNNONMUSR_H_
|
||||
|
@ -38,22 +38,22 @@ class PRunRRF : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunRRF();
|
||||
PRunRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag);
|
||||
PRunRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunRRF();
|
||||
|
||||
virtual double CalcChiSquare(const std::vector<double>& par);
|
||||
virtual double CalcMaxLikelihood(const std::vector<double>& par);
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual unsigned int GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
|
||||
protected:
|
||||
virtual bool PrepareData();
|
||||
virtual Bool_t PrepareData();
|
||||
|
||||
private:
|
||||
double fFitStartTime;
|
||||
double fFitStopTime;
|
||||
unsigned int fNoOfFitBins;
|
||||
Double_t fFitStartTime;
|
||||
Double_t fFitStopTime;
|
||||
UInt_t fNoOfFitBins;
|
||||
};
|
||||
|
||||
#endif // _PRUNRRF_H_
|
||||
|
@ -38,28 +38,28 @@ class PRunSingleHisto : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunSingleHisto();
|
||||
PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag);
|
||||
PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunSingleHisto();
|
||||
|
||||
virtual double CalcChiSquare(const std::vector<double>& par);
|
||||
virtual double CalcMaxLikelihood(const std::vector<double>& par);
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual unsigned int GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; }
|
||||
|
||||
protected:
|
||||
virtual bool PrepareData();
|
||||
virtual bool PrepareFitData(PRawRunData* runData, const unsigned int histoNo);
|
||||
virtual bool PrepareRawViewData(PRawRunData* runData, const unsigned int histoNo);
|
||||
virtual bool PrepareViewData(PRawRunData* runData, const unsigned int histoNo);
|
||||
virtual Bool_t PrepareData();
|
||||
virtual Bool_t PrepareFitData(PRawRunData* runData, const UInt_t histoNo);
|
||||
virtual Bool_t PrepareRawViewData(PRawRunData* runData, const UInt_t histoNo);
|
||||
virtual Bool_t PrepareViewData(PRawRunData* runData, const UInt_t histoNo);
|
||||
|
||||
private:
|
||||
double fFitStartTime;
|
||||
double fFitStopTime;
|
||||
unsigned int fNoOfFitBins;
|
||||
double fBackground; ///< needed if background range is given. In units per bin
|
||||
Double_t fFitStartTime;
|
||||
Double_t fFitStopTime;
|
||||
UInt_t fNoOfFitBins;
|
||||
Double_t fBackground; ///< needed if background range is given. In units per bin
|
||||
|
||||
bool EstimateBkg(unsigned int histoNo);
|
||||
Bool_t EstimateBkg(UInt_t histoNo);
|
||||
};
|
||||
|
||||
#endif // _PRUNSINGLEHISTO_H_
|
||||
|
@ -47,16 +47,16 @@ class PStartupHandler : public TObject, public TQObject
|
||||
|
||||
virtual void OnStartDocument(); // SLOT
|
||||
virtual void OnEndDocument(); // SLOT
|
||||
virtual void OnStartElement(const char*, const TList*); // SLOT
|
||||
virtual void OnEndElement(const char*); // SLOT
|
||||
virtual void OnCharacters(const char*); // SLOT
|
||||
virtual void OnComment(const char*); // SLOT
|
||||
virtual void OnWarning(const char*); // SLOT
|
||||
virtual void OnError(const char*); // SLOT
|
||||
virtual void OnFatalError(const char*); // SLOT
|
||||
virtual void OnCdataBlock(const char*, Int_t); // SLOT
|
||||
virtual void OnStartElement(const Char_t*, const TList*); // SLOT
|
||||
virtual void OnEndElement(const Char_t*); // SLOT
|
||||
virtual void OnCharacters(const Char_t*); // SLOT
|
||||
virtual void OnComment(const Char_t*); // SLOT
|
||||
virtual void OnWarning(const Char_t*); // SLOT
|
||||
virtual void OnError(const Char_t*); // SLOT
|
||||
virtual void OnFatalError(const Char_t*); // SLOT
|
||||
virtual void OnCdataBlock(const Char_t*, Int_t); // SLOT
|
||||
|
||||
virtual bool StartupFileFound() { return fStartupFileFound; }
|
||||
virtual Bool_t StartupFileFound() { return fStartupFileFound; }
|
||||
virtual TString GetStartupFilePath() { return fStartupFilePath; }
|
||||
|
||||
virtual void CheckLists();
|
||||
@ -73,14 +73,14 @@ class PStartupHandler : public TObject, public TQObject
|
||||
eColorList, eColor};
|
||||
EKeyWords fKey;
|
||||
|
||||
bool fStartupFileFound;
|
||||
Bool_t fStartupFileFound;
|
||||
TString fStartupFilePath;
|
||||
PMsrFourierStructure fFourierDefaults;
|
||||
PStringVector fDataPathList;
|
||||
PIntVector fMarkerList;
|
||||
PIntVector fColorList;
|
||||
|
||||
bool StartupFileExists(char *fln);
|
||||
Bool_t StartupFileExists(Char_t *fln);
|
||||
|
||||
ClassDef(PStartupHandler, 1)
|
||||
};
|
||||
|
@ -107,12 +107,12 @@ class PTheory;
|
||||
* <p>Structure holding the infos of a the available internally defined functions.
|
||||
*/
|
||||
typedef struct theo_data_base {
|
||||
unsigned int fType; ///< function tag
|
||||
unsigned int fNoOfParam; ///< number of parameters for this function
|
||||
bool fTable; ///< table flag, indicating if the function is generate from a table
|
||||
TString fName; ///< name of the function as written into the msr-file
|
||||
TString fAbbrev; ///< abbreviation of the function name
|
||||
TString fComment; ///< comment added in the msr-file theory block to help the used
|
||||
UInt_t fType; ///< function tag
|
||||
UInt_t fNoOfParam; ///< number of parameters for this function
|
||||
Bool_t fTable; ///< table flag, indicating if the function is generate from a table
|
||||
TString fName; ///< name of the function as written into the msr-file
|
||||
TString fAbbrev; ///< abbreviation of the function name
|
||||
TString fComment; ///< comment added in the msr-file theory block to help the used
|
||||
TString fCommentTimeShift; ///< comment added in the msr-file theory block if there is a time shift
|
||||
} PTheoDataBase;
|
||||
|
||||
@ -192,52 +192,52 @@ static PTheoDataBase fgTheoDataBase[THEORY_MAX] = {
|
||||
class PTheory
|
||||
{
|
||||
public:
|
||||
PTheory(PMsrHandler *msrInfo, unsigned int runNo, const bool hasParent = false);
|
||||
PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent = false);
|
||||
virtual ~PTheory();
|
||||
|
||||
virtual bool IsValid();
|
||||
virtual double Func(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Bool_t IsValid();
|
||||
virtual Double_t Func(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
|
||||
private:
|
||||
virtual void CleanUp(PTheory *theo);
|
||||
virtual int SearchDataBase(TString name);
|
||||
virtual Int_t SearchDataBase(TString name);
|
||||
virtual void MakeCleanAndTidyTheoryBlock(PMsrLines* fullTheoryBlock);
|
||||
virtual void MakeCleanAndTidyPolynom(unsigned int i, PMsrLines* fullTheoryBlock);
|
||||
virtual void MakeCleanAndTidyUserFcn(unsigned int i, PMsrLines* fullTheoryBlock);
|
||||
virtual void MakeCleanAndTidyPolynom(UInt_t i, PMsrLines* fullTheoryBlock);
|
||||
virtual void MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines* fullTheoryBlock);
|
||||
|
||||
virtual double Asymmetry(const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double SimpleExp(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double GeneralExp(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double SimpleGauss(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double StaticGaussKT(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double StaticGaussKTLF(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double DynamicGaussKTLF(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double StaticLorentzKT(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double StaticLorentzKTLF(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double DynamicLorentzKTLF(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double CombiLGKT(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double SpinGlass(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double RandomAnisotropicHyperfine(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double Abragam(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double InternalField(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double TFCos(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double Bessel(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double InternalBessel(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double SkewedGauss(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double Polynom(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual double UserFcn(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t Asymmetry(const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t SimpleExp(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t GeneralExp(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t SimpleGauss(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StaticGaussKT(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StaticGaussKTLF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicGaussKTLF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StaticLorentzKT(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t StaticLorentzKTLF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t DynamicLorentzKTLF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t CombiLGKT(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t SpinGlass(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t RandomAnisotropicHyperfine(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t Abragam(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t InternalField(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t TFCos(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t Bessel(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t InternalBessel(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t SkewedGauss(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t Polynom(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
virtual Double_t UserFcn(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
|
||||
|
||||
virtual void CalculateGaussLFIntegral(const double *val) const;
|
||||
virtual void CalculateLorentzLFIntegral(const double *val) const;
|
||||
virtual double GetLFIntegralValue(const double t) const;
|
||||
virtual void CalculateDynKTLF(const double *val, int tag) const;
|
||||
virtual double GetDynKTLFValue(const double t) const;
|
||||
virtual void CalculateGaussLFIntegral(const Double_t *val) const;
|
||||
virtual void CalculateLorentzLFIntegral(const Double_t *val) const;
|
||||
virtual Double_t GetLFIntegralValue(const Double_t t) const;
|
||||
virtual void CalculateDynKTLF(const Double_t *val, Int_t tag) const;
|
||||
virtual Double_t GetDynKTLFValue(const Double_t t) const;
|
||||
|
||||
// variables
|
||||
bool fValid;
|
||||
unsigned int fType;
|
||||
vector<unsigned int> fParamNo; ///< holds the parameter numbers for the theory (including maps and functions, see constructor desciption)
|
||||
unsigned int fNoOfParam;
|
||||
Bool_t fValid;
|
||||
UInt_t fType;
|
||||
vector<UInt_t> fParamNo; ///< holds the parameter numbers for the theory (including maps and functions, see constructor desciption)
|
||||
UInt_t fNoOfParam;
|
||||
PTheory *fAdd, *fMul;
|
||||
|
||||
TString fUserFcnClassName; ///< name of the user function class for within root
|
||||
@ -247,10 +247,10 @@ class PTheory
|
||||
|
||||
PMsrHandler *fMsrInfo;
|
||||
|
||||
mutable double fPrevParam[THEORY_MAX_PARAM]; ///< needed for LF-stuff
|
||||
mutable PDoubleVector fLFIntegral; ///< needed for LF-stuff. Keeps the non-analytic integral values
|
||||
mutable double fDynLFdt;
|
||||
mutable PDoubleVector fDynLFFuncValue; ///< needed for LF-stuff. Keeps the dynamic LF KT function values
|
||||
mutable Double_t fPrevParam[THEORY_MAX_PARAM]; ///< needed for LF-stuff
|
||||
mutable PDoubleVector fLFIntegral; ///< needed for LF-stuff. Keeps the non-analytic integral values
|
||||
mutable Double_t fDynLFdt;
|
||||
mutable PDoubleVector fDynLFFuncValue; ///< needed for LF-stuff. Keeps the dynamic LF KT function values
|
||||
};
|
||||
|
||||
#endif // _PTHEORY_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user